﻿// JScript File


var RISE = {}; // namespace  

//=============================================================================
// Allows you to start multiple functions with one windows.onload
RISE.starter = function () {
    RISE.calloutHover();
    RISE.googleAPI();
}


//==================================================================
// Function that highlights callout buttons on mouseover

RISE.calloutHover = function () {

    //detect browser:
    browserName = navigator.appName;
    browserVer = parseInt(navigator.appVersion);
    if (browserName == "Netscape" && browserVer >= 3) 
        browserVer = "1";
    else if (browserName == "Microsoft Internet Explorer" && browserVer == 4) 
        browserVer = "1";
    else browserVer = "2";

    // Define and preload both active and inactive link images:
    if (browserVer == 1) 
    {
        home_off = new Image(208,27);
        home_off.src = "../media/images/buttons/nav_home.png";
        home_on = new Image(208,27);
        home_on.src = "../media/images/buttons/active_home.png";
        
        info_off= new Image(210,30);
        info_off.src = "../media/images/buttons/nav_information.png";
        info_on = new Image(210,30);
        info_on.src = "../media/images/buttons/active_information.png";
        
        menus_off = new Image(211,32);
        menus_off.src = "../media/images/buttons/nav_menus.png";
        menus_on = new Image(211,32);
        menus_on.src = "../media/images/buttons/active_menus.png";
        
        events_off= new Image(209,32);
        events_off.src = "../media/images/buttons/nav_events.png";
        events_on = new Image(209,32);
        events_on.src = "../media/images/buttons/active_events.png";
        
        reserve_off= new Image(210,35);
        reserve_off.src = "../media/images/buttons/nav_reservations.png";
        reserve_on = new Image(210,35);
        reserve_on.src = "../media/images/buttons/active_reservations.png";
    }
}


//=================================================================================
RISE.googleAPI = function () {
    if (GBrowserIsCompatible()) 
    {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(33.760901, -84.395612), 15);
        
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());

        var point = new GLatLng(33.760901, -84.395612);
        map.addOverlay(new GMarker(point));
    }
}



//=================================================================================
//image swapping function:

function hiLite(imgDocID, imgObjName) 
{
    if (browserVer == 1) 
    {
        document.images[imgDocID].src = eval(imgObjName + ".src");
    }
}




//=================================================================================
// Dropdown menu Functions  (flyout.js)

var DDSPEED = 10;
var DDTIMER = 15;
var OFFSET = -1;
var ZINT = 100;

function ddMenu(id,d)
{
    var h = document.getElementById(id + '-ddheader');
    var c = document.getElementById(id + '-ddcontent');
    clearInterval(c.timer);
    
    if (d == 1)  /* on MouseOver */
    {
        clearTimeout(h.timer);
        c.style.display = 'block';
        
        if(c.maxh && c.maxh <= c.offsetHeight)
            return
        else if(!c.maxh)
        {
            c.style.left = (h.offsetWidth + OFFSET) + 'px';
            c.style.height = 'auto';
            c.maxh = c.offsetHeight;
            c.style.height = '0px';
        }
        
        ZINT = ZINT + 1;
        c.style.zIndex = ZINT;
        c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
    }
    else  /* is MouseOut! */
    {
        h.timer = setTimeout(function(){ddCollapse(c)},250);
    }
}


//========================
function ddCollapse(c)
{
    c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}


//========================
function cancelHide(id)
{
    var h = document.getElementById(id + '-ddheader');
    var c = document.getElementById(id + '-ddcontent');
    
    clearTimeout(h.timer);
    clearInterval(c.timer);
    
    if(c.offsetHeight < c.maxh)
        c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
}


//=========================
function ddSlide(c,d)
{
    var currh = c.offsetHeight;
    var dist;
    
    if (d == 1)
        dist = Math.round((c.maxh - currh) / DDSPEED);
    else
        dist = Math.round(currh / DDSPEED);

    if (dist <= 1 && d == 1)
        dist = 1;

    c.style.height = currh + (dist * d) + 'px';
    c.style.opacity = currh / c.maxh;
    c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
    
    if(currh > (c.maxh - 2) && d == 1)
        clearInterval(c.timer);
    else if (dist < 1 && d != 1)
    {
        clearInterval(c.timer);
        c.style.display = 'none';
    }
}




//=================================================================
// Function that starts it all

window.onload = RISE.starter;





