function botonin(mybot) {
	document.getElementById(mybot).style.cursor = 'pointer';
	document.getElementById(mybot).src = 'img/boton2.gif';
}

function botonout(mybot) {
	document.getElementById(mybot).style.cursor = 'normal';
	document.getElementById(mybot).src = 'img/boton1.gif';
}

function bin(mybot) {
	document.getElementById(mybot).style.cursor = 'pointer';
	document.getElementById(mybot).src = 'img/boton4.gif';
}

function bout(mybot) {
	document.getElementById(mybot).style.cursor = 'normal';
	document.getElementById(mybot).src = 'img/boton3.gif';
}

function cursorin(img,dest) {
	document.getElementById(img).style.display = 'block';
	document.getElementById(dest).style.display = 'block';
}

function cursorout(img,dest) {
	document.getElementById(img).style.display='none';
	document.getElementById(dest).style.display='none';
}

function godoc(strUrl) {
	document.location.href = strUrl;
}

function sendsuscripcion() {
	var f = document.formsuscripcion;
	var dirmail = f.email.value;
	var filter = /^.+@.+\..{2,3}$/;
	var validmail;
	if (filter.test(dirmail)) {
		validmail = true;
	} else {
		validmail = false;
	}
	if (f.persona.value=="" || f.email.value=="") {
		alert("Debes proporcionarnos al menos un nombre y una dirección de correo.")
	} else {
		if(validmail==false) {
			alert("La dirección de correo indicada no es válida");
		} else {
			f.submit();
		}
	}
}

function sendcontacto() {
	var f = document.formcontacto;
	var dirmail = f.email.value;
	var filter = /^.+@.+\..{2,3}$/;
	var validmail;
	if (filter.test(dirmail)) {
		validmail = true;
	} else {
		validmail = false;
	}
	if (f.contacto.value=="" || f.email.value=="") {
		alert("Debes proporcionarnos al menos un nombre y una dirección de correo.")
	} else {
		if(validmail==false) {
			alert("La dirección de correo indicada no es válida");
		} else {
			f.submit();
		}
	}
}

function sendinteresa() {
	var f = document.forminteresa;
	if (f.que1.value=="" || f.que2.value=="") {
		alert("Debes decirnos qué ofreces y qué te interesa.")
	} else {
		if (f.contacto.value=="" || f.telefono.value=="") {
			alert("Debes proporcionarnos al menos un nombre y un número de teléfono.")
		} else {
			f.submit();
		}
		}
}

function gocat(num) {
	document.getElementById("idsector").value = num;
	document.getElementById("idproducto").value = document.getElementById("cata"+num).value;
	document.formcatalogo.submit();
}

function sendpeticion() {
	var f = document.formpeticion;
	var dirmail = f.email.value;
	var filter = /^.+@.+\..{2,4}$/;
	var validmail;
	if (filter.test(dirmail)) {
		validmail = true;
	} else {
		validmail = false;
	}
	if (f.peticion2.value=="" || f.persona.value=="" || f.empresa.value=="" || f.telefono.value=="") {
		alert("La petición concreta, persona de contacto, empresa, teléfono y e-mail son datos obligatorios.")
	} else {
		if(validmail==false) {
			alert("La dirección de correo indicada no es válida");
		} else {
			f.submit();
		}
	}
}

function formin(myfield,len) {
	document.getElementById(myfield).style.backgroundImage = 'url(img/campo'+len+'f.gif)';
}

function formout(myfield,len) {
	document.getElementById(myfield).style.backgroundImage = 'url(img/campo'+len+'.gif)';
}

function opchat() {
	var parameters="toolbar=0,scrollbars=0,location=0,status=false,menubar=0,resizable=0,width=750,height=450,left=25,top=25";
	var url = 'chat/login.asp';
	newwindow = window.open(url,'wchat',parameters);
	newwindow.focus();
}

function catFilter() {
	document.catalogo.submit();
}

function getBrowserWidth() {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth != 0) {
		return document.documentElement.clientWidth;
	} else if (document.body) {
		return document.body.clientWidth;
	}
	return 0;
}

function displayresol() {
	var theWidth = getBrowserWidth();
	if (theWidth<=800) {
		document.getElementById("tagstyle").href = "_estilos800.css";
	}
}

function sp(npag) {
	document.form_catalogo.pag.value = npag;
	document.form_catalogo.submit();
}

function spord(ord) {
	document.form_catalogo.orden.value = ord;
	document.form_catalogo.submit();
}

function CreateControlFlash(divid, objectid, width, height, url, mode) {
	var d = document.getElementById(divid);
	var strHTML = '<object id="' + objectid + '" type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">';
	strHTML = strHTML + '<param name="movie" value="' + url + '" />';
	if(mode=='1') { strHTML = strHTML + '<param name="wmode" value="transparent" />'; }
	strHTML = strHTML + '<a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;Lang=Spanish&amp;P5_Language=Spanish"><img src="flash/noflash.gif" border="0" alt="no tiene flash" /></a>';
	strHTML = strHTML + '</object>';
	d.innerHTML = strHTML;
}

function showcat(id,max) {
	if(document.getElementById("prodser_"+id).style.display=='block') {
		document.getElementById("prodser_"+id).style.display='none';
	} else {
		document.getElementById("prodser_"+id).style.display= 'block';
	}
	for (var i=1; i<max; i++) {
		if(id!=i) {
			if (document.getElementById("prodser_"+i)!=null) {
				document.getElementById("prodser_"+i).style.display = 'none';
			}
		}
	}
	document.getElementById("anchor_"+id).focus();
}

function catain(id) {
	document.getElementById("li_"+id).style.backgroundRepeat = "no-repeat";
	document.getElementById("li_"+id).style.backgroundPosition = "top left";
	document.getElementById("li_"+id).style.backgroundImage = "url('img/fondocat.jpg')";
}

function cataout(id) {
	document.getElementById("li_"+id).style.backgroundImage = "none";
}
