// Execute when DOM is ready

jQuery(document).ready(function() {
//	jQuery('#treemenu1 li ul').parents('li').addClass('sub');
});

jQuery(function(){

	// account sub menu
	jQuery('li.subroot ul').addClass('sub');
	var hover_config = {    
		sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
		interval: 100, // number = milliseconds for onMouseOver polling interval    
		over: showSub, // function = onMouseOver callback (REQUIRED)
		timeout: 200, // number = milliseconds delay before onMouseOut    
		out: hideSub // function = onMouseOut callback (REQUIRED)    
	};
	jQuery('ul.sub').parent().hoverIntent(hover_config);

	// fix links to named anchors when base href is used (static pages)
	if (jQuery('base').length) {
		jQuery('a[ href ^= "#" ]').each(function() {
			var href = window.location + jQuery(this).attr('href').replace('/#.*/i','');
			jQuery(this).attr('href',href);
		});
	}

});

function showSub() {
		jQuery(this).children('a:first').addClass('subhover');
//		jQuery('ul.sub').hide();
		jQuery(this).children('ul.sub').show(); 
//		jQuery(this).children('ul.sub').fadeIn('fast', function() { 
//			 if (!(jQuery.support.opacity)) 
//				 this.style.removeAttribute('filter'); 
//			});
	}
	
function hideSub() {
		jQuery(this).children('ul.sub').hide();
		jQuery(this).children('a:first').removeClass('subhover');
	}
	

////////////////////////////////////////////////

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html> */
(function(jQuery){jQuery.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=jQuery.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){jQuery(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;jQuery(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{jQuery(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);

/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * Copyright (c) 2008 Filament Group
--------------------------------------------------------------------*/
jQuery.fn.equalHeights=function(px){jQuery(this).each(function(){var currentTallest=0;jQuery(this).children().each(function(i){if(jQuery(this).height()>currentTallest){currentTallest=jQuery(this).height();}});if(!px||!Number.prototype.pxToEm)currentTallest=currentTallest.pxToEm();if(jQuery.browser.msie&&jQuery.browser.version==6.0){jQuery(this).children().css({'height':currentTallest});}
jQuery(this).children().css({'min-height':currentTallest});});return this;};
