//FUNCION AFTERLOGIN
function afterlogin( x )
{ 
	if ( x == '1')
	{
		document.location.href = document.location.href;
	}
	else
	{
		foco('conf');
	}
}

//ENVIARLE A GOAJAX UNA URL CON UNA VARIABLE GET QUE VIENE DESDE UN CAMPO DE UN FORMULARIO
function getAlgo(idForm,div,url,CampoFoco) {
	var variable = document.getElementById(idForm).email.value;
	var url = url + variable;
	goAJAX(div,url,'','get(\'' + CampoFoco +   '\').focus();');
	return false;
}

//HACER FOCO EN UN ELEMENTO
function foco(idElemento){
	get(idElemento).focus();
}

//BLANQUEAR ELEMENTO
function en_blanco()
{
	document.f3.buscar.value = "";
}

//SUBMIT FORMULARIO
function submitform()
{
	document.f1.submit();
}

//MOSTRAR-OCULTAR
function Help(section) {
  q=window.open('index.php?mod=help&section='+section, 'Help', 'scrollbars=1,resizable=1,width=450,height=400');
}
function ShowOrHide(d1, d2) {
  if (d1 != '') DoDiv(d1);
  if (d2 != '') DoDiv(d2);
}
function DoDiv(id) {
  var item = null;
  if (document.getElementById) {
	item = document.getElementById(id);
  } else if (document.all){
	item = document.all[id];
  } else if (document.layers){
	item = document.layers[id];
  }
  if (!item) {
  }
  else if (item.style) {
	if (item.style.display == "none"){ item.style.display = ""; }
	else {item.style.display = "none"; }
  }else{ item.visibility = "show"; }
}

//CONTADOR CARACTERES 
function getObject(obj) {
  var theObj;
  if(document.all) {
  if(typeof obj=="string") {
  return document.all(obj);
  } else {
  return obj.style;
  }
  }
  if(document.getElementById) {
  if(typeof obj=="string") {
  return document.getElementById(obj);
  } else {
  return obj.style;
  }
  }
  return null;
}

function Contar(entrada,salida,texto,caracteres) {
var entradaObj=getObject(entrada);
var salidaObj=getObject(salida);
var longitud=caracteres - entradaObj.value.length;

if(longitud <= 0) {
longitud=0;
texto='<span class="disable"> '+texto+' </span>';
entradaObj.value=entradaObj.value.substr(0,caracteres);
}
salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}