
$(document).ready(function(){

	$(".showresults li").live({
        mouseenter:
           function()
           {
			//$(this).find('.description').show();
			$(this).find('.description').addClass("descriptionactive")
           },
        mouseleave:
           function()
           {
			//$(this).find('.description').hide();
	 		$(this).find('.description').removeClass("descriptionactive")
           }
       }
    );

    $("#datesearch").click(function() {
    	$(".datedrop").slideToggle(300,function(){
         
         if($(".datedrop").is(":visible")){
         //$("#fav_button_recat a").html('close newslists');
           $("#datesearch a").addClass('close');
          
          }else{
           //$("#fav_button_recat a").html('Add to newslist');
           $("#datesearch a").removeClass('close');
          
     }
     $("body").click(function() {
     	$(".datedrop").hide();
           $("#datesearch a").removeClass('close');
     })
         
     });    
     return false;
		
	});
	
	
	
	 $("#btsubscribe").click(function() {
    	$(".subscribedrop").slideToggle(300,function(){
         
         if($(".subscribedrop").is(":visible")){
         //$("#fav_button_recat a").html('close newslists');
           $("#btsubscribe a").addClass('close');
          
          }else{
           //$("#fav_button_recat a").html('Add to newslist');
           $("#btsubscribe a").removeClass('close');
          
     }
     $("body").click(function() {
     	$(".subscribedrop").hide();
           $("#btsubscribe a").removeClass('close');
     })
         
     });    
     return false;
		
	});
	
	
	
	
	$(".showresults li").live("click", function(){
		location.href = $(this).find("a").attr("href");
	});
	
	$("#button_clips").click(function() {
		 $('#button_clips').addClass("active")
		 $('#button_shows').removeClass("active")
		 $('#button_also').removeClass("active")
	     var s = $("#jq_showid").val();
	     var c   = 1; 
	     var st   = 0; 
	     $('#showclips').html('<img src="/img/ajax_loader.gif" height="55" width="54" border="0"  />');
	     $.ajax({
	        type: "GET",
	        url: "/jq/get_showclips.php",
	        data: "s=" + s + "&c=" + c + "&st=" + st,
	        success: function(msg){
	            $('#showclips').html(msg)  
	                 .hide()  
	                 .fadeIn(200);  
	             }
	         });
	    return false;
	});
	
	
	$("#button_also").click(function() {
		 $('#button_also').addClass("active")
		 $('#button_shows').removeClass("active")
		 $('#button_clips').removeClass("active")
	     var s = $("#jq_showid").val();
	     var c   = $("#jq_showcatid").val();
	     $('#showclips').html('<img src="/img/ajax_loader.gif" height="55" width="54" border="0"  />');
	     $.ajax({
	        type: "GET",
	        url: "/jq/get_similarshows.php",
	        data: "s=" + s + "&c=" + c,
	        success: function(msg){
	            $('#showclips').html(msg)  
	                 .hide()  
	                 .fadeIn(200);  
	             }
	         });
	    return false;
	});

$("#nextfive").click(function() {
     var s = $("#jq_showid").val();
     var l   = $("#jq_limit").val();
     var ls   = $("#jq_limit").val();
     $('#showclips').html('<img src="/img/ajax_loader.gif" height="55" width="54" border="0"  />');
     $.ajax({
        type: "GET",
        url: "/jq/get_nextfive.php",
        data: "s=" + s + "&l=" + l + "&ls=" + ls,
        success: function(msg){
            $('#showclips').html(msg)  
                 .hide()  
                 .fadeIn(200);  
             }
         });
    return false;
});


$("#add_favorite").click(function() {
     var s = $("#jq_showid").val();
     var u = $("#jq_cookieid").val();
     $('#add_favorite').html('adding');
     $.ajax({
        type: "POST",
        url: "/jq/add_favorite.php",
        data: "s=" + s + "&u=" + u,
        success: function(msg){
            $('#add_favorite').html(msg)  
                 .hide()  
                 .fadeIn(200);  
             }
         });
    return false;
});



$("#remove_favorite").live({
        mouseenter:
           function()
           {
			$('#remove_favorite').html('remove');
           },
        mouseleave:
           function()
           {
			$('#remove_favorite').html('Favorite');
           }
       }
    );


$("#remove_favorite").click(function() {
     var s = $("#jq_showid").val();
     var u = $("#jq_cookieid").val();
     $('#remove_favorite').html('removing');
     $.ajax({
        type: "POST",
        url: "/jq/remove_favorite.php",
        data: "s=" + s + "&u=" + u,
        success: function(msg){
            $('#remove_favorite').html(msg)  
                 .hide()  
                 .fadeIn(200);  
             }
         });
    return false;
});




$(".remove_playlist").click(function() {
     var a = $(this).attr('id');
     var u = $("#jq_cookieid").val();
     $.ajax({
        type: "POST",
        url: "/jq/remove_playlist.php",
        data: "a=" + a + "&u=" + u,
        success: function(msg){
            $('#li_' + a).fadeOut(200);  
             }
         });
    return false;
});




 $("#searchaudio").click(function() {
    	$(".searchdrop").slideToggle(300,function(){
         
     //$("body").click(function() {
     //	$(".searchdrop").hide();
     //})
         
     });    
     return false;
		
	});
	
	
 $("#userdropdown").click(function() {
    	$("#userdropnav").slideToggle(300,function(){
         
     $("body").click(function() {
     	$("#userdropnav").hide();
     })
         
     });    
     return false;
		
	});
	
	$(".results li").live({
        mouseenter:
           function()
           {
			$(this).find('.cliptools').show();
			$(this).find('.clipimage').addClass("clipimageactive")
           },
        mouseleave:
           function()
           {
			$(this).find('.cliptools').hide();
	 		$(this).find('.clipimage').removeClass("clipimageactive")
           }
       }
    );
   
   

	$(".playlist a").live("click", function(){
     var a = $(this).attr('id');
     var u = $("#jq_cookieid").val();
     $(this).html('......');
     $.ajax({
        type: "POST",
        url: "/jq/add_saved.php",
        data: "a=" + a + "&u=" + u,
        success: function(msg){
            $('#' + a).html('Saved')  ;  
             }
         });
    return false;
});
	
	

	 
});

