//---------------------
var red = true

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function mostrarMenu(menu){
	for(j= 1; j <= 9; j++)
		MM_showHideLayers('menu'+j,'','hide');
		MM_showHideLayers('menu'+menu,'','show')
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v=='hide')?'none':v; }
    obj.display=v; }
}

//---------------- DIFUNINAR IMAGEN -----------------------------------
function difuminar(img,flag){
 if (flag==0) img.filters.alpha.opacity=100
 else img.filters.alpha.opacity=50 
 }


// ----------- reemplazar texto
	function reemplazar(texto, esto, por_esto){
		return texto.replace(esto,por_esto);
	}

//------------------- eliminamos caracteres no deseados 
function validar(cadena) 
	{
		cambia=document.FormInvitacion[cadena].value
		h=cambia.length
		for (i=0;i<h;i++){ 
			cambia=cambia.replace("'",".")
			cambia=cambia.replace('"','.')
		} 

		document.FormInvitacion[cadena].value=cambia;
	}
function validar1(cadena) 
	{
		cambia=document.FormContacto[cadena].value
		h=cambia.length
		for (i=0;i<h;i++){ 
			cambia=cambia.replace("'",".")
			cambia=cambia.replace('"','.')
		} 

		document.FormContacto[cadena].value=cambia;
	}

//--------------------------------------------------------


//--------------------------------------------------------
function Login () {
	var errorMsg = "";
	var errorMsgLong = "";

	if (document.FormLogin.user.value == ""){
		errorMsg += "\n\t- Indicar el usurio";
	}

	if (document.FormLogin.pass.value == ""){
		errorMsg += "\n\t- Indicar la contraseņa de entrada";
	}

	if (errorMsg != ""){
		MuestraError(errorMsg)
		return false;
	}
	
	return true;
}

function Recordar () {
	var errorMsg = "";
	var errorMsgLong = "";

 	var direccionEmail = document.FormRecordar.email.value
	if (((direccionEmail=="") || (direccionEmail.indexOf(".")==-1)) || (direccionEmail.indexOf("@")==-1))  {
		errorMsg += "\n\t- Debe de indiar un email correcto";
	}

	if (errorMsg != ""){
		MuestraError(errorMsg)
		return false;
	}
	
	return true;
}

//--------------------------------------------------------
function Contacto () {
	var errorMsg = "";
	var errorMsgLong = "";

	validar1('nombre')
	if (document.FormContacto.nombre.value == ""){
		errorMsg += "\n\t- Debe de indicar su nombre";
	}

	validar1('direccion')
	if (document.FormContacto.direccion.value == ""){
		errorMsg += "\n\t- Debe de indicar su direccion";
	}

	validar1('poblacion')
	if (document.FormContacto.poblacion.value == ""){
		errorMsg += "\n\t- Debe de indicar su poblacion";
	}

	validar1('telefono')
	if (document.FormContacto.telefono.value == ""){
		errorMsg += "\n\t- Debe de indicar su telefono movil";
	}

 	var direccionEmail = document.FormContacto.email.value
	if (((direccionEmail=="") || (direccionEmail.indexOf(".")==-1)) || (direccionEmail.indexOf("@")==-1))  {
		errorMsg += "\n\t- Debe de indiar un email correcto";
	}

	validar1('interes')
	if (document.FormContacto.interes.value == ""){
		errorMsg += "\n\t- Debe de indicar su interes";
	}


	if (errorMsg != ""){
		MuestraError(errorMsg)
		return false;
	}
	
	return true;
}

// --------------------- mensajes de error
function MuestraError (errorMsg){

	msg =  "_________________________________________________\n\n";
	msg += "\t Existen datos obligatorios.Por\n";
	msg += "\t favor corrige el problema.\n";
	msg += "__________________________________________________\n\n";
	msg += "El siguientes campos deben ser corregidos: -\n";
		
	errorMsg += alert(msg + errorMsg + "\n" );
}

//------------------- aumentar y desminuir letras (accesibilidad )
var tamanoLetrapordefecto = 5;
var tamanoLetra = tamanoLetrapordefecto;
var tamanoLetraminimo = 3;
var tamanoLetramaximo = 7;
var identidadLetra;

function aumentaLetra() {
    if (tamanoLetra < tamanoLetramaximo) {
    tamanoLetra += 1;
    identidadLetra = document.getElementById('tamano');
    identidadLetra.className = 'tamanoletra' + tamanoLetra;
    }
}

function disminuyeLetra() {
    if (tamanoLetra > tamanoLetraminimo) {
    tamanoLetra -= 1;
    identidadLetra = document.getElementById('tamano');
    identidadLetra.className = 'tamanoletra' + tamanoLetra;
    }
}

function imprimir() {
    window.print();
}

// ----------- procesos de cesta ---------------------------

function amuestra(){
	url="/validacion.asp?tipo=muestra&rrn="+Math.random()
	llamarasincrono(url,'caja_validacion')
}
function avalidacion(){

	var errorMsg = "";
	var errorMsgLong = "";

 	var direccionEmail = document.validacion.user.value
	if (((direccionEmail=="") || (direccionEmail.indexOf(".")==-1)) || (direccionEmail.indexOf("@")==-1))  {
		errorMsg += "\n\t- Debe de indiar un email correcto";
	}
	if (document.validacion.pass.value == ""){
		errorMsg += "\n\t- Debe de indicar su password";
	}
	if (errorMsg != ""){
		MuestraError(errorMsg)
		return false;
	}
	url="/validacion.asp?tipo=valida&user="+document.validacion.user.value+"&pass="+document.validacion.pass.value+"&rrn="+Math.random()
	llamarasincrono(url,'caja_validacion')

}
function acerrar(){
	url="/validacion.asp?tipo=cerrar&rrn="+Math.random()
	llamarasincrono(url,'caja_validacion')
}
function arecuerda(){
	url="/validacion.asp?tipo=recuerda&rrn="+Math.random()
	llamarasincrono(url,'caja_validacion')
}
function arecuerdauser(){
	var errorMsg = "";
	var errorMsgLong = "";

 	var direccionEmail = document.validacion.user.value
	if (((direccionEmail=="") || (direccionEmail.indexOf(".")==-1)) || (direccionEmail.indexOf("@")==-1))  {
		errorMsg += "\n\t- Debe de indiar un email correcto";
	}
	if (errorMsg != ""){
		MuestraError(errorMsg)
		return false;
	}
	alert('alaaaaaa')
	url="/validacion.asp?tipo=recuerda&user="+document.validacion.user.value+"&rrn="+Math.random()
	llamarasincrono(url,'caja_validacion')
}

function validarDatosClient(){

	if (document.DatosClient.pass.value != document.DatosClient.pass1.value){
		errorMsg += "\n\t- Revise la contraseņa";
	}

	if (document.DatosClient.nombre.value == ""){
		errorMsg += "\n\t- Debe de indicar su nombre";
	}

	if (document.DatosClient.apellidos.value == ""){
		errorMsg += "\n\t- Debe de indicar sus apellidos";
	}

	if (document.DatosClient.direccion1.value == ""){
		errorMsg += "\n\t- Debe de indicar la direccion";
	}

	if (document.DatosClient.NIF.value == ""){
		errorMsg += "\n\t- Debe de indicar su NIF o CIF";
	}

	if (document.DatosClient.cp.value == ""){
		errorMsg += "\n\t- Debe de indicar su Codico Postal";
	}

	if (document.DatosClient.ciudad.value == ""){
		errorMsg += "\n\t- Debe de indicar su Ciudad";
	}

	if (document.DatosClient.provincia.value == ""){
		errorMsg += "\n\t- Debe de indicar su Provincia";
	}

	if (document.DatosClient.pais.value == ""){
		errorMsg += "\n\t- Debe de indicar su pais";
	}

	if (document.DatosClient.telefono.value == ""){
		errorMsg += "\n\t- Debe de indicar su telefono";
	}




			pass=Request.form("pass")
			trata=Request.form("trata")
			nombre=Request.form("nombre")
			apellidos=Request.form("apellidos")
			direccion1=Request.form("direccion1")
			direccion2=Request.form("direccion2")
			direccion3=Request.form("direccion3")
			NIF=Request.form("NIF")
			cp=Request.form("cp")
			ciudad=Request.form("ciudad")
			provincia=Request.form("provincia")
			pais=Request.form("pais")
			Telefono=Request.form("Telefono")
			SMS=Request.form("SMS")
			situacion=Request.form("situacion")
			dia=Request.form("dia")
			mes=Request.form("mes")
			any=Request.form("any")
			FormaPago=Request.form("FormaPago")



}

