function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

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;
}

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 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 showMenu() {
    var x = findPosX(document.getElementById('bookNowURL'))-120;
    var y = findPosY(document.getElementById('bookNowURL'))-150;

    //r = document.getElementById('ratesParent');
    r = document.getElementById('resFormContainer');
    r.style.top = y+'px';
    r.style.left = x+'px';

    formOutMenu.showMenu('resForm');
}

function showdiv(sid, id) {
    var so = document.getElementById(sid);
    var o = document.getElementById(id);

    if (o != null) {
        var x = findPosX(so); 
        var y = findPosY(so)+60; 

        o.style.left = x+'px';
        o.style.top = y+'px';
        o.style.display = "";
    }
}

function hidediv(id) {
    var o = document.getElementById(id);
    if (o != null) {
        o.style.display = "none";
    }
}
function upclock(){ 
    var dte = new Date();
    var hrs = dte.getHours();
    var min = dte.getMinutes(); 
    var sec = dte.getSeconds();
    var col = ":";
    var spc = " ";
    var apm;
    
    if (12 < hrs) { 
    apm="pm";
    hrs-=12;
    }

    else {
    apm="am";
    }

    if (hrs == 0) hrs=12;
    if (min<=9) min="0"+min;
    if (sec<=9) sec="0"+sec;
    
    if(navigator.appName == "Netscape") {
    clock = document.getElementById('clock');
    clock.innerHTML = hrs+col+min+col+sec+spc+apm;
    //document.clock.document.write(hrs+col+min+col+sec+spc+apm);
    //document.clock.document.close();
    }

    if (navigator.appVersion.indexOf("MSIE") != -1){
    clock.innerHTML = hrs+col+min+col+sec+spc+apm;
    }
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//use this to reload form security image - securityCodeDiv is div id
var cakeGlobalSecurityImageSeq = Math.floor(Math.random()*50000);
function reloadSecurityCode(style) {
    var obj = document.getElementById('securityCodeDiv');
    var txt = '<img src="/getImage/formCode/180/35/' + cakeGlobalSecurityImageSeq;
        txt+= '/code.gif" title="please type text from this image to field below" alt="" style="'+style+'">';
    obj.innerHTML = txt;
    cakeGlobalSecurityImageSeq++;
}

function show_popup(what, w, h)
{
        w=window.open(what,"Image","width=" + w + ",height=" + h + ",scrollbars=YES,resizable=YES",1);
}

