// JavaScript Document
$(document).ready(function(){
								
	
	
	var FX_drop_down_left = [0,60,0];
	var FX_timeout_counter=0;
	var FX_intervalID;
	var currentFXSubmenu=null;
	
	$('.nav-bot').css('position','relative');
	$('.nav-bot').css('top',-20);
	$('.nav-bot').children('ul').find('a').each(function(n){ 
														    //$(this).css('padding-top',-10);
															$(this).bind('mouseover',FXmouseover);
														 	$(this).bind('mouseout',FXmouseout);
														   });
	
	function FXmouseover()
	{
		
		var n=$(this).attr('rel').split("fx")[1];
		
		
		
		var targetDropDown = $('.dropDownFX[rel="'+$(this).attr('rel')+'"]');
		targetDropDown.css('top',30);
		if(targetDropDown.html()!=null)
		{
			
			targetDropDown.css('left',FX_drop_down_left[n]+50);
			targetDropDown.css('opacity',0);
			targetDropDown.find('.option_container_fx').eq(0).css('height',0);
			
			tgtHeight = ((targetDropDown.find('.option_container_fx').eq(0).find('li').length)*22);
			targetDropDown.css('height',tgtHeight+10);
			targetDropDown.show();
			targetDropDown.animate({opacity:1,left:FX_drop_down_left[n]},880);
			targetDropDown.find('.option_container_fx').eq(0).animate({height:tgtHeight},880);
			
			targetDropDown.bind('mouseover',menuCont_handler);
			targetDropDown.bind('mouseout',menuCont_handler);
			currentFXSubmenu = targetDropDown;
		}
	}
	
	function FXmouseout()
	{
	   	startFXTimer();
	}
	
	function menuCont_handler(evt)
	{
		switch(evt.type)
		{
		  case "mouseover":
		  clearInterval(FX_intervalID);
		  FX_timeout_counter=0;
		  break;
		  
		  case "mouseout":
		  startFXTimer();
		  break;
		}
	}
	
	function incr()
	{
		if(FX_timeout_counter<5)
		{
			FX_timeout_counter++;
		}
		else
		{
		  vanish();
		  FX_timeout_counter=0;	
		  clearInterval(FX_intervalID);
		  
		}
		
		//$('#rt').attr('value',FX_timeout_counter);
	}
	
	function startFXTimer()
	{
	  	clearInterval(FX_intervalID);
		FX_timeout_counter=0;
		
		FX_intervalID = setInterval(incr,50);
	}
	
	function vanish()
	{
	  if(currentFXSubmenu!=null)
	  { currentFXSubmenu.hide('fast');}
	}
								
});
