function initNav()
{
	var nav = document.getElementById("main-nav");
	if(nav)
	{
		$(".drop-down").css({"opacity": 0, "display": "none", "visibility": "visible"});
		var lis = $("#main-nav li.item");
		$(lis).each(function(el)
		{
			 $(lis[el]).hover(
				function () {
					$(this).addClass("hover");
					var drop = this.getElementsByTagName("div").item(0);
					$(drop).css({"display": "block"});
					$(drop).animate({"opacity": 1}, 300);
				}, 
				function () {
					$(this).removeClass("hover");
					var drop = this.getElementsByTagName("div").item(0);
					$(drop).animate({"opacity": 0}, 300, function() {$(drop).css({"display": "none", "opacity": 0});});
				}
			);
		});
	}
}
$(document).ready(function()
{
	initNav();
});

function showFreeShipPopup() {
    var body = '<div id="ship_panel" style="padding-left:345px;padding-top:10px;"><img src="/images/homepage/images/shipping-banner.jpg" usemap="#PopupMap" border="none"></div>';
    
    shipPanel = new YAHOO.widget.Panel("ship_panel", {
                        width:"286px",
                        height:"181px",
                        constraintoviewport: true,
                        underlay:"none",
                        close:false,
                        visible:false,
                        draggable:false,
                        modal: true
                    });
    shipPanel.setBody(body);

    shipPanel.render(document.getElementById('header'));
    shipPanel.show();
}

function hideFreeShipPopup() {
    shipPanel.hide(true);
}

/**
 * This function is called when enter key is typed in the "become an insider" textbox.
 * calls the fucntion adventure.submitForm using the textbox value.
 */
function enterPressed(myfield,e) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13){
        adventure.submitForm(document.getElementById('header_email_signup').value,
            'name', null, null, null, null, null, null, '');
        return false;
    } else {
        return true;
    }
}