// Variables para setear
onload=function() 
{
	cAyuda=document.getElementById("mensajesAyudaO");
	cTex=document.getElementById("ayudaTexto");
	divTransparente=document.getElementById("transparencia");
	divMensaje=document.getElementById("transparenciaMensaje");
	form=document.getElementById("formulario");
	tablaPaquetes=document.getElementById("listaPaquetes");
		
	claseNormal="input";
	claseError="inputError";
	
	ayuda=new Array();
	ayuda["Inicio"]="<br><br>Click para ir al inicio de este sitio web";
	ayuda["Cédula"]="Ingresa tu número de cédula<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Correo electrónico"]="Ingresa un e-mail válido<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Teléfono1"]="Ingresa un teléfono de contacto<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Teléfono2"]="Ingresa un teléfono adicional de contacto<br>CAMPO OPCIONAL<img src='img/trz.gif' alt='Error'>";
	ayuda["Tueste y presentación"]="Por favor selecciona  la presentación y el tipo de tueste para al menos un paquete<img src='img/trz.gif' alt='Error'>";
	ayuda["Contacto"]="Ingresa el nombre de la persona a quien va dirigido el envío<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Provincia"]="Ingresa la provincia de la dirección de entrega<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Cantón"]="Ingresa el cantón de la dirección de entrega<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	ayuda["Otras señas"]="Ingresa otros detalles importantes de la dirección de entrega<br>CAMPO OBLIGATORIO<img src='img/trz.gif' alt='Error'>";
	
	preCarga("img/ok.gif", "img/loading.gif", "img/error.gif");
}

function preCarga()
{
	imagenes=new Array();
	for(i=0; i<arguments.length; i++)
	{
		imagenes[i]=document.createElement("img");
		imagenes[i].src=arguments[i];
	}
}





//////////////////////////////////////////////////// Mensajes de ayuda

if(navigator.userAgent.indexOf("MSIE")>=0) navegador=0;
else navegador=1;

function colocaAyuda(event)
{
	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	cAyuda.style.top=corY+20+"px";
	cAyuda.style.left=corX+15+"px";
}




function ocultaAyuda()
{
	cAyuda.style.display="none";
	if(navegador==0) 
	{
		document.detachEvent("onmousemove", colocaAyuda);
		document.detachEvent("onmouseout", ocultaAyuda);
	}
	else 
	{
		document.removeEventListener("mousemove", colocaAyuda, true);
		document.removeEventListener("mouseout", ocultaAyuda, true);
	}
}

function muestraAyuda(event, campo)
{
	colocaAyuda(event);
	
	if(navegador==0) 
	{ 
		document.attachEvent("onmousemove", colocaAyuda); 
		document.attachEvent("onmouseout", ocultaAyuda); 
	}
	else 
	{
		document.addEventListener("mousemove", colocaAyuda, true);
		document.addEventListener("mouseout", ocultaAyuda, true);
	}
	
	
	cTex.innerHTML=ayuda[campo];
	cAyuda.style.display="block";
}

