				var linea='c';
				var linea_old='z';
				var base_linea_old='z';


				function cambiaColor(id, src, color)
				{
				document.all[id].bgColor = color;
				src.style.cursor="hand";
				}

				function cambiaColor3(color) {
				if (linea_old!='z') {
				document.all[linea_old].bgColor = color;
				document.all[base_linea_old].bgColor = '#C0C0C0';
				}
				}



				function cambiaColor2(id, t, src, color1, color2) {

				if (id==linea) {
				document.all[id].bgColor = color2;
				//document.all[t].bgColor =  '#C0C0C0';
				}
				else {
				document.all[id].bgColor = color1;
				//document.all[t].bgColor =   '#C0C0C0';
				}

				src.style.cursor="hand";
				}

function buscaRef() {
ref=document.FormRef.Ref.value;
if (!ref) {
return false
} else {
return true
}
}

function showHintCP(capaPOB) {
xmlHttp=GetXmlHttpObject()
var url="/visualweb/productos/buscadatos2.asp?cp="+document.calData.cp.value
url+="&idMun="+document.calData.munID.value
url+="&idPob="+document.calData.pobID.value+'&sid='+Math.random()

xmlHttp.onreadystatechange=function () { 

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {   
document.getElementById(capaPOB).innerHTML=(xmlHttp.responseText)
document.calData.provCHR.value=document.getElementById("NOMpro1").value
document.calData.paisCHR.value=document.getElementById("NOMpais1").value
	}
} 

xmlHttp.open("GET",url,true)
xmlHttp.send(null)		
} 


function respuestaOlvido(mail) {
xmlHttpq=GetXmlHttpObject()
var url="/visualweb/productos/buscamail.asp?email="+mail+'&sid='+Math.random()
xmlHttpq.onreadystatechange=function () { 
if (xmlHttpq.readyState==4 || xmlHttpq.readyState=="complete") {   
		document.getElementById("validate").innerHTML=(xmlHttpq.responseText)
	}	
} 
xmlHttpq.open("GET",url,true)
xmlHttpq.send(null)
}

function olvidoClave() {
	document.getElementById("clave").innerHTML="<table border=0 cellspacing=0 cellpadding=4><tr><td colspan=2 valign=top><font class=titulares2><b>Introduzca su e-mail y le enviaremos su clave de acceso en breves instantes.</b></font></td></tr><tr height=5><td width=63 height=25></td><td ><div id=validate></div></td></tr><tr><td valign=middle width=63>E-mail:</td><td valign=middle><input type=TEXT size=25 onblur=showHint('/visualweb/productos/buscamail.asp?email='+value,'validate'); onkeypress='return handleEnter(this, event)' name=email tabindex=1></td></tr><tr><td valign=middle width=63><a href=# onclick='volverdeolvidoClave();return false;'><img src='/visualweb/productos/images/atrasgris.gif' border=0></a></td><td valign=middle><font size=1 color=black></font></td></tr></table>"
}

function volverdeolvidoClave() {
document.getElementById("clave").innerHTML="<table border=0 cellspacing=0 cellpadding=2><tr><td valign=top width=100%><font class=titulares2><b>Introduzca los datos siguientes para identificarse como cliente.</b></font></td></tr><tr><td width=100%><div align=left><table border=0 cellspacing=0 cellpadding=2><tr><td valign=middle width=106></td><td></td></tr><tr><td valign=middle width=106><div align=left><p>E-mail:</p></div></td><td><input type=TEXT size=25 onblur=showHint('buscamail.asp?noenviar=1&email='+value,'validate'); name=email tabindex=1></td></tr><tr><td valign=middle width=106><div align=left><p>Clave de acceso:</p></div></td><td><input type=password size=25 name=pw tabindex=2></td></tr><tr><td valign=middle width=106 height=50></td><td valign=middle><a href=# class=boton1 title='Enviar los datos para identificarme' onclick='document.MyForm.submit();'>Identificarme</a></td></tr><tr><td colspan=2 valign=middle>Si olvid&oacute; su clave de acceso haga click <a href=# onclick=olvidoClave();return false;><b>aqu&iacute;</b></a></td></tr></table></div></td></tr></table>"
}


function actualizaPedido(pedido,linea,q,ref) {
urlactualiza='/visualweb/productos/CambiaEstado.asp?id_pedido='+pedido+'&ref='+ref+'&linea='+linea+'&q='+q;

Hint(urlactualiza,'pedido');
recalCular()
}

function addRefPedido(ref,q,idprod,imgprod,familia) {
Hint('/visualweb/productos/baz_add_action_from1b.asp?p_ref='+ref+'&p_img='+imgprod+'&p_fam='+familia+'&p_prod_id='+idprod+'&q='+q,'pedido');
recalCular()
}

function borrarLinea(linea,idpedido,empr) {
urlborrar='/visualweb/productos/baz_order_delete_item.asp?linea='+linea+'&idpedido='+idpedido+'&empresa='+empr;
Hint(urlborrar,'pedido');
recalCular()
}

function gastos() {
vol=document.addlista.volumentotal.value;
cp=document.addlista.cp1.value;
pedidox=document.addlista.idPedido.value;
var url="/visualweb/productos/buscagastos.asp?cp="+cp
url+="&idPedido="+pedidox
url+="&volumen="+vol
url+='&sid='+Math.random()
Hint(url,'pedido');
}

function recalCular() {
gastos()

showHint('/visualweb/productos/pedido.asp','pedidoWindow')

}

function Hint(url,capa1) {
if (url.indexOf("?")>=0) {
var url=url+'&sid='+Math.random()
} else {
var url=url+'?sid='+Math.random()
}


xmlHttpPage=GetXmlHttpObject()
xmlHttpPage.open("GET",url,false)
xmlHttpPage.send(null)
} 


function showHint(url,capa1) {
if (url.indexOf("?")>=0) {
var url=url+'&sid='+Math.random()
} else {
var url=url+'?sid='+Math.random()
}
xmlHttpPage=GetXmlHttpObject()
xmlHttpPage.onreadystatechange=function () { 
if (xmlHttpPage.readyState==4 || xmlHttpPage.readyState=="complete") {   
		document.getElementById(capa1).innerHTML=(xmlHttpPage.responseText)
		document.getElementById(capa1).style.visibility = 'visible' 		
	}
} 

xmlHttpPage.open("GET",url,false)
xmlHttpPage.send(null)
document.getElementById(capa1).innerHTML=(xmlHttpPage.responseText)
document.getElementById(capa1).style.visibility = 'visible' 

} 



function GetXmlHttpObject(){ 
var objXMLHttp=null
if (window.XMLHttpRequest){
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject){
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 

function handleEnter (field, event) { 
        var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; 
        if (keyCode == 13) { 
field.blur();
return false;
        } 
        else 
        return true; 
    }    


				var linea='c';
				var linea_old='z';
				var base_linea_old='z';


				function cambiaColor(id, src, color)
				{
				document.all[id].bgColor = color;
				src.style.cursor="hand";
				}

				function cambiaColor3(color) {
				if (linea_old!='z') {
				document.all[linea_old].bgColor = color;
				document.all[base_linea_old].bgColor = '#C0C0C0';
				}
				}



				function cambiaColor2(id, t, src, color1, color2) {

				if (id==linea) {
				document.all[id].bgColor = color2;
				//document.all[t].bgColor =  '#C0C0C0';
				}
				else {
				document.all[id].bgColor = color1;
				//document.all[t].bgColor =   '#C0C0C0';
				}

				src.style.cursor="hand";
				}
				
function isEmpty(s) {
	return ((s == null) || (s.length == 0));
}

function isDigit(c)
{
	return ((c >=0) && (c <=9));
}

function isInteger (s)
{
	if (isEmpty(s.value)) return false;
	for (var i = 0; i < s.value.length; i++)
		if (!isDigit(s.value.charAt(i))) return false;
	return true;
}

function isFloat(s)
{
	if (isEmpty(s.value))return false;
	if (isNaN(parseFloat(s.value))) return false;
	return true;
}

		
function isDecimalComa(s)
{
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (c==".") return false;
	}
	data = s.split(",");
	if (data.length > 2) return false;
	parteEntera = data[0];
	if (isEmpty(parteEntera)) return false;
	for (i = 0; i < parteEntera.length; i++)
	{
		var c = parteEntera.charAt(i);
		if (!isDigit(c)) return false;
	}
	if (data.length > 1)
	{
		parteDecimal = data[1];
		if(parteDecimal.length > 2) //numero de decimales
			return false;
		if (isEmpty(parteDecimal)) return false;
		for (i = 0; i < parteDecimal.length; i++)
		{
			var c = parteDecimal.charAt(i);
			if (!isDigit(c)) return false;
		}
	}
	return true;
}

function anyCheck() {
var total = 0;
var max = document.delForm.p_dely.length;
if (eval("document.delForm.p_dely.checked") == true) {
    total += 1;
   }
for (var idx=0; idx < max; idx++) {
if (eval("document.delForm.p_dely[" + idx + "].checked") == true) {
    total += 1;
   }
}
if (total < 1) {
alert("No se ha seleccionado ninguna linea.");
return false;
}
else {
if (confirm("Está seguro de borrar las líneas seleccionadas")) {
return true;
}
else {
return false;
}
}
}

var checkflag = "false";
function check(field) {
if (checkflag == "false") {
document.delForm.p_dely.checked = true;
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
document.delForm.p_dely.checked = false; 
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}



function ValidarForm() {
if (document.MyForm.nombre.value =='' ) {
alert ("El campo Nombre no puede quedar en blanco");
return false;
}
else if (document.MyForm.dir.value =='' ) {
alert ("El campo Direcci—n no puede quedar en blanco");
return false;
}
else if (document.MyForm.pob.value =='' ) {
alert ("El campo Poblaci—n no puede quedar en blanco");
return false;
}
else if (document.MyForm.cp.value =='' ) {
alert ("El campo C—d. Postal no puede quedar en blanco");
return false;
}
else if (document.MyForm.email.value =='' ) {
alert ("El campo E-mail no puede quedar en blanco");
return false;
}
else {
return true;
}
}

/*
\u00e1 -> ‡ 
\u00e9 -> Ž 
\u00ed -> ’ 
\u00f3 -> — 
\u00fa -> œ 
\u00c1 -> ç 
\u00c9 -> ƒ 
\u00cd -> ê 
\u00d3 -> î 
\u00da -> ò 
\u00f1 -> – 
\u00d1 -> „
*/

function valForm(rev) {
if (document.calData.nombre.value =='' ) {
alert ("El campo Persona de contacto no puede quedar en blanco");
return false;
}
else if (document.calData.tel.value =='' ) {
alert ("El campo Tel\u00e9fono contacto no puede quedar en blanco");
return false;
}
else if (document.calData.dire.value =='' ) {
alert ("El campo Direcci\u00f3n de env\u00edo no puede quedar en blanco");
return false;
}
else if (document.calData.cp.value =='' ) {
alert ("El campo C\u00f3digo Postal no puede quedar en blanco");
return false;
}
else if (document.calData.pobIDsel.value =='' ) {
alert ("El campo Poblaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.nombre2.value =='' ) {
alert ("El campo Nombre / empresa no puede quedar en blanco");
return false;
}
else if (document.calData.dni.value =='' ) {
alert ("El campo DNI / NIF no puede quedar en blanco");
return false;
}
else if (document.calData.dire2.value =='' ) {
alert ("El campo Direcci\u00f3n de facturaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.cp2.value =='' ) {
alert ("El campo C\u00f3d. Postal de facturaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.pob2.value =='' ) {
alert ("El campo Poblaci\u00f3n de facturaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.prov2.value =='' ) {
alert ("El campo Provincia de facturaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.pais2.value =='' ) {
alert ("El campo Pa\u00eds de facturaci\u00f3n no puede quedar en blanco");
return false;
}
else if (document.calData.email.value =='' ) {
alert ("El campo E-mail no puede quedar en blanco");
return false;
}
else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.calData.email.value)==false) {
alert("El E-mail introducido no es v\u00e1lido")
return (false)
}
else if (document.calData.password.value =='' ) {
alert ("El campo Clave de acceso no puede quedar en blanco");
return false;
}
else if (document.calData.password.value != document.calData.password2.value ) {
alert ("No coincide la confirmaci\u00f3n de la Clave de acceso");
return false;
}
else if (eval("document.calData.condiciones.checked") == false) {
alert ("Debe aceptar las condiciones de uso y compras en etiquelandia.com");
return false;
}
else {
document.calData.submit()
}
}

function meterDatosFacturacion() {

var n1=document.getElementById("nombrew").value
var t1=document.getElementById("telw").value
var d1=document.getElementById("direw").value
var cp1=document.getElementById("cpw").value

if (!document.getElementById("pobCHRw")) {
} else {
var pobSel=document.getElementById("pobCHRw").value
}

if (!document.getElementById("pobIDsel")) {
} else {
var pobSel=document.getElementById("pobIDsel").options[document.getElementById("pobIDsel").options.selectedIndex].text
}

var prov1=document.getElementById("provCHR").value
var pais1=document.getElementById("paisCHR").value

document.calData.nombre2.value=n1
document.calData.tel2.value=t1
document.calData.dire2.value=d1
document.calData.cp2.value=cp1
document.calData.pob2.value=pobSel
document.calData.prov2.value=prov1
document.calData.pais2.value=pais1
}

function valPago() {
var total = 0;
var max = document.formPago.formapago.length;
if (eval("document.formPago.formapago.checked") == true) {
    total += 1;
   }
for (var idx=0; idx < max; idx++) {
if (eval("document.formPago.formapago[" + idx + "].checked") == true) {
    total += 1;
   }
}
if (total < 1) {
alert("No ha seleccionado ninguna forma de pago.");
return false;
}
else if (eval("document.formPago.condiciones.checked") == false) {
alert ("Debe aceptar las condiciones generales de venta en etiquelandia.com");
return false;
}
else {
document.formPago.submit();
}
}

function sumar(x, valor) { 
x=(x*1)+(valor*1);
return x;
} 

function restar(x, valor) { 
if (x > valor) { 
x=x-valor; 
} 
return x;
} 

function resizeIframe() {
	iHeight = document.body.scrollHeight
	window.style.height = iHeight + 205 + "px"
}

function resizeIframe2() {
	i = top.document.getElementById(window.name)
	iHeight = document.body.scrollHeight
	i.style.height = iHeight + 200 + "px"
	i.style.scroll = "no";
}	

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function printdiv(printpage)
{
var headstr = "<html><head><link rel=stylesheet href='/estilo1.css' media=print><link rel=stylesheet href='/visualweb/productos/estilo.css' media=print></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print(); 
document.body.innerHTML = oldstr;
return false;
}
