// hoverIntent plugin
(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);

// Preloading images
jQuery.preloadImages = function() {   
     for(var i = 0; i<arguments.length; i++)   
    {
          jQuery("<img>").attr("src", arguments[i]);   
    } 
}
$.preloadImages("../Images/IHSGlobal/fairplaydropdown_2col.png", "../Images/IHSGlobal/ihsdropdown_2col.png");
// Preload images for IE6
if ($.browser.msie && $.browser.version.substr(0,1)<7) {
    $.preloadImages("../Images/IHSGlobal/ie6_fairplaydropdown1.png", "../Images/IHSGlobal/ie6_ihsdropdown1.png", "../Images/ie6_dropdown2.png", "../Images/IHSGlobal/ie6_dropdown3.png");	
};

//click code
function FPdropdownClickShow() { $('#FairplayDropdown').show(); $('#IHSDropdown').hide(); }
function FPdropdownClickHide() { $('#FairplayDropdown').hide(); }
function IHSdropdownClickShow() { $('#IHSDropdown').show(); $('#FairplayDropdown').hide(); }
function IHSdropdownClickHide() { $('#IHSDropdown').hide(); }
// Primary Navigation dropdown code
function FPdropdownShow(){ $('#FairplayDropdown').fadeIn(150);$('#IHSDropdown').fadeOut(150);}
function FPdropdownHide(){ $('#FairplayDropdown').fadeOut(150);}
function FPdropdownShowIE(){ $('#FairplayDropdown').show();$('#IHSDropdown').hide();}
function FPdropdownHideIE(){ $('#FairplayDropdown').hide();}
function IHSdropdownShow(){ $('#IHSDropdown').fadeIn(150);$('#FairplayDropdown').fadeOut(150);}
function IHSdropdownHide(){ $('#IHSDropdown').fadeOut(150);}
function IHSdropdownShowIE(){ $('#IHSDropdown').show();$('#FairplayDropdown').hide();}
function IHSdropdownHideIE(){ $('#IHSDropdown').hide();}
$(function(){
$('#FairplayDropdown ul').wrapAll('<span class="ie6fix" />');
$('#IHSDropdown ul').wrapAll('<span class="ie6fix" />');
if(jQuery.support.leadingWhitespace) {
  $('#fairplaytab').hoverIntent({
				over: FPdropdownShow, 
				timeout: 400, 
				out: FPdropdownHide
			});
  $('#ihstab').hoverIntent({
				over: IHSdropdownShow, 
				timeout: 400, 
				out: IHSdropdownHide
			});
} else {
  $('#fairplaytab').hoverIntent({
				over: FPdropdownShowIE, 
				timeout: 400, 
				out: FPdropdownHideIE
			});
  $('#ihstab').hoverIntent({
				over: IHSdropdownShowIE, 
				timeout: 400, 
				out: IHSdropdownHideIE
			});
}
});

// More Link - Add >> text
$(document).ready(function(){
	$("a.more").append('<span>&raquo;</span>');
});

// Focus input box with class=focus
$(document).ready(function(){
	$("input.focus").focus();
});
