$(function(){    
        $("#message_list ul.comment")
         .live("mouseover", function() {
                 $(this).addClass("glaybg");
                 $(this).children("li").children("div.reply").show(); 
                 $(this).children("li").children("div.message_del").show();
                 
         }) 
         .live("mouseout",function() {
                 $(this).removeClass("glaybg");
                 $(this).children("li").children("div.reply").hide();
                 $(this).children("li").children("div.message_del").hide();
                 
         })
});  

$(function(){ 
	$("a[name$='videodel']")
	.live("mouseover", function() {
		$(this).children("img").attr("src","/image/icon/red_x.gif");
	})
	$("a[name$='videodel']")
	.live("mouseout", function() {
		$(this).children("img").attr("src","/image/icon/gray_x.gif");
	})
}); 

$(function(){ 
	$("a[name$='favourite']")
	.live("mouseover", function() {
		$(this).children("img").attr("src","/image/icon/red_favourite.gif");
	})
	$("a[name$='favourite']")
	.live("mouseout", function() {
		$(this).children("img").attr("src","/image/icon/gray_favourite.gif");
	})
}); 

$(function(){ 
	$("a[name$='quote']")
	.live("mouseover", function() {
		$(this).children("img").attr("src","/image/icon/red_quote.gif");
	})
	$("a[name$='quote']")
	.live("mouseout", function() {
		$(this).children("img").attr("src","/image/icon/gray_quote.gif");
	})
}); 

$(function(){    
        $("#contents_r li.comment")
         .live("mouseover", function() {
                 $(this).children("div.subinfo").children("span.replay").show(); 
                 
         }) 
         .live("mouseout",function() {
                 $(this).children("div.subinfo").children("span.replay").hide();    
         })
}); 

$(function(){    
        $("#top_search, #top_under_search, #top_under_search_bottom" )
         .live("mouseover", function() {
                 $("#top_under_search").show();
				 $("#top_under_search_bottom").show(); 
                 
         }) 
         .live("mouseout",function() {
                 $("#top_under_search").hide();  
				 $("#top_under_search_bottom").hide(); 
         })
});
$(function(){  
	$("#top_under_search span" )
	.live("click",function() {
		$("#search_song, #search_singer, #search_message, #search_people").removeClass("sel");
		$(this).addClass("sel");
		 if ($(this).is("#search_song" ))
		 {
			$("#id_top_search_type, #id_search_typ").attr("value","song");
		}
		if ($(this).is("#search_singer" ))
		 {
			$("#id_top_search_type, #id_search_typ").attr("value","singer");
		}
		if ($(this).is("#search_message" ))
		 {
			$("#id_top_search_type, #id_search_typ").attr("value","message");
		}
		if ($(this).is("#search_people" ))
		 {
			$("#id_top_search_type, #id_search_typ").attr("value","people");
		}
	})
});

$(function(){		
	$("#id_link")	
	 .focus(function() {
		$(this).siblings("span.hiddensub").html('目前支持分享mp3或wma格式的URL链接').show();		
	})
		.blur(function() {$(this).siblings("span.hiddensub").html('').hide();})		
});		

$(function(){    
        $("#contents_r li.sub_menu")
         .live("mouseover", function() {
                 $(this).addClass("cur_sub_menu");
                 
         }) 
         .live("mouseout",function() {
                 $(this).removeClass("cur_sub_menu");
                 
         })
});
		 
$(function(){    
        $("#top_menu_login")
         .live("click",function() {
 			if ( $("#top_hidden").is(":hidden")){
				 $("#top_hidden").addClass("top_hidden_bg");

				 $("#top_hidden_main").removeClass("show_join");
				 $("#top_hidden_top").removeClass("show_jointop");
				 $("#top_hidden_main").addClass("show_login");
				 $("#top_hidden_top").addClass("show_logintop");


				$("#top_hidden_join").hide();
				$("#top_hidden_login").show();

				$("#top_hidden_main").show();
				$("#top_hidden").slideDown("slow"); 
			}
			else{ 
				if ( $("#top_hidden_join").is(":visible")){
					$("#top_hidden_main").removeClass("show_join");
					 $("#top_hidden_top").removeClass("show_jointop");
					$("#top_hidden_main").addClass("show_login");
					 $("#top_hidden_top").addClass("show_logintop");
					$("#top_hidden_join").hide();
					$("#top_hidden_login").show();
				}
				else{
					$("#top_hidden").slideUp("slow");
				}
			}
                 
         }) 
});

$(function(){    
        $("#top_menu_join")
         .live("click",function() {
			if ( $("#top_hidden").is(":hidden")){
				$("#top_hidden").addClass("top_hidden_bg");

				$("#top_hidden_main").removeClass("show_login");
				$("#top_hidden_top").removeClass("show_logintop");
				$("#top_hidden_main").addClass("show_join");
				$("#top_hidden_top").addClass("show_jointop");

				$("#top_hidden_login").hide();
				$("#top_hidden_join").show();

				$("#top_hidden_main").show();
				$("#top_hidden").slideDown("slow"); 
			}
			else{ 
				if ( $("#top_hidden_login").is(":visible")){
					$("#top_hidden_main").removeClass("show_login");
					$("#top_hidden_top").removeClass("show_logintop");
					$("#top_hidden_main").addClass("show_join");
					$("#top_hidden_top").addClass("show_jointop");
					$("#top_hidden_login").hide();
					$("#top_hidden_join").show();
				}
				else{
					$("#top_hidden").slideUp("slow");
				}
			}
                 
         }) 
});


$(function(){
	var offsetX = 20;
	var offsetY = 10;
	
	$("li.picture").hover(function(e){
		//mouse on
		var href = $(this).children("img.preview_picture_pl").attr("alt");
		$("<img id='largeImage' src='" + href + "'>").css("top", e.pageY + offsetY).css("left", e.pageX + offsetX).appendTo("body");
	}, function(){
		//mouse off
		$("#largeImage").remove();
	});
	
	$("li.picture").mousemove(function(e){
		$("#largeImage").css("top", e.pageY + offsetY).css("left", e.pageX + offsetX);
	})
	
});

function setmiddle(img,height) {  
	var diff = height - img.offsetHeight; 
	//if(diff > 0) {  
		img.style.marginTop = Math.floor(diff/2) + 'px';  
	//}  
} 
function setbottom(img,height) {  
	var diff = height - img.offsetHeight; 
	if(diff > 0) {  
		img.style.marginTop = Math.floor(diff/1) + 'px';  
	}  
} 

function imgload(thisImg,url){
 
	var current = $(thisImg).attr("src");
	var error = current.substring( current.length-9, current.length-4);
	if(error=="error"){
		return;
	}
	else{
		$(thisImg).attr("src",url);
	}
}