<!-- Javascript code for the button changes -->

if(document.images) {
    imgOn  = new Array(7);
    imgOff = new Array(7);

    for(var n=1;n<=7;n++) {
        imgOn[n] = new Image;
        imgOff[n]= new Image;
    }
        
        imgOn[1].src = "images/buttons/home-on.gif"
        imgOn[2].src = "images/buttons/tour-on.gif"
        imgOn[3].src = "images/buttons/rates-on.gif"
        imgOn[4].src = "images/buttons/activities-on.gif"
        imgOn[5].src = "images/buttons/directions-on.gif"
        imgOn[6].src = "images/buttons/pets-on.gif"
        imgOn[7].src = "images/buttons/contact-on.gif"

        imgOff[1].src = "images/buttons/home-off.gif"
        imgOff[2].src = "images/buttons/tour-off.gif"
        imgOff[3].src = "images/buttons/rates-off.gif"
        imgOff[4].src = "images/buttons/activities-off.gif"
        imgOff[5].src = "images/buttons/directions-off.gif"
        imgOff[6].src = "images/buttons/pets-off.gif"
        imgOff[7].src = "images/buttons/contact-off.gif"

        // Examine the pageTab variable and switch on the image
        // corresponding to the tab that the page falls under.
        imgOff[pageTab].src = imgOn[pageTab].src;

    function buttonOn(i) {
        if(document.images) document.images["xx" + i].src=imgOn[i].src;
    }

    function buttonOff(i) {
        if(document.images) document.images["xx" + i].src=imgOff[i].src;
    }
}               

function makeArray() {
     for (i = 0; i<makeArray.arguments.length; i++)
          this[i + 1] = makeArray.arguments[i];
}

function loadPage() {
    if (document.layers) {
            document.banner.visibility = 'hidden';
            document.banner.left = ((window.innerWidth-800)/2);
            document.banner.visibility = 'visible';
    }
        
    var months = new makeArray('January','February','March','April','May','June','July','August','September','October','November','December');

    var date = new Date();
    var day  = date.getDate();
    var month = date.getMonth() + 1;
    var yy = date.getYear();
    var year = (yy < 1000) ? yy + 1900 : yy;

        document.availability.monthselect.selectedIndex=month-1;
        document.availability.dayselect.selectedIndex=day-1;
        document.availability.yearselect.selectedIndex=year-2010;
        
}

var menuItems=new Array();

menuItems[2]='<div class="menuitems"><a href="tour_guest_index.shtml">Guest Rooms</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_dining.shtml">Dining Room</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_great.shtml">Great Room</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_exercise.shtml">Game Room &amp; Library</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_hottub.shtml">Hot Tub &amp; Sauna</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_condo.shtml">Slopeside Condo</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_extras.shtml">Extras</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_comments.shtml">Guest Comments</a></div>'
menuItems[2]+='<div class="menuitems"><a href="tour_gallery_index.shtml">Photo Gallery</a></div>'
menuItems[2]+='<div class="menuitems"><a target="other" href="brochure.shtml">Print Brochure</a></div>'

menuItems[3]='<div class="menuitems"><a href="rates_rates.shtml">Room Rates</a></div>'
menuItems[3]+='<div class="menuitems"><a href="rates_winterspecials.shtml">Winter Packages</a></div>'
menuItems[3]+='<div class="menuitems"><a href="rates_generalspecials.shtml">Summer Packages</a></div>'
menuItems[3]+='<div class="menuitems"><a href="rates_foliagespecials.shtml">Foliage Packages</a></div>'
menuItems[3]+='<div class="menuitems"><a href="rates_weddingspecials.shtml">Wedding Services</a></div>'
menuItems[3]+='<div class="menuitems"><a href="availability.shtml">Check Availability</a></div>'
menuItems[3]+='<div class="menuitems"><a href="rates_holidayschedule.shtml">Holiday Calendar</a></div>'
menuItems[3]+='<div class="menuitems"><a href="book_online.shtml">Book Online</a></div>'


menuItems[4]='<div class="menuitems"><a href="activities_winter.shtml">Winter</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_spring.shtml">Spring &amp; Summer</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_fall.shtml">Fall</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_anytime.shtml">Anytime</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_dining.shtml">Dining</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_winelist.shtml">Wine List</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_birding.shtml">Birdwatching</a></div>'
menuItems[4]+='<div class="menuitems"><a href="activities_events.shtml">Events</a></div>'

menuItems[7]='<div class="menuitems"><a href="contact_aboutus.shtml">About Us</a></div>'
menuItems[7]+='<div class="menuitems"><a href="contact_aboutourcats.shtml">About Our Cats</a></div>'
menuItems[7]+='<div class="menuitems"><a href="contact_contactus.shtml">Contact Us</a></div>'
menuItems[7]+='<div class="menuitems"><a href="availability.shtml">Check Availability</a></div>'
menuItems[7]+='<div class="menuitems"><a href="book_online.shtml">Book Online</a></div>'
menuItems[7]+='<div class="menuitems"><a target="other" href="brochure.shtml">Print Brochure</a></div>'

var buttonWidths=new Array();

buttonWidths[2]=51;
buttonWidths[3]=47;
buttonWidths[4]=51;
buttonWidths[5]=77;
buttonWidths[6]=84;
buttonWidths[7]=47;
buttonWidths[8]=77;

var ie4=document.all
var ns6=document.getElementById&&!document.all
var ns4=document.layers
var opera=navigator.userAgent.indexOf("Opera")!=-1

function showmenu (img,which) {
    if (!document.all&&!document.getElementById&&!document.layers)
        return;
        clearhidemenu();

    menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : "";
    menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj;

    var winWidth=ie4? document.body.clientWidth : window.innerWidth;
    var winLeftPos=((winWidth-800)/2)+326;
    var winTopPos=108;
        
        if (opera)
            winTopPos=105;
        
    // Determine where we're opening the submenu
    for (i=2; i<=img; i++) {
            winLeftPos+=buttonWidths[i];
    }

    winLeftPos=ie4? winLeftPos : winLeftPos-7;

    if (ie4||ns6)
        menuobj.innerHTML=which;
    else {
        which='<table border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"><tr><td><table border="0" cellspacing="0" cellpadding="2" bgcolor="#FCE7CC"><tr><td>'+which+'</td></tr></table></td></tr></table>';
        menuobj.document.write('<layer name=gui bgColor=#FCE7CC onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>');
        menuobj.document.close();
    }

    menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width;

    //Find out how close the mouse is to the corner of the window
    var rightedge=ie4? document.body.clientWidth-winLeftPos : window.innerWidth-winLeftPos;

    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<menuobj.contentwidth+10)
        //move the horizontal position of the menu to the left by it's width
        menuobj.thestyle.left=winLeftPos-(menuobj.contentwidth-buttonWidths[img+1]);
    else
        //position the horizontal position of the menu where the mouse was clicked
        menuobj.thestyle.left=winLeftPos;

    menuobj.thestyle.top=winTopPos;             
    menuobj.thestyle.visibility="visible";
    return false
}

function contains_ns6(a, b) {
    //Determines if 1 element in contained in another
    while (b.parentNode)
        if ((b = b.parentNode) == a)
            return true;
    return false;
}

function hidemenu(){
    if (window.menuobj)
        menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
}

function dynamichide(e){
    if (ie4&&!menuobj.contains(e.toElement))
        hidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
        hidemenu()
}

function delayhidemenu(){
    if (ie4||ns6||ns4)
        delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
    if (window.delayhide)
        clearTimeout(delayhide)
}

function highlightmenu(e,state){
    if (document.all)
        source_el=event.srcElement
    else if (document.getElementById)
        source_el=e.target
    if (source_el.className=="menuitems"){
        source_el.id=(state=="on")? "mouseoverstyle" : ""
    }
    else{
        while(source_el.id!="popmenu"){
            source_el=document.getElementById? source_el.parentNode : source_el.parentElement
            if (source_el.className=="menuitems"){
                source_el.id=(state=="on")? "mouseoverstyle" : ""
            }
        }
    }
}

if (ie4||ns6)
    document.onclick=hidemenu
	