window.onload = init; // call initialize function on window load
document.write("<link rel=\"shortcut icon\" href=\"http://www.foodberry.com/favicon.ico\" />");

 
// *****************************************
// Initialization
// *****************************************

function init() {

    // Preload Images    
    pic1 = new Image(88,39);
    pic2 = new Image(88,39); 
    pic1.src="http://www.foodberry.com/images/btn_topNav_brightYellow.gif"; 
    pic2.src="http://www.foodberry.com/images/btn_topNav_brightGreen.gif"; 

    
    // Event handlers
    document.getElementById("topNav1").onmouseover = mouseOverEffect;
    document.getElementById("topNav2").onmouseover = mouseOverEffect;
    document.getElementById("topNav3").onmouseover = mouseOverEffect;
    document.getElementById("topNav4").onmouseover = mouseOverEffect;
    document.getElementById("topNav5").onmouseover = mouseOverEffect;
    document.getElementById("topNav6").onmouseover = mouseOverEffect;
    document.getElementById("topNav7").onmouseover = mouseOverEffect;
    
    document.getElementById("topNav1").onmouseout = mouseOverEffect;
    document.getElementById("topNav2").onmouseout = mouseOverEffect;
    document.getElementById("topNav3").onmouseout = mouseOverEffect;
    document.getElementById("topNav4").onmouseout = mouseOverEffect;
    document.getElementById("topNav5").onmouseout = mouseOverEffect;
    document.getElementById("topNav6").onmouseout = mouseOverEffect;
    document.getElementById("topNav7").onmouseout = mouseOverEffect;            
         
    
}


// *****************************************
// Supporting Functions
// *****************************************


// Sets active section in top navigation menu
function setTopMenu(selected) {		
    document.getElementById("topNav"+selected).className = "selected";	 // change style of currently selected menu item
}


// On mouseOver, change element class (highlight top menu items on mouseover)
function mouseOverEffect() {
        if (this.className == "yellow") {
            this.className = "brightYellow";
        }
        else if (this.className == "brightYellow") {
            this.className = "yellow";
        }
        
        if (this.className == "green") {
            this.className = "brightGreen";
        }
        else if (this.className == "brightGreen") {
            this.className = "green";
        }
}



// Show Div
function showDiv(id) {
    document.getElementById(id).style.display = "block";
}

// Hide Div
function hideDiv(id) {    
    document.getElementById(id).style.display = "none";
}


// Search Event handlers
$(".search-input").focus(function() { if (this.value == this.title) { this.value = ""; } });
$(".search-input").blur(function() { if (this.value == "") { this.value = this.title; } });

