var site = function() {
	this.navLi = $('#nav li').children('ul').hide().end();
	this.mainLi = $('#nav > li');
	this.init();
};

site.prototype = {
 	
 	init : function() {		
		this.setMenu();
		this.setCorners();
 	},
 	
    setCorners : function(){
		this.navLi.find('> ul').corner('4px');
	},
 	// Enables the slidedown menu, and adds support for IE6
 	
 	setMenu : function() {
 	
 	$.each(this.navLi, function() {
 		if ( $(this).children('ul')[0] ) {
 			$(this)
 				.append('<span />')
 				.children('span')
 					.addClass('hasChildren')
 		}
 	});
 	
 		this.navLi.hover(function() {
 			// mouseover
			$(this).find('> ul').stop(true, true).slideDown('fast');
			
 		}, function() {
 			// mouseout
 			$(this).find('> ul').stop(true, true).hide(); 	
		});
		
		var info;
		
		this.mainLi.hover(function(){
			info = $(this).css('background');
			$(this).children('ul').find('.hasChildren').show();
			$(this).find('> a').css('background', '#616161');
		}, function(){
			$(this).find('> a').css('background', info);
			$(this).find('.hasChildren ').hide();
		});
 		
 	}
 
}


new site();

