$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover( 
	function() { $(this).addClass(c);  },
	function() { $(this).removeClass(c); }
	);
	});
};
	
//JCAROUSEL
function mycarousel_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

//NEWS STORY HIGHLIGHTING
$(function()
	{
		$(".listing").hover(
		function()
	{
	$(this).addClass("listingHighlight");
	},
		function()
	{
	$(this).removeClass("listingHighlight");
	})
})
	
$(document).ready(function(){
	
	var megaConfig = 
    {       
        interval: 100,      //time in milliseconds for mouse position check
        sensitivity: 4,     //mouse movement in pixels
        over: addMega,      //called when the mouse hovers
        timeout: 200,       //time to wait before performing the mouseout
        out: removeMega     //called when the mouse leaves
    }; 
          
    function addMega()
    {   
        $(this).addClass("clsMenuHover");   
    }   
       
    function removeMega()
    {   
        $(this).removeClass("clsMenuHover");   
    }
	
    //Set the drop down menu up
	$("li.clsMegaMenu").hoverIntent(megaConfig);
	
	jQuery(document).ready(function() {
	jQuery('#mycarousel').jcarousel({
		auto: 2,
		wrap: 'last',
		initCallback: mycarousel_initCallback
	});
	});

	// news story clickable
	/*$("#mainContent div.listing").click(function(){
	window.location=$(this).find("a").attr("href");return false;
	});*/
				
});

