/*********************/
/* Header Javascript */
/*********************/

/* drop menus */

var menu = new function(){

  this.setup = function( id ){
    var $menu = $('#menu-'+id);
    
    $menu.hover(function(){
      $(this)
      	.find('img').attr('src', eSiteImgDir + '/header/dropmenus/' + id + '-rolled.gif').end()
      	.find('.entries').show();
    },function(){
      $(this)
      	.find('img').attr('src', eSiteImgDir + '/header/dropmenus/' + id + '-normal.gif').end()
       	.find('.entries').hide();
    });
    
    $menu.find('.entry a').hover(function(){
      $(this).parent().addClass('hover');
    },function(){
      $(this).parent().removeClass('hover');
    });
    
    $.preload(eSiteImgDir + '/header/dropmenus/' + id + '-rolled.gif'); 
  };
  
  // add a hidden iframe behind the menu to stop the bleeding through of select boxes in IE6
  this.ie6hack = function()
  {
  	 try
  	 {
	  	 if ($.browser.msie && $.browser.version==="6.0")
	  	 {
	  		$('#header .menu .entries').bgiframe();
	  	 }
	 }
	 catch(e){}
  }
};

var miniCart = new function(){

	var $mini_cart, $drop_down;
	
	this.init = function(){$mini_cart = $("#minicart");}
	
	this.set = function(content)
	{
		$mini_cart.html(content);
		
		$drop_down = $("#minicart .dropdown");
	};
	
	this.open = function()
	{
		$drop_down.bgiframe().show("slide", { direction: "up" }, 1000);
	};
	
	this.close = function()
	{
		$drop_down.hide("slide", { direction: "up" }, 1000);
	};
};

//Popup Paths - copied over from topnav.js - 
// TODO: need to find a better way
var popupPathSHIP = "view____popup-detailsSHIP.html?dispHeadFoot=false";

 /* Add the window open to the bill me later image */
$(function(){
  $('#footer .partners .billmelater a')
    .click(function(){
      window.open(
        $(this).attr('href'),
        "billmelater",
        "status=0,toolbar=0,menubar=0,directories=0,resizeable=0,scrollbars=1,height=500,width=505"
      );
      return false;
    });
});
