function GRUPOS_ver(id)
{
	SYS_loadContents("includes/html/grupos.php?id=" + id,"GRUPOS_contents_" + id,function(){GRUPOS_openContents(id)});
}

function GRUPOS_edit(id)
{
	SYS_loadContents("includes/html/grupos.php?form_usuario=true&editar=" + id,"GRUPOS_contents_" + id,function(){GRUPOS_openContents(id)});
}

function GRUPOS_openContents(id)
{
	var row = $("GRUPOS_row_0_" + id);
	if(row != undefined)
	{
		if(row.className == "USER_row_1") row.className = "USER_row_1_2";
		if(row.className == "USER_row_2") row.className = "USER_row_2_2";
	}
	
	var row = $("GRUPOS_row_1_" + id);
	if(row.className == "USER_row_1") row.className = "USER_row_1_2";
	if(row.className == "USER_row_2") row.className = "USER_row_2_2";
	
	var obj = $("GRUPOS_contents_" + id);
	if(obj.style.display == "none") Effect.toggle(obj,"blind");
}

function GRUPOS_closeContents(id)
{
	var row = $("GRUPOS_row_0_" + id);
	if(row != undefined)
	{
		if(row.className == "USER_row_1_2") row.className = "USER_row_1";
		if(row.className == "USER_row_2_2") row.className = "USER_row_2";
	}
	
	var row = $("GRUPOS_row_1_" + id);
	if(row.className == "USER_row_1_2") row.className = "USER_row_1";
	if(row.className == "USER_row_2_2") row.className = "USER_row_2";
	
	var obj = $("GRUPOS_contents_" + id);
	Effect.toggle(obj,"blind");
}

function GRUPOS_cancel(id)
{
	if(id != 0) CONFIRM_do(function(){GRUPOS_closeContents(id);},"¿ Seguro que desea cancelar ?<br><br>( se perderán todos los datos no guardados )");
}

function GRUPOS_delete(id,unalert)
{
	SYS_mostrarRefresher();
	new Ajax.Updater("dummy_container","includes/html/grupos.php",{method:"post",postBody:"borrar=" + id,onSuccess:function(retorno){
	//new Ajax.Updater(document.getElementsByTagName("body")[0],"includes/html/grupos.php",{method:"post",postBody:"borrar=" + id,onSuccess:function(){
		if(SYS_isError(retorno.responseText))
		{
			SYS_doError(retorno.responseText);
			return;
		}
		SYS_ocultarRefresher();
		SYS_loadContents("includes/html/grupos.php?lista=true");
		if(unalert != true) CONFIRM_do(null,"El grupo fue eliminado correctamente.",true)
	}});
}

function GRUPOS_quitarGrupo(GRUPO,usuario,objUSUARIOS,grupo)
{
	Element.remove(GRUPO);
	objUSUARIOS.value = objUSUARIOS.value.gsub(usuario + ",","");
	if(objUSUARIOS.value.empty()) $("GRUPOS_grupos_none_" + grupo).style.display = "";
}

function GRUPOS_new()
{
	SYS_loadContentsPOP('includes/html/grupos.php?form_usuario=true');
}