// JavaScript Document
<!-- ANCLAS -->
function irA(elemID) {
	var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	while (offsetTrail) {
		offsetLeft += offsetTrail.offsetLeft;
		offsetTop += offsetTrail.offsetTop;
		offsetTrail = offsetTrail.offsetParent;
	}
	if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined" && navigator.appName=="Microsoft Internet Explorer" ) {
		offsetLeft += parseInt(document.body.leftMargin);
		offsetTop += parseInt(document.body.topMargin);
	}
	window.scrollTo(offsetLeft,offsetTop);
}
<!-- -->

<!-- FORM REGISTER -->
<!--
function valida_envia(){ 
    if (document.fvalida.condiciones.checked==0){ 
       alert("Debe aceptar la política de privacidad");
       //document.fvalida.LOPD.focus() 
	   parent.location.reload();
       return 0; 
    }
}
//-->
<!-- -->

<!-- FORM LOGIN -->
function form_login(formobj){
	var fieldRequired=Array("user_login","pass_login");
    var fieldDescription=Array();
	var alertMsg = "¡¡ Para acceder debe ingresar su usuario y contraseña !!\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//-->


<!-- FORM REGISTER -->
function form_register(formobj){
	var fieldRequired=Array("nombre","apellidos","localidad","cif","provincia","direccion","cp","telf","email","usuario","contrasenya");
    var fieldDescription=Array();
	var alertMsg = "¡¡ Para continuar debe rellenar obligatoriamente los campos marcados con un *: !!\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					//alertMsg += " - " + fieldDescription[i] + "\n";
					alertMsg += "  " + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == 0){
					alertMsg += "  " + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//-->



<!-- FORM REGISTER -->
function form_recover(formobj){
	var fieldRequired=Array("email_recover");
    var fieldDescription=Array();
	var alertMsg = "¡¡ Debe introducir su dirección de Email !!\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == 0 || obj.options[obj.selectedIndex].text == ""){
					//alertMsg += " - " + fieldDescription[i] + "\n";
					alertMsg += "  " + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == 0){
					alertMsg += "  " + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += "  " + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//-->


<!--
function alerta_cesta(){ 

       alert("¡ Debe estar registrado para poder realizar una compra !");
 
}
//-->



<!--
/*
function reload_page(){
	window.onunload = sale;
	var valor;
	if(document.cookie){
		galleta = unescape(document.cookie)
		galleta = galleta.split(';')
		for(m=0; m<galleta.length; m++){
			if(galleta[m].split('=')[0] == "recarga"){
				valor = galleta[m].split('=')[1]
				break;
			}
		}
		if(valor == "sip"){
			document.cookie = "recarga=nop"; 
			window.onunload = function(){};
			document.location.reload()
		}
		else{
		window.onunload=sale
		}
	}
	function sale(){
		document.cookie ="recarga=sip"
	}
}
*/
//-->
