   var LastColor;
   var LastClick="";

   function SetInner(msgFrame,sText)
      {
         var oObj=attach(msgFrame);
         oObj.innerText=sText;
      };

   function GoSorted(iAdmin)
      {
         with (window.document)
            {
               sURL=(consSiteURL3+'admin=' + iAdmin);
               sURL=urlencodefull(sURL+'&orden=' + frmStatus.cboOrden.value);
               frmStatus.action=sURL;
               frmStatus.submit();
            }
      }

   function DoMapa(vId,vIdioma)
      {
         window.document.ZoneILocal.target='_blank';
         window.document.ZoneILocal.action='DialogMapaPrestacion.asp?id='+vId+'&idioma='+vIdioma;
         window.document.ZoneILocal.submit();
      }

   function ColorObj(id,vColor)
      {
         var temp_Obj;
         temp_Obj = attach(id);
         if (LastClick!="")
            {
               if(ns4) 
                  {
                     LastClick.backgroundColor = LastColor;
                  }
               else
                  {
                     LastClick.style.backgroundColor = LastColor;
                  }
            }
         LastClick=temp_Obj;
         if(ns4) 
            {
               LastColor = temp_Obj.backgroundColor;
               temp_Obj.backgroundColor = vColor;
            }
         else
            {
               LastColor = temp_Obj.style.backgroundColor;
               temp_Obj.style.backgroundColor = vColor;
            }
      }

   function right(e) {
	if (navigator.appName == 'Netscape' && 
	(e.which == 3 || e.which == 2))
	return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && 
	(event.button == 2 || event.button == 3)) {
	alert("Sorry, you can't right click here...");
	return false;
	}
	return true;
   }

   function urlencodefull(text) 
      {
         text= text.replace(/ /g,"%20");
         return text;
      }

   function GoLanguage(iLang)
      {  
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteIDURL+iLang);
               Menu.action=sURL;
               Menu.submit();
            }
      }

   function GoLanguageX()
      {  
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteIDURL+iLang);
               Menu.action=sURL;
               Menu.submit();
            }
      }

   function GoSingleFile(iFile)
      {
         with (window.document)
            {
               var i;
			   iZon=ZoneIndex.cboZonaHome2.options[ZoneIndex.cboZonaHome2.selectedIndex].value;
               iLoc=ZoneIndex.cboLocalidadHome2.options[ZoneIndex.cboLocalidadHome2.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
			   for (i=0;i<ZoneIndex.service2.length;i++){ 
       				if (ZoneIndex.service2[i].checked){
						iApp=ZoneIndex.service2[i].value;
          				break;
					}
    			}
               sURL=urlencodefull(consSiteURL4+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion=-6&SingleFile='+iFile);
               ZoneIndex.action=urlencodefull(sURL);
               ZoneIndex.submit();
            }
      }
	  
	
   function GoSingleFileMenu(iFile)
      {
         with (window.document)
            {
               var i;
			   iZon=MenuR_S.cboZona.options[MenuR_S.cboZona.selectedIndex].value;
               iLoc=MenuR_S.cboLocalidad.options[MenuR_S.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
			   iApp=MenuR_S.cboApp.options[MenuR_S.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteURL4+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion=-6&SingleFile='+iFile);
               MenuR_S.action=urlencodefull(sURL);
               MenuR_S.submit();
			}
	  }
   
   function GoIndexCaseFlag(iSecc,iCase)
      {
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteURL3+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc+'&caseflag='+iCase);
               Menu.action=sURL;
               Menu.submit();
            }
      }

   function GoIndexCaseFlagSSL(iSecc,iCase)
      {
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSSLSiteURL+'&idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc+'&caseflag='+iCase);
               Menu.action=sURL;
               Menu.submit();
            }
      }

   function GoIndexCaseFlagILocal(iSecc,iCase)
      {
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteURL3+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc+'&caseflag='+iCase);
               ZoneILocal.action=sURL;
               ZoneILocal.submit();
            }
      }

   function GoIndex(iSecc)
      {
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteURL2+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc);
               Menu.action=sURL;
               Menu.submit();
            }
      }
      
   function GoRegistration(iNewUserType,iCaseFlag)
      {
         with (window.document)
            {
               iZon=MenuR_S.cboZona.options[MenuR_S.cboZona.selectedIndex].value;
               iLoc=MenuR_S.cboLocalidad.options[MenuR_S.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
               iApp=1;//Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=urlencodefull(consSiteURL4+consUserInfo+'&NewUserType='+iNewUserType+'&App='+iApp+'&idioma='+iLang+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion=-7&caseflag='+iCaseFlag);
               MenuR_S.action=sURL;
               MenuR_S.submit();
            }
      }

   function GoReserveAnyForm(iSecc,iGroup,vcboZona,vcboLocalidad)
      {
         with (window.document)
            {
               iZon=vcboZona.options[vcboZona.selectedIndex].value;
               iLoc=vcboLocalidad.options[vcboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               if (iGroup==888)
                  {
                     iSecc=888;
                  }
               if (iGroup==-1)
                  {
                     iSecc=-1;
                  }
               if (iGroup==-4)
                  {
                     iSecc=-4;
                  }
               if (iGroup==-5)
                  {
                     iSecc=-5;
                  }
               if (iGroup==-9)
                  {
                     iSecc=-9;
                     if (iLang==1)
                        {
                           iLangDir='spanish';
                        }
                     if (iLang==2)
                        {
                           iLangDir='portuguesse';
                        }
                     if (iLang==3)
                        {
                           iLangDir='english';
                        }
                     GoSingleFile('html/'+iLangDir+'/id_country_'+iZon+'/id_zone_'+iLoc+'/valores.asp');
                     return;
                  }
               
               switch (iGroup)
                  {
                     case '0':
                        mvarTemp=consSiteURL1;
                        break;
                     case '2':
                        mvarTemp=consSiteURL3;
                        break;
                     case '4':
                        mvarTemp=consSiteURL2;
                        break;
                     case '9':
                        mvarTemp=consSiteURL3;
                        break;
                     case '-1':
                        mvarTemp=consSiteURL2;
                        break;
                     case '-2':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-4':
                        mvarTemp=consSiteURL2;
                        break;
                     case '-5':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-6':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-7':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-8':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-9':
                        mvarTemp=consSiteURL4;
                        break;
                     case '888':
                        mvarTemp=consSiteURL4;
                        break;
                     default:
                        mvarTemp=consSiteURL1;
                        break;
                  }
               iApp=iSecc;
               sURL=urlencodefull(mvarTemp+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGroup+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc);
               Menu.action=sURL;
               Menu.submit();
            }
      }

   function GoReserve(iSecc,iGroup)
      {
         with (window.document)
            {
               iZon=ZoneIndex.cboZonaHome1.options[ZoneIndex.cboZonaHome1.selectedIndex].value;
               iLoc=ZoneIndex.cboLocalidadHome1.options[ZoneIndex.cboLocalidadHome1.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
//               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
		 	   iApp=iGroup;
				if ((iZon!=0 && iLoc!=0 && iApp!=0) && (iZon!='' && iLoc!='' && iApp!=''))			   
			   	//if (iZon!=0 && iLoc!=0) 
				{
               	if (iGroup==888)
                  {
                     iSecc=888;
                  }
               	if (iGroup==-1)
                  {
                     iSecc=-1;
                  }
               	if (iGroup==-4)
                  {
                     iSecc=-4;
                  }
               	if (iGroup==-5)
                  {
                     iSecc=-5;
                  }
               	if (iGroup==-9)
                  {
                     iSecc=-9;
                     if (iLang==1)
                        {
                           iLangDir='spanish';
                        }
                     if (iLang==2)
                        {
                           iLangDir='portuguesse';
                        }
                     if (iLang==3)
                        {
                           iLangDir='english';
                        }
                     GoSingleFile('html/'+iLangDir+'/id_country_'+iZon+'/id_zone_'+iLoc+'/valores.asp');
                     return;
                  }
               
               	switch (iGroup)
                  {
                     case '0':
                        mvarTemp=consSiteURL1;
                        break;
                     case '2':
                        mvarTemp=consSiteURL3;
                        break;
                     case '4':
                        mvarTemp=consSiteURL2;
                        break;
                     case '9':
                        mvarTemp=consSiteURL3;
                        break;
                     case '-1':
                        mvarTemp=consSiteURL2;
                        break;
                     case '-2':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-4':
                        mvarTemp=consSiteURL2;
                        break;
                     case '-5':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-6':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-7':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-8':
                        mvarTemp=consSiteURL4;
                        break;
                     case '-9':
                        mvarTemp=consSiteURL4;
                        break;
                     case '888':
                        mvarTemp=consSiteURL4;
                        break;
                     default:
                        mvarTemp=consSiteURL1;
                        break;
                  }
               sURL=urlencodefull(mvarTemp+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGroup+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc);
               ZoneIndex.action=sURL;
               ZoneIndex.submit();
			   }
			   else
			{
				var Message='';
				switch (iLang)
				{
					case '1': 
					Message='Debes seleccionar País y Destino';
					break;
					case '2': 
					Message='Você deve escolher um destino e País';
					break;							
					case '3': 
					Message='You must select a country and Destination';
					break;
					default:
					Message='Debes seleccionar País y Destino';
					break;
				}
				alert(Message);
			}
            }
      }
      
	function GoTravel(iSecc)
	{
		with (window.document)
		{
			var tipo;
			if (iSecc==-3)
			{
				tipo=1;
			}
			else
			{
				tipo=2;
				iSecc=-3;
			}
			iLang=MenuR.lsidioma.value;
			if (tipo==1)
			{
				var i;
				iZon=ZoneIndex.cboZonaHome2.options[ZoneIndex.cboZonaHome2.selectedIndex].value;
				iLoc=ZoneIndex.cboLocalidadHome2.options[ZoneIndex.cboLocalidadHome2.selectedIndex].value;
			
				for (i=0;i<ZoneIndex.service2.length;i++)
				{ 
					if (ZoneIndex.service2[i].checked)
					{
						iGroup=ZoneIndex.service2[i].value;
						break;
					}
				}
			    //iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value; // ESTO ESTABA COMENTADO
			}
			else
			{
				iZon=MenuR_S.cboZona.options[MenuR_S.cboZona.selectedIndex].value;
				iLoc=MenuR_S.cboLocalidad.options[MenuR_S.cboLocalidad.selectedIndex].value;
				iGroup=MenuR_S.cboApp.options[MenuR_S.cboApp.selectedIndex].value;					
			}
			iApp=iGroup;
			//alert(iApp);
			if ((iZon!=0 && iLoc!=0 && iApp!=0) && (iZon!='' && iLoc!='' && iApp!=''))
			{
				if (iGroup==888)
				{
					iSecc=888;
				}
				if (iGroup==-1)
				{
					iSecc=-1;
				}
				if (iGroup==-4)
				{
					iSecc=-4;
				}
				if (iGroup==-5)
				{
					iSecc=-5;
				}
				if (iGroup==-9)
				{
					iSecc=-9;
					if (iLang==1)
					{
						iLangDir='spanish';
					}
					if (iLang==2)
					{
						iLangDir='portuguesse';
					}
					if (iLang==3)
					{
						iLangDir='english';
					}
					if (tipo==1)
					{
						GoSingleFile('html/'+iLangDir+'/id_country_'+iZon+'/id_zone_'+iLoc+'/valores.asp');
					}
					else
					{
						GoSingleFileMenu('html/'+iLangDir+'/id_country_'+iZon+'/id_zone_'+iLoc+'/valores.asp');
					}
					return;
				}
			
				switch (iGroup)
				{
					case '0':
					mvarTemp=consSiteURL1;
					break;
					case '2':
					mvarTemp=consSiteURL3;
					break;
					case '4':
					mvarTemp=consSiteURL2;
					break;
					case '9':
					mvarTemp=consSiteURL3;
					break;
					case '-1':
					mvarTemp=consSiteURL2;
					break;
					case '-2':
					mvarTemp=consSiteURL4;
					break;
					case '-4':
					mvarTemp=consSiteURL2;
					break;
					case '-5':
					mvarTemp=consSiteURL4;
					break;
					case '-6':
					mvarTemp=consSiteURL4;
					break;
					case '-7':
					mvarTemp=consSiteURL4;
					break;
					case '-8':
					mvarTemp=consSiteURL4;
					break;
					case '-9':
					mvarTemp=consSiteURL4;
					break;
					case '888':
					mvarTemp=consSiteURL4;
					break;
					default:
					mvarTemp=consSiteURL1;
					break;
				}
				sURL=urlencodefull(mvarTemp+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGroup+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSecc);
				if (tipo==1)
				{
					ZoneIndex.action=sURL;
					ZoneIndex.submit();
				}
				else
				{
					MenuR_S.action=sURL;
					MenuR_S.submit();	   
				}
			}
			else
			{
				var Message='';
				switch (iLang)
				{
					case '1': 
					Message='Debes seleccionar País y Destino';
					break;
					case '2': 
					Message='Você deve escolher um destino e País';
					break;							
					case '3': 
					Message='You must select a country and Destination';
					break;
					default:
					Message='Debes seleccionar País y Destino';
					break;
				}
				alert(Message);
			}
		}
	}
	
   function GoZoneSections(iCaseFlag)
      {
         with (window.document)
            {
               iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
               iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               sURL=(consSiteURL2+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion=-2');
               sURL=urlencodefull(sURL+'&caseflag='+iCaseFlag);
               Menu.action=sURL;
               Menu.submit();
            }
      }

     function GoLog(user,pass)
       {
		 with (window.document)
            {
               iZon=MenuR_S.cboZona.options[MenuR_S.cboZona.selectedIndex].value;
			   iLoc=MenuR_S.cboLocalidad.options[MenuR_S.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
               iApp=1;
               iUser = user;
               iPassword = pass;
			   sURL=urlencodefull(consSiteURL2+consUserInfo+'&DoLog=1&DoUser='+iUser+'&DoPassword='+iPassword+'&App='+iApp+'&idioma='+iLang);
               //alert('sURL: ' +sURL);
			   MenuR.action = sURL;
               //alert('sURL: ' + sURL);
				MenuR.submit();
            }
       }

   function GoLoc(iZone, iLoc)
      {
         with (window.document)
            {
               Menu.cboZona.value=iZone;
               ChangeOptions('cboZona','cboLocalidad','arrLocalidades','Menu.');
               Menu.cboLocalidad.value=iLoc;
               GoIndex(-1);
            }
      }

   function GoLocLodge(iZone, iLoc, iSecc, iGroup)
      {
         with (window.document)
            {
               Menu.cboZona.value=iZone;
               ChangeOptions('cboZona','cboLocalidad','arrLocalidades','Menu.');
               Menu.cboLocalidad.value=iLoc;
               GoReserve(iSecc,iGroup);                                                            
            }
      }

   function GoToPageSorted()
      {
         with (window.document)
            {
               iZon=ZoneILocal.cboZona1.value;
               iLoc=ZoneILocal.cboLocalidad1.value;
               iLang=MenuR.lsidioma.value;
               iApp=6;
               sURL=(consSiteURL3+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSeccion);
               sURL=urlencodefull(sURL+'&orden='+ZoneILocal.cboOrden.value);
               ZoneILocal.action=sURL;
               ZoneILocal.submit();
            }
      }

   function GoToPageSortedPaged(iPage)
      {
         with (window.document)
            {
               iZon=ZoneILocal.cboZona1.value;
               iLoc=ZoneILocal.cboLocalidad1.value;
               iLang=MenuR.lsidioma.value;
               iApp=6;
               sURL=(consSiteURL3+'idioma='+iLang+'&App='+iApp+'&Grupo='+iGrupo+'&pais='+iZon+'&zona='+iLoc+'&seccion='+iSeccion);
               sURL=urlencodefull(sURL+'&orden='+ZoneILocal.cboOrden.value+'&PageIndex='+iPage);
               ZoneILocal.action=sURL;
               ZoneILocal.submit();
            }
      }

   function LoadFramePRI(iframerec,ipres,iconsulta,ibegin,imoneda,iColor)
      {
         iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
         mSRC=urlencodefull(consSiteRootPath+'html/neutral/zoneilocal/priceiframe.asp?idioma='+iLang+'&id_prestacion='+ipres+'&consulta='+iconsulta+'&begin='+ibegin+'&id_moneda='+imoneda+'&sbColor='+iColor);
         if (iframerec != '')
            {
               iframerec.src=mSRC;
            }
         else
            {
               return mSRC;
            };
      }

   function LoadFrameMSG(iframerec,ipres,ititle,iservicio,iColor)
      {
         iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
         mSRC=urlencodefull(consSiteRootPath+'html/neutral/zoneilocal/msgiframe.asp?idioma='+iLang+'&id_prestacion='+ipres+'&title='+ititle+'&id_servicio='+iservicio+'&sbColor='+iColor);
         if (iframerec != '')
            {
               iframerec.src=mSRC;
            }
         else
            {
               return mSRC;
            };
      }

   function LoadFramePIC(iframerec,ipres,iColor,tTipoPrest,tZona)
      {  
         iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
         iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
         mSRC=urlencodefull(consSiteRootPath+'html/neutral/zoneilocal/pictureiframe.asp?zona='+iZon+'&idioma='+iLang+'&id_prestacion='+ipres+'&sbColor='+iColor+'&TipoPrestacion='+tTipoPrest+'&TextoZona='+tZona);
         if (iframerec != '')
            {
               iframerec.src=mSRC;
            }
         else
            {
               return mSRC;
            };
      }

   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 OpenWindow(sURL,sTitle,sWidth,sHeight)
      {
         var str;
         var mvarURL;
         if (sURL.indexOf('dialogmodal')==-1 || sURL.indexOf('DVTEAM')>-1)
            {
               str = "height=" + sHeight + ",innerHeight=" + sHeight + ",width=" + sWidth + ",innerWidth=" + sWidth;
               if (window.screen) 
                  {
                     var ah = screen.availHeight - 50;
                     var aw = screen.availWidth - 10;
                     var xc = (aw - sWidth) / 2;
                     var yc = (ah - sHeight) / 2;
                     str += ",left=" + xc + ",screenX=" + xc;
                     str += ",top=" + yc + ",screenY=" + yc;
                  }
               str+=',dependent=yes,alwaysRaised=yes,scrollbars=no,status=no,resizable=yes,menubar=no';
               mvarURL=urlencodefull(sURL);
               window.open(mvarURL,sTitle,str);
            }
         else
            {
               OpenWindowModal(sURL,sTitle,sWidth,(sHeight+25));
            }
      }

   function OpenWindowModal(sURL,sTitle,sWidth,sHeight)
      {
         var vRet;
         var str;
         var mvarURL;
         str='help:no;status:no;dialogheight:'+ sHeight +'px;dialogwidth:' + sWidth + 'px;scroll:auto';
         mvarURL=urlencodefull(sURL);
         vRet=showModalDialog(mvarURL,0,str);
         return vRet;
      }

   function OpenWindowModalEX(pURL,pTitle,pWidth,pHeight,pConfirm)
      {
         var vRet;
         bOK=true;
         if (pConfirm==true)
            {
               bOK=confirm("Confirma la operación ?");
            }
         if (bOK==true)
            {
               vRet=OpenWindowModal(pURL,pTitle,pWidth,pHeight);
            }
         return vRet;
      }

   function attach(id)
      {
         var obj
         if(ns4) obj = document.layers[id];
         else if(ie4) obj = document.all[id];
         else if(ie5 || ns6) obj = document.getElementById(id);
         LastAttachedObject = obj;
      return obj
   }

   function hide_obj(id)
      {
         temp_Obj = attach(id);
         if(ns4) temp_Obj.visibility = "hide";
         else temp_Obj.style.visibility = "hidden";
      }

   function show_obj(id)
      {
         temp_Obj = attach(id);
         temp_Obj.zIndex=99;
         if(ns4) temp_Obj.visibility = "show";
         else temp_Obj.style.visibility = "visible"
      }

   function AttachObj(id)
      {
         var obj;
         if(NS4) obj = document.layers[id];
         else if(IE4) obj = document.all[id];
         else if(IE5 || NS6) obj = document.getElementById(id);
         return obj;
      }

   function HideObj(id)
      {
         var temp_Obj;
         temp_Obj = AttachObj(id);
         if(NS4) 
            {
               temp_Obj.visibility = "hide";
            }
         else
            {
               temp_Obj.style.visibility = "hidden";
            }
      }

   function ShowObj(id)
      {
         var temp_Obj;
         temp_Obj = AttachObj(id);
         if(NS4) 
            {
               temp_Obj.visibility = "show";
            }
         else
            {
               temp_Obj.style.visibility = "visible";
            }
      }
      
   function GoFirstPage()
      {
         with (window.document)
            {
               try
                  {
                     iLang=MenuR.lsidioma.options[MenuR.lsidioma.selectedIndex].value;
                  }
               catch(e)
                  {
                     iLang=iLangForced;
                  }
               ConfirmReserve_Send.action='http://www.interhabit.com/interhabit/index.asp?ID='+iLang;
               ConfirmReserve_Send.submit();
            }
      }
      
    function CloseForm() 
        {
        self.close();
        }

     function SearchFocus()
         {
            window.document.MenuR.Cadena.focus();
         }

     function GoSeek(i_lang)
        {
         with (window.document)
            {
       //        iZon=Menu.cboZona.options[Menu.cboZona.selectedIndex].value;
         //      iLoc=Menu.cboLocalidad.options[Menu.cboLocalidad.selectedIndex].value;
               iLang=MenuR.lsidioma.value;
//               iApp=Menu.cboApp.options[Menu.cboApp.selectedIndex].value;
               vCadena=Menu.Cadena.value;
               if (vCadena=='')
                  {
                     alert(sEmptyBusca);
                  }
               else
                  {
                     sURL=urlencodefull(consSiteIDURL4+'60'+iLang+'&cadena='+vCadena);
                     Menu.action=sURL;
                     Menu.submit();
                  }
            }
        }
        
     function DoEnter(event)
        {   
           var i=checkEnter(event);
           if (i)
              {
                 GoSeek();
              }
        };

   function ChangeOptions(lstPrimary, lstSecondary, strArray, strForm) 
      {
         var alen = eval(strArray + ".length")
         var listLen = 0;
         var strKey = eval("document." + strForm + lstPrimary + ".options[document." + strForm + lstPrimary + ".selectedIndex].value");
         eval("document." + strForm + lstSecondary + ".options.length = 0");
         for (var i = 0; i < alen; i++) 
            {
               if (eval(strArray + "[i][0] == " + strKey))
                  {
                     eval("document." + strForm + lstSecondary + ".options[listLen] = new Option(" + strArray + "[i][2], " + strArray + "[i][1])");
                     listLen = listLen + 1;
                  }
            }
         if (listLen > 0)
            {
               eval("document." + strForm + lstSecondary + ".options[0].selected = true");
            }
      }

//   function ChangeOptions2(lstPrimary,lstSecondary,strArray,strForm,bTodos,bNinguno,bOtro) 
      function ChangeOptions2(lstPrimary,lstSecondary,strArray,strForm,bTodos,bNinguno) 
      {
		 var alen=eval(strArray + ".length");
         var listLen=0;
         var strKey=eval("document."+strForm+lstPrimary+".options[document."+strForm+lstPrimary+".selectedIndex].value");
         eval("document."+strForm+lstSecondary+".options.length=0");
         for (var i=0;i<alen;i++) 
            {
               if (eval(strArray+"[i][0]=="+strKey))
                  {
                     eval("document."+strForm+lstSecondary+".options[listLen]=new Option("+strArray+"[i][2], "+strArray+"[i][1])");
                     listLen=(listLen+1);
                  }
            }
        // if (bOtro==true) {eval("document."+strForm+lstSecondary+".options[listLen]=new Option('[Otro]',0)")};
         if (bNinguno==true) {eval("document."+strForm+lstSecondary+".options[listLen]=new Option('[Ninguno]',0)")};		 
         if (bTodos==true) {eval("document."+strForm+lstSecondary+".options[listLen]=new Option('[Todos]',0)")};
         //if (bOtro==true) {eval("document."+strForm+lstSecondary+".value=0")};
		 if (bNinguno==true) {eval("document."+strForm+lstSecondary+".value=0")};
         if (bTodos==true) {eval("document."+strForm+lstSecondary+".value=0")};
         if (bNinguno==false && bTodos==false && listLen>0) {eval("document."+strForm+lstSecondary+".options[0].selected=true")};
		 AddPuntitos(lstSecondary);
		 if (lstPrimary=='id_pais' && lstSecondary=='id_provincia' )
		{
			hide_obj('txtOtraProvincia');
		}
		 
      }

	function GoModal(iLang) 
      {
         OpenWindow('dialogmodal.asp?SQLTypeExec=TRAPLOSTDATA&idioma='+iLang+'&SQL=traplostada','',450,250);
      }

    function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
    }

    function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
    }
    return null;
    }

    function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
    }

function isDate(dateStr) {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {
return false;
}

day = matchArray[1];
month = matchArray[3]; // p@rse date into variables
year = matchArray[5];

if (day < 1 || day > 31) {
return false;
}

if (month < 1 || month > 12) { // check month range
return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {
return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {
return false;
}
}
return true; // date is valid
}

   function ValidateToFromDates(fd,fh)
      {
         var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
         var matchArrayD = fd.match(datePat); // is the format ok?
         dayD = matchArrayD[1];
         monthD = matchArrayD[3]; // p@rse date into variables
         yearD = matchArrayD[5];
         var matchArrayH = fh.match(datePat); // is the format ok?
         dayH = matchArrayH[1];
         monthH = matchArrayH[3]; // p@rse date into variables
         yearH = matchArrayH[5];
         var dFD = new Date(yearD,monthD,dayD);
         var dFH = new Date(yearH,monthH,dayH);
         if (dFD>dFH) {return false} else {return true};
      }

   function check_date(field)
      {
         var checkstr = "0123456789";
         var DateField = field;
         var Datevalue = "";
         var DateTemp = "";
         var seperator = "/";
         var day;
         var month;
         var year;
         var leap = 0;
         var err = 0;
         var i;
         err = 0;
         DateValue = DateField.value;
         /* Delete all chars except 0..9 */
         if (DateValue.length==10)
            {
               for (i = 0; i < DateValue.length; i++) 
                  {
	                  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {DateTemp = DateTemp + DateValue.substr(i,1)};
                  }
               DateValue = DateTemp;
               /* Always change date to 8 digits - string*/
               /* if year is entered as 2-digit / always assume 20xx */
               if (DateValue.length == 6) {DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2)};
               if (DateValue.length != 8) {err = 19};
               /* year is wrong if year = 0000 */
               year = DateValue.substr(4,4);
               if (year == 0) {err = 20};
               /* Validation of month*/
               month = DateValue.substr(2,2);
               if ((month < 1) || (month > 12)) {err = 21};
               /* Validation of day*/
               day = DateValue.substr(0,2);
               if (day < 1) {err = 22};
               /* Validation leap-year / february / day */
               if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {leap = 1};
               if ((month == 2) && (leap == 1) && (day > 29)) {err = 23};
               if ((month == 2) && (leap != 1) && (day > 28)) {err = 24};
               /* Validation of other months */
               if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {err = 25};
               if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {err = 26};
               /* if 00 ist entered, no error, deleting the entry */
               if ((day == 0) && (month == 0) && (year == 00)) {err = 0; day = ""; month = ""; year = ""; seperator = ""};
               /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
               if (err == 0) 
                  {
                     DateField.value = day + seperator + month + seperator + year;
                     return true;
                  }
               /* Error-message if err != 0 */
               else 
                  {
                     alert("Fecha incorrecta!");
                     DateField.value='';
                     DateField.select();
	                  DateField.focus();
                     return false;
                  }
            }
      }

   function EvalDates(oDesde,oHasta)
      {
         bEval=check_date(oHasta);
         if (bEval==true)
            {
               bEval=ValidateToFromDates(oDesde.value,oHasta.value);
               if (bEval==false)
                  {
                     oDesde.value='';
                     oHasta.value='';
                     oDesde.select();
                     oDesde.focus();
                     alert('La fecha hasta debe ser mayor o igual a la fecha desde');
                  }
            }
         return bEval
      }

   function checkMail(x)
      {
	      var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	      if (filter.test(x)) {return true} else {return false};
      }
	  
	function GoModHome (iLang){ 
   			window.open('/interhabit/dialogm.asp?SQLTypeExec=TRAPLOSTDATA&idioma='+iLang+'&SQL=traplostada',"","width=450,height=250,scrollbars=NO") 
		} 
		
	function GoChange (iLang){ 
   		window.open('get_new_password.asp?idioma='+iLang+'',"","width=250,height=400,scrollbars=NO") 
	}
	
	function OpenList (sUrl){
			document.MenuL.action=sUrl;
			document.MenuL.target='blanco'
			document.MenuL.onsubmit=window.open('', 'blanco', "width=450,height=350,scrollbars=YES")
         	document.MenuL.submit();
         	
		} 
		
	function show_Div(sDiv) // recibe el nombre del div como cadena
	{
		var oObj=attach(sDiv);
		oObj.style.overflow='visible';
		oObj.style.height='auto';
		oObj.style.visibility='visible';
	}

	function hide_Div(sDiv) // recibe el nombre del div como cadena
	{
		var oObj=attach(sDiv);
		oObj.style.overflow='hidden';
		oObj.style.height='1px';
		oObj.style.visibility='hidden';
	}	
		
   function BringTop(oTop,iSecc,iSeccSitio)
	{
		if (iSecc==2 ||iSecc==3 || iSecc==9 || iSecc==10)
		{
			show_Div(oTop);
			switch (iSecc)
			{
				case 2,'2':
						show_Div('divFecha_Hasta');
						show_Div('divAdultos');
						show_Div('divNinos');
						show_Div('divHabitaciones');
						if (iSeccSitio==0)
						{
							hide_Div('selectorExcursion');
							hide_Div('selectorTransfer');
							hide_Div('selectorPaquete');
							show_Div('selectorHoteles');
						}
						else
						{
							show_Div('linkSearch');
						}
					break;
				case 3,'3':
						show_Div('divFecha_Hasta');
						show_Div('divAdultos');
						show_Div('divNinos');
						hide_Div('divHabitaciones');
						if (iSeccSitio==0)
						{
							hide_Div('selectorHoteles');
							hide_Div('selectorExcursion');
							hide_Div('selectorPaquete');
							show_Div('selectorTransfer');
						}
						else
						{
							show_Div('linkSearch');							
						}
						
					break;
				case 9,'9':
						show_Div('divFecha_Hasta');
						show_Div('divAdultos');
						show_Div('divNinos');
						hide_Div('divHabitaciones');

						if (iSeccSitio==0)
						{
							hide_Div('selectorHoteles');
							hide_Div('selectorTransfer');
							hide_Div('selectorPaquete');
							show_Div('selectorExcursion');
						}
						else
						{
							show_Div('linkSearch');							
						}

					break;
				case 10,'10':
						hide_Div('divFecha_Hasta');
						show_Div('divAdultos');
						show_Div('divNinos');
						hide_Div('divHabitaciones');				

						if (iSeccSitio==0)
						{
							hide_Div('selectorHoteles');
							hide_Div('selectorExcursion');
							hide_Div('selectorTransfer');
							show_Div('selectorPaquete');
						}
						else
						{
							show_Div('linkSearch');
						}

					break;
			}
		}
		else
		{
			hide_Div(oTop);
			if (iSeccSitio==1)
			{
				hide_Div('linkSearch');
			}
		}
	}
	
	function CheckData(iSecc,oDesde,oHasta,iHome)
	{
		var fecha;
		var lenFechaDesde=oDesde.value;
		var lenFechaHasta=oHasta.value;
		if (lenFechaDesde.length>0 && lenFechaHasta.length>0)
		{
			fecha=EvalDates(oDesde,oHasta);
		}
		if (fecha==true || lenFechaDesde.length<1 || lenFechaHasta.length<1)
		{
			if (iHome==1)
			{
				GoReserve(-3,iSecc);
			}
			else
			{
				GoTravel(2);			
			}
		}
	}
	
	function MyReservations(sUrl)
		{
			document.Reservas.action=sUrl;
			document.Reservas.submit()
		}
	function DoGo(sUrl)
	{
		document.location.href=sUrl;

	}
	
	function AddPuntitos(oObjeto)
	{
		var ctrl=attach(oObjeto);
		var nomObj= new Array();// ctrl.options;
		var idObj= new Array();// ctrl.options;	
		var cantidad=ctrl.options.length;
		var opt=ctrl.options;
		var i=0;
		for(i=0; i<cantidad; i++)
		{
			nomObj[i]=opt[i].text;
			idObj[i]=opt[i].value;		
			//document.write (idPais[i] + ' ' + nomPais[i] + '<br>');
		}
		ctrl.options.length = 0;
		var optNull = document.createElement('option');
		optNull.value = -1;
		var texto = document.createTextNode('[...]');
		optNull.appendChild(texto);
		ctrl.appendChild(optNull);
		
		texto='';
		for(i=0; i<cantidad; i++)
		{
			var optReload = document.createElement('option');
			optReload.value = idObj[i];
			texto = document.createTextNode(nomObj[i]);
			optReload.appendChild(texto);
			ctrl.appendChild(optReload);
			//document.write (opt[i].value + ' ' + opt[i].text + '<br>');
		}	
	}
