//Función que hace que un div en específico aparezca o desparezca
function divTogle(nomDiv)
{
	$('#'+nomDiv).toggle('fast');
}
//FUNCION AJAX CARGA EL CONTENIDO DE UNA PAGINA X EN UN DIV Y
function change(pg,div)
{
  pagina=pg;
  content="#"+div;
  
  var x=$(content);
  //x.ajaxStart(function(){inicioEnvio(content)});
  x.html('<p class="intTxtDescr" align="center"><br /><img src="images/cargando.gif">Cargando...</p>');
  x.load(pagina); 
  //return false;
}

//	Función que valida los campos vacios del formulario
function vacio(campo, nombre) 
{
	if (document.getElementById(campo).value == '')
	{	alert("Llenar campo "+nombre);
	 	document.getElementById(campo).style.color="#ffffff";
	 	document.getElementById(campo).style.background="#ff0000";
		document.getElementById(campo).focus();
		return 1;
	} else return 0;
}

//	Función que un campo sea un entero
function Entero(campo,nombre)
{
     //Convertimos a entero
	 var valor = document.getElementById(campo).value;
     //Compruebo si es un valor numérico
     if (isNaN(valor)) 
        {	
		alert("El campo "+nombre+" no es un entero.");
	 	document.getElementById(campo).style.color="#ffffff";
	 	document.getElementById(campo).style.background="#ff0000";
		document.getElementById(campo).focus();
		return 1;
	 	}
	 else return 0;
            
}
//Función que checa que una cadena sea un e-mail valido
function checaemail(campo,nombre)
{
   var cadena = document.getElementById(campo).value;
   var indexant;
   var indexact=0;
   if(cadena.length >= 7)
   {
	  indexant = indexact;
	  indexact = cadena.indexOf("@",indexant);
	  if(indexact > indexant)
	  {
		 indexant=indexact;
		 if(cadena.indexOf("@",indexant+1)!=-1)
		 {
			alert("El campo "+nombre+" no es v\u00E1lido, verifique.");
			document.getElementById(campo).style.color="#ffffff";
			document.getElementById(campo).style.background="#ff0000";
			document.getElementById(campo).focus();
			return 1;
		 }
		 indexact = cadena.indexOf(".",indexant);
		 if(indexact > (indexant+2))
		 {
			if(cadena.length > (indexact+2))
			    return 0;
		 }
	  }
   }
   alert("El campo "+nombre+" no es v\u00E1lido, verifique.");
   document.getElementById(campo).style.color="#ffffff";
   document.getElementById(campo).style.background="#ff0000";
   document.getElementById(campo).focus();
   return 1;
}
//Función que regresa un campo a su estado de estilo normal
function normal(campo)
{
	document.getElementById(campo).style.color="#000000";
	document.getElementById(campo).style.background="#ffffff";
}

function abreNews(pagina,ancho,altura)
{ 
	window.open(pagina,"PopUp","width="+ ancho +",height="+ altura +",innerwidth="+ 0 +",innerheight="+ 0 +",resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,channelband=no");
}

function abre(page,a,h)
{ 
	window.open(page,null,"width="+ a +",height="+ h +",resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,channelband=no");
}
