function tag(id) {return document.getElementById(id);}

var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='inline'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();



function validar_contacto(formulario) {
if (Se_Muestra(tag('error_nombre')) == true || Se_Muestra(tag('error_email')) == true || Se_Muestra(tag('error_mensaje')) == true || Se_Muestra(tag('error_codigo')) == true || Se_Muestra(tag('error_motivo')) == true) {
alert("Todos los campos deben tener un Ticket verde a su derecha.");
return false;
} else
if (Se_Muestra(tag('selecproducto')) == true && Se_Muestra(tag('error_selecproducto')) == true) {
alert("Todos los campos deben tener un Ticket verde a su derecha.");
	return false;
} else
if (Se_Muestra(tag('otro')) == true && Se_Muestra(tag('error_otromotivo')) == true) {
alert("Todos los campos deben tener un Ticket verde a su derecha.");
	return false;
} else {
	return true;
};
};


function validar_ldv(formulario) {
if (Se_Muestra(tag('error_nombre')) == true || Se_Muestra(tag('error_email')) == true || Se_Muestra(tag('error_mensaje')) == true || Se_Muestra(tag('error_codigo')) == true) {
alert("Todos los campos deben tener un Ticket verde a su derecha.");
return false;
} else {
return true;
};
};
	
	

function validar_nombre(nombre) {
	if (nombre.value.length < 5) {
	Ocultar(tag('correcto_nombre'));
	Mostrar(tag('error_nombre'));
	//alert('Complete el campo Nombre. 10 Carácteres mínimo.');
	nombre.focus();
	} else {
	Ocultar(tag('error_nombre'));
	Mostrar(tag('correcto_nombre'));
	};
};
	

function validar_email(email) {
if (email.value.length < 5 || email.value.indexOf ('@', 0) == -1 || email.value.indexOf ('.', 0) == -1) {
	Ocultar(tag('correcto_email'));
	Mostrar(tag('error_email'));
	email.focus();
	} else {
	Ocultar(tag('error_email'));
	Mostrar(tag('correcto_email'));
	};
};

function validar_otro(otro) {
	if (otro.value.length < 4) {
	Ocultar(tag('correcto_otromotivo'));
	Mostrar(tag('error_otromotivo'));
	otro.focus();
	} else {
	Ocultar(tag('error_otromotivo'));
	Mostrar(tag('correcto_otromotivo'));
	};
};

function checkear_mouse_move() {
	nombre = tag('nombre');
	email = tag('email');
	otro = tag('otromotivo');
	if (nombre.value.length < 5) {
	Ocultar(tag('correcto_nombre'));
	Mostrar(tag('error_nombre'));
	//alert('Complete el campo Nombre. 10 Carácteres mínimo.');
	} else {
	Ocultar(tag('error_nombre'));
	Mostrar(tag('correcto_nombre'));
	};
	
	if (email.value.length < 5 || email.value.indexOf ('@', 0) == -1 || email.value.indexOf ('.', 0) == -1) {
	Ocultar(tag('correcto_email'));
	Mostrar(tag('error_email'));
	} else {
	Ocultar(tag('error_email'));
	Mostrar(tag('correcto_email'));
	};
	
	if (otro.value.length < 4) {
	Ocultar(tag('correcto_otromotivo'));
	Mostrar(tag('error_otromotivo'));
	} else {
	Ocultar(tag('error_otromotivo'));
	Mostrar(tag('correcto_otromotivo'));
	};
};
	

function validar_mensaje(mensaje) {
var mlength=mensaje.getAttribute? parseInt(mensaje.getAttribute("maxlength")) : ""
var minlength=mensaje.getAttribute? parseInt(mensaje.getAttribute("minlength")) : ""
if (mensaje.getAttribute && mensaje.value.length>mlength)
mensaje.value=mensaje.value.substring(0,mlength)

if (mensaje.value.length < minlength || mensaje.value.length > 500) {
    Ocultar(tag('correcto_mensaje'));
	Mostrar(tag('error_mensaje'));
	mensaje.focus();
	} else {
	Ocultar(tag('error_mensaje'));
	Mostrar(tag('correcto_mensaje'));
	};
};


function validar_codigo(codigoingresado, codigo) {
if (codigoingresado.value < 5 || !(codigo == codigoingresado.value)) {
	Ocultar(tag('correcto_codigo'));
	Mostrar(tag('error_codigo'));
	codigo2.focus();
	} else {
	Ocultar(tag('error_codigo'));
	Mostrar(tag('correcto_codigo'));
	};
};
	
	
	
	
	
	

	
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

function Alternar(Seccion){ 
    if (Seccion.style.display=="none"){
		Seccion.style.display="";
		} else {
		Seccion.style.display="none";
		} 
	}

function Mostrar(Seccion){ 
	Seccion.style.display="";
}
	
function Ocultar(Seccion){ 
	Seccion.style.display="none";
}

function Se_Muestra(Seccion) {
if (Seccion.style.display == "") {
	return true;
} else {
	return false;
};
};



hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});

hs.graphicsDir = 'highslide/graphics/';
hs.wrapperClassName = 'borderless';



function cambio(laurl){
        var objeto= document.getElementById("mostrarfotocuadro");
        objeto.style.backgroundImage= "url("+laurl+");";
        }


