function EnviarPass()
{	if (document.getElementById('PassActual').value=='')
	{	alert('Informe la clave de acesso actual');
		document.getElementById('PassActual').focus();
		return false;
	}
	if (document.getElementById('PassNuevo').value=='')
	{	alert('Informe la nueva clave de acesso');
		document.getElementById('PassNuevo').focus();
		return false;
	}
	if (document.getElementById('PassRepetir').value=='')
	{	alert('Repita la nueva clave de acesso');
		document.getElementById('PassRepetir').focus();
		return false;
	}
	
	if (document.getElementById('PassNuevo').value == document.getElementById('PassActual').value )
	{	alert('La nueva clave de acceso debe ser diferente de la antigua');
		document.getElementById('PassNuevo').focus();
		return false;
	}
	
	if (document.getElementById('PassNuevo').value != document.getElementById('PassRepetir').value )
	{	alert('La nueva clave de acceso no coincide');
		document.getElementById('PassRepetir').focus();
		return false;
	}
	
	
	document.FormularioPass.submit();
}

function EnvioCopia(NumPedido)
{	
	if (document.getElementById('CopiaEmail').value=='')
	{	alert('Informe el email');
		document.getElementById('CopiaEmail').focus();
		return false;
	}
	else
	{	arroba=document.getElementById("CopiaEmail").value.indexOf("@");
		punto=document.getElementById("CopiaEmail").value.indexOf(".",arroba);
		if (arroba<1 || (punto-arroba)<2 || punto==(document.getElementById("CopiaEmail").value.length-1))
		{	alert("Introducir una dirección de correo electrónico correcta.")
			document.getElementById("CopiaEmail").focus();
			return (false);
		}
	}
	
	document.getElementById('frOculta2').src='EnvioCopia.asp?NumPedido='+ NumPedido +'&Email='+document.getElementById('CopiaEmail').value;
	
	alert("Procesando envio.\n\nAcepte y en breve recibirá la copia del pedido.");
}
function ValidarCliente()
{	if (document.getElementById('Usuario').value=='')
	{	alert("Informe el usuario");
		document.getElementById('Usuario').focus();
		return false;
	}
	if (document.getElementById('Contrasena').value=='')
	{	alert("Informe la contraseña");
		document.getElementById('Contrasena').focus();
		return false;
	}
	document.FormularioCliente.submit();	
}

function EnviarFormularioCA()
{	if (document.getElementById('CA').value=='')
	{	alert("Informe el código artículo.");
		document.getElementById('CA').focus();
		return false;
	}
	document.FormularioCA.submit();
}

function EnviarFormularioBusqueda()
{	document.FormularioBusqueda.action="resultados.asp";
	document.FormularioBusqueda.submit();
}

function EnviarFormularioPC()
{	if (document.getElementById('PC').value=='')
	{	alert("Informe la palabra clave.");
		document.getElementById('PC').focus();
		return false;
	}
	document.FormularioPC.submit();
}


function Tecla(Campo,funcion)
{	if (self.event.keyCode == 13 )
	{	self.event.keyCode = 9;
		if (self.event.srcElement.name == Campo)
		{	if (funcion=='ValidarCliente')
			{	ValidarCliente();	}	
		}
		if (self.event.srcElement.name == Campo)
		{	if (funcion=='FormularioCA')
			{	EnviarFormularioCA();	}	
		}
		if (self.event.srcElement.name == Campo)
		{	if (funcion=='FormularioBusqyeda')
			{	EnviarFormularioBusqueda();	}	
		}
		if (self.event.srcElement.name == Campo)
		{	if (funcion=='FormularioPC')
			{	EnviarFormularioPC();	}	
		}
	}	
}


function RevisarCantidad(obj)
{	if (obj.value!="")
	{	var number = parseFloat(obj.value);
		//alert(obj.value);
		if (isNaN(number)==true)
		{	alert("Sólo valores numéricos ..."); 
			obj.focus();
		}
		else
		{	if(number<=0)
			{	alert("Informar un valor mayor de 0."); 
				obj.focus();
			}
		}
	}	
}

function WindowOpenCentrado(url, name, param,w, h, perc) 
{ 	var winX = (screen.availWidth - w)*perc*.01;
	var winY = (screen.availHeight - h)*perc*.01;
	popupWin = window.open(url, name, 'width=' + w + ',height=' + h +',left=' + winX + ',top=' + winY + ','+param);
}

function EnviarPedido2()
{	if (Formulario.DatosEnvioDiferentes.checked)	
	{	
		if (document.getElementById('RazonSocial').value=='')
		{	alert("Informe la razón social.");
			document.getElementById('RazonSocial').focus();
			return false;
		}
		if (document.getElementById('Domicilio').value=='')
		{	alert("Informe el domicilio.");
			document.getElementById('Domicilio').focus();
			return false;
		}
		if (document.getElementById('CodigoPostal').value=='')
		{	alert("Informe el codigo postal.");
			document.getElementById('CodigoPostal').focus();
			return false;
		}
		if (document.getElementById('Municipio').value=='')
		{	alert("Informe el municipio.");
			document.getElementById('Municipio').focus();
			return false;
		}
		if (document.getElementById('Provincia').value=='')
		{	alert("Informe la provincia.");
			document.getElementById('Provincia').focus();
			return false;
		}
		/*if (document.getElementById('Nacion').value=='')
		{	alert("Informe la Nacion.");
			document.getElementById('Nacion').focus();
			return false;
		}*/
		if (document.getElementById('Telefono').value=='')
		{	alert("Informe el Telefono.");
			document.getElementById('Telefono').focus();
			return false;
		}
	}
	document.Formulario.submit();	
}


Numero=0
function EfectoImagenDefault()
{	if (navigator.appName=="Microsoft Internet Explorer") 
	{	
		if (Numero < 5)
		{	Numero=Numero+1;	}
		else
		{	Numero=1;	}
		
		Imagen.src='../img/fotos_header/'+Numero+'.jpg';
		Imagen.filters.item(0).Apply();
		Imagen.filters.item(0).Transition = 16;
		Imagen.filters.item(0).Play(2.0);
		Imagen.style.visibility="inherit";
		setTimeout("EfectoImagenDefault()",8000);
	}
	else
	{	document.getElementById('Imagen').style.visibility="inherit";
		document.getElementById('Imagen').src='img/fotos_header/1.jpg'; 	
		document.getElementById('SelectLlegadaDefault').style.visibility="hidden";
		document.getElementById('SelectSalidaDefault').style.visibility="hidden";
	}
}
function EfectoImagenDefault2()
{	if (navigator.appName=="Microsoft Internet Explorer") 
	{	
		if (Numero < 6)
		{	Numero=Numero+1;	}
		else
		{	Numero=1;	}
		
		Imagen.src='img/fotos_header/'+Numero+'.jpg';
		Imagen.filters.item(0).Apply();
		Imagen.filters.item(0).Transition = 9;
		Imagen.filters.item(0).Play(2.0);
		Imagen.style.visibility="inherit";
		setTimeout("EfectoImagenDefault2()",8000);
	}
	else
	{	document.getElementById('Imagen').style.visibility="inherit";
		document.getElementById('Imagen').src='img/fotos_header/1.jpg'; 	
		document.getElementById('SelectLlegadaDefault').style.visibility="hidden";
		document.getElementById('SelectSalidaDefault').style.visibility="hidden";
	}
}

function EnvioPaso3()
{	
	document.getElementById('ImagenComprar').style.display='none';
	document.getElementById('BotonComprar').innerHTML='Procesando...';
	
	document.getElementById('ImagenVolver').style.display='none';

	setTimeout("EnviarPaso3_()",500);
}

function EnviarPaso3_()
{	document.Formulario.submit();
}

function EnvioPaso2()
{	
	document.getElementById('ImagenComprar').style.display='none';
	document.getElementById('BotonComprar').innerHTML='Procesando...';
	setTimeout("EnviarPaso2_()",500);
}

function EnviarPaso2_()
{	
	if (document.getElementById('DireccionDiferente').checked)
	{	if (document.getElementById('NNombre').value=='')
		{	alert('Informe el nombre para la nueva dirección de envio.');
			document.getElementById('ImagenComprar').style.display='block';
			document.getElementById('BotonComprar').innerHTML='';
			document.getElementById('NNombre').focus();
			return false;
		}
		if (document.getElementById('NDomicilio').value=='')
		{	alert('Informe el domicilio para la nueva dirección de envio.');
			document.getElementById('ImagenComprar').style.display='block';
			document.getElementById('BotonComprar').innerHTML='';
			document.getElementById('NDomicilio').focus();
			return false;
		}
		if (document.getElementById('NCP').value=='')
		{	alert('Informe el codigo postal para la nueva dirección de envio.');
			document.getElementById('ImagenComprar').style.display='block';
			document.getElementById('BotonComprar').innerHTML='';
			document.getElementById('NCP').focus();
			return false;
		}
		if (document.getElementById('NMunicipio').value=='')
		{	alert('Informe el municipio para la nueva dirección de envio.');
			document.getElementById('ImagenComprar').style.display='block';
			document.getElementById('BotonComprar').innerHTML='';
			document.getElementById('NMunicipio').focus();
			return false;
		}
		if (document.getElementById('NProvincia').value=='')
		{	alert('Informe la provincia para la nueva dirección de envio.');
			document.getElementById('ImagenComprar').style.display='block';
			document.getElementById('BotonComprar').innerHTML='';
			document.getElementById('NProvincia').focus();
			return false;
		}
	}
	
	document.FormularioPaso2.action='MiPedido3.asp';
	document.FormularioPaso2.submit();
}