 /**
* 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);// End hoverIntent
  var obj = null;

  function checkHover() {
      if (obj) {
         obj.find('ul').fadeOut('medium');
		
		 obj.find('.TopMenuLink  span').css({ "padding-bottom:":"6px" });
      } //if
  } //checkHover


		 

	
function TrackVideo(Event, videoID, Name, Category, Pauses, isFullscreen) {
	//Events: "start", "milestone" or "complete".  Required.
	//videoID, Name and Category should be passed in flashvars or xml data.  If they are not defined then default values will be used.
	//Pauses = Optional.  Number of times the video has been paused since last milestone.
	//isFullscreen = Optional, 0 or 1.  Set to 1 if video is in fullscreen mode.
	if (typeof videoID == "undefined") {
		videoID = "0";
	}
	if (typeof Name == "undefined") {
		Name = "Unnamed Store Video"; //Default value for site
	}		
	if (typeof Category == "undefined") {
		Category = "Store Video Preview"; //Default value for site
	}
	if (typeof Pauses == "undefined") {
		Pauses = 0;
	}
	if (typeof isFullscreen == "undefined") {
		isFullscreen = 0;
	}
	var viewmode = "embedded";
	if (isFullscreen == 1) {viewmode = "fullscreen";}
	
	var events = "event14";
	var linktrackvars = "events,";
	var eventName = "Video Milestone Event";
	if (Event == "start") {
		events = "event12";
		eventName = "Video Start";
	}
	else if (Event == "complete") {
		events = "event13, event8";
		linktrackvars = linktrackvars.concat("products,");
		eventName = "Video Complete";
	}
	else {linktrackvars = linktrackvars.concat("products,");}
	
	linktrackvars = linktrackvars.concat("prop39,prop6,prop39,eVar39,prop10,eVar30,eVar6,eVar10,eVar31,eVar32,eVar33,eVar34,eVar35,eVar36,eVar47");
	
	var s_account="comcastexercisetvdev";//set Omniture report account to use
	var loc=document.location.toString();
	if (loc.indexOf("www.exercisetv.tv") >= 0 || loc.indexOf("//exercisetv.tv") >= 0 || loc.indexOf("2www.exercisetv.tv") >= 0)
	{
	s_account="comcastexercisetv";; //comcastondemand not ready yet
	// s_account="comcastexercisetv,comcastondemand";;
	}
	var s=s_gi(s_account);
	s.linkTrackVars=linktrackvars;
	s.linkTrackEvents=events;
	
	s.events=events;
	s.eVar39 = videoID;
	s.prop39=s.eVar30= Name;
	s.prop6=s.eVar6= Category; 
	s.prop10=s.eVar10= viewmode; //possible values are embedded and fullscreen

	if (Event == "milestone" || Event == "complete") {
		if (Pauses > 0) {
			s.products=";;;;event14=25.00|event8=" + Pauses.toString(); ////25% since last milestone | # of pauses between each milestone
		}
		else {
			s.products=";;;;event14=25.00"; ////25% since last milestone	
		}
	}
	s.tl(document.URL,'o', eventName);
	//clear vars
	s.events=s.products=s.eVar8=s.eVar39 = s.prop39=s.eVar30=s.prop6=s.eVar6= s.prop10=s.eVar10="";
}
		



function hidemenu(){
	if (!menuOn)
	{
		$('.subnav .center > li:not(.current)').removeClass('active');
		$('.menudropdowns > div:visible').fadeOut('medium',function(){menuDD=null;});
	}
}


//DOCUMENT READY
		 
$(document).ready(function(){

	menuOn=false;
	$('.subnav li,.menudropdowns > div').hoverIntent(function() {
		menuOn=true;
		if($(this).is('li'))
		{
			menuLI = $(this);
			if($(this).find('a.ddhover').length==1)
				menuDDnew = $($(this).find('a.ddhover').attr('href'));
			else menuDDnew= null;
		}
		else
		{
			menuDDnew =  $(this);
			menuLI=$('a.ddhover').filter(function() {return $(this).attr('href').substring(1) == menuDDnew.attr('id');}).closest('li');
		}
         if (typeof menuDD != "undefined" && menuDD && (menuDDnew == null || menuDD.attr('id') != menuDDnew.attr('id'))) 
		{
            menuDD.fadeOut('fast');
        } 
		menuDD = menuDDnew;
		$('.subnav .center > li').not(menuLI).not('.current').removeClass('active');
		menuLI.addClass('active');
		
		//positioning
// && (menuDD.offset().left==0 || menuDD.offset().left == null)
		if (menuDD!=null)
		{
			mainoffset = menuLI.closest('.center').offset();
			mainwidth= menuLI.closest('.center').outerWidth();
			offset=menuLI.offset();
			menuwidth=menuLI.outerWidth();
			
			//menuDD.css("top", offset.top + menuLI.outerHeight() );			
			offtop = offset.top + menuLI.outerHeight();
			if ( offset.left + menuwidth > mainoffset + mainwidth )
			{
			    offleft = offset.left +  menuwidth - menuDD.outerWidth();
				//menuDD.css("margin-left", offset.left +  menuwidth - menuDD.outerWidth() );
			}
				
			else
			{
			    offleft = offset.left
				//menuDD.css("margin-left",offset.left);
			}
			//alert(offleft);
			//menuDD.animate({marginLeft: offleft}, 100);
			menuDD.offset({left:offleft,top:offtop});
		}
		if (menuDD!=null)
			menuDD.fadeIn('fast');
      }
	  , function() { menuOn=false; }
	);
	  
	$('.subnav').hoverIntent(function() {}, 
		function()
		{
			setTimeout("hidemenu()",200);
		}
	);
	  
	});
	
	

	







	

	




	

			
		