// JavaScript Document
$('a.zoom').each(function(){
	$(this).fancybox({'zoomOpacity':true,'titlePosition':'inside','zoomSpeedIn':500,'zoomSpeedOut':500,'hideOnContentClick': true,'transitionIn':'elastic','transitionOut':'elastic'});
	});
$("#search").focusValue();
$("#searchSubmit").hover(function(){$(this).addClass("hover")}, function(){$(this).removeClass("hover");});
(function($){$.fn.onHover=function(cssClass){$(this).hover(function(){$(this).addClass(cssClass);},function(){$(this).removeClass(cssClass);});}})(jQuery);
(function($){
	$.fn.menuOnFly = function(options){
		var opts = $.extend({}, $.fn.menuOnFly.defaults, options);
		var mi = $(this);
		$(this).children('li').children('a.dropDown').click(function(){
						   s = $(this).hasClass('selected');						   
						   $('#menuFlyHoverCont').hide();
						   $(this).parent('li').removeClass('hover');
						   if(s){
								if(opts.animation=='fade'){									
									$(this).next(opts.affect).fadeOut(opts.speed);									
								}
								else if(opts.animation=='slide'){									
									$(this).next(opts.affect).slideUp(opts.speed);
								}
								else{									
									$(this).next(opts.affect).toggle();
								}								
								$(this).oneTime(opts.speed, function() {
									$(this).parent('li').removeClass('selected');								
									$(this).removeClass('selected');
								  });							
						   }
						   else{							   
							   mi.children('li').children('a.selected').removeClass('selected');
							   mi.children('li.selected').removeClass('selected');
							   $(this).parent('li').addClass('selected');
							   $(this).addClass('selected');
							   if(opts.animation=='fade'){
									if(opts.type=='accordion'){mi.children('li').children(opts.affect).fadeOut(opts.speed);}
								   $(this).next(opts.affect).fadeIn(opts.speed);
								}
								else if(opts.animation=='slide'){
									 if(opts.type=='accordion'){mi.children('li').children(opts.affect).slideUp(opts.speed);}
									$(this).next(opts.affect).slideDown(opts.speed);
								}
								else{
									 if(opts.type=='accordion'){mi.children('li').children(opts.affect).hide();}
									$(this).next(opts.affect).show();
								}							  
						   }						  
						   return false;
						   });
	}
	$.fn.menuOnFly.defaults = {
		animation:'',
		speed: 300,
		type:'accordion',
		affect:'ul'
	};
})(jQuery);
$("#mainMenu").menuOnFly({affect:"div",type:"accordion",animation:"slide"});
$(".subMenu").menuOnFly({affect:"ul",type:"accordion",animation:"slide"});
$(".sub2Menu").menuOnFly({affect:"ul",type:"accordion",animation:"slide"});
$(".sub2Menu ul").menuOnFly({affect:"ul",type:"accordion",animation:"slide"});
var timeOut = 500;
var timer = 0;
var current = 0;
function closeSiteList(){$("#siteList li").removeClass("selected");}
function clearSiteTimer(){window.clearTimeout(timer);timer = null;}
function setSiteTimer(){timer = window.setTimeout(closeSiteList, timeOut);}
$("#siteList a.siteGroup").hover(
	function(){		
		clearSiteTimer();		
		if(!$(this).parent('li').hasClass("selected")){
			$("#siteList li").removeClass("selected");
			$(this).parent('li').addClass("selected");
			//$("#siteList .siteGroupList").hide();
			//$(this).next(".siteGroupList").show();
			$(this).next(".siteGroupList").unbind();
			$(this).next(".siteGroupList").bind("mouseover click",clearSiteTimer);		
			$(this).next(".siteGroupList").bind("mouseout",setSiteTimer);	
		}		
		return false;
	},
	function(){	
		setSiteTimer();								
		return false;
		}							
	);
var maxHeight = ($('.pageLayout-4-2 #content_a').height() < $('.pageLayout-4-2 #content_c').height())?$('.pageLayout-4-2 #content_c').height():$('.pageLayout-4-2 #content_a').height();
$('.pageLayout-4-2 #content_a').height(maxHeight);