function nav_overs(id,h,spd){
	$('#'+id+' li').hover(function() {
	$(this).children('.link a').animate({ marginTop: -h }, spd);
	}, function() {
	$(this).children('.link a').animate({ marginTop: -0 }, spd);          
	});	
}

function galleryPager(nm){
	var lpos = nm*-594;
	$('#detail-gallery').animate({"marginLeft": lpos+"px"}, 200, "easeOutQuad", function(){ });
}

function show_subnav(elem,id){
	$('#'+elem).hover(function(){
	fadeIn('#'+elem,'#'+id);
	}, function (){
	fadeOut('#'+elem,'#'+id);
	});
}

timer = null;

function fadeIn(elem,id){
	if(timer) clearTimeout(timer);
	$('.flyout').not(id).hide();
	$('#hdrnav li').not(elem).removeClass('showsub');
	$(id).fadeIn('fast');
	$(elem).addClass('showsub');
}

function fadeOut(elem,id){
	timer = setTimeout("doFade('"+elem+"','"+id+"')",100);
}

function doFade(elem,id){
	$(id).fadeOut('fast');
	$(elem).removeClass('showsub');
}

function popUpPage(pg,w,h,t,l) {
	OpenWin = this.open(pg, "PopUpWindow", "width="+w+",height="+h+",toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,top="+t+",left="+l);
}

$(document).ready(function(){
	show_subnav('connect','connect-subnav');
	show_subnav('login','login-box');
	nav_overs('nav','48',200);
	nav_overs('ftrsocial','56',0);
	$('li.oc-toggle').click(function() { var tyid = $(this).attr('id'); if($('#m-'+tyid).hasClass('closed')){ $('#m-'+tyid).removeClass('closed'); $('#m-'+tyid).addClass('open'); return false; } else {  $('#m-'+tyid).removeClass('open'); $('#m-'+tyid).addClass('closed'); return false; } });
	$('.cathdr').click(function() { if($(this).parent('.catgroup').hasClass('open')){ $(this).parent('.catgroup').removeClass('open'); return false; } else {  $(this).parent('.catgroup').addClass('open'); return false; } });
	$('.cathdr').hover(function(){ $(this).addClass('over'); }, function(){ $(this).removeClass('over'); });
});
