// JavaScript Document
function borrar(){
	document.getElementById('formulario').nombre.value = '';
	document.getElementById('formulario').apellido.value = '';
	document.getElementById('formulario').telefono.value = '';
	document.getElementById('formulario').email.value = '';
	document.getElementById('formulario').mensaje.value = '';
}
function enviar(){
	document.formulario.submit();
}
function enviarSubs(){
	document.formsubs.submit();
}
function toClosePopin(){
     

	if ( document.getElementById("popupdivexterno")){
		document.getElementById("popupdivexterno").style.visibility="hidden";
	}

	if ( document.getElementById("subspopup")){
		document.getElementById("subspopup").style.visibility="hidden";
	}

}
function subsOk(){
	//document.getElementById("subscribeEmail").value = "Gracias por suscribirse";
	document.getElementById("subscribeEmail").value = "";
	//window.open('..\subscriptionOK.html', 'subscription ok', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=455,height=155');
	if ( document.getElementById("popupdivexterno")){
		document.getElementById("popupdivexterno").style.visibility="visible";
	}
	
	if ( document.getElementById("subspopup")){
		document.getElementById("subspopup").style.visibility="visible";
	}


}



function toClosePopin2(){
     document.getElementById("popupdivexterno2").style.visibility="hidden";
}
function subsOk2(){
	document.getElementById("popupdivexterno2").style.visibility="visible";
}


function EraseSubCamp(){
	document.getElementById("subscribeEmail").value = "";
	/*if(document.getElementById("subscribeEmail").value == "Gracias por suscribirse"){
		document.getElementById("subscribeEmail").value = "";
	}*/

}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe ingresar una direccion de E-mail valida.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' debe contener un numero.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es necesario.\n'; }
    } if (errors) alert('Error:\n'+errors);
    document.MM_returnValue = (errors == '');
} }


function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} 
}
