$(document).ready(function(){
$('#recent_tabs div.recent_tab').hide(); // Hide all recent tab divs
$('#recent_tabs div:first').show(); // Show the first div
$('#recent_tabs ul li:first').addClass('active'); // Set the class of the first link to active
$('#recent_tabs ul li a').click(function(){ //When any link is clicked
$('#recent_tabs ul li').removeClass('active'); // Remove active class from all links
$('.recent_tab div').removeClass('blurbwrap_current blurbpanel_current'); 
$(this).parent().addClass('active'); //Set clicked link class to active
var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
var currentContainer = $(this).attr('title'); 
$('#recent_tabs').removeClass();
$('#recent_tabs div.recent_tab').hide(); // Hide all recent tab divs
$('#recent_tabs').addClass(currentContainer);
$(currentTab).show(); // Show div with id equal to variable currentTab
if (currentContainer == 'second') {
	$('#recent_two .blurbwrap').addClass('blurbwrap_current');
	$('#recent_two .blurbpanel').addClass('blurbpanel_current');
    }
else if (currentContainer == 'third') 	{
	$('#recent_three .blurbwrap').addClass('blurbwrap_current');
	$('#recent_three .blurbpanel').addClass('blurbpanel_current');
	}
else {
	$('#recent_one .blurbwrap').addClass('blurbwrap_current');
	$('#recent_one .blurbpanel').addClass('blurbpanel_current');
	};
blurbslide();
return false;
});
});

$(document).ready(function(){
blurbslide();
});

var blurbslide = (function() {
	 var blurbWrap = $(".blurbwrap_current");
	 var blurbHeight = $(".blurbwrap_current").height();
	 var blurbPanel = $(".blurbpanel_curent");
	 var blurbPanelHeight = $(".blurbpanel_current").height();	 
	 $(".recent_tab").hoverIntent(
	 function() {
	 	blurbWrap.animate({
	 	marginTop: 349 - blurbHeight - blurbPanelHeight,
	 	height: 24 + blurbHeight + blurbPanelHeight
	 }, 800);
	 },
	 function() {
	 	blurbWrap.animate({
	 	marginTop: 349,
	 	height: 24
	 }, 500);
	 }
	); 
});

// hoverIntent plugin: improves jquery's default hover method by waiting till mouse cursor slows down before firing event

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);


var helpNudgeIn = (function () {
    $(this).find(".sidehelp").animate({left: "480", backgroundColor: "#ffffc8"}, "slow");
});

var helpNudgeOut = (function () {
    $(this).find(".sidehelp").animate({left: "500", backgroundColor: "#fff"}, 100);
});

var hoverConfig = {    
     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
     interval: 100, // number = milliseconds for onMouseOver polling interval    
     over: helpNudgeIn, // function = onMouseOver callback (REQUIRED)    
     timeout: 1000, // number = milliseconds delay before onMouseOut    
     out: helpNudgeOut // function = onMouseOut callback (REQUIRED)    
};


