var site = function() {
	this.nav = $('#menu');
	this.navLi = $('#menu li').children('ul').hide().end();
	this.init();
};

site.prototype = {
 	
 	init: function() {
 		this.setMenu();
 	},
 	
 	// Enables the slidedown menu, and adds support for IE6
 	setMenu: function() {
 	
		$.each(this.navLi, function() {
			// using the array indexer gives you a dom object back ( <span class="hasChildren"></span> )
			if ( $(this).children('ul')[0] ) {
				$(this)
					.append('<span />')
					.children('span')
						.addClass('hasChildren')
			}
		});
 	
 		this.navLi.hover(function() {
 			// mouseover
			$(this).find('> ul').stop(true, true).slideDown('slow');
 		}, function() {
 			// mouseout
 			$(this).find('> ul').stop(true, true).hide(); 		
		});
		
		
 		// hi-light the money saving link on the sidebar
	 	this.nav.hover(
		  function () {
			$('a.eco').css({"background-position":"-200px 0px"});
		  }, 
		  function () {
			$('a.eco').css({"background-position":"0px 0px"});
		  }
		);	
		$('a.eco').hover(
		  function () {
			$(this).css({"background-position":"-200px 0px"});
		  }, 
		  function () {
			$(this).css({"background-position":"0px 0px"});
		  }
		);	
 		
 	}
 
}

new site();
