var g_requestType;

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) {
  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() {
  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 writeTodaysDate() {
    var dateStamp = new Date();
    var dateDay = dateStamp.getDay();
    var arDays = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    var arMonths = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    
    document.write(arDays[dateDay] + ', ' + arMonths[(dateStamp.getMonth())] + ', ' + dateStamp.getDate() + ', ' +dateStamp.getFullYear());
}

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
  
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
    
}

function doLogin()
{
    document.frmLogin.submit();
};

function changeRequestFormDisplay(requestType)
{ 
  if (document.frmRequest.radRequestType)
  {
    if (requestType != ''){
      g_requestType = requestType;    
      if (requestType == 'regularRequest'){         
        document.getElementById('returnOnDate').style.display = 'block';      
        document.getElementById('returnOnText').style.display = 'block';  
        
        document.getElementById('multiCity').style.display = 'none';
        document.frmRequest.radRequestType[0].checked = true;
      }
      else if (requestType == 'multicityRequest'){
        document.getElementById('depCity').style.display = 'none'; 
        document.getElementById('returnOnText').style.display = 'none';  
        
        if (document.frmGui.txtDepartOn2) document.frmGui.txtDepartOn2.value = document.frmGui.txtReturnOn.value;		    
              
        document.getElementById('multiCity').style.display = 'block';
        document.frmRequest.radRequestType[1].checked = true;
      };
      
      createCookie('requestType',requestType,0,20);    
    }
    else
    {       
      var cookieValue = readCookie('requestType');
      
      if (cookieValue == null){                            
        changeRequestDisplay('regularRequest');      
      }
      else 
      {    
        changeRequestDisplay(cookieValue);     
        
      };
    };
  };
};