

$(document).ready(function(){
	$('#nav li').has('ul').addClass("submenu");
	$('#sidebar_nav li').has('ul').addClass("submenu");
	
	var config = {    
     sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
     interval: 0, // number = milliseconds for onMouseOver polling interval    
     over: addingClass, // function = onMouseOver callback (REQUIRED)    
     timeout: 300, // number = milliseconds delay before onMouseOut    
     out: removingClass // function = onMouseOut callback (REQUIRED)    
	};
	
	$('#nav .submenu').hoverIntent( config );
	$('#sidebar_nav .submenu').hoverIntent( config );
	
	var youtube = $(".youtube_content").height();
	if (youtube > 0) {
		var margin_top = youtube + 30;
		$("#right_sidebar").css("margin-top",margin_top+"px");
	}
	
	$('#featured_boxes a').each(function(index) {
    var title =  $(this).attr('title');
		var h1 = $(this).text();
		$(this).html('<span class="featured_header">'+h1+'</span><span class="featured_content">'+title+'</span>');
  });
	
	$('#featured_boxes li:eq(0) a').css("background-position", "0px 0px");
	$('#featured_boxes li:eq(1) a').css("background-position", "0px -65px");
	$('#featured_boxes li:eq(2) a').css("background-position", "0px -130px");
	$('#featured_boxes li:eq(0) a').hover(
		function () {
			$(this).css("background-position", "-275px 0px");
		}, 
		function () {
			$(this).css("background-position", "0px 0px");
		}
	);
	$('#featured_boxes li:eq(1) a').hover(
		function () {
			$(this).css("background-position", "-275px -65px");
		}, 
		function () {
			$(this).css("background-position", "0px -65px");
		}
	);
	$('#featured_boxes li:eq(2) a').hover(
		function () {
			$(this).css("background-position", "-275px -130px");
		}, 
		function () {
			$(this).css("background-position", "0px -130px");
		}
	);

});

jQuery.preLoadImages("/tulsa-lawncare/images/navigation/sidebar_nav_submenu_over.png", "/tulsa-lawncare/images/feature_boxes/featured_box_over.gif", "/tulsa-lawncare/images/navigation/nav_submenu_over.png","/tulsa-lawncare/images/navigation/nav_dropdown_bkgnd.png","/images/navigation/sidebar_nav_slideout_bkgnd.png");


function addingClass(){  $(this).addClass("hovered");}
function removingClass(){ $(this).removeClass("hovered");}


