/* Macromedia functions */

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];}
}

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;
}

/* End Macromedia functions */

/* Functions to define styelsheets according to browser */
/* developed by oscarbernal.com */

/* variables */

var ie =  ((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=4));
var ns = ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)>=4));
var n6 = ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==5));

// Function for client form

     
//-->

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
	

	
// validate flash and browser for transparency

function writeflash(){

var writens = '\n'+
	'<img src="images/menu_home.gif" width="208" height="233" border="0" usemap="#menu">'+'\n'

var writeie = '\n'+
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="208" height="233">'+'/n'+
		'<param name=movie value="anim/menu.swf">'+'/n'+
		'<param name=quality value=high>'+'/n'+
		'<param name="WMODE" value="transparent">'+'/n'+
		'</object>';

document.writeln('<div id="menu">');
	if ((ie)){
	document.writeln(writeie);
	}
	if ((ns)) {
	document.writeln(writens);
	}
	
document.writeln('</div>');
}

// function for flash home menu
function go(URL){

	if (URL == 'company'){
	document.location = "html/company/index.php?vin=";
	}
	if (URL == 'solutions'){
	document.location = "html/solutions/index.php?vin=";
	}
	if (URL == 'portfolio'){
	document.location = "html/portfolio/index.php?vin=";
	}
	if (URL == 'products'){
	document.location = "html/products/index.php?vin=";
	}
}

// function for clients form

function processCli(theForm){
	if (theForm.user.value == ""){
	   alert ("An user is required!!!");
	   return false;
	}  
	if (theForm.password.value == ""){
	   alert ("A Password is required!!!");
	   return false;
	}  
}

//funciones para abrir pops

function openQuote(URL){
	var quote;
	quote = window.open(URL, "packs", "width=450,height=500,scrollbars=yes,top=10,left=20,status=yes,directories=no,menubars=no");
	quote.focus();
}

function openSales(URL){
	var quote;
	quote = window.open(URL, "packs", "width=400,height=400,scrollbars=yes,top=10,left=20,status=yes,directories=no,menubars=no");
	quote.focus();
}

function openCup(URL){
	var quote;
	quote = window.open(URL, "packs", "width=435,height=320,scrollbars=yes,top=10,left=20,status=yes,directories=no,menubars=no");
	quote.focus();
}

function openWindow(URL, xHeight, xWidth, xLeft, xTop, xScroll, xBar){
	var xWindow;
	xWindow = window.open(URL, "packs", "width="+xWidth+",height="+xHeight+",scrollbars="+xScroll+",top="+xTop+",left="+xLeft+",status="+xBar+",directories=no,menubars=no,maximize=false");
	xWindow.focus();
}

function openReports(URL){
	var reports;
	var xHeight = screen.availHeight - 40;
	var xWidth = screen.availWidth - 30;
	reports = window.open(URL, "reports", "width="+xWidth+",height="+xHeight+",scrollbars=yes,top=10,left=20,status=no,directories=no,menubars=no,maximize=false");
	reports.focus();
}

function trim(str) {
  str = str.replace (/\s/g, "");
  return str; 
}

function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.tv)|(\.ec)|(\..{2,2}))$)\b/gi);

if (goodEmail){
   return (true);
} else {
   return (false);
   }
}

function sAll() {
     xForm = document.survey;
	for (var i=0; i<xForm.elements.length; i++){
		var e = xForm.elements[i];
		if ((e.type == 'checkbox') && (e.disabled == 0)){
		  if (e.checked == 0){
			e.checked = 1;	
		  } else {
			e.checked = 0;
		  }	
		}
	}
}

function selectCasillero() {
    var xForm = document.frmreferencia;
	for (var i=0; i<xForm.elements.length; i++){
		var e = xForm.elements[i];
		if (e.type == 'checkbox'){
		  if (e.checked == 0){
			e.checked = 1;	
		  } else {
			e.checked = 0;
		  }	
		}
	}
}

function valSurveyHobbies(xForm){
	var contObj = 0;
	xForm.hidObjetos.value = "";
	xForm.hidHobbies.value = "";
	for (var i=1; i<xForm.chkHobbies.length + 1; i++){
		var e = xForm.chkHobbies[i-1];
		if (e.checked){
			xForm.hidHobbies.value += i + ";";
			contObj++;
		}
	}
	
	if (contObj > 0) {
	  contObj = 1;
	}  
	
	xForm.hidObjetos.value = contObj;	
}

function valSurveyHabits(xForm){
  var contObj = 0;
  /*Val Acceso Internet */
  if (xForm.cmbBoolean1.options[xForm.cmbBoolean1.selectedIndex].value == "1"){
	xForm.hidInternet.value = "";
	for (var i=1; i<xForm.chkInternet.length + 1; i++){
		var e = xForm.chkInternet[i-1];
		if (e.checked){
			xForm.hidInternet.value += i + ";";
			contObj++;
		}
	}
	if (contObj == 0) {
	  alert ("Seleccione como accesa a la Web");
	  return false;
	}  
  } //End Acceso internet
  var contObj = 0;
  /*Val Tipo de Tarjeta de Crédito*/
  if (xForm.cmbBoolean4.options[xForm.cmbBoolean4.selectedIndex].value == "1"){
	xForm.hidCCType.value = "";
	for (var i=1; i<xForm.chkCCType.length + 1; i++){
		var e = xForm.chkCCType[i-1];
		if (e.checked){
			xForm.hidCCType.value += i + ";";
			contObj++;
		}
	}
	if (contObj == 0) {
	  alert ("Seleccione los tipos de Tarjeta de Créditos que posee");	
	  return false;
	}  
  } //End Tipo de Tarjeta de Crédito
  var contObj = 0;
  /*Val Suscripciones a Revistas o Catálogos*/
  if (xForm.cmbBoolean6.options[xForm.cmbBoolean6.selectedIndex].value == "1"){
	xForm.hidMagType.value = "";
	for (var i=1; i<xForm.chkMagazines.length + 1; i++){
		var e = xForm.chkMagazines[i-1];
		if (e.checked){
			xForm.hidMagType.value += i + ";";
			contObj++;
		}
	}
	if (contObj == 0) {
	  alert ("Seleccione el tipo de Suscripcione que le gusaria recibir");
	  return false;
	}  
  } //End Tipo de Tarjeta de Crédito

}
function validateEmail(accountemail){
  var valor =0;	
  if (trim(accountemail)==""){
     return valor =1;
  }
  var val = accountemail;
  var p= val.indexOf('@');
  if (p<1 || p==(val.length-1)) {
	 return valor=2;
  }
  return valor;
}

function valSurveyUser(xForm){
  if (trim(xForm.nick.value)==""){
     alert ("Por favor, su Alias es requerido");
     xForm.nick.value = "";
	 xForm.nick.focus();
     return false
  }
  if (trim(xForm.email.value)==""){
     alert ("Por favor, su E-Mail es requerido");
     xForm.email.value = "";
	 xForm.email.focus();
     return false
  }
  var val = xForm.email.value;
  var p= val.indexOf('@');
  if (p<1 || p==(val.length-1)) {
	 alert(xForm.email.value + " no es un E-Mail válido");
	 xForm.email.select();	 
	 return false;
  }
  if (trim(xForm.password.value)==""){
     alert ("Por favor, su Clave es requerida");
     xForm.password.value = "";
	 xForm.password.focus();
     return false
  }
  if (trim(xForm.password.value)!=trim(xForm.password2.value)){
     alert ("Por favor, su Clave y Confirmación deben ser iguales");
	 xForm.password.focus();
     return false
  }
  if (trim(xForm.name.value)==""){
     alert ("Por favor, su Nombre es requerido");
     xForm.name.value = "";
	 xForm.name.focus();
     return false
  }
  if (!validateDate(xForm.dob.value)) {
	 alert("Error en Fecha");
	 xForm.dob.focus();
	 return false;
  }   
}

function cerrarWindow(){
  window.close();
}

function focusWin( pageToLoad, winName ) {                              
    window.open( pageToLoad, winName );
	window.blur();
}

function validateDate(strDate) {
	if (strDate.length != 10) return false;
	if (isNaN(Date.parse(strDate))) return false;
	if (Date.parse(strDate) < 0) return false;
	var strMonth = strDate.substr(0,2);
	var strDay = strDate.substr(3,2);
	var strYear = strDate.substr(6,4);
	if (isNaN(strMonth)) return false;
	if (isNaN(strDay)) return false;
	if (strYear > 2060) return false;
	if (isNaN(strYear)) return false;
	if (strMonth < 1 || strMonth > 12) return false;
	if (strDay < 1 || strDay > 31) return false;
	return true;
}

function openTracking(){
window.open ("external.html");
}

/* Macromedia functions */

function openPack(URL){
	var pack;
	pack = window.open(URL, "packs", "width=455,height=445,scrollbars=yes,top=10,left=20,status=yes,directories=no,menubars=no");
	pack.focus();
}

function valContact(xForm){
/*  var txtTo = 'To:';
  var txtSubject = 'Subject:';*/
  var txtName = 'Form Incomplete!\n---------------------\n' + '  Name';
  var txtCompany = 'Form Incomplete!\n---------------------\n' + '  Company Name';
  var txtCountry = 'Form Incomplete!\n---------------------\n' + '  Country';
  var txtCity = 'Form Incomplete!\n---------------------\n' + '  City';
  var txtPhone = 'Form Incomplete!\n---------------------\n' + '  Phone';
  var txtFax = 'Fax';
  var txtEmail = 'Form Incomplete!\n---------------------\n' + '  EMail Address';
  var txtEmail2 = ' is not a valid EMail Addess';
  /*switch (lng){
  case 'sp':  txtTo= 'Para:';
  			  txtSubject = 'Asunto:';
			  txtName = 'Forma Incompleta!\n---------------------\n' + '  Nombre';			  
			  txtCountry = 'Forma Incompleta!\n---------------------\n' + '  País';;
			  txtCity = 'Forma Incompleta!\n---------------------\n' + '  Ciudad';
			  txtPhone = 'Forma Incompleta!\n---------------------\n' + '  Teléfono';
			  txtFax = 'Fax:';
			  txtEmail = 'Forma Incompleta!\n---------------------\n' + '  EMail';
			  txtEmail2 = ' no es una dirección de correo válido';
			  break;
        }*/
		
  with (xForm) {
  
		 if (Name.value == ""){
			alert(txtName);
			Name.focus();
			return false;};		  
		  if (Country.value == 0) {
			 alert(txtCountry);
			Country.focus();
			return false;};
		  if (City.value == "") {
			 alert(txtCity);
			City.focus();
			return false;};
		  if (Phone.value == "") {
			 alert(txtPhone);
			Phone.focus();
			return false;};	
		  if (EMail.value == "") {
			alert(txtEmail);
			EMail.focus();
			return false;};
		  if (!checkEmailAddress(xForm.EMail)) {
			EMail.focus();
			alert(EMail.value + txtEmail2);
			EMail.select();
			return false;};
	}	     
}

function recarga(form) {
	if (form.pais.value==0) {
		alert ("Favor, Seleccione Pais.");
		xForm.pais.focus()
		return false;
	}
	form.is1.value=form.pais[form.pais.selectedIndex].value;
	form.action="../../html/rates/index.php?xopt=3";
	form.submit(); 
}//fin de la funcion selecciona

function Enviar(xForm) {
	if (xForm.pais.value==0) {
		alert("Seleccione País.!");
		xForm.pais.focus()
		return false;
	}
	if (xForm.servicio.value==0)  {
		alert("Seleccione al Menos un Tipo de Servicio.!" );
		xForm.servicio.focus()
		return false;
	}
	//xForm.action="../../html/rates/index.php?xopt=14";
	xForm.action="../../html/rates/TarifaDetalle.php?xopt=3";
	xForm.submit();
}//fin de la funcion selecciona

function valTermino(){
var	Forma=document.frmRegPaso1;
	if (Forma.Termino.checked) {
		Forma.Aceptar.disabled=false;
	} else {
		Forma.Aceptar.disabled=true;
	}
}

function valRegpaso1() {
var	Forma=document.frmRegPaso1;
	if (Forma.TipoM.value =="") {
		alert("Tipo de Membresia invalido, por favor revise.");
		Forma.TipoM.focus()
		return false;
	}
	Forma.TipoMN.value=Forma.TipoM[Forma.TipoM.selectedIndex].text;	
	if (Forma.Pais.value =="") {
		alert("Pais de origen inválido, por favor revise");
		Forma.Pais.focus()
		return false;
	}

	if (Forma.Pais.value=="") {
		alert("Favor, Seleccione Pais");
		Forma.Pais.focus()
		return false;
	}

	Forma.PaisN.value=Forma.Pais[Forma.Pais.selectedIndex].text;
	//Forma.PaisN.value=Forma.Pais.value;
	//alert (Forma.PaisN.value);
	if (Forma.Email.value =="") {
		alert("Ingrese correo electrónico");
		Forma.Email.focus()
		return false;
	}
	var val = Forma.Email.value;
	var p= val.indexOf('@');
	if (p<1 || p==(val.length-1)) {
	 alert("Correos electronicos inválidos, por favor revise");
	 Forma.Email.select();	 
	 return false;
	}
	if (Forma.Email1.value =="") {
		alert("Ingrese Correo electrónico");
		Forma.Email1.focus()
		return false;
	}
	val = Forma.Email1.value;
	p= val.indexOf('@');
	if (p<1 || p==(val.length-1)) {
	 alert("Correos electronicos inválidos, por favor revise");
	 Forma.Email1.select();	 
	 return false;
	}
	if (Forma.Email.value != Forma.Email1.value) {
		alert("Correos no son Iguales por favor revise");
		Forma.Email1.focus()
		return false;
	}

	if (Forma.Clave.value =="") {
		alert("Ingrese Contraseña");
		Forma.Clave.focus()
		return false;
	}

	if (Forma.Clave.value.length<4) {
		alert("Contraseña inválida, tamaño minimo 4 caracteres, por favor revise");
		Forma.Clave.focus()
		return false;
	}
	if (Forma.ReClave.value =="") {
		alert("Repita Contraseña");
		Forma.ReClave.focus()
		return false;
	}
	if (Forma.ReClave.value != Forma.Clave.value) {
		alert("Contraseñas invalidas, por favor revise.");
		Forma.ReClave.focus()
		return false;
	}
	Forma.submit()
}

function valEmpresa() {
var	Forma=document.frmRegPaso2;
	Forma.Empresa.value="";
	if (Forma.Opt[0].checked) {
		Forma.Empresa.disabled=true;
		Forma.Nombre.focus()
	} else {
		Forma.Empresa.disabled=false;
		Forma.Empresa.focus()
	}	
}

function valEmpresaUpdate() {
var	Forma=document.frmUpdate;
	Forma.Empresa.value="";
	if (Forma.Opt[0].checked) {
		Forma.Empresa.disabled=true;
		Forma.Nombre.focus()
	} else {
		Forma.Empresa.disabled=false;
		Forma.Empresa.value=Forma.EmpresaN.value;
		Forma.Empresa.focus()
	}	
}

function valRegpaso2() {
var	Forma=document.frmRegPaso2;

	if (Forma.Opt[1].checked) {
		if (Forma.Empresa.value=="") {
			alert("El Nombre de la empresa es requerido, por favor revise");
			Forma.Empresa.focus()
			return false;
		}
	}
	if (Forma.Nombre.value =="") {
		alert("Su Nombre es requerido, por favor revise");
		Forma.Nombre.focus()
		return false;
	}

	if (Forma.Apellido.value =="") {
		alert("Su Apellido es requerido, por favor revise");
		Forma.Apellido.focus()
		return false;
	}
	if (Forma.Opt[1].checked) {
		if (Forma.RegistroC.value =="") {
			alert("El Registro Único Contribuyente es requerido, por favor revise");
			Forma.RegistroC.focus()
			return false;
		}
	}
	if (Forma.Cedula.value =="") {
		alert("La Cédula de Identidad es requerida, por favor revise");
		Forma.Cedula.focus()
		return false;
	}

	if (Forma.Mes.value =="" || Forma.Dia.value =="" || Forma.Anio.value =="") {
		alert("Fecha de Nacimiento inválido, por favor revise");
		Forma.Mes.focus()
		return false;
	}

	//if (!validateDate(Date.parse(Forma.Mes.value + "/" + Forma.Dia.value + "/" + Forma.Anio.value))) {
	//	alert("Error en la Fecha de Nacimiento !");
	//	Forma.Mes.focus();
	//	return false;
	//}  
	if(Forma.Mes.value==2) {	
		if(anyoBisiesto(Forma.Anio.value)) {
			 Febrero=29;
		} else {
			 Febrero=28;
		}	 
		if (Forma.Dia.value > Febrero) 	{ 
			alert("Dia Incorrecto con respecto al Mes de Febrero.");
			return false;
		}	
	}
	if (Forma.Pregunta.value=="") {
		alert("Informacion de Como se Entero invalido, por favor revise");
		Forma.Pregunta.focus();
		return false;
	} 
}

function anyoBisiesto(anyo) {
	// si el año introducido es de dos cifras lo pasamos al periodo de 1900. Ejemplo: 25 > 1925
	if (anyo < 100)
		var fin = anyo + 1900;
	else
		var fin = anyo ;
	// primera condicion: si el resto de dividir el año entre 4 no es cero > el año no es bisiesto
	// es decir, obtenemos año modulo 4, teniendo que cumplirse anyo mod(4)=0 para bisiesto
	if (fin % 4 != 0)
		return false;
	else {
		if (fin % 100 == 0) {
			// si el año es divisible por 4 y por 100 y divisible por 400 > es bisiesto
			if (fin % 400 == 0) {
				return true;
			} else { //si es divisible por 4 y por 100 pero no lo es por 400 > no es bisiesto
				return false;
			}
		} else { //si es divisible por 4 y no es divisible por 100 > el año es bisiesto
			return true;
		}
	}
}

function validateDate(strDate) {
	if (strDate.length != 10) return false;
	if (isNaN(Date.parse(strDate))) return false;
	if (Date.parse(strDate) < 0) return false;
	var strMonth = strDate.substr(0,2);
	var strDay = strDate.substr(3,2);
	var strYear = strDate.substr(6,4);
	if (isNaN(strMonth)) return false;
	if (isNaN(strDay)) return false;
	if (strYear > 2060) return false;
	if (isNaN(strYear)) return false;
	if (strMonth < 1 || strMonth > 12) return false;
	if (strDay < 1 || strDay > 31) return false;
	return true;
}

function valRegpaso3(Correo) {
var	Forma=document.frmRegPaso3;
	if (Forma.Ciudad.value =="") {
		alert("Nombre de la Ciudad es requerido, por favor revise.");
		Forma.Ciudad.focus()
		return false;
	}

	if (Forma.Estado.value =="") {
		alert("Estado es requerido, por favor revise.");
		Forma.Estado.focus()
		return false;
	}
	Forma.NomEstado.value=Forma.Estado[Forma.Estado.selectedIndex].text;	
	if (Forma.DireccionE.value =="") {
		alert("Dirección de Entrega es requerido, por favor revise");
		Forma.DireccionE.focus()
		return false;
	}
	if (Forma.CArea.value =="") {
		alert("Código de teléfono Internacional inválido, por favor revise.");
		Forma.CArea.focus()
		return false;
	}
	if (Forma.TelefonoT.value =="") {
		alert("Información de Teléfono inválido de Trabajo, por favor revise");
		Forma.TelefonoT.focus()
		return false;
	}
	if (trim(Forma.EmailA.value) != "") {
		var val = Forma.EmailA.value;
		var p= val.indexOf('@');
		if (p<1 || p==(val.length-1)) {
			alert("Correos electrónicos inválidos, por favor revise");
			Forma.EmailA.select();	 
			return false;
		}
		if (Forma.EmailA.value == Correo) {
			alert("Correo Alterno debe ser diferente a "+Correo);
			Forma.EmailA.focus()
			return false;
		}
		if (Forma.EmailA.value != Forma.EmailA1.value) {
			alert("Correos electrénicos diferentes, por favor revise");
			Forma.EmailA1.focus()
			return false;
		}
	}

	if (Forma.CAleatorio.value =="") {
		alert("Información de la Derecha inválido, por favor revise");
		Forma.CAleatorio.focus()
		return false;
	}

	if (Forma.CAleatorio.value!=Forma.Oculto.value) {
		alert("Información de la Derecha inválido, por favor revise");
		Forma.CAleatorio.focus()
		return false;
	
	}
}

function ValMaximo(objeto) {
var evento_key = window.event.keyCode; 
var Forma=document.frmRegPaso3;
	/*if (window.event.keyCode==86) {
		window.event.keyCode = 0; 
		return false; 
	}*/
	
	if (Forma.DireccionE.value.length>119) {
		window.event.keyCode = 0; 
		//return false; 
	}else{
	return true;} 	
}
function click(objeto){
var evento_key = window.event.keyCode; 
	if(window.event.button==2){
		alert('Boton derecho deshabilitado');
	}
}

function Imprimir() {
/*    version = parseInt(navigator.appVersion);
    if (version >= 4)
      window.print();*/
/*	  function window_print()
{*/
var agt=navigator.userAgent.toLowerCase()
nVersion = parseInt(navigator.appVersion);
nMac = (agt.indexOf("mac") != -1);
nIE  = (agt.indexOf("msie") != -1);
nWin   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
nIE4Win  = (nIE && (nVersion == 4) && nWin);

if (window.print){
		nCanPrint = "yes";
		window.print();
	} 	else	{
		nCanPrint = "no";
		alert("You need a browser with a new JavaScript version to print this page from here");
	}	
/*}
//-->
</SCRIPT>*/
}

function OpenImprimir(URL){
	var quote;
	quote = window.open(URL, "packs", "width=640,height=600,scrollbars=yes,top=10,left=20,status=no,directories=no,menubars=no");
	quote.focus();
}

function OpenPrint(URL,Ancho,Alto){
	var quote;
	quote = window.open(URL, 'packs', 'WIDTH='+ Ancho +',HEIGHT='+ Alto +',scrollbars=yes,top=10,left=80,status=no,directories=no,menubars=no');
	quote.focus();
}

 function ValNumero (objeto) {
 var evento_key = window.event.keyCode; 
 switch (evento_key) {
	case 13: 
	case 48: 
	case 49: 
	case 50: 
	case 51: 
	case 52: 
	case 53: 
	case 54: 
	case 55: 
	case 56: 
	case 57: 
	break; 
	default: 
	window.event.keyCode = 0; 
	return false; 
 }
 return true; 
}

function ValTipoM (){
var Forma=document.frmTipo;
	/*if (Forma.TipoM.value =="") {
		alert("Tipo de Membresia invalido, por favor revise.");
		Forma.TipoM.focus()
		return false;
	}  */
	//Forma.TipoMN.value=Forma.TipoM[Forma.TipoM.selectedIndex].text;	
	if (Forma.TipoM.value=='P') {
		if (Forma.Fecha30.value >30 )  {
			if (Forma.Fecha60.value > 60 ) {
				alert("Su membresia no puede ser cambiada en este momento, por favor acepte minimo 60 dias previos a la fecha de expiracion.");
				return false;
			}
		}	
	}
   Forma.Aceptar.disabled=true;
}  //Fin Función

function ValUpdate() {
var	Forma=document.frmUpdate;

	if (Forma.Ciudad.value =="") {
		alert("Nombre de la Ciudad es requerido, por favor revise.");
		Forma.Ciudad.focus()
		return false;
	}

	if (Forma.Estado.value =="") {
		alert("Estado es requerido, por favor revise.");
		Forma.Estado.focus()
		return false;
	}
	Forma.NomEstado.value=Forma.Estado[Forma.Estado.selectedIndex].text;	

	if (Forma.DireccionE.value =="") {
		alert("Dirección de Entrega es requerido, por favor revise");
		Forma.DireccionE.focus()
		return false;
	}

	if (Forma.CArea.value =="") {
		alert("Código de teléfono Internacional inválido, por favor revise.");
		Forma.CArea.focus()
		return false;
	}

	if (Forma.TelefonoT.value =="") {
		alert("Información de Teléfono inválido de Trabajo, por favor revise");
		Forma.TelefonoT.focus()
		return false;
	}

	if (trim(Forma.EmailA.value) != "") {
		var val = Forma.EmailA.value;
		var p= val.indexOf('@');
		if (p<1 || p==(val.length-1)) {
			alert("Correos electrónicos inválidos, por favor revise");
			Forma.EmailA.select();	 
			return false;
		}
	}
	if (Forma.EmailA.value != Forma.EmailA1.value) {
		alert("Correos electrénicos inválidos, por favor revise");
		Forma.EmailA1.focus()
		return false;
	}

	if (Forma.Opt[1].checked) {
		if (Forma.Empresa.value=="") {
			alert("El Nombre de la empresa es requerido, por favor revise");
			Forma.Empresa.focus()
			return false;
		}
	}
	if (Forma.Nombre.value =="") {
		alert("Su Nombre es requerido, por favor revise");
		Forma.Nombre.focus()
		return false;
	}

	if (Forma.Apellido.value =="") {
		alert("Su Apellido es requerido, por favor revise");
		Forma.Apellido.focus()
		return false;
	}
	if (Forma.Opt[1].checked) {
		if (Forma.RegistroC.value =="") {
			alert("El Registro Único Contribuyente es requerido, por favor revise");
			Forma.RegistroC.focus()
			return false;
		}
	}
	if (Forma.Cedula.value =="") {
		alert("La Cédula de Identidad es requerida, por favor revise");
		Forma.Cedula.focus()
		return false;
	}

	if (Forma.Mes.value =="" || Forma.Dia.value =="" || Forma.Anio.value =="") {
		alert("Fecha de Nacimiento inválido, por favor revise");
		Forma.Mes.focus()
		return false;
	}

	if(Forma.Mes.value==2) {	
		if(anyoBisiesto(Forma.Anio.value)) {
			 Febrero=29;
		} else {
			 Febrero=28;
		}	 
		if (Forma.Dia.value > Febrero) 	{ 
			alert("Dia Incorrecto con respecto al Mes de Febrero.");
			return false;
		}	
	}
	Forma.Aceptar.disabled=true;	
}

function ValAcceso() {
var Forma = document.frmAcceso;
	//Información Actual
	if (Forma.Email.value =="") {
		alert("Ingrese correo electrónico Actual");
		Forma.Email.focus()
		return false;
	}
	var val = Forma.Email.value;
	var p= val.indexOf('@');
	if (p<1 || p==(val.length-1)) {
		alert("Correos electronicos inválidos, por favor revise");
		Forma.Email.select();	 
		return false;
	}
	if (Forma.Email.value != Forma.Email1.value) {
		alert("Correo electronico Actual Incorrecto, por favor revise");
		Forma.Email.focus()
		return false;
	}
	if (Forma.Clave.value =="") {
		alert("Ingrese Contraseña Actual");
		Forma.Clave.focus()
		return false;
	}
	if (Forma.Clave100.value != Forma.Clave1.value) {
		alert("Contraseña Actual Incorrecto, por favor revise");
		Forma.Clave100.focus()
		return false;
	}
	//Información Nueva	
	if ((Forma.EmailN.value=="") && ((Forma.ClaveN.value=="")) ) {
		alert("Ingrese Nuevo Correo electrónico ó Contraseña");
		Forma.EmailN.focus()
		return false;
	}

	if (Forma.EmailN.value!="") {
		val = Forma.EmailN.value;
		p= val.indexOf('@');
		if (p<1 || p==(val.length-1)) {
			alert("Correo electronico Nuevo inválido, por favor revise");
			Forma.EmailN.select();
			return false;
		}
		if (Forma.EmailN.value != Forma.ReEmailN.value) {
			alert("Correos Nuevos no son Iguales por favor revise");
			Forma.EmailN.focus()
			return false;
		}
	}	
	//Validar Nueva Clave
	if (Forma.EmailN.value=="") {
		if (Forma.ClaveN.value =="") {
			alert("Ingrese Nueva Contraseña");
			Forma.ClaveN.focus()
			return false;
		}
	}
	if (Forma.ClaveN.value !="") {
		if (Forma.ClaveN.value.length<4) {
			alert("Contraseña Nueva inválida, tamaño minimo 4 caracteres, por favor revise");
			Forma.ClaveN.focus()
			return false;
		}
		if (Forma.ReClaveN.value =="") {
			alert("Repita Nueva Contraseña");
			Forma.ReClaveN.focus()
			return false;
		}
		if (Forma.ReClaveN.value != Forma.ClaveN.value) {
			alert("Contraseñas Nuevas invalidas, por favor revise.");
			Forma.ClaveN.focus()
			return false;
		}
	}
	
	Forma.Aceptar.disabled=true;
	//Forma.submit()
}

function valTerminoTipoM(){
var	Forma=document.frmTipo;0
	if (Forma.Termino.checked) {
		Forma.Aceptar.disabled=false;
	} else {
		Forma.Aceptar.disabled=true;
	}
}

function OpenPantalla(URL, ancho, alto){
	var quote;
	quote = window.open(URL,'packs','WIDTH='+ ancho +',HEIGHT='+ alto +',scrollbars=yes,top=10,left=20,directories=no,status=yes,menubars=no');
	quote.focus();
}

function valCamposTarjeta(){
var	Forma=document.frmTarjeta;
	if (Forma.chkTarjeta.checked) {
		Forma.DuenioT.disabled=false;
		Forma.TipoT.disabled=false;
		Forma.NumeroT.disabled=false;
		Forma.MesT.disabled=false;
		Forma.AnioT.disabled=false;
		Forma.CodigoT.disabled=false;
		Forma.BancoT.disabled=false;		
	} else {
    	Forma.reset();
		Forma.DuenioT.disabled=true;
		Forma.TipoT.disabled=true;
		Forma.NumeroT.disabled=true;
		Forma.MesT.disabled=true;
		Forma.AnioT.disabled=true;
		Forma.CodigoT.disabled=true;
		Forma.BancoT.disabled=true;
	}
}

function valTarjeta() {
var	Forma =document.frmTarjeta;
	if (Forma.chkTarjeta.checked) {
		if (trim(Forma.DuenioT.value)==''){
			alert('Nombre del Tarjeta Habiente invalida, por favor revise');
			Forma.DuenioT.focus();
			return false;}	
		if (trim(Forma.TipoT.value)==''){
			alert('Tipo de Tarjeta valida, por favor revise');
			Forma.TipoT.focus();
			return false;}	
		if (trim(Forma.NumeroT.value)==''){
			alert('Número de Tarjeta valida, por favor revise');
			Forma.NumeroT.focus();
			return false;}	
		if (trim(Forma.AnioT.value)=='' || trim(Forma.MesT.value)==''){
			alert('Fecha de Expiración valida, por favor revise');
			Forma.MesT.focus();
			return false;}
		if (trim(Forma.CodigoT.value)==''){
			alert('Código de Tarjeta valido, por favor revise');
			Forma.CodigoT.focus();
			return false;
		}	
		if (trim(Forma.BancoT.value)==''){
			alert('Banco de Emisor valido, por favor revise');
			Forma.BancoT.focus();
			return false;}	
	}
}

function valProcesos(Opcion,Proceso){
var	Forma=document.frmProceso;
	if (Opcion=="T") { 	//Tracking
		if (Proceso=="E") { 	//Exportación
			window.location.href="/admin/xml/export/tracking.php?Procesar=1";
		}
		if (Proceso=="I") { 	//Importación
			window.location.href="/admin/xml/import/tracking.php?Procesar=1";
		}
	}
}
function getElementRef(id)
 {
 var dom1=(document.getElementById)?1:0;
 var ie4plus=(document.all)?1:0;
 var ns4=(document.layers)?1:0;
 var safari=(navigator.appVersion.indexOf("Safari") != -1)?1:0;
 var mac=(navigator.appVersion.indexOf("Macintosh") != -1)?1:0;
 
  if (dom1) return document.getElementById(id);
  else if (ie4plus) return document.all[id];
  else if (ns4) return document.layers[id];
  else return null;
 }

function togglePane(id) {
  var theObj=getElementRef(id);
  if (theObj) {
   if (theObj.style) {
	    if (theObj.style.display=='block') {
			theObj.style.display='none';
			} else {
			theObj.style.display='block';
			}
   	} else {
	    if (theObj.display=='block') {
		theObj.display='none';
		} else {
		theObj.display='block';
		}
   }
  }
}

function Criterio(){
	var Forma = document.frmPantalla;
	if (Forma.servicio.value == "" || Forma.servicio.value == 0) {
		alert ("Favor, Seleccione Registro .");
		Forma.servicio.focus();
		return false; 
	} else {
		Forma.submit();
	}
}
function Reg(Forma) {
	//var Forma = document.frmPantalla;
	Forma.action="../../html/rates/index.php?xopt=3";
	Forma.submit(); 
}


<!--
var intervalotime;

function cerrar(){
var ns = navigator.appName == "Netscape";
var ns4 = (ns && parseInt(navigator.appVersion) == 4);
var ns5 = (ns && parseInt(navigator.appVersion) > 4);
var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
var layerpromo;
if (ns4)
        layerpromo = document["LayerBannerPromo"];
    else if (ns5)
        layerpromo = document.getElementById("LayerBannerPromo");
    else
        layerpromo = document.all ? document.all["LayerBannerPromo"] : null;
			
  //layerpromo.style.visibility = "hidden";

intervalotime = setTimeout("mover(2)",10);
 
}


function abrir(){
var ns = navigator.appName == "Netscape";
var ns4 = (ns && parseInt(navigator.appVersion) == 4);
var ns5 = (ns && parseInt(navigator.appVersion) > 4);
var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
var layerpromo;
	if (ns4){
			layerpromo = document["LayerBannerPromo"];
	} else { 
		if (ns5) {
			layerpromo = document.getElementById("LayerBannerPromo");
		} else {
			layerpromo = document.all ? document.all["LayerBannerPromo"] : null; 
		}
	}
	intervalotime = setTimeout("mover(1)",2000);
}

function mover(opcion){
var ns = navigator.appName == "Netscape";
var ns4 = (ns && parseInt(navigator.appVersion) == 4);
var ns5 = (ns && parseInt(navigator.appVersion) > 4);
var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
var layerpromo;
var vartop;
var cadena;
var arrayValor;
clearTimeout(intervalotime);

if (ns4){
		layerpromo = document["LayerBannerPromo"];
} else { 
	if (ns5) {
		layerpromo = document.getElementById("LayerBannerPromo");
	} else {
		layerpromo = document.all ? document.all["LayerBannerPromo"] : null; 
	}
}
if(opcion==1){
if (ns4){
   vartop = layerpromo.style.top;
   if(vartop != 15) {
    layerpromo.style.top +=5;
	intervalotime = setTimeout("mover(1)",15); 
   } else {
	clearTimeout(intervalotime);
   }   
} else { 
   if (ns5) {
	   vartop = layerpromo.style.top;
	   arrayValor = vartop.split("");
	   cadena="";
	   for(i=0;i<(arrayValor.length-2);i++){
	       cadena += arrayValor[i];
	   }
	   if(parseInt(cadena) != 15) {
		   var numerotop = parseInt(cadena)+5; 
		  // if(vartop != 15) {
			 //layerpromo.style.top +=5;
			 layerpromo.style.top = String(numerotop)+"px";
			 intervalotime = setTimeout("mover(1)",15);
	   } else {
				 clearTimeout(intervalotime);
	   }
   } else {
	   vartop = layerpromo.style.top;
	   arrayValor = vartop.split("");
	   cadena="";
	   for(i=0;i<(arrayValor.length-2);i++){
	       cadena += arrayValor[i];
	   }
	   if(parseInt(cadena) != 15) {
	     var numerotop = parseInt(cadena)+5; 
         layerpromo.style.top = String(numerotop)+"px";
		 intervalotime = setTimeout("mover(1)", 15); 
       }else {
	   clearTimeout(intervalotime);
	   }   
  }
}
}else{
if (ns4){
   vartop = layerpromo.style.top;
   if(vartop != -215) {
    layerpromo.style.top -=5;
	intervalotime = setTimeout("mover(2)",15); 
   } else {
	   layerpromo.style.visibility = "hidden";
	   clearTimeout(intervalotime);
   }   
} else { 
   if (ns5) {
	   vartop = layerpromo.style.top;
		arrayValor = vartop.split("");
	  // alert(arrayValor);
	   cadena="";
	   for(i=0;i<(arrayValor.length-2);i++){
	       cadena += arrayValor[i];
	   }
	   if(parseInt(cadena) != -215) {	  
	  //if(vartop != -215) {
         //layerpromo.style.top -=5; 
		var numerotop = parseInt(cadena)-5; 
		// alert(numerotop);
         layerpromo.style.top = String(numerotop)+"px";		 
		 intervalotime = setTimeout("mover(2)",15);
       } else {
		   layerpromo.style.visibility = "hidden";
		   clearTimeout(intervalotime);
	   }   
   } else {
	   vartop = layerpromo.style.top;
	   arrayValor = vartop.split("");
	  // alert(arrayValor);
	   cadena="";
	   for(i=0;i<(arrayValor.length-2);i++){
	       cadena += arrayValor[i];
	   }
	   if(parseInt(cadena) != -215) {
	     var numerotop = parseInt(cadena)-5; 
		// alert(numerotop);
         layerpromo.style.top = String(numerotop)+"px";
		 intervalotime = setTimeout("mover(2)",15); 
       }else {
		   layerpromo.style.visibility = "hidden";
		   clearTimeout(intervalotime);
	   }   
  }
}
}
}
/*
function adicionarreferencia(){
	var xForm = document.frmreferencia;
	var contador=0;
	for(var i=0;i<5;i++){
		if((xForm.elements["nombre"+i].value!="")&&(xForm.elements["apellido"+i].value!="")&&(xForm.elements["email"+i].value!="")){
		contador++;
		} 
	}
	if(contador<5){
	  alert("Por favor ingrese informacion");
	  xForm.nombre0.focus();
	  xForm.chkAdicionar.checked=false;
	  return false;
	}
	strTable="<table>";
	for(i=5;i<10;i++){
        strTable+="<tr><td align='center'><input type='text' name='nombre"+i+"' size='15' maxlength='20'></td>";
        strTable+="<td align='center'><input type='text' name='apellido"+i+"' size='15' maxlength='20'></td>";
        strTable+="<td align='center'><input type='text' name='email"+i+"' size='15' maxlength='50'></td>";
		strTable+="<td align='center'><input type='text' name='alterno"+i+"' size='15' maxlength='50'></td>";
        strTable+="</tr><tr>";
        strTable+="<td align='center'><div id='lnombre"+i+"'></div></td>";
        strTable+="<td align='center'><div id='lapellido"+i+"'></div></td>";
        strTable+="<td align='center'><div id='lemail"+i+"'></div></td>";
		strTable+="<td align='center'><div id='lalterno"+i+"'></div></td></tr>";
		}
		
    //alert(strTable);
	var lo_container = document.getElementById('emailreferencia');
	lo_container.innerHTML=strTable+"</table><input type='checkbox' name='chkAdicionar' value='0' onClick='eliminarreferencia();'>Eliminar 5 registros.&nbsp;&nbsp;<input type='checkbox' name='chkTerminos' value=''><a href='#' onClick='showMe();return false'>Acepta t&eacute;rminos y condiciones</a></div>";
}

function eliminarreferencia(){
	//var xForm = document.frmreferencia;
	strTable="";
	var lo_container = document.getElementById('emailreferencia');
	lo_container.innerHTML="<input type='checkbox' name='chkAdicionar' value='' onClick='adicionarreferencia();'>Adicionar 5 registros.&nbsp;&nbsp;<input type='checkbox' name='chkTerminos' value=''><a href='#' onClick='showMe();return false'>Acepta t&eacute;rminos y condiciones</a></div>";
	//xForm.cancelar.value="Limpiar";
//alert(lo_container.innerHTML);
}
*/
function fg_accept(){
 var lo_Form = document.frmreferencia;	
 lo_Form.enviar.disabled=true;
 if(lo_Form.chkTerminos.checked){
	lo_Form.enviar.disabled=false;
	}
}

function fg_objetus() {
      var http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
	  if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
      }
      return http_request;
   }
/***********Function fg_loadContainer******************/
/*Fecha: 06-01-2006*/
/*Development: Alex Solis*/
/*Description: Permite presentar las paginas en el contenedor principal, si el metodo de envio de la pagina es mediante GET o POST
Parametros:
ps_pagehtml:URL de la pagina a envocar;
po_method: Metodo a invocar GET o POST;
po_div: Nombre del Objeto DIV utilizado;
po_objects: objetos solo utilizado cuando el metodo es POST
*/
function fg_loadContainer(ps_pagehtml,po_method,po_div,po_objects){
	var lo_container;
	if(po_div==undefined){
	   lo_container = document.getElementById('id_container');		
	} else {
	   lo_container = document.getElementById(po_div);			
	}
	var lo_ajax=fg_objetus();
	lo_container.innerHTML = "Processing...";
	if(po_method==undefined){
		po_method="GET";
	} 
	lo_ajax.open(po_method, ps_pagehtml,true);
	lo_ajax.onreadystatechange=function() {
			if (lo_ajax.readyState==4) {
				  lo_container.innerHTML = lo_ajax.responseText;
			} 
	}
	if(po_method=="GET"){
		lo_ajax.send(null);
	} else {
		lo_ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		lo_ajax.send(po_objects);
	}
}
/***********Function getElementRef******************/
/*Fecha: 06-01-2006*/
/*Development: Alex Solis*/
/*Description: Permite identificar los objetos que estan cargados en la pagina y asi poder manipular sus propiedades y metodos*/
function getElementRef(id)
 {
 var dom1=(document.getElementById)?1:0;
 var ie4plus=(document.all)?1:0;
 var ns4=(document.layers)?1:0;
 var safari=(navigator.appVersion.indexOf("Safari") != -1)?1:0;
 var mac=(navigator.appVersion.indexOf("Macintosh") != -1)?1:0;
 
  if (dom1) return document.getElementById(id);
  else if (ie4plus) return document.all[id];
  else if (ns4) return document.layers[id];
  else return null;
 }
 
function fg_validate_form(){
	var xForm = document.frmreferencia;
	for (var i=0; i<xForm.elements.length; i++){
		e = xForm.elements[i];
		if (e.type == 'text') {
		   e.disabled=false;
		   e.value = "";
		   var lo_container = document.getElementById('l'+e.name);
		   lo_container.innerHTML = "";
		}
	}
	//eliminarreferencia();
}

function fg_save_referencia(){
    var xForm = document.frmreferencia;
	var contador=0;
	var indice=5;
	var error =0;
	//xForm.hdreferencia.value ="";
	
	/*if(xForm.chkAdicionar.value=="0"){
	   indice=10;
	} */
	var lo_container ;
	var lo_containerA;
	var lo_containerN;
	var lo_containerP;
	
	//lb_bandera=false;

	for(var i=0;i<indice;i++){
		var lo_container = document.getElementById('lemail'+i);
		var lo_containerA = document.getElementById('lalterno'+i);			
		var lo_containerN = document.getElementById('lnombre'+i);
		var lo_containerP = document.getElementById('lapellido'+i);
		lo_container.innerHTML ="";
		lo_containerA.innerHTML = "";
		lo_containerN.innerHTML = "";
		lo_containerP.innerHTML = "";
						   
		//alert(i);
		if((xForm.elements["nombre"+i].value!="")&&(xForm.elements["apellido"+i].value!="")&&(xForm.elements["email"+i].value!="")&&(xForm.elements["nombre"+i].disabled==false)){
			switch(validateEmail(xForm.elements["email"+i].value)){
			case 0:	
			     contador++;
				 break;
			case 1:
			     lo_container.innerHTML = "Por favor, su correo electronico es requerido";
error++;
		         //lb_bandera=false;
				// return false;
				 break;
			case 2:
			     lo_container.innerHTML = "Correo electronico no es válido";

error++;				 
//return false;
				 //lb_bandera=false;
				 break;
			}
			
			xForm.elements["email"+i].focus;		 
			if(xForm.elements["alterno"+i].value!=""){
				switch(validateEmail(xForm.elements["alterno"+i].value)){
				case 0:	
					 break;
				case 1:					 
lo_containerA.innerHTML = "Por favor, su correo electronico es requerido";

error++;					
// return false;
					 //lb_bandera=false;
					 break;
				case 2:
					 lo_containerA.innerHTML = "Correo electronico no es válido";

error++;
					 //return false;
					 //lb_bandera=false;
					 break;
				}
				xForm.elements["alterno"+i].focus;
			}
		} else {
			if((xForm.elements["nombre"+i].value!="")||(xForm.elements["email"+i].value!="")){
			  	
				if(xForm.elements["nombre"+i].value==""){
				   lo_containerN.innerHTML ="Nombre requerido";

error++;
				   //return false;
				}
				//alert(lo_containerN.innerHTML);
				if(xForm.elements["apellido"+i].value==""){
				   lo_containerP.innerHTML ="Apellido requerido";

error++;
				   //return false;
				}
				//alert(lo_containerN.innerHTML);
				if(xForm.elements["email"+i].value==""){
				   lo_container.innerHTML ="Correo electronico requerido";

error++;
				   //return false;
				}
				//alert(lo_container.innerHTML);
			}
			//
			//alert(i);
		}
	}
	//alert(lb_bandera);
if(error==0){	
//if (contador!=0){
	   xForm.opcion.value="1";
	   xForm.submit();
	}
	
}


function enviarReferido(opcion){
	var xForm = document.frmreferencia;
	var caracter = "&";
	var url="";
	if(opcion== undefined){
		 xForm.opcion.value = "";
		 xForm.method= "post";
		 xForm.action="../../html/account/recomendar.php";
	} else{
		 if(opcion>1){
			var contador=0;
			for (var i=0; i<xForm.elements.length; i++){
			    var e = xForm.elements[i];
				if (e.type == 'checkbox'){
				  if (e.checked){
					  e.value="1";
					  contador++;
				  }	
				}
		    } 
			if(contador==0){
			  alert("Debe seleccionar minimo un registro");
			  return false;
			}
		 }
		 xForm.method= "post";
		 xForm.action="../../html/account/consulta.php";
		 xForm.opcion.value = opcion;
	}
	 xForm.submit();
}