// JavaScript Document

function makebocadillo(event, nombre, dia)
{
	if(navigator.userAgent.indexOf("MSIE")>=0) navegador=0;
	else navegador=1;

	colocabocadillo(event);
	if(ganadores[nombre]!=""){
			var bocata=document.getElementById("bocadillo")
	var diaGana=document.getElementById("diaGana")
	
	if(dia>=16){
		var mes = "Junio"	
	}else{
		var mes = "Julio"	
	}
	
	diaGana.innerHTML="Ganador "+dia+" de "+mes;
	var nombreGana=document.getElementById("nombreGana")
	nombreGana.innerHTML=ganadores[nombre];
	bocata.style.display="block";
	}

}

function ocultarbocadillo(dia){
	var bocata=document.getElementById("bocadillo")
	bocata.style.display="none";
}



function colocabocadillo(e)
{	
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	
	document.getElementById("bocadillo").style.top = posy - 90	 + "px";
	document.getElementById("bocadillo").style.left = posx - 10 + "px";
}

// JavaScript Document
function openErrorLogin(){
		
	if(myLightWindow == null)
	{
		setTimeout(openErrorLogin, 100);
	}
	else
	{
myLightWindow.activateWindow({href:'popUps/pop_errorLogIn.html', title:'', caption:'', type:'external', width:'490', height:'203'});
	}
}

function openForgetPassword(){
if(myLightWindow == null)
	{
		setTimeout(openForgetPassword, 100);
	}
	else
	{
		myLightWindow.activateWindow({href:'popUps/pop_recordarPassword.html', title:'', caption:'', type:'external', width:'490', height:'203'});		
	}
}

function doEmailDuplicado(){
if(myLightWindow == null)
	{
		setTimeout(doEmailDuplicado, 100);
	}
	else
	{
		myLightWindow.activateWindow({href:'popUps/pop_email_duplicado.html', title:'', caption:'', type:'external', width:'490', height:'205'});	
	}
}

function doNIFDuplicado(){
	if(myLightWindow == null)
	{
		setTimeout(doNIFDuplicado, 100);
	}
	else
	{
	myLightWindow.activateWindow({href:'popUps/pop_nif_duplicado.html', title:'', caption:'', type:'external', width:'490', height:'205'});	
	}
}

function openLightWindow(pag, w, h){
	if(myLightWindow == null)
	{
		setTimeout(openLightWindow, 100);
	}
	else
	{
	myLightWindow.activateWindow({href:pag, title:'', caption:'', type:'external', width:w, height:h});		
	}
}
function openLightWindowGlobal(error){
	if(myLightWindow == null)
	{
		setTimeout(openLightWindowGlobal, 100);
	}
	else
	{
	myLightWindow.activateWindow({href:'popUps/pop_errorGenerico.asp?mensaje='+error, title:'', caption:'', type:'external', width:490, height:175});		
	}
}
function envioAmigoOK(error){
	if(myLightWindow == null)
	{
		setTimeout(envioAmigoOK, 100);
	}
	else
	{
		myLightWindow.activateWindow({href:'popUps/pop_envioAmigoOK.asp?mensaje='+error, title:'', caption:'', type:'external', width:490, height:250});	
	}
}
function pop_validationOk(error){
	if(myLightWindow == null)
	{
		setTimeout(pop_validationOk, 100);
	}
	else
	{
		myLightWindow.activateWindow({href:'popUps/pop_validationOk.html?mensaje='+error, title:'', caption:'', type:'external', width:490, height:250});
	}
}
function pop_validationNoOk(error){
	if(myLightWindow == null)
	{
		setTimeout(pop_validationNoOk, 100);
	}
	else
	{
			myLightWindow.activateWindow({href:'popUps/pop_validationNoOk.html?mensaje='+error, title:'', caption:'', type:'external', width:490, height:250});
	}
	
}

function OpenDestacado(){
var img=document.getElementById("imgDestacado")
img.src="img/destacado2.gif"
var likDestacado=document.getElementById("likDestacado")
likDestacado.href="javascript:CloseDestacado();"
}
function CloseDestacado(){
var img=document.getElementById("imgDestacado")
img.src="img/detacado1.jpg"
var likDestacado=document.getElementById("likDestacado")
likDestacado.href="javascript:OpenDestacado();"
}
