

function mostrarPrecios(tipo,id){
	emailwindow=dhtmlmodal.open('PreciosyHorarios', 'iframe', 'http://www.clubdeamigos.org.ar/general/precios-horarios.asp?tipo='+tipo+'&id='+id, 'Precios y Horarios', 'width=744px,height=473px,center=1,resize=0,scrolling=1')

}

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) { //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 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];
	//alert(a[i+2]);
   }
}

function OpenWindow(url,name,values)
{
	window.open(url,name,values);
}

function setCookie(name, value, expires, path, domain, secure)
{
  var curCookie = name + "=" + escape(value) +
	  ((expires) ? "; expires=" + expires.toGMTString() : "") +
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain=" + domain : "") +
	  ((secure) ? "; secure" : "");
  document.cookie = curCookie;
  
}


function getCookie(c_name)
{
	if (document.cookie.length>0)
	  {
		  c_start=document.cookie.indexOf(c_name + "=")
		  if (c_start!=-1)
			{ 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	  }
	return null
}
		
function onloadMenu()
{	
	
	//id = getCookie('seccion')
	//if ( id != null)
	//{
	//	v(id);
	//}
}

function v(id) //v: visualizar
{
	var now = new Date();
	now.setTime(now.getTime() + 2 * 24 * 60 * 60 * 1000);
	//setCookie('seccion',id,now);
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

function o(id,estado,colorbg,hijos) //o: over
{
	if (estado == 1) {
		document.getElementById(id).style.background = colorbg;
		
	} else {
		document.getElementById(id).style.background = '';
		
	}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function postearform () 
{
	var txterror=''
	var error = false; 
	
	if ( document.formContactenos.nombre.value.length == 0 ) 	{error=true; txterror= txterror + 'Debe completar el campo Nombre; \n \n'};
		
	if ( !IsNumeric(document.formContactenos.telefono.value) ) 		{error=true; txterror= txterror + 'Debe completar el campo Teléfono o ingresar caracteres válidos;\n \n'};
	
	if (document.formContactenos.email.value.match("@") == null) 		{error=true; txterror= txterror + 'Debe completar el campo Email o ingresar un Email válido; \n \n'};

	if (document.formContactenos.mensaje.value.length == 0) 		{error=true; txterror= txterror + 'Debe escribir un mensaje; \n \n'};

	if (error == true) 
		{
			var mensaje
			mensaje = 'Se produjeron los siguientes errores: \n \n' + txterror;
			alert(mensaje);
		}
	else
		{
			document.formContactenos.submit();
		}
}
function postearformnewsletter () 
{
	var txterror=''
	var error = false; 
	
	if (document.formContactenos.nombre.value.length == 0 ) 	{error=true; txterror= txterror + 'Debe completar el campo Nombre; \n \n'};	
	if (document.formContactenos.email.value.length == 0) 		{error=true; txterror= txterror + 'Debe completar el campo Email; \n \n'};
	if (error == true) 
		{
			var mensaje
			mensaje = 'Se produjeron los siguientes errores: \n \n' + txterror;
			alert(mensaje);
		}
	else
		{
			document.formContactenos.submit();
		}
}

function postearformprueba () 
{
	var txterror=''
	var error = false; 
	var strValidCharsN = "0123456789";
	var strValidCharsT = "qwertyuiopasdfghjklkñzxcvbnm";
	var strChar;
	var TieneNumero=false;
	var TieneTexto=false;	
	
	if ( document.formContactenos.nombre.value.length == 0 ) 	{error=true; txterror= txterror + 'Debe completar el campo Nombre; \n \n'};
	
 	if ( document.formContactenos.telefono.value.length == 0 ) 		{error=true; txterror= txterror + 'Debe completar el campo Teléfono;\n \n'};
	
	if (document.formContactenos.email.value.length == 0) 		{error=true; txterror= txterror + 'Debe completar el campo Email; \n \n'};

	if (error == true) 
		{
			var mensaje
			mensaje = 'Se produjeron los siguientes errores: \n \n' + txterror;
			alert(mensaje);
		}
	else
		{
			document.formContactenos.submit();
		}
}

function postearformregistro ()
{
	var txterror=''
	var error = false; 
	var strValidCharsN = "0123456789";
	var strValidCharsT = "qwertyuiopasdfghjklkñzxcvbnm";
	var strChar;
	var TieneNumero=false;
	var TieneTexto=false;
	
	document.formContactenos.sinerror.value=='false';	
	if ( document.formContactenos.p1.value.length == 0 || document.formContactenos.p2.value.length == 0 || document.formContactenos.p3.value.length == 0 || document.formContactenos.p4.value.length == 0 || document.formContactenos.p5.value.length == 0) 		
		{error=true; txterror= txterror + '    Debe completar el campo Nro. de Pasaporte. \n \n'};

	if ( document.formContactenos.nombre.value.length == 0 ) 	{error=true; txterror= txterror + '    Debe completar el campo Nombre. \n \n'};
	
	if ( document.formContactenos.apellido.value.length == 0 ) {error=true; txterror= txterror + '    Debe completar el campo Apellido. \n \n'};

	//if ( document.formContactenos.dni.value == 0 ) 			{error=true; txterror= txterror + ' Debe completar el campo DNI; \n \n'};
	
	if (document.formContactenos.email.value.match("@") == null) 		{error=true; txterror= txterror + '    Debe completar el campo Email o ingresar un Email válido. \n \n'};

	if (document.formContactenos.usuario.value.length == 0) 		{error=true; txterror= txterror + '    Debe escribir un mensaje. \n \n'};

	if (document.formContactenos.email.value.match("@") == null) 		{error=true; txterror= txterror + '    Debe completar el campo usuario. \n \n'};	

	strString=document.formContactenos.contrasena.value;
		for (i = 0; i < strString.length; i++)
		{
		  strChar = strString.charAt(i);
		  if (strValidCharsT.indexOf(strChar) == -1)
			 {
				TieneNumero=true;
			 }
		   if (strValidCharsN.indexOf(strChar) == -1)
			 {
				TieneTexto=true;
			 }	 
		}
		if (TieneNumero==false || TieneTexto==false)
		{
			txterror = txterror + '    La contraseña debe ser alfanúmerica.\n\n';
			error=true;
		}
			
		if (document.formContactenos.contrasena.value != '' && document.formContactenos.contrasena2.value != ''){
			if ((document.formContactenos.contrasena.value) == (document.formContactenos.contrasena2.value)){
				if (document.formContactenos.contrasena.value.length < 8){
					txterror = txterror + '    La contraseña debe contener al menos 8 caracteres.\n\n';
					error=true;
				}
			}else{
				txterror = txterror + '    La contraseña y la repetición de la contraseña deben ser iguales.\n\n';
				error=true;
			}
		}else{
			txterror = txterror + '    La contraseña debe contener al menos 8 caracteres. \n\n';
			error=true;
		}	
	
		if (error == true) 
			{
				var mensaje
				mensaje = 'Se produjo el siguiente error: \n \n' + txterror;
				alert(mensaje);
			}
		else
			{
				pasaporte=document.formContactenos.p1.value+'-'+document.formContactenos.p2.value+'-'+document.formContactenos.p3.value+'-'+document.formContactenos.p4.value+'-'+document.formContactenos.p5.value+'-'+document.formContactenos.p6.value;
				//alert(pasaporte);
				document.formContactenos.pasaporte.value=pasaporte;
				document.formContactenos.sinerror.value='true';
				document.formContactenos.submit();
			}
}

function postearformolvide () 
{
	var txterror=''
	var error = false; 
	document.formContactenos.sinerror.value=='false';	

	if (document.formContactenos.email.value.match("@") == null) 		{error=true; txterror= txterror + '   Debe completar el campo Email o ingresar un Email válido. \n \n'};

	if (error == true) 
		{
			var mensaje
			mensaje = 'Se produjo el siguiente error: \n \n' + txterror;
			alert(mensaje);
		}
	else
		{
			document.formContactenos.sinerror.value='true';
			document.formContactenos.submit();
		}
}

function validar () {
	document.getElementById('tabla_registro').style.display='none';
	document.getElementById('tabla_confirm').style.display='inline';
}

function isEMailAddr(elem) {

	var str = elem;
	var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
	if (!str.match(re)) {
		return false;
	} else {
		return true;
	}

function validarvisita() {
	var msg="";
	var error = false;

	if (document.form1.txtNombre.value=="") {
		msg = "Por favor, ingresá tu Nombre\n"
		error = true;
	}
	if (document.form1.txtApellido.value=="") {
		msg += "Por favor, ingresá tu Apellido\n"
		error = true;
	}
	if (document.form1.txtEmail.value!="") {
		if (isEMailAddr(document.form1.txtEmail.value)==false) {
			msg += "El e-mail ingresado es inválido. Por favor revisalo y volvé a intentar.\n"
			error = true
		}
	}
	else
	{
		msg += "Por favor, ingresá tu e-mail\n"
		error = true
	}


	if (!error) {
		window.alert('esta ok');
		//document.form1.action='enviovisita.asp';
		//document.form1.submit();	
	}
	else {
		window.alert(msg);
	}
}

}
