(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);

$(function () {
	$('.dropdown').each(function () {
		$(this).parent().eq(0).hoverIntent({
			timeout: 100,
			over: function () {
				var current = $('.dropdown:eq(0)', this);
				current.slideDown(100);
				$(this).closest('li').toggleClass("highlight");
		},
			out: function () {
				var current = $('.dropdown:eq(0)', this);
				current.fadeOut(200);
				$(this).closest('li').toggleClass("highlight");
			}
		});
	}); 
});


$(document).ready(function() {
	setTimeout( function(){
		$('.entry:last-child .divider').css("display", "none");
	}, 500);
	
	$('.zip').closest('div').css({'width' : '20%', 'clear' : 'none'});
});




function ajaxRequest(directory, page){
	$('#ajaxCont *').fadeOut("slow");
	setTimeout( function(){
		$('#ajaxCont').css("display","none");
		$('#ajaxCont').load(directory+'/'+page+'.php');
		$('#ajaxCont').fadeIn("slow");
      }, 500);
}


function goToByScroll(id){
	setTimeout( function(){
		$('html,body').animate({scrollTop: $("#"+id).offset().top-14},'slow');
	}, 500);
}

function showTests(id, link){
	$(id).show("slow");
	$(link).hide("fast");
}

function hideTests(id, link){
	$('html, body').animate({
		scrollTop: '0px'
	},
	1000);

	$(id).hide("slow");
	$(link).show("fast");

}
