function popInnie(url)
{
  popWin(url,400,460);
}
function popTiny(url)
{
  popWin(url,200,300);
}
function popOut(url)
{
  popWin(url,650,400);
}
function popOut2(url)
{
  popWin2(url,650,400);
}
function popCal(url,fname)
{
  url +="?df="+fname;
  popWin(url,180,180);
}
function popWin(url,w,h)
{
 var win = window.open(url,"Pop","resizable,scrollbars,height="+h+",width="+w);
 win.focus();
}
function popWin2(url,w,h)
{
 var win = window.open(url,"Pop2","resizable,scrollbars,height="+h+",width="+w);
 win.focus();
}

function popUp_verisign(url) {
 sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
 //self.name = "mainWin";
}

function Jabba()
{
  alert("He he he");
}

function chDate(elem)
{
  var xdate;
  var thisyear;
  var arr_m;
  var arr_d;
  var arr_y;
  var arr_ms;
  var arr_m;
  var arr_d;
  var arr_y;
  var arr_ms;
  var night_ms;
  var tmp_year;

  this_year=(new Date()).getYear();
  if(this_year<1900)this_year+=1900; 

  night_ms=(document.forms['dateform'].nights.selectedIndex+1)*86400000;

  arr_m=document.forms['dateform'].month.selectedIndex;
  arr_d=document.forms['dateform'].day.selectedIndex+1;
  arr_y=this_year+document.forms['dateform'].year.selectedIndex;
  xdate=new Date(arr_y, arr_m, arr_d);
  arr_ms=xdate.getTime();

  dep_m=document.forms['dateform'].dep_month.selectedIndex;
  dep_d=document.forms['dateform'].dep_day.selectedIndex+1;
  dep_y=this_year+document.forms['dateform'].dep_year.selectedIndex;
  xdate=new Date(dep_y, dep_m, dep_d);
  dep_ms=xdate.getTime();


  switch(elem.name){
   case "month":
   case "day":
   case "year":
   case "nights":
               dep_ms=arr_ms+night_ms;
               break;
   case "dep_month":
   case "dep_day":
   case "dep_year":
               arr_ms=dep_ms-night_ms;
               break;
   }
   arrdate=new Date(arr_ms);
   depdate=new Date(dep_ms);

   document.forms['dateform'].month.selectedIndex = arrdate.getMonth();
   document.forms['dateform'].day.selectedIndex = arrdate.getDate()-1;
   tmp_year=arrdate.getYear(); if(tmp_year<1900)tmp_year+=1900; 
   document.forms['dateform'].year.selectedIndex =tmp_year-this_year;
  
   document.forms['dateform'].dep_month.selectedIndex = depdate.getMonth();
   document.forms['dateform'].dep_day.selectedIndex = depdate.getDate()-1;
   tmp_year=depdate.getYear(); if(tmp_year<1900)tmp_year+=1900; 
   document.forms['dateform'].dep_year.selectedIndex =tmp_year-this_year;
}

function canWeGoThereT(url,tier)
{
  var f=this.document.forms.dateform;
  f.tier.value=tier;
  canWeGoThere(url);
}
function canWeGoThereH(url,hnum)
{
  var f=this.document.forms.dateform;
  f.hnum.value=hnum;
  canWeGoThere(url);
}
function canWeGoThereHS(url,hnum,sid)
{
  var f=this.document.forms.dateform;
  f.hnum.value=hnum;
  f.siteid.value=sid;
  canWeGoThere(url);
}

function canWeGoThere(url)
{
  var f=this.document.forms.dateform;
  var y=f.year[f.year.selectedIndex].text;           
  var m=f.month[f.month.selectedIndex].value;        
  var d=f.day[f.day.selectedIndex].text;        
  var s=parseInt(f.nightstay[f.nightstay.selectedIndex].text);  //ABERN 07/26/2005 -- changed from [  var s=f.nightstay[f.nightstay.selectedIndex].text; ] 
                                                      //  to [  var s=parseInt(f.nightstay[f.nightstay.selectedIndex].text);]
  								//because the nightstay combo does not include the leading zeros.  That is why the condition
								// f.origdate.value==newdate is always true the 1st time.
  var p=f.pcod.value;

  var newdate=new String(y+m+d+s+p);
  var newdate2=new String(y+m+d+"0"+s+p); //ABERN 07/26/2005 -- newdate2 will handle nightstay with no leading zero.

  if( (f.origdate.value==newdate) || (f.origdate.value==newdate2) )
  {  /* ok, override the default form with the res form */        
      if(PageMode!=null){
        if(url.substring(0,5)=="https"){
          PageMode=1;
        }
      }
      f.action=url;                                               
      setTimeout('goThere()',500); 
      
  }                                                               
  else                                                            
  {  //ABERN 07/25/2005 -- commented-out.  Instead, just re-submitted the form to update f.origdate                                                             
     /*alert("The Availability does not match the\n date selected. "
           + " Click OK to requery.");*/
     f.submit();                                                     
  }                                                               
}
function goThere()
{
  var f=this.document.forms.dateform;
  f.submit();
}

function pickLocalDate(month,day,year){                              
var a;                                                               
 this.window.document.dateform.month.options[month-1].selected=true; 
 this.window.document.dateform.day.options[day-1].selected=true;     
 for(a=0;a<this.window.document.dateform.year.length;a++)            
  {                                                                  
    if( this.window.document.dateform.year[a].text==year)            
    {                                                                
      this.window.document.dateform.year.options[a].selected=true ;  
    }                                                                
  }                                                                  
}                                                                    
function popLurk(url)
{                                                                               
  if( (!document.cookie) || (document.cookie.indexOf("crushSatan=1")==-1)) 
  {
    w=window.open(url,'lurk','width=100,height=60');
    self.focus(); 
    w.moveBy(100,100);                                                            
  }
}                                                                               
