$(document).ready(function(){
//    $("#tab > ul").tabs();	  	
 //   $("#message_tabs > ul").tabs();
	  
	$(".subscribe").click(function(){	
	  		var id    = $(this).attr("id");
			var title = $(this).attr("title");
			if(title=="訂閱"){
				mode="1";
			}else{
				mode="0";
			}			
			$.post("/msg/subscribe", { w_id : id , value: mode },
				function(data){
					if(data==true){
						if(mode=="1"){
							$(".subscribe").attr({ title: "取消訂閱" });					
							$(".subscribe").text("取消訂閱");						
						}else{
							$(".subscribe").attr({ title: "訂閱" });					
							$(".subscribe").text("訂閱");						
						}
					}else{
						flashMsg("訂閱尚未成功!!");
					}				
				}			
			);
	});
	
	$(".bookmark").click(function(){	
		var id	  = $(this).attr("id");
		var src   = $(this).attr("src");
		var mode  = $(this).attr("alt");
		$(this).attr({ id: "bk_"+id });
		$.post("/msg/mark",{ item: id, value: mode },
			function(data){
				if(data==true){
					if(mode==1){
						$("#bk_"+id).attr({ 
							src:   "/public/images/16_star.gif",
					        title: "移出我的最愛",
							alt:   "0",			
							id:    id	 });
					}else{
						$("#bk_"+id).attr({ 
							src:   "/public/images/16_star2.gif",
					        title: "加入我的最愛",
							alt:   "1",			
							id:    id	 });
					}
				}else{
					flashMsg("動作失敗!");
					$("#bk_"+id).attr({ id:id});
				}
			}
		
		);
	});

	$(".profile_slide").click(function(){
		var mode = $(this).attr("alt");
		if(mode==1){
			$(this).attr({ 'alt': '0' });
			$(this).next("div").slideUp("slow");
		}else{
			$(this).attr({ 'alt': '1' });
			$(this).next("div").slideDown("slow");		
		}	
	});

});
	    

