//JavaScript - Controls login Slider
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#slide-panel").slideToggle("slow");
});
});
// JavaScript - Controls main menu
jQuery(document).ready(function() { 
//jQuery("#dropmenu ul").css({display: "none"}); // Opera Fix 
jQuery("#dropmenu li").hover(function(){ 
        jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268); 
        },function(){ 
        jQuery(this).find('ul:first').css({visibility: "hidden"}); 
        }); 
});
// JavaScript - Controls featured content in banner section On home page
$(document).ready(function(){
		$("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 8000, true); 
	});
// JavaScript - Controls featured item On home page
$(document).ready(function(){
		$("#featured_item-events").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0, true); 
	});
// JavaScript - Controls Book slider content On home page
$(document).ready(function(){  							 
		//Set Globals for calculations 
		var ulwidth = (($('#latest_product ul li').size())*275);
		var contwidth = 563;
		var max_left = contwidth - ulwidth; 	
		var min_left = 0; 
		var left_offset = ($("#latest_product ul").offset()).left;	
		//Set the width of the UL = total li * 275 
		// remove the width: 9999px;  from the style sheet
		$('#latest_product ul').css({"width":ulwidth+"px"});	
		// Start animation
   		$(".nextPage").click(function(){
	  		var pos = $("#latest_product ul").offset();	  
	  	if (((pos.left+275-left_offset)-(min_left)  ) < 0)
			$("#latest_product ").animate({left: '+=275px'}, 1000);
	  	else
			$("#latest_product ").animate({left:(max_left-15)+'px'}, 1000);
	  	});
	 	// Start animation in the opposite direction
    	$(".prevPage").click(function(){
	  		var pos = $("#latest_product ul").offset();
	  	if ((max_left - (pos.left-275)) < 0)
			$("#latest_product ").animate({left: '-=275px'}, 1000);
	  	else
			$("#latest_product ").animate({left: '0px'}, 1000);
    	});
  	}); 
// JavaScript Document - Controls Tabbed Box On home page
var currentTab = 0; // Set to a different number to start on a different tab.
function openTab(clickedTab) {
	var thisTab = $(".tabbed-box .tabs a").index(clickedTab);
	$(".tabbed-box .tabs li a").removeClass("active");
	$(".tabbed-box .tabs li a:eq("+thisTab+")").addClass("active");
	$(".tabbed-box .tabbed-content").hide();
	$(".tabbed-box .tabbed-content:eq("+thisTab+")").show();
	currentTab = thisTab; }
$(document).ready(function() {
	$(".tabs li:eq(0) a").css("border-left", "none");	
	$(".tabbed-box .tabs li a").click(function() { 
		openTab($(this)); return false; 
	});	
	$(".tabbed-box .tabs li a:eq("+currentTab+")").click()
});
// JavaScript Document - Controls Top 5 song demand On home page
$("#vote").click(function () {
      $("#top5").hide();
	  $("#msrq").fadeIn("slow");
	
	});

$("#song_request").click(function () {
      $("#top5").hide();
	  $("#request_div").fadeIn("slow");
    });
$("#submit_vote").click(function () {
      $("#msrq").hide();
	  $("#top5").fadeIn("slow");
    
	});

$("#vote_cancel").click(function () {
      $("#msrq").hide();
	  $("#top5").fadeIn("slow");
    
	});

$("#submit_mysong").click(function () {
      $("#request_div").hide();
	  $("#top5").fadeIn("slow");
	  
    });

$("#request_cancel").click(function () {
      $("#request_div").hide();
	  $("#top5").fadeIn("slow");
    
	});


	
// JavaScript Document - Controls Alternating Top 5 On-Demand Songs list Color
$("ol.top5List li").each(function(i, val) {
  $(this).css("background", i & 1 ? "#ffffff" : "#eff3f4");
});	