﻿/**
* 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)
* @return    The object (aka "this") that called hoverIntent, and the event 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);

/*
 * Superfish v1.3.1 - jQuery menu widget
 *
 * Copyright (c) 2007 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 */

(function(jQuery){
	jQuery.fn.superfish = function(o){
		var jQuerysf = this,
			defaults = {
			hoverClass	: 'sfHover',
			pathClass	: 'overideThisToUse',
			delay		: 800,
			animation	: {opacity:'show'},
			speed		: 'normal'
		},
			over = function() {
				clearTimeout(this.sfTimer);
				clearTimeout(jQuerysf[0].sfTimer);
				jQuery(this)
				.showSuperfishUl()
				.siblings()
				.hideSuperfishUl();
			},
			out = function(){
				var jQueryjQuery = jQuery(this);
				if ( !jQueryjQuery.is('.'+o.bcClass) ) {
					this.sfTimer=setTimeout(function(){
						jQueryjQuery.hideSuperfishUl();
						if (!jQuery('.'+o.hoverClass,jQuerysf).length) { 
							over.call(jQuerycurrents.hideSuperfishUl());
						}
					},o.delay);
				}		
			};
		jQuery.fn.extend({
			hideSuperfishUl : function(){
				return this
					.removeClass(o.hoverClass)
					.find('ul:visible')
						.hide()
					.end();
			},
			showSuperfishUl : function(){
				return this
					.addClass(o.hoverClass)
					.find('>ul:hidden')
						.animate(o.animation,o.speed)
					.end();
			},
			applySuperfishHovers : function(){
				return this[(jQuery.fn.hoverIntent) ? 'hoverIntent' : 'hover'](over,out);
			}
		});
		o = jQuery.extend({bcClass:'sfbreadcrumb'},defaults,o || {});
		var jQuerycurrents = jQuery('li:has(ul)',this).filter('.'+o.pathClass);
		if (jQuerycurrents.length) {
			jQuerycurrents.each(function(){
				jQuery(this).removeClass(o.pathClass).addClass(o.hoverClass+' '+o.bcClass);
			});
		}
		var jQuerysfHovAr=jQuery('li:has(ul)',this)
			.applySuperfishHovers(over,out)
			.find('a').each(function(){
				var jQuerya = jQuery(this), jQueryli = jQuerya.parents('li');
				jQuerya.focus(function(){
					over.call(jQueryli);
					return false;
				}).blur(function(){
					jQueryli.removeClass(o.hoverClass);
				});
			})
			.end()
			.not('.'+o.bcClass)
				.hideSuperfishUl()
			.end();
		jQuery(window).unload(function(){
			jQuerysfHovAr.unbind('mouseover').unbind('mouseout');
		});
		return this.addClass('superfish').blur(function(){
			out.call(this);
		});
	};
})(jQuery);

/*
 * Initializes the superfish menu behavior on the top navigation menu
 */
function initializeMenu() {
    jQuery(".level0").superfish({
        pathClass : 'current',
        animation : {opacity:'show'},
        delay : 800
    });
}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();