(function($) {
	$(document).ready(function() {	
		
		var $uls = $("#topnav-middle ul li");
		
		$uls.hover(function() {
			// on state
			$('ul', this).stop().animate({ opacity : 0.95 }, 350);	
		}, function() {
			// off state
			$('ul', this).stop().animate({ opacity : 0 }, 350);		
		});
		
		// logo link
		$("#logo").css({ cursor: 'pointer' }).click(function() {
			window.location = $('a', this).attr('href');
		});
		// email link
		$("#topnav-email").css({ cursor: 'pointer' }).click(function() {
			window.location = 'mailto:info@bennethomeimprovement.com';
		});
		
		// home modules

		$("#home-module1").css({ cursor: 'pointer' }).click(function() {
			window.location = '/about-us/';
		});
		$("#home-module2").css({ cursor: 'pointer' }).click(function() {
			window.location = '/services/';
		});
		$("#home-module3").css({ cursor: 'pointer' }).click(function() {
			window.location = '/contact-us/';
		});
		
/*
		
			
		function includeCSS(p_file) {
			var v_css  = document.createElement('link');
			v_css.rel = 'stylesheet'
			v_css.type = 'text/css';
			v_css.href = p_file;
			document.getElementsByTagName('head')[0].appendChild(v_css);
		}
		
		var ct = new Date();			// new current time object
		var ch = ct.getHours();			// current hours	
		
		
		
		// daytime: returns 0 if morning, 1 if afternoon, 2 if evening
		function daytime() {
			if (ch >= 17 || ch < 4)  return 2; 
			if (ch >= 13 || ch < 17)  return 1; 
			if (ch >= 4 || ch < 13) return 0;

		}	
		
		if(daytime()==0) {
			includeCSS("http://scddev.com/wp-content/themes/bennett/css/morning.css");
		}
		if(daytime()==1) {
			includeCSS("http://scddev.com/wp-content/themes/bennett/css/afternoon.css");
		}
		if(daytime()==2) {
			includeCSS("http://scddev.com/wp-content/themes/bennett/css/evening.css");
		} 
*/

		
	});
})(jQuery);
