function ingreso()
{
	var correo = document.getElementById("correo").value;
	
	var pass = document.getElementById("pass").value;
	
	if(correo != "" || pass != "")
	{
		if((document.getElementById("correo").value.indexOf ('@', 0) == -1)||(document.getElementById("correo").value.length < 5)){
			alert("El correo electrónico ingresado no es válido");
		}else{
			Validacion(correo,pass);
		}	
	}else{
		alert('Verifique que ninguno de los campos este vacio');
	}
}


//comprueba la validez del usuario por el nick y el correo contra la base de datos
function Validacion(user, password)
{
		//document.location.href='login.php?usuario='+user+'&password='+password;
		
		var pagina='./login.php?usuario='+user+'&password='+password;
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 		
			if (ajax.readyState==4)
			{ 
				var result=ajax.responseText;
				
				var arreglo = new Array();
				//alert(">>"+result+"<<");
				
				arreglo = result.split("\'"); 
				
				//alert(arreglo[0]+" >> "+arreglo[1]+" >> "+arreglo[2]);
				
				
					if(arreglo[1]!="no"){
						document.getElementById('divUser').innerHTML=ajax.responseText;						
						document.location.href = 'miGol.php';
					}else{
						alert('Usuario y contraseña invalidos, digite nuevamente sus datos.');
					}
			}
			
		}
		ajax.send(null);
}

function CerrarSesion()
{
		var pagina='./cerrarSesion.php';
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 			
			if (ajax.readyState==4)
			{ 
				document.getElementById('divUser').innerHTML=ajax.responseText;
				return true;
			}
		}
		ajax.send(null);
}



function adultos()
{	
	//alert('registro');
	
	document.getElementById('menuIzquierdo').style["display"]="none";
	
	xc = (461-88)/2
	yc = (493-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('461','493','Layers/carnes.html');
	bloquear();
}

function cachorros()
{	
	//alert('registro');
	document.getElementById('menuIzquierdo').style["display"]="none";

	xc = (461-88)/2
	yc = (493-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('461','493','Layers/cachorros.html');
	bloquear();
}

function carnes()
{	
	//alert('registro');
	document.getElementById('menuIzquierdo').style["display"]="none";

	xc = (461-88)/2
	yc = (493-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('461','493','Layers/adultos.html');
	bloquear();
}

function tapas()
{	
	xc = (599-88)/2
	yc = (986-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('599','700','tapasindex.php');
	bloquear();
}

function premiosConcurso()
{	
	xc = (600-88)/2
	yc = (555-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('600','555','premios.php');
	bloquear();
}

function voto(idGol, idUsuarioVota)
{	
		//alert('voto '+idWall+' '+idUsuarioVota);
		/*var pagina='./ajax/votacion.php?idWall='+idWall+'&idUsuarioVota='+idUsuarioVota;
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 
			
			if (ajax.readyState==4)
			{ 
				document.getElementById('divvotos').innerHTML=ajax.responseText;
				voteVideo();
				
			}
		}
		ajax.send(null);*/
		
		xc = (600-88)/2
		yc = (485-19)/2	
		
		document.getElementById("cargando").style.top = yc+'px';
		document.getElementById("cargando").style.left = xc+'px';
		opendivwin('600','485','msjVoto.php?idGol='+idGol+'&idUsuarioVota='+idUsuarioVota);
		bloquear();		
}

function voteVideo()
{	
	//alert('registro');
	
	xc = (600-88)/2
	yc = (485-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('600','485','msjVoto.php');
	bloquear();
}

function msjNoGol()
{	
	//alert('registro');
	
	xc = (600-88)/2
	yc = (485-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('600','485','msjRegistro.php');
	bloquear();
}

function msjGolAgregado()
{	
	//alert('registro');
	
	xc = (600-88)/2
	yc = (485-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('600','485','msjGol.php');
	bloquear();
}

function cuentale()
{	
	//alert('registro');
	
	xc = (599-88)/2
	yc = (613-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('599','613','cuentale.php');
	bloquear();
}


function recordar()
{
	xc = (599-88)/2
	yc = (550-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	
	opendivwin('599','537','recordarContrasena.php');
	bloquear();
}

/* >>>>>>>>>>>>>>>>>>>>>>>> Viejo <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */


function Distritos(Ciudad)
{
		var pagina='./ajax/distritos.php?ciu='+Ciudad;
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 
			
			if (ajax.readyState==4)
			{ 
				document.getElementById('divdistritos').innerHTML=ajax.responseText;
				return true;
			}
		}
		ajax.send(null);
}



function validacionRegistro()
{		
	//document.location.href='validacionRegistro.php';
	
	var pagina='./validacionRegistro.php';
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 					
			if (ajax.readyState==4)
			{ 
				var result=ajax.responseText;
				var arreglo = new Array();
				//alert(">>"+result+"<<");
				arreglo = result.split("\'"); 
				
				/*for(i=0;i<arreglo.length;i++){
				 alert("i= "+i+" "+arreglo[i]+"<BR>");
				}*/							
				//alert(arreglo[1]);
					if(arreglo[1] =="armartono"){						
						ArmarTono();
					}else{
						if(arreglo[1] =="registro"){	
						registro();
						}else{
							MsjAlerta(arreglo[1]);
						}
						
					}
			}
			
		}
		ajax.send(null);
	
}


function clickTags(bannner)
{		
	//document.location.href='validacionRegistro.php';
	//alert(bannner);
	var pagina='./clickTags.php?bannner='+bannner;
		ajax=nuevoAjax();
		ajax.open("GET", pagina, true);
		ajax.onreadystatechange=function()
		{ 					
			if (ajax.readyState==4)
			{ 
				var result=ajax.responseText;		
			}			
		}
		ajax.send(null);
	
}





function vars(name,value)
{
	window.document.myFlash.SetVariable(name,value);
}


function Contador()
{
	var dias = _Default.Contador().value;	
	vars('diasRestantes', dias);
}


function OpenLayer()
{
	document.getElementById("Layers").style.display = "";
	setTimeout("Cerrar()",8000)	
}

function Cerrar()
{
	document.getElementById("Layers").style.display = "none";
}

function CerrarSesion(){
		cargarValor("nombre", "./salir.php")
		vars('ingreso', "");
}


function mecanicahimno(){	

	document.getElementById('flashExito').style.display= "block";
	document.getElementById('flyimageColPar').style.display = "block";					
}

function cerrarlayer(){	
	
	//alert('cerrarrrr');
	document.getElementById('flashExito').style["display"] = "none";
	document.getElementById('flyimageColPar').style["display"] = "none";
		
}

/*
function letrahimno(){	

	document.getElementById('flashExito').style.display= "block";
	document.getElementById('flyHimnoColPar').style.display = "block";					
}



function eplHideLayer(){	
	
	
	document.getElementById('flashExito').style["display"] = "none";
	document.getElementById('flyHimnoColPar').style["display"] = "none";
	
		
}
*/

function letrahimno()
{	
	xc = (800-88)/2
	yc = (480-19)/2	
	
	cerrarlayer();
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('800','480','layerhimno.php');
	bloquear();
	
}

/*
function mecanicatapas()
{	
	xc = (599-88)/2
	yc = (555-19)/2	
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('599','555','layertapas.php');
	bloquear();
}
*/

function mecanicatapas()
{	
	document.getElementById('flashTapas').style.display= "block";
	document.getElementById('flyTapasColPar').style.display = "block";					
}

function cerrarLayerTapas(){	
	
	//alert('cerrarrrr');
	document.getElementById('flashTapas').style["display"] = "none";
	document.getElementById('flyTapasColPar').style["display"] = "none";
		
}



function colparestablecimientos()
{	
	xc = (500-88)/2
	yc = (800-19)/2	
	
	cerrarLayerTapas();
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('500','861','establecimientos.php');
	bloquear();
}

function colparterminos()
{	
	xc = (500-88)/2
	yc = (800-19)/2	
	
	cerrarLayerTapas();
	
	document.getElementById("cargando").style.top = yc+'px';
	document.getElementById("cargando").style.left = xc+'px';
	opendivwin('500','800','terminos.php');
	bloquear();
	
}
