function usuarios_validar(ruta)
{
	var opciones="";
	var usuario="";
	var clave="";
	if(document.getElementById('usuario').value!="")
	{
		usuario=document.getElementById('usuario').value;
	}
	if(document.getElementById('clave').value!="")
	{
		clave=document.getElementById('clave').value;
	}
	if(usuario!="" && clave !="")
	{
		opciones=devuelvesincrono('usuarios_validar.aspx?usuario='+escape(usuario)+'&clave='+escape(clave)+'');
		if(opciones=="ok")
		{
			window.open(ruta+'.aspx','_self');
		}	
		else
		{
			alert('El usuario o la clave de acceso son incorrectos');
			window.open('acceso.aspx','_self');
		}	
	}
	else
	{
		alert('Rellene los campos usuario y clave');
	}	
}
function usuarios_validar_pedido(ruta)
{
	var opciones="";
	var usuario="";
	var clave="";
	if(document.getElementById('usuario_pedido').value!="")
	{
		usuario=document.getElementById('usuario_pedido').value;
	}
	if(document.getElementById('clave_pedido').value!="")
	{
		clave=document.getElementById('clave_pedido').value;
	}
	if(usuario!="" && clave !="")
	{
		opciones=devuelvesincrono('usuarios_validar.aspx?usuario='+escape(usuario)+'&clave='+escape(clave)+'');
		if(opciones=="ok")
		{
			window.open(ruta+'.aspx','_self');
		}	
		else
		{
			alert('El usuario o la clave de acceso son incorrectos');
		}	
	}
	else
	{
		alert('Rellene los campos usuario y clave');
	}	
}
function presupuesto_consultar()
{
	var presupuesto="";
	var referencia="";
	if(document.getElementById('presupuesto').value!="")
	{
		presupuesto=document.getElementById('presupuesto').value;
	}
	if(document.getElementById('referencia').value!="")
	{
		referencia=document.getElementById('referencia').value;
	}
	if(referencia!="" && presupuesto !="")
	{
		window.open('pedido_confirmar.aspx?num_pres='+escape(presupuesto)+'&num_ref='+escape(referencia)+'','_self');
	}
	else
	{
		alert('Rellene los campos de numero de presupuesto y numero de referencia');
	}	
}
function presupuesto_formaspago(dato)
{
	if(dato!="0")		
	{
		window.open('pedido_confirmar.aspx?formapagoid='+dato+'','_self');
	}
	else
	{
		alert("De no seleccionar una forma de pago, se le aplicara la predefinida por el cliente.");
	}
}
function presupuesto_enviar(pedidoid)
{
	var opciones="";
	opciones=devuelvesincrono('presupuesto_enviar.aspx?pedidoid='+escape(pedidoid)+'');
	if(opciones=="ok")	
	{
		alert("Envio realizado correctamente");
	}
	else
	{
		alert(opciones);
	}
}
function articulos_buscador()
{
	var buscador="";
	if(document.getElementById('buscador').value!="")
	{
		buscador=document.getElementById('buscador').value;
		window.open('articulos.aspx?buscador='+escape(buscador)+'&opcion=1','_self');
	}
	else
	{
		alert('Rellene el campo con el contenido que desea buscar');
	}
}
function articulo_borrar(dato)
{
	var opciones="";
	var respuesta ="";
	respuesta = confirm("¿Desea borrar el articulo del presupuesto?")
	if (respuesta)
	{
		opciones=devuelvesincrono('articulos_borrar.aspx?fila='+dato+'');
		if(opciones=="ok")
		{
			alert('Articulo eliminado del presupuesto');
			window.open('pedido.aspx','_self');				
		}
	}
}
function cerrar_session(ruta)
{
	var resultado="";
	opciones=devuelvesincrono('cerrar_sesion.aspx');
	if(opciones=="ok")
	{
		window.open(ruta+'.aspx','_parent');
	}
}
function grabar(ref,tarifa)
{
	var opciones="";
	opciones=devuelvesincrono('articulos_grabar.aspx?ref='+escape(ref)+'&tarifa='+tarifa+'');
	if(opciones=="ok")
	{
		alert('Articulo añadido correctamente al presupuesto');
		llamarasincrono('articulos_cantidad.aspx','capa_carro');
	}
	else
	{		
		alert('El articulo ya se encuentra en su pedido, para modificar la cantidad consulte el apartado, articulos en pedido, muchas gracias.');
	}
}
function pedido_actualizar(linea)
{
	var cantidad=0;
	var opciones="";
	cantidad=document.getElementById(linea+'cantidad_pedido').value;
	if(cantidad==0)
	{
		alert('La cantidad siempre tiene que ser mayor que 0.');
		document.getElementById(linea+'cantidad_pedido').value=1;
	}
	else
	{
		opciones=devuelvesincrono('articulos_modificar.aspx?fila='+linea+'&cantidad='+cantidad+'');	
		if(opciones=="ok")
		{
			window.open('pedido.aspx','_self');	
		}
	}
}
function comprobar_correo()
{	
	var regla = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;	
	if ((document.getElementById('correo').value.match(regla)) && (document.getElementById('correo').value!='')) 
	{
		document.getElementById('correo').style.backgroundColor="#ffffff";
	}
	else
	{		
		document.getElementById('correo').value="";
		document.getElementById('correo').style.backgroundColor="#CCCCCC";
		document.getElementById('correo').focus();		
		alert('La dirección de correo es incorrecta.');		
	}
}
function comprobar_password()
{
	var c1="";
	var c2="";
	c1=	document.getElementById('password').value;
	c2=	document.getElementById('password2').value;		
	var tiene=1;
	var num=1;
	for(i=0;i<c1.length;i++)	
	{	
		if(c1.charAt(i)=="@" || c1.charAt(i)=="?" ||  c1.charAt(i)=="-" ||  c1.charAt(i)=="_" || c1.charAt(i)=="=" || c1.charAt(i)==" ")
		{
			tiene=0;
		}
	}
	if(tiene!=0)
	{
		if(c1!=c2)
		{
			alert('La contraseña y la confirmación de la contraseña no coinciden.')
			document.getElementById('password').value="";
			document.getElementById('password2').value="";		
			document.getElementById('password').style.backgroundColor="#CCCCCC";
			document.getElementById('password2').style.backgroundColor="#CCCCCC";
			document.getElementById('password').focus();
			num=0;
		}
		else
		{		
			for(i=0;i<c1.length;i++)	
			{					
				if (i>=5 && i<11) 
				{
					num=1;
				}
				else
				{
					num=0;
				}
			
			}
			if(num==0)
			{
				alert('Su contraseña debe tener entre 6 y 10 caracteres.');
				document.getElementById('password').value="";
				document.getElementById('password2').value="";		
				document.getElementById('password').style.backgroundColor="#CCCCCC";
				document.getElementById('password2').style.backgroundColor="#CCCCCC";
				document.getElementById('password').focus();

			}
			else
			{
				document.getElementById('password').style.backgroundColor="#ffffff";
				document.getElementById('password2').style.backgroundColor="#ffffff";
			}
		}
	}
	else
	{
		alert('Su contraseña contiene caracteres no permitidos.')
		document.getElementById('password').value="";
		document.getElementById('password2').value="";		
		document.getElementById('password').style.backgroundColor="#CCCCCC";
		document.getElementById('password2').style.backgroundColor="#CCCCCC";
		document.getElementById('password').focus();
	}
	if(num==1)
	{
	    var RegExPattern = /(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,12})$/;
    	if ((document.getElementById('password').value.match(RegExPattern)) && (document.getElementById('password').value!='')) 
		{
			
		}
		else
		{
			alert('Su contraseña debe contener números y letras.');
			document.getElementById('password').value="";
			document.getElementById('password2').value="";		
			document.getElementById('password').style.backgroundColor="#CCCCCC";
			document.getElementById('password2').style.backgroundColor="#CCCCCC";
			document.getElementById('password').focus();    
		} 
	}
}
function comprobar_cp()
{
	var cp=document.getElementById('cp').value;
	var numeros="0123456789";
	for(i=0; i<cp.length; i++)
	{
		if (numeros.indexOf(cp.charAt(i),0)!=-1)
		{
			document.getElementById('cp').style.backgroundColor="#FFFFFF";
		}		
		else
		{
			alert('Solo caracteres numericos');
			document.getElementById('cp').value="";
			document.getElementById('cp').style.backgroundColor="#CCCCCC";
			document.getElementById('cp').focus();
		}
	}
}
function comprobar_telefono()
{
	var telefono=document.getElementById('telefono').value;
	var numeros="0123456789";
	for(i=0; i<telefono.length; i++)
	{
		if (numeros.indexOf(telefono.charAt(i),0)!=-1)
		{
			document.getElementById('telefono').style.backgroundColor="#FFFFFF";
		}		
		else
		{
			alert('Solo caracteres numericos');
			document.getElementById('telefono').value="";
			document.getElementById('telefono').style.backgroundColor="#CCCCCC";
			document.getElementById('telefono').focus();
		}
	}
}
function comprobar_fax()

{
	var telefono=document.getElementById('fax').value;
	var numeros="0123456789";
	for(i=0; i<telefono.length; i++)
	{
		if (numeros.indexOf(telefono.charAt(i),0)!=-1)
		{
			document.getElementById('fax').style.backgroundColor="#FFFFFF";
		}		
		else
		{
			alert('Solo caracteres numericos');
			document.getElementById('fax').value="";
			document.getElementById('fax').style.backgroundColor="#CCCCCC";
			document.getElementById('fax').focus();
		}
	}
}
function grabar_cliente()
{
	var wcorreo="";
	var wclave="";
	var wnombre="";		
	var wdireccion="";
	var wpoblacion="";
	var wcp="";
	var wdni="";
	var wtelefono="";
	var comprobar_mail="";
	var wfax="";
	var wpersona="";
	var wentidad="";
	if(document.getElementById('entidad').value!="")
	{
		wentidad=document.getElementById('entidad').value;
	}

	if(document.getElementById('persona').value!="")
	{
		wpersona=document.getElementById('persona').value;
	}
	if(document.getElementById('correo').value!="")
	{
		wcorreo=document.getElementById('correo').value;
	}
	
	if(document.getElementById('password').value!="")
	{
		wclave=document.getElementById('password').value;
	}
	if(document.getElementById('nombre').value!="")
	{
		wnombre=document.getElementById('nombre').value;
		for(i=0;i<wnombre.length;i++)	
		{	
			wnombre=wnombre.replace("á","&aacute;");
			wnombre=wnombre.replace("Á","&Aacute;");
			wnombre=wnombre.replace("é","&eacute;");
			wnombre=wnombre.replace("É","&Eacute;");
			wnombre=wnombre.replace("í","&iacute;");
			wnombre=wnombre.replace("Í","&Iacute;");
			wnombre=wnombre.replace("ó","&oacute;");
			wnombre=wnombre.replace("Ó","&Oacute;");
			wnombre=wnombre.replace("ú","&uacute;");
			wnombre=wnombre.replace("Ú","&Uacute;");	
			wnombre=wnombre.replace("ñ","&ntilde;");
			wnombre=wnombre.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('direccion').value!="")
	{
		wdireccion=document.getElementById('direccion').value;
		for(i=0;i<wdireccion.length;i++)	
		{	
			wdireccion=wdireccion.replace("á","&aacute;");
			wdireccion=wdireccion.replace("Á","&Aacute;");
			wdireccion=wdireccion.replace("é","&eacute;");
			wdireccion=wdireccion.replace("É","&Eacute;");
			wdireccion=wdireccion.replace("í","&iacute;");
			wdireccion=wdireccion.replace("Í","&Iacute;");
			wdireccion=wdireccion.replace("ó","&oacute;");
			wdireccion=wdireccion.replace("Ó","&Oacute;");
			wdireccion=wdireccion.replace("ú","&uacute;");
			wdireccion=wdireccion.replace("Ú","&Uacute;");	
			wdireccion=wdireccion.replace("ñ","&ntilde;");
			wdireccion=wdireccion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('poblacion').value!="")
	{
		wpoblacion=document.getElementById('poblacion').value;
		for(i=0;i<wpoblacion.length;i++)	
		{	
			wpoblacion=wpoblacion.replace("á","&aacute;");
			wpoblacion=wpoblacion.replace("Á","&Aacute;");
			wpoblacion=wpoblacion.replace("é","&eacute;");
			wpoblacion=wpoblacion.replace("É","&Eacute;");
			wpoblacion=wpoblacion.replace("í","&iacute;");
			wpoblacion=wpoblacion.replace("Í","&Iacute;");
			wpoblacion=wpoblacion.replace("ó","&oacute;");
			wpoblacion=wpoblacion.replace("Ó","&Oacute;");
			wpoblacion=wpoblacion.replace("ú","&uacute;");
			wpoblacion=wpoblacion.replace("Ú","&Uacute;");	
			wpoblacion=wpoblacion.replace("ñ","&ntilde;");
			wpoblacion=wpoblacion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('cp').value!="")
	{
		wcp=document.getElementById('cp').value;
	}
	if(document.getElementById('dni').value!="")
	{
		wdni=document.getElementById('dni').value;
	}
	if(document.getElementById('telefono').value!="")
	{
		wtelefono=document.getElementById('telefono').value;
	}
	if(document.getElementById('fax').value!="")
	{
		wfax=document.getElementById('fax').value;
	}
	var wopcion_pago=0;    
	if(document.getElementById('opcion').value!="")
	{
		wopcion_pago=document.getElementById('opcion').value;
	}

	var mail="";
	var mail2="";
	var cantidad_pedido=0;
	var cliente="";
	var opciones="";

	if(wtelefono!="" && wcorreo!="" && wdni!="" && wdireccion!="" && wopcion_pago!="0" && wclave!="" && wnombre!="")
	{		
		cliente=devuelvesincrono('clientes_grabar.aspx?correo='+escape(wcorreo)+'&clave='+escape(wclave)+'&nombre='+escape(wnombre)+'&direccion='+escape(wdireccion)+'&poblacion='+escape(wpoblacion)+'&cp='+wcp+'&dni='+wdni+'&telefono='+wtelefono+'&opcion_pago='+wopcion_pago+'&fax='+wfax+'&persona='+wpersona+'');				
		if(cliente=="ko")
		{			
			alert('Imposible registrarse en www.ude.es, consulte con el administrador del portal');
		}
		else
		{
			alert('Gracias por registrarse en www.ude.es');						
			cantidad_pedido=devuelvesincrono('usuarios_encriptar.aspx?cod_cliente='+escape(cliente)+'');
			if(cantidad_pedido==0)
			{				
				window.open('articulos.aspx','_self');					
			}
			else
			{
				window.open('pedido.aspx','_self');					
			}			
		}		
	}
	else
	{
		alert('Por favor, rellene los campos obligatorios');
	}
}
function grabar_cliente2()
{
	var wcorreo="";
	var wclave="";
	var wnombre="";		
	var wdireccion="";
	var wpoblacion="";
	var wcp="";
	var wdni="";
	var wtelefono="";
	var comprobar_mail="";
	var wfax="";
	var wpersona="";
	var wentidad="";
	if(document.getElementById('entidad').value!="")
	{
		wentidad=document.getElementById('entidad').value;
	}

	if(document.getElementById('persona').value!="")
	{
		wpersona=document.getElementById('persona').value;
	}
	if(document.getElementById('correo').value!="")
	{
		wcorreo=document.getElementById('correo').value;
	}
	
	if(document.getElementById('password').value!="")
	{
		wclave=document.getElementById('password').value;
	}
	if(document.getElementById('nombre').value!="")
	{
		wnombre=document.getElementById('nombre').value;
		for(i=0;i<wnombre.length;i++)	
		{	
			wnombre=wnombre.replace("á","&aacute;");
			wnombre=wnombre.replace("Á","&Aacute;");
			wnombre=wnombre.replace("é","&eacute;");
			wnombre=wnombre.replace("É","&Eacute;");
			wnombre=wnombre.replace("í","&iacute;");
			wnombre=wnombre.replace("Í","&Iacute;");
			wnombre=wnombre.replace("ó","&oacute;");
			wnombre=wnombre.replace("Ó","&Oacute;");
			wnombre=wnombre.replace("ú","&uacute;");
			wnombre=wnombre.replace("Ú","&Uacute;");	
			wnombre=wnombre.replace("ñ","&ntilde;");
			wnombre=wnombre.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('direccion').value!="")
	{
		wdireccion=document.getElementById('direccion').value;
		for(i=0;i<wdireccion.length;i++)	
		{	
			wdireccion=wdireccion.replace("á","&aacute;");
			wdireccion=wdireccion.replace("Á","&Aacute;");
			wdireccion=wdireccion.replace("é","&eacute;");
			wdireccion=wdireccion.replace("É","&Eacute;");
			wdireccion=wdireccion.replace("í","&iacute;");
			wdireccion=wdireccion.replace("Í","&Iacute;");
			wdireccion=wdireccion.replace("ó","&oacute;");
			wdireccion=wdireccion.replace("Ó","&Oacute;");
			wdireccion=wdireccion.replace("ú","&uacute;");
			wdireccion=wdireccion.replace("Ú","&Uacute;");	
			wdireccion=wdireccion.replace("ñ","&ntilde;");
			wdireccion=wdireccion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('poblacion').value!="")
	{
		wpoblacion=document.getElementById('poblacion').value;
		for(i=0;i<wpoblacion.length;i++)	
		{	
			wpoblacion=wpoblacion.replace("á","&aacute;");
			wpoblacion=wpoblacion.replace("Á","&Aacute;");
			wpoblacion=wpoblacion.replace("é","&eacute;");
			wpoblacion=wpoblacion.replace("É","&Eacute;");
			wpoblacion=wpoblacion.replace("í","&iacute;");
			wpoblacion=wpoblacion.replace("Í","&Iacute;");
			wpoblacion=wpoblacion.replace("ó","&oacute;");
			wpoblacion=wpoblacion.replace("Ó","&Oacute;");
			wpoblacion=wpoblacion.replace("ú","&uacute;");
			wpoblacion=wpoblacion.replace("Ú","&Uacute;");	
			wpoblacion=wpoblacion.replace("ñ","&ntilde;");
			wpoblacion=wpoblacion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('cp').value!="")
	{
		wcp=document.getElementById('cp').value;
	}
	if(document.getElementById('dni').value!="")
	{
		wdni=document.getElementById('dni').value;
	}
	if(document.getElementById('telefono').value!="")
	{
		wtelefono=document.getElementById('telefono').value;
	}
	if(document.getElementById('fax').value!="")
	{
		wfax=document.getElementById('fax').value;
	}
	var wopcion_pago=0;    
	if(document.getElementById('opcion').value!="")
	{
		wopcion_pago=document.getElementById('opcion').value;
	}

	var mail="";
	var mail2="";
	var cantidad_pedido=0;
	var cliente="";
	var opciones="";

	if(wtelefono!="" && wcorreo!="" && wdni!="" && wdireccion!="" && wopcion_pago!="0" && wclave!="" && wnombre!="")
	{		
		open('clientes_grabar2.aspx?correo='+escape(wcorreo)+'&clave='+escape(wclave)+'&nombre='+escape(wnombre)+'&direccion='+escape(wdireccion)+'&poblacion='+escape(wpoblacion)+'&cp='+wcp+'&dni='+wdni+'&telefono='+wtelefono+'&opcion_pago='+wopcion_pago+'&fax='+wfax+'&persona='+wpersona+'','_self');						
	}
	else
	{
		alert('Por favor, rellene los campos obligatorios');
	}
}
function modificar_cliente()
{
	var wcorreo="";
	var wclave="";
	var wnombre="";		
	var wdireccion="";
	var wpoblacion="";
	var wcp="";
	var wdni="";
	var wtelefono="";
	var comprobar_mail="";
	var wfax="";
	var wpersona="";
	var wentidad="";
	var wcliente="";
	if(document.getElementById('cliente').value!="")
	{
		wcliente=document.getElementById('cliente').value;
	}
	if(document.getElementById('entidad').value!="")
	{
		wentidad=document.getElementById('entidad').value;
	}
	if(document.getElementById('persona').value!="")
	{
		wpersona=document.getElementById('persona').value;
	}
	if(document.getElementById('correo').value!="")
	{
		wcorreo=document.getElementById('correo').value;
	}
	
	if(document.getElementById('password').value!="")
	{
		wclave=document.getElementById('password').value;
	}
	if(document.getElementById('nombre').value!="")
	{
		wnombre=document.getElementById('nombre').value;
		for(i=0;i<wnombre.length;i++)	
		{	
			wnombre=wnombre.replace("á","&aacute;");
			wnombre=wnombre.replace("Á","&Aacute;");
			wnombre=wnombre.replace("é","&eacute;");
			wnombre=wnombre.replace("É","&Eacute;");
			wnombre=wnombre.replace("í","&iacute;");
			wnombre=wnombre.replace("Í","&Iacute;");
			wnombre=wnombre.replace("ó","&oacute;");
			wnombre=wnombre.replace("Ó","&Oacute;");
			wnombre=wnombre.replace("ú","&uacute;");
			wnombre=wnombre.replace("Ú","&Uacute;");	
			wnombre=wnombre.replace("ñ","&ntilde;");
			wnombre=wnombre.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('direccion').value!="")
	{
		wdireccion=document.getElementById('direccion').value;
		for(i=0;i<wdireccion.length;i++)	
		{	
			wdireccion=wdireccion.replace("á","&aacute;");
			wdireccion=wdireccion.replace("Á","&Aacute;");
			wdireccion=wdireccion.replace("é","&eacute;");
			wdireccion=wdireccion.replace("É","&Eacute;");
			wdireccion=wdireccion.replace("í","&iacute;");
			wdireccion=wdireccion.replace("Í","&Iacute;");
			wdireccion=wdireccion.replace("ó","&oacute;");
			wdireccion=wdireccion.replace("Ó","&Oacute;");
			wdireccion=wdireccion.replace("ú","&uacute;");
			wdireccion=wdireccion.replace("Ú","&Uacute;");	
			wdireccion=wdireccion.replace("ñ","&ntilde;");
			wdireccion=wdireccion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('poblacion').value!="")
	{
		wpoblacion=document.getElementById('poblacion').value;
		for(i=0;i<wpoblacion.length;i++)	
		{	
			wpoblacion=wpoblacion.replace("á","&aacute;");
			wpoblacion=wpoblacion.replace("Á","&Aacute;");
			wpoblacion=wpoblacion.replace("é","&eacute;");
			wpoblacion=wpoblacion.replace("É","&Eacute;");
			wpoblacion=wpoblacion.replace("í","&iacute;");
			wpoblacion=wpoblacion.replace("Í","&Iacute;");
			wpoblacion=wpoblacion.replace("ó","&oacute;");
			wpoblacion=wpoblacion.replace("Ó","&Oacute;");
			wpoblacion=wpoblacion.replace("ú","&uacute;");
			wpoblacion=wpoblacion.replace("Ú","&Uacute;");	
			wpoblacion=wpoblacion.replace("ñ","&ntilde;");
			wpoblacion=wpoblacion.replace("Ñ","&Ntilde;");
		}
	}
	if(document.getElementById('cp').value!="")
	{
		wcp=document.getElementById('cp').value;
	}
	if(document.getElementById('dni').value!="")
	{
		wdni=document.getElementById('dni').value;
	}
	if(document.getElementById('telefono').value!="")
	{
		wtelefono=document.getElementById('telefono').value;
	}
	if(document.getElementById('fax').value!="")
	{
		wfax=document.getElementById('fax').value;
	}
	var wopcion_pago=0;    
	if(document.getElementById('opcion').value!="")
	{
		wopcion_pago=document.getElementById('opcion').value;
	}
	var opciones="";
	if(wtelefono!="" && wcorreo!="" && wdni!="" && wdireccion!="" && wopcion_pago!="0" && wclave!="" && wnombre!="")
	{		
		opciones=devuelvesincrono('clientes_modificar.aspx?cliente='+wcliente+'&correo='+escape(wcorreo)+'&clave='+escape(wclave)+'&nombre='+escape(wnombre)+'&direccion='+escape(wdireccion)+'&poblacion='+escape(wpoblacion)+'&cp='+wcp+'&dni='+wdni+'&telefono='+wtelefono+'&opcion_pago='+wopcion_pago+'&fax='+wfax+'&persona='+wpersona+'');				
		if(opciones=="ok")
		{
			alert('Datos modificados correctamente');						
			window.open('index.aspx','_self');					
		}
		else
		{
			alert(opciones);
		}		
	}
	else
	{
		alert('Por favor, rellene los campos obligatorios');
	}
}
function recuperar_clave(opcion)
{
	var opciones="";
	var dato="";
	if(opcion==1)
	{
		if(document.getElementById('correo').value!="")
		{
			dato=document.getElementById('correo').value;
			opciones=devuelvesincrono('clientes_recuperar.aspx?correo='+escape(dato)+'');
			alert(opciones);
		}
		else
		{
			alert('Rellene el campo correo para poder enviar su contraseña');	
		}
	}
	if(opcion==2)
	{
		if(document.getElementById('nif').value!="")
		{
			dato=document.getElementById('nif').value;
			opciones=devuelvesincrono('clientes_recuperar.aspx?nif='+escape(dato)+'');
			alert(opciones);
		}
		else
		{
			alert('Rellene el campo nif para poder enviar su contraseña');	
		}
	}
}
function formaspago(dato)
{
	document.getElementById('opcion').value=dato;
}
function enviar_contacte()
{
	var nombre="";
	var apellidos="";
	var direccion="";
	var cp="";
	var telefono="";
	var fax="";
	var mail="";
	var consulta="";
	var opciones="";
	
	if(document.getElementById('nombre').value!="")
	{
		nombre=document.getElementById('nombre').value;
	}
	if(document.getElementById('apellidos').value!="")
	{
		apellidos=document.getElementById('apellidos').value;
	}
	if(document.getElementById('direccion').value!="")
	{
		direccion=document.getElementById('direccion').value;
	}
	if(document.getElementById('cp').value!="")
	{
		cp=document.getElementById('cp').value;
	}
	if(document.getElementById('telefono').value!="")
	{
		telefono=document.getElementById('telefono').value;
	}
	if(document.getElementById('fax').value!="")
	{
		fax=document.getElementById('fax').value;
	}
	if(document.getElementById('mail').value!="")
	{
		mail=document.getElementById('mail').value;
	}
	if(document.getElementById('consulta').value!="")
	{
		consulta=document.getElementById('consulta').value;
	}
	opciones=devuelvesincrono('enviar_contacte.aspx?nombre='+escape(nombre)+'&apellidos='+escape(apellidos)+'&direccion='+escape(direccion)+'&cp='+escape(cp)+'&telefono='+escape(telefono)+'&fax='+escape(fax)+'&mail='+escape(mail)+'&consulta='+escape(consulta)+'');
	if(opciones=="ok")
	{
		alert("Envio correcto, gracias por ponerse en contacto con nosotros");
	}
	else
	{	
		alert(opciones);
	}	
}
function enviar_sugerencias()
{
	var nombre="";
	var telefono="";
	var mail="";
	var consulta="";
	var opciones="";
	
	if(document.getElementById('nombre').value!="")
	{
		nombre=document.getElementById('nombre').value;
	}	
	if(document.getElementById('telefono').value!="")
	{
		telefono=document.getElementById('telefono').value;
	}	
	if(document.getElementById('mail').value!="")
	{
		mail=document.getElementById('mail').value;
	}
	if(document.getElementById('consulta').value!="")
	{
		consulta=document.getElementById('consulta').value;
	}
	opciones=devuelvesincrono('enviar_sugerencias.aspx?nombre='+escape(nombre)+'&telefono='+escape(telefono)+'&mail='+escape(mail)+'&consulta='+escape(consulta)+'');
	if(opciones=="ok")
	{
		alert("Envio correcto, gracias por enviar su sugerencias");
	}
	else
	{	
		alert(opciones);
	}	
}
function calc() 
{                                        
	document.forms[0].submit();
	open('','_parent','width=725,height=600,scrollbars=no,resizable=no,status=yes,menubar=no,location=no');	       	                   
} 
