$(document).ready(function(){
	$("#loading").ajaxStart(function(){
		$(this).show();
	});
	$("#loading").ajaxStop(function(){
		$(this).hide();
	});
	buttonActions();
	$(function(){ 
		$("ul#ticker01").liScroll(); 
	}); 
	commentsView();
	videoView();
	seenView();
	setTimeout("hideOverlay()", 6000);
	$("#addCommentButton").bind("click", function(){
		$("#addComment").slideDown("slow");
	});
	$("#sendToAFriendButton").bind("click", function(){
		$("#sendToAFriend").slideDown("slow");
	});
	$(".Ruler").each(function(i){
		//$("#departmentsWidth"+i).css("width", $(this).attr("name"));
		if (parseInt($(this).attr("name")) > 0){
			$(this).animate({width: parseInt($(this).attr("name"))*2.5}, 3000);
		}
	});
});
function hideOverlay(){
	$("#overlayBanner").hide();
}
function buttonActions(){
	$(".mainMenuItem").bind("mouseenter", function(){
		var submenu = $(this).attr("name") ;
		if (submenu == undefined) $("#submenu0").show();
		$(".subs").each(function(i){
			$(this).hide();
		});
		
		$("#submenu"+submenu).show();
		if ($("#submenu"+submenu).text() == ""){
			$("#submenu0").show(); 
		}
	});
	
	$("#displayNews").bind("mouseenter", function(){
		$(".subs").each(function(i){
			$(this).hide();
		});
		$("#submenu0").show();
	});
	
}

function commentsView(){
	$(".commentsButton").bind("mouseenter", function(){
		var index = $(".commentsButton").index(this);
		$("#commentsCount"+index).fadeIn("slow");
	});
	$(".commentsButton").bind("mouseleave", function(){
		var  index = $(".commentsButton").index(this);
		$("#commentsCount"+index).fadeOut("fast");
	});
}
function videoView(){
	$(".videoButton").bind("mouseenter", function(){
		var index = $(".videoButton").index(this);
		$("#videoCount"+index).fadeIn("slow");
	});
	$(".videoButton").bind("mouseleave", function(){
		var  index = $(".videoButton").index(this);
		$("#videoCount"+index).fadeOut("fast");
	});
}
function seenView(){
	$(".seenButton").bind("mouseenter", function(){
		var index = $(".seenButton").index(this);
		$("#seenCount"+index).fadeIn("slow");
	});
	$(".seenButton").bind("mouseleave", function(){
		var  index = $(".seenButton").index(this);
		$("#seenCount"+index).fadeOut("fast");
	});
}