/*cheyan 2013.01.25*/
function dropPub(){
	document.getElementById("pub-ul").style.display="block";
}
function upPub(){
	document.getElementById("pub-ul").style.display="none";
}
function dropNotice(){
	document.getElementById("user-notice-ul").style.display="block";
}
function upNotice(){
	document.getElementById("user-notice-ul").style.display="none";
}
function dropUser(){
	document.getElementById("user-info-ul").style.display="block";
}
function upUser(){
	document.getElementById("user-info-ul").style.display="none";
}
/*标签展开*/
function dropdownTag(o){
	if($("#moretaglist").attr("status-data")=='hide'){
		$("#moretaglist").attr("status-data","show").slideDown('fast');
		$(o).html("收起").addClass("down");
	}else{
		$("#moretaglist").attr("status-data","hide").slideUp('fast');
		$(o).html("展开").removeClass("down");
	}
}
/*右侧广告浮动*/
$(document).ready(function(){
	if($("#sl-float").size()>0&&$(".sl-foot").size()>0){
		setTimeout(function(){
			if($(".wrapMain").size()>0){
				var mainLeft=$(".wrapMain");
			}else if($(".newMain").size()>0){
				var mainLeft = $(".newMain");
			}else if($(".main_left").size()>0){
				var mainLeft = $(".main_left");
			}else{
				var mainLeft=$(".wrapMain");
			}
			if($(".wrapSide").size()>0){
				var mainRight=$(".wrapSide");
			}else if($(".main_right").size()>0){
				var mainRight = $(".main_right");
			}else{
				var mainRight = $(".wrapSide");
			}
			if (mainLeft.height() > mainRight.height()){
				scrollAd();
			}
		
		},500);
	}
	function scrollAd(){
		//获得广告元素
		var adobj=$("#sl-float");
		var adobj_o_top=adobj.offset().top;
		var adobj_o_height=adobj.height();
		
		//初始化浏览器顶底坐标
		var window_top=0;
		//顶浏览器浮动类
		var fixedClassTop = 'sl-fixed sl-fixed-top';
		
		$(window).bind("scroll", function(){
			//浏览器顶坐标
			window_top=$(window).scrollTop();
			//获取底部foot元素
			var footobj=$(".sl-foot");
			var footobj_o_top=footobj.offset().top;

			//计算广告最大的上下浮动像素区间
			var max_float_height=parseInt(footobj_o_top-adobj_o_top-adobj_o_height);
			//计算广告最大的浮动坐标
			var max_float_y=parseInt(footobj_o_top-adobj_o_height);

			//进入移动漂浮状态
			if(window_top>=adobj_o_top){
				if(window_top<max_float_y){//开始漂浮
					adobj.css({"top":"0","margin-top":"0"}).addClass(fixedClassTop);
				}else{//沉底
					adobj.removeClass(fixedClassTop).css({"margin-top":max_float_height});
				}
			}else{//复位到顶部
				adobj.removeClass(fixedClassTop).css({"top":adobj_o_top,"margin-top":"0"});
			}
			
		});
	}
});
$(function(){
	$(".ind-menu .dl").hover(
		function(){$(this).addClass("on")},
		function(){$(this).removeClass("on")}
	);
	$(".loginBtn").hover(function(){
		$(this).addClass("loginBtn-on")
	},function(){
		$(this).removeClass("loginBtn-on")
	});
});
function userlogin(){
	var offsettop=$(".ui-popup").offset().top;
	$(".ui-popup").css({display:"block",top:offsettop+"px"});
	$(".ui-popup").popupFn();
	$(".ui-mask").show();
};
function mypostion(o){
	var width=$(window).width();
	var height=$(window).height();
	var divW=$(o).outerWidth();
	var divH=$(o).outerHeight();
	var left=(width-divW)/2+$(window).scrollLeft();
	var top=(height-divH)/2+$(window).scrollTop();
	return {"left":left,"top":top};
};
function myTips(msg,status){
	if(status!="success" && status!="error"){status="error";};
	if (status=="success") {
		$("body").append('<div class="ui-mask" id="ui-mask"></div><div class="change_success" id="change_success"><span class="text">'+msg+'</span></div>');
		var my=mypostion("#change_success");
		$("#change_success").css({"position":"absolute","z-index":"999999999","top":my.top+"px","left":my.left+"px"});
		$("#ui-mask").show();
		$("#change_success").show();
		setTimeout(function(){
			$("#change_success,#ui-mask").fadeOut("slow",function(){
				$("#ui-mask").remove();
				$("#change_success").remove();
			});
		},2000);
	}else{
		$("body").append('<div class="ui-mask" id="ui-mask"></div><div class="change_error" id="change_error"><span class="text">'+msg+'</span></div>');
		var my=mypostion("#change_error");
		$("#change_error").css({"position":"absolute","z-index":"999999999","top":my.top+"px","left":my.left+"px"});
		$("#ui-mask").show();
		$("#change_error").show();
		setTimeout(function(){
			$("#change_error,#ui-mask").fadeOut("slow",function(){
				$("#ui-mask").remove();
				$("#change_error").remove();
			});
		},1000);
	};
};
/*scroll top*/
(function($){jQuery.fn.scrolls = function(){var $backToTopEle = $('<a id="backToTop" href="javascript:void(0);" title="返回顶部"><i class="ico"></i></a>').appendTo($("body")).click(function() {$("html, body").animate({ scrollTop: 0 }, 200);}), $backToTopFun = function() {var st = $(document).scrollTop(), winh = $(window).height();(st > 100)? $backToTopEle.fadeIn(300): $backToTopEle.fadeOut(300);if (!window.XMLHttpRequest) {$backToTopEle.css("top", st + winh - 166);}};$(window).bind("scroll", $backToTopFun);}
})(jQuery);


/*tabs*/
(function($){jQuery.fn.tabs = function(tabTit,on,tabCon){$(tabCon).each(function(){$(this).children().eq(0).show();});$(tabTit).each(function(){$(this).children().eq(0).addClass(on);});$(tabTit).children().mouseover(function(){$(this).addClass(on).siblings().removeClass(on);var index = $(tabTit).children().index(this);$(tabCon).children().eq(index).show().siblings().hide();});};})(jQuery);

/*extend*/
(function($){jQuery.fn.extend({setCaret: function(){ if(!jQuery.browser.msie) return;var initSetCaret = function(){ var textObj = jQuery(this).get(0);textObj.caretPos = document.selection.createRange().duplicate();};jQuery(this).click(initSetCaret).select(initSetCaret).keyup(initSetCaret);},insertAtCaret: function(textFeildValue){ var textObj = jQuery(this).get(0);if(document.all && textObj.createTextRange && textObj.caretPos){ var caretPos=textObj.caretPos;caretPos.text = caretPos.text.charAt(caretPos.text.length-1) == '' ? textFeildValue+'' : textFeildValue;} else if(textObj.setSelectionRange){ var rangeStart=textObj.selectionStart;var rangeEnd=textObj.selectionEnd;var tempStr1=textObj.value.substring(0,rangeStart);var tempStr2=textObj.value.substring(rangeEnd);textObj.value=tempStr1+textFeildValue+tempStr2;textObj.focus();var len=textFeildValue.length;textObj.setSelectionRange(rangeStart+len,rangeStart+len);textObj.blur();}else{ textObj.value+=textFeildValue;} } });})(jQuery);

/*textcount*/
(function($){jQuery.fn.txtCount = function(tipWrap, maxNumber){var countClass = 'js_txtCount', fullClass = 'js_txtFull',	disabledClass = 'disabled',	undisableClass = 'undisabled';var count = function(){var btn = $(this).closest('form').find(':submit'),info = $('.comm_topic'),val = $(this).val().length,disabled = {on: function(){btn.removeAttr('disabled').removeClass(disabledClass).addClass(undisableClass);},off: function(){btn.attr('disabled', 'disabled').removeClass(undisableClass).addClass(disabledClass);}};if (val == 0){disabled.off();info.css("display","block");}if(val <= maxNumber){if (val > 0) {disabled.on();info.css("display","none");}tipWrap.html('<span class="' + countClass + '">' + val + '/' + maxNumber + '</span>');}else{disabled.off();tipWrap.html('<span class="' + countClass + '"><strong class="' + fullClass + '">-' + (val - maxNumber) + '</strong>/' + maxNumber + '</span>');};};$(this).bind('keyup focus change', count);return this;};})(jQuery);

/*scrollLoading*/
$(document).ready(function() {
$.fn.scrollLoading = function(options) {
		var defaults = {attr: "original"};
		var params = $.extend({}, defaults, options || {});
		params.cache = [];
		$(this).each(function() {
			var node = this.nodeName.toLowerCase(), url = $(this).attr(params["attr"]);
			if (!url) { return; }
			var data = {obj: $(this),tag: node,url: url};
			params.cache.push(data);
		});
		
		var loading = function() {
			var s_t = $(window).scrollTop(), s_b = s_t + $(window).height();
			$.each(params.cache, function(i, data) {
				var o = data.obj, tag = data.tag, url = data.url;
				if (o) {
					pos_t = o.offset().top; pos_b = pos_t + o.height();
					pos_m=parseInt((pos_t+pos_b)/2);
					oneScr=1000;
					s_t_int=parseInt(s_t/oneScr)*oneScr;
					s_b_int=(parseInt(s_b/oneScr)+1)*oneScr;
					if (pos_m > s_t_int && pos_m < s_b_int) {
						o.hide().attr("src", url).fadeIn(300);
						o.removeClass("lazy");
						data.obj = null;
					}
				}
			});		
			return false;	
		};
		loading();
		$(window).bind("scroll", loading);
	};
	$("img.lazy").scrollLoading();
});


function addBookmark(sTitle,sURL){
    try{
        window.external.addFavorite(sURL, sTitle);
    }catch(e){
        try{
            window.sidebar.addPanel(sTitle, sURL, "");
        }catch (e){
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}

/*copyToClipBoard*/
function copyToClipBoard(o){
	ZeroClipboard.setMoviePath("http://js.qzone.cc/v3/js/zeroclipboard/ZeroClipboard.swf"); 
	var clip = new ZeroClipboard.Client(); 	
	clip.setHandCursor(true); 
	
	var obj = $(o);
	var id = $(o).attr("id");
	var content = $(o).text();
	clip.setText(content);  
	clip.glue(id);
	
	clip.addEventListener( "complete", function(){ 
		$('#copyTips').remove();
		var x=$(o).offset().left-20;
		var y=$(o).offset().top-50;
		
		$("body").append('<div class="copyTips" id="copyTips" style="z-index:99999">内容已成功复制到剪贴板</div>');
		$("#copyTips").css({"position":"absolute","left":x,"top":y});
		$('#copyTips').delay(1000).fadeOut("fast");
	}); 

}
function copyToClipBoardText(o,text){
	
	ZeroClipboard.setMoviePath("http://js.qzone.cc/v3/js/zeroclipboard/ZeroClipboard.swf");
	var clip = new ZeroClipboard.Client();
	clip.setHandCursor(true);
	
	var obj = $(o);
	var id = $(o).attr("id");
	var content = text;
	clip.setText(content);
	clip.glue(id);
	clip.addEventListener( "mouseOver", function(client) {
		obj.show(); 
	});   
	clip.addEventListener( "complete", function(){ 
		$('#copyTips').remove();
		var x=$(o).offset().left-20;
		var y=$(o).offset().top-50;
		$("body").append('<div class="copyTips" id="copyTips" style="z-index:99999">内容已成功复制到剪贴板</div>');
		$("#copyTips").css({"position":"absolute","left":x,"top":y});
		$('#copyTips').delay(1000).fadeOut("fast");
	}); 
}

/*left right height*/
(function(){var oDiv=document.getElementById("float");if(oDiv==undefined)return false;var H=0,iE6;var Y=oDiv;while(Y){H+=Y.offsetTop;Y=Y.offsetParent};iE6=window.ActiveXObject&&!window.XMLHttpRequest;function myscroll(){var s=document.body.scrollTop||document.documentElement.scrollTop;if(s>H){oDiv.className="div1 div2";if(iE6){oDiv.style.top=(s-H)+"px"}}else oDiv.className="div1"};if(!iE6||true){window.onscroll=buffer(myscroll,150,this)}})();

$(function(){
	$(window).scrolls();
	
	
	var w=$('#filterSearch_txt').width();
	$('#filterSearch_txt').bind({
		focus:function(){
			$(this).css("width",w-35+"px");
			$('#filterSearch_btn').show();
			if(this.value=='搜索')this.value='';
			this.style.color='#000'
		}
		,blur:function(){
			if(this.value=='')this.value='搜索';
			this.style.color='#aaa'
		}
	})
});

$(function(){
	var loadCardT=0,closeCartT=0;
	$(".icard").live('mouseout',function(){
		clearTimeout(loadCardT);
		 $("#icard-div").hover(
			  function(){clearTimeout(closeCartT);$("#icard-div").show();},
			  function(){closeCartT=setTimeout(function(){$("#icard-div").hide();},500);}
		 );
		closeCartT=setTimeout(function(){$("#icard-div").hide();},500);
	});
	$(".icard").live("mouseover",function(){
		clearTimeout(closeCartT);
		var that=$(this);
		var win=$(window);
		loadCardT=setTimeout(function(){
			Card.Load(that,win);
		},200);
	});
	if($("#refuse_list").size()>0){
		var refuse_data=$("code").html();
		var cnt_s=0;
		$("#refuse_list p").each(function(){
			cnt=parseInt($(this).attr("data"));
			cnt_e=parseInt(cnt_s+cnt);
			$(this).html(refuse_data.substring(cnt_s,cnt_e));
			cnt_s=parseInt(cnt_s+cnt);
		});
	}
});
QzTool={
	thispostion:function(o){
		var x=$(o).offset().left; 
		var y=$(o).offset().top+$(o).height();
		return {"x":x,"y":y};
	},
	windowpostion:function(o){
		var x=$(window).width()/2+$(window).scrollLeft(); 
		var y=$(window).height()/2+$(window).scrollTop();
		return {"x":x,"y":y};
	},
	mouseposition:function(e){
		var x = 0, y = 0;
		var e = e || window.event;
		if (e.pageX || e.pageY) {x = e.pageX;y = e.pageY;} 
		else if (e.clientX || e.clientY){
			x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;y = e.clientY + document.body.scrollTop  + document.documentElement.scrollTop;
		}
		return {"x":x,"y":y};
	},
	Ajax:function(option){
		var def = {type:"post",data:"",dataType:"json",before:function(){}}; 
		var opts = $.extend(def, option);
		burl=((opts.request.indexOf("?")==-1)? "?":"&")+"_rnd="+new Date().getTime();
		$.ajax({type: opts.type,url:opts.request+burl,data:opts.data,dataType: opts.dataType,beforeSend:opts.before,success:opts.respon});
	},
	ajaxLoginCheck:function(res){
		if(res.is_login==0){
			QzTool.Adiv(res);
			return false;
		}else{
			return true;
		}
	},
	boolIe:function(){
		if ($.browser.msie && ($.browser.version == "6.0")){
			return true;		
		}else{
			return false;
		}
	},
	Adiv:function(res){
		/*$("#ajaxlogin").html(res.html);
		var offsettop=$(".ui-popup").offset().top;
		$(".ui-popup").css({display:"block",top:offsettop+"px"});
		$(".ui-popup").popupFn();
		$(".ui-mask").show();*/

		$("#ajaxlogin").html(res.html);
		var my=mypostion(".newLogin");
		$(".newLogin").css({"position":"absolute","z-index":"9999999","top":my.top+"px","left":my.left+"px"});
		$(".newLogin").show();
		$("#ui-layer").show();
	}
};
Card={
	Load:function(that,win){
		var t=that.offset().top-3;
		var l=that.offset().left;
		var w=that.width();
		var h=that.height()+6;
		var sl=win.scrollLeft();
		var sr=win.scrollLeft()+win.width();
		var st=win.scrollTop();
		var sb=win.scrollTop()+win.height();
		if((t-st)>(sb-t)){var scol="up";}else{var scol="down";}
		if(((l+w/2)-sl)>(sr-((l+w/2)))){var srow="left";}else{var srow="right";}
		htmlt='<table cellpadding="0" cellspacing="0" border="0" id="icard-div"><tr><td colspan="3" class="colt"></td></tr><tr><td class="coll"></td><td class="colm" valign="top"><div class="icard-tip-b icard-tip"></div><div class="icard-div-main"><img src="images/ajax.gif" class="ajaxicon"></div></td><td class="colr"></td></tr><tr><td colspan="3" class="colb"></td></tr></table>';
		htmlb='<table cellpadding="0" cellspacing="0" border="0" id="icard-div"><tr><td colspan="3" class="colt"></td></tr><tr><td class="coll"></td><td class="colm" valign="top"><div class="icard-tip-t icard-tip"></div><div class="icard-div-main"><img src="images/ajax.gif" class="ajaxicon"></div></td><td class="colr"></td></tr><tr><td colspan="3" class="colb"></td></tr></table>';
		QzTool.Ajax({
			request: "/ajax/card",
			data:"user_id="+that.attr("user_id"),
			before:function(){
				$("#icard-div").remove();
				if(scol=='up'){
					$("body").append(htmlt);
					cardh=$("#icard-div").height();
					cardw=$("#icard-div").width();
					if(srow=='right'){
						$("#icard-div").css({top:t-cardh,left:l});
						if(w>24){
							$(".icard-tip").css({marginLeft:w/2-15});
						}else{
							$(".icard-tip").css({marginLeft:5});
						}
						
					}else{
						$("#icard-div").css({top:t-cardh,left:l-cardw+w});
						if((cardw-w/2)>24){
							$(".icard-tip").css({marginLeft:cardw-w/2-20});
						}else{
							$(".icard-tip").css({marginLeft:cardw-w/2-15});
						}
					}
				}else{
					$("body").append(htmlb);
					cardh=$("#icard-div").height();
					cardw=$("#icard-div").width();
					if(srow=='right'){
						$("#icard-div").css({top:t+h,left:l});
						if(w>24){
							$(".icard-tip").css({marginLeft:w/2-15});
						}else{
							$(".icard-tip").css({marginLeft:5});
						}
					}else{
						$("#icard-div").css({top:t+h,left:l-cardw+w});
						if((cardw-w/2)>24){
							$(".icard-tip").css({marginLeft:cardw-w/2-20});
						}else{
							$(".icard-tip").css({marginLeft:cardw-w/2-15});
						}
					}
				}
			},
			respon:function(res){
				$(".icard-div-main").html(res.html);
			}
		});
	}
};
Face={
	load:function(div_show,div_id){
		if(!arguments[0]) {div_show = "#js_emotion"};
		if(!arguments[1]) {div_id = "#textContent"};
		if($(div_show+" .qqFace").size()<=0){
			QzTool.Ajax({
				request: "/ajax/face",
				data:"div_id="+div_id,
				respon:function(res){
					$(div_show).html(res.html).show();
				}
			});
		}else{
			$(div_show).show();
		}
	}
};
ActTop={
	addFollow:function(o){
		var id=$(o).attr("data");
		var div=$(o).attr("id-data");
		QzTool.Ajax({
			request: "/user/topfollow",
			data:"id="+id+"&div="+div,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#"+res.div).html(res.html);
			}
		});
	}
};
ActIndex={
	reflashAvatar:function(){
		$("#avatarDiv").html('<div style="display:block;width:720px;line-height:280px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		var page=ReflashAvatarData.avatar_page;
		QzTool.Ajax({
			request: "/index/avatarlist",
			data:"page="+page,
			respon:function(res){
				$("#avatarDiv").html(res.html);
				ReflashAvatarData.avatar_page=res.page;
			}
		});
	},
	reflashPic:function(){
		var page=ReflashPicData.pic_page;
		QzTool.Ajax({
			request: "/index/piclist",
			data:"page="+page,
			respon:function(res){
				$("#picDiv").html(res.html);
				ReflashPicData.pic_page=res.page;
			}
		});
	},
	fetchRecommendPic:function(cat_id){
		$(".maxwidth").css({left:"0px"});
		$("#picDiv").html('<div style="display:block;width:920px;line-height:300px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		ActIndex.fetchPicTag(cat_id);
		QzTool.Ajax({
			request: "/index/piclist",
			data:"cat_id="+cat_id,
			respon:function(res){				
				$("#picDiv").html(res.html);
			}
		});
	},
	fetchPicTag:function(cat_id){
		QzTool.Ajax({
			request: "/index/taglist",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#picTag").html(res.html);
			}
		});		
	},
	reflashSign:function(){
		var divH=$("#signDiv").height();
		$("#signDiv").html('<div style="display:block;width:100%;line-height:'+divH+'px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		var page=ReflashSignData.sign_page;
		QzTool.Ajax({
			request: "/index/signlist",
			data:"page="+page,
			respon:function(res){
				$("#signDiv").hide().html(res.html).fadeIn("slow");
				ReflashSignData.sign_page=res.page;
			}
		});
	},
	reflashName:function(){
		var divH=$("#nameDiv").height();
		$("#nameDiv").html('<div style="display:block;width:100%;line-height:'+divH+'px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		var page=ReflashNameData.name_page;
		QzTool.Ajax({
			request: "/index/namelist",
			data:"page="+page,
			respon:function(res){
				$("#nameDiv").hide().html(res.html).fadeIn("slow");
				ReflashNameData.name_page=res.page;
			}
		});
	},
	fetchStarMember:function(){
		var member_star=$.trim($("#member_star").html()).length;
		if (member_star>0) {return false;}
		$("#member_star").html('<div style="display:block;width:960px;background:#fff;line-height:262px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/index/starmember",
			respon:function(res){
				$("#member_star").html(res.html);
			}
		});		
	},
	addFollow:function(o){
		var id=$(o).attr("data");
		var div=$(o).attr("id-data");
		QzTool.Ajax({
			request: "/index/follow",
			data:"id="+id+"&div="+div,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#"+res.div).html(res.html);
			}
		});
	},
	/*userDaren:function(nav){
		QzTool.Ajax({
			request: "/index/darenlist",
			data:"nav="+nav,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status!=200){
					myTips(res.msg,"error");
					return false;
				}
				$("#darenDiv").hide().html(res.html).fadeIn("slow");
			}
		});
	},*/
	userDaren:function(type){
		$("#darenDiv").html('<div style="display:block;width:960px;background:#fff;line-height:220px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/index/userdaren",
			data:"type="+type,
			respon:function(res){
				if(res.status!=200){
					myTips(res.msg,"error");
					return false;
				}
				$("#darenDiv").hide().html(res.html).fadeIn("slow");
			}
		});
	}
};
ActUser={
	postWall:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/ajax/actwall",
			data:$("#wallForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");
					myTips(res.msg,"error");return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#quoteIdInput").val("0");
				$("#quoteUidInput").val("0");
				$("#wall_list").html(res.data);
				$("#wall_list_page").html(res.pagination);
				$("#wall_list_count").html(res.wall_count);
				if (res.msg!=''&&res.msg!==null) {
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(wall_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(wall_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").css({"paddingTop":"23px"}).focus();
	},
	changeProvince:function(obj){
		var pid=$(obj).val();
		QzTool.Ajax({
			request: "/ajax/actprovince",
			data:"p_id="+pid,
			respon:function(res){
				if(res.html!=''){
					$("#citySelect").html(res.html);
				}else{
					$("#citySelect").html("<option value='0'>不限</option>");
				};
			}
		});
	},
	uploadAvatar:function(){
		var Moptions = { 
			beforeSubmit:function(){
				$("#upload_status").show();
			},
			success:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				$("#upload_status").hide();
				if(res.status==200){
					$("#uploadDiv").html(res.html);
				}else{
					myTips(res.msg,"error");
					return false;
				}
			}, 
			dataType:  "json",  
			clearForm: true,    
			resetForm: true     
		}; 
		$("#formAvatar").ajaxForm(Moptions);
		setTimeout(function(){$("#formAvatar").submit();},200);
	},
	uploadWallpaper:function(){
		var Moptions = { 
			beforeSubmit:function(){
				$("#set_wallpaper").append('<div class="upload_status" id="upload_status">壁纸上传中...</div>');
			},
			success:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				$("#upload_status").removeClass("upload_status");
				
				if(res.status==200){
					$("#upload_status").addClass("ajax_success");
					$("#upload_status").html("上传成功");
					var outTime=500;
					$("#wallpaperDiv").html(res.html);
				}else{
					$("#upload_status").addClass("ajax_error");
					$("#upload_status").html(res.msg);
					var outTime=3000;
				}
				setTimeout(function(){
					$("#upload_status").fadeOut("slow",function(){					
						$("#upload_status").remove();
					});
				},outTime);
			}, 
			dataType:  "json",  
			clearForm: true,    
			resetForm: true     
		}; 
		$("#formWallpaper").ajaxForm(Moptions);
		setTimeout(function(){$("#formWallpaper").submit();},200);
	},
	setWallpaper:function(){
		var data=$("#setWallpaper").serializeArray();
			if(data.length<=0){
				return false;
			}
		QzTool.Ajax({
			request: "/my/setwallpaper",
			data:data,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==200){
					$hideDiv();
				}else{
					myTips(res.msg,"error");
					return false;
				}
				
			}
		});
	},
	delWallpaper:function(id){
		QzTool.Ajax({
			request: "/my/delwallpaper",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#wallpaper_"+res.id).remove();
				$("#set_wallpaper").append('<div class="del_status" id="del_status">删除成功</div>');
				setTimeout(function(){
					$("#del_status").fadeOut("slow",function(){					
						$("#del_status").remove();
					});
				},500);
			}
		});
	},
	addFollow:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollow",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	addFollowNew:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollownew",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	addFollowRank:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollowrank",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	cancelFollow:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/cancelfollow",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	addFollowUser:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollowuser",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	cancelFollowUser:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/cancelfollowuser",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	addFollowTop:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollowtop",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
			}
		});
	},
	addFollowInList:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/addfollowinlist",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==201){
					myTips(res.msg,"error");
					return false;
				}
				$("#relationBotton-"+res.id).html(res.html);
				$("#relationBottonAction-"+res.id).show();
			}
		});
	},
	cancelFollowInlist:function(o){
		var id=$(o).attr("data");
		QzTool.Ajax({
			request: "/ajax/cancelfollowinlist",
			data:"id="+id,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				$("#relationBotton-"+res.id).html(res.html);
				$("#relationBottonAction-"+res.id).hide();
			}
		});
	},
	cancelFav:function(id){
		if(confirm("确定要取消收藏吗？")){
			QzTool.Ajax({
				request: "/my/cancelfav",
				data:"id="+id,
				respon:function(res){
					if(QzTool.ajaxLoginCheck(res)===false){return ;}
					$("#cell-"+res.id).remove();
				}
			});
		}
	},
	deleteWall:function(id){
		if(confirm("确定要删除吗？")){
			QzTool.Ajax({
				request: "/my/deletewall",
				data:"id="+id,
				respon:function(res){
					if(QzTool.ajaxLoginCheck(res)===false){return ;}
					$("#cell-"+res.id).remove();
				}
			});
		}
	},
	deleteWallArray:function(){
		var cdata=$("#wallForm").serializeArray();
			if(cdata.length<=0){
				alert("请勾选需要批量删除的条目");
				return false;
			}
		if(confirm("确定要删除吗？")){
			QzTool.Ajax({
				request: "/my/deletewallarray",
				data:cdata,
				respon:function(res){
					if(QzTool.ajaxLoginCheck(res)===false){return ;}
					for(var i=0;i<=res.id.length-1;i++){
						$("#cell-"+res.id[i]).remove();
					}
				}
			});
		}
	},
	deleteMsg:function(id){
		if(confirm("确定要删除吗？")){
			QzTool.Ajax({
				request: "/my/deletemsg",
				data:"id="+id,
				respon:function(res){
					if(QzTool.ajaxLoginCheck(res)===false){return ;}
					$("#cell-"+res.id).remove();
				}
			});
		}
	},
	deleteMsgArray:function(){
		var cdata=$("#wallForm").serializeArray();
			if(cdata.length<=0){
				alert("请勾选需要批量删除的条目");
				return false;
			}
		if(confirm("确定要删除吗？")){
			QzTool.Ajax({
				request: "/my/deletemsgarray",
				data:cdata,
				respon:function(res){
					if(QzTool.ajaxLoginCheck(res)===false){return ;}
					for(var i=0;i<=res.id.length-1;i++){
						$("#cell-"+res.id[i]).remove();
					}
				}
			});
		}
	},
	userLikeMember:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/ajax/userlikemember",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-10;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-25;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};
ActAvatar={
	refreshFeatured:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:250px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/avatar/refreshfeatured",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
			}
		});	
	},
	refreshAvatar:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/avatar/refreshavatar",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				// $(".pagination").css({"display":"none"});
				// $(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	loadUploadAvatar:function(timestamp,verify,uid){
		$('#upload_avatar').uploadify({
			'swf'      : '/uploadify.swf',
			'uploader' : '/avatar/upload/',
			'formData' : {'timestamp':timestamp,'verify':verify,'uid':uid},
			'onFallback':function(){
				 alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
			},
			'onUploadStart': function(file) {
				$("#"+file.id).show();
				$("#upload_avatar-button").hide();
			},
			'onUploadError':function(file){
				$("#"+file.id).hide();
				QzData.uploadFailImgs.push(file.name);
			},
			'onUploadSuccess':function(file,res,response){
				if(response===false){
					$("#"+file.id).hide();
					QzData.uploadFailImgs.push(file.name);
				}else{
					if(res==null||res==''){
						$("#"+file.id).hide();
						QzData.uploadFailImgs.push(file.name);
					}else{
						resJSON=$.parseJSON(res);
						if(resJSON.status!=200){
							$("#"+file.id).remove();
							QzData.uploadFailImgs.push(file.name);
						}else{
							$("#"+file.id+" .uploadify-progress").remove();
							$("#"+file.id).append("<img src='"+resJSON.msg+"' class='img' data='"+resJSON.id+"'><input type='hidden' name='imgid[]' value='"+resJSON.id+"'>");
							$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
							$(".uploadify-queue").sortable({
							 connectWith:'.uploadify-queue-item',
							 deactivate:function (event,ui) {
								$(".cover").remove();
								$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
								ui.item[0].style.zIndex=100;
							  }
							});
						}
						
					}
				}
			},
			'onQueueComplete' : function() {
				$("#upload_avatar-button").show();
				if(QzData.uploadFailImgs.length>0){
					var str="你有"+QzData.uploadFailImgs.length+"张图片因网络原因上传失败，请检查后重新上传。\n";
					for(var imgc=0;imgc<=QzData.uploadFailImgs.length-1;imgc++){
						str+=QzData.uploadFailImgs[imgc]+"\n";
					}
					alert(str);
				}
			　	QzData.uploadFailImgs=[];
			}
		});
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		$("#cat_id").val($(o).attr('data'));
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/avatar/loadtag",
			data:"cat_id="+$(o).attr('data'),
			respon:function(res){
				$("#similarTags").html(res.html);
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postAvatar:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		message=$.trim($("#avatar_title").val());
		if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		if(message.length >50){
			myTips("标题字太多了","error");
			return false;
		}
		if(!$("#upload_avatar-queue img").size()>0){
			myTips("请上传头像","error");
			return false;
		}
		if(QzData.is_submit==0){
			QzData.is_submit=1;
			$("#avatarForm").submit();
			
		}
		return true;
	},
	postThread:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/avatar/actthread",
			data:$("#threadForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");					
					myTips(res.msg,"error");
					return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#thread_list").html(res.data);
				$("#thread_list_page").html(res.pagination);
				if (res.msg!=''&&res.msg!==null){
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(thread_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(thread_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").focus();
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/avatar/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-10;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-25;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};

ActPic={
	refreshFeatured:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:250px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/pic/refreshfeatured",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
			}
		});	
	},
	refreshPic:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/pic/refreshpic",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	loadUploadPic:function(timestamp,verify,uid){
		$('#upload_avatar').uploadify({
			'swf'      : '/uploadify.swf',
			'uploader' : '/pic/upload/',
			'formData' : {'timestamp':timestamp,'verify':verify,'uid':uid},
			'onFallback':function(){
				 alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
			},
			'onUploadStart': function(file) {
				
				$("#"+file.id).show();
				$("#upload_avatar-button").hide();
			},
			'onUploadError':function(file){
				$("#"+file.id).hide();
				QzData.uploadFailImgs.push(file.name);
			},
			'onUploadSuccess':function(file,res,response){
				if(response===false){
					$("#"+file.id).hide();
					QzData.uploadFailImgs.push(file.name);
				}else{
					if(res==null||res==''){
						$("#"+file.id).hide();
						QzData.uploadFailImgs.push(file.name);
					}else{
						resJSON=$.parseJSON(res);
						if(resJSON.status!=200){
							$("#"+file.id).remove();
							QzData.uploadFailImgs.push(file.name);
						}else{
							$("#"+file.id+" .uploadify-progress").remove();
							$("#"+file.id).append("<img src='"+resJSON.msg+"' class='img' data='"+resJSON.id+"'><input type='hidden' name='imgid[]' value='"+resJSON.id+"'>");
							$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
							$(".uploadify-queue").sortable({
							 connectWith:'.uploadify-queue-item',
							 deactivate:function (event,ui) {
								$(".cover").remove();
								$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
								ui.item[0].style.zIndex=100;
							  }
							});
						}
						
					}
				}
			},
			'onQueueComplete' : function() {
				$("#upload_avatar-button").show();
				if(QzData.uploadFailImgs.length>0){
					var str="你有"+QzData.uploadFailImgs.length+"张图片因网络原因上传失败，请检查后重新上传。\n";
					for(var imgc=0;imgc<=QzData.uploadFailImgs.length-1;imgc++){
						str+=QzData.uploadFailImgs[imgc]+"\n";
					}
					alert(str);
				}
			　	QzData.uploadFailImgs=[];
			}
		});
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		$("#cat_id").val($(o).attr('data'));
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/pic/loadtag",
			data:"cat_id="+$(o).attr('data'),
			respon:function(res){
				$("#similarTags").html(res.html);
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postPic:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		message=$.trim($("#pic_title").val());
		if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		if(message.length >50){
			myTips("标题字太多了","error");
			return false;
		}
		if(!$("#upload_avatar-queue img").size()>0){
			alert("请上传图片");
			return false;
		}
		
		if(QzData.is_submit==0){
			QzData.is_submit=1;
			$("#picForm").submit();
			
		}
		return true;
	},
	postThread:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/pic/actthread",
			data:$("#threadForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");
					myTips(res.msg,"error");return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#thread_list").html(res.data);
				$("#thread_list_page").html(res.pagination);
				if (res.msg!=''&&res.msg!==null){
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(thread_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(thread_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").focus();
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/pic/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-10;
					var y=$(o).offset().top-21;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-28;
					var y=$(o).offset().top-21;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};

ActSkin={
	refreshFeatured:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:250px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/skins/refreshfeatured",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
			}
		});	
	},
	refreshSkin:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/skins/refreshskin",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	loadUploadSkin:function(timestamp,verify,uid){
		$('#upload_avatar').uploadify({
			'swf'      : '/uploadify.swf',
			'uploader' : '/skins/upload/',
			'formData' : {'timestamp':timestamp,'verify':verify,'uid':uid},
			'onFallback':function(){
				 alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
			},
			'onUploadStart': function(file) {
				$("#"+file.id).show();
				$("#upload_avatar-button").hide();
			},
			'onUploadError':function(file){
				$("#"+file.id).hide();
				QzData.uploadFailImgs.push(file.name);
			},
			'onUploadSuccess':function(file,res,response){
				if(response===false){
					$("#"+file.id).hide();
					QzData.uploadFailImgs.push(file.name);
				}else{
					if(res==null||res==''){
						$("#"+file.id).hide();
						QzData.uploadFailImgs.push(file.name);
					}else{
						resJSON=$.parseJSON(res);
						if(resJSON.status!=200){
							$("#"+file.id).remove();
							QzData.uploadFailImgs.push(file.name);
						}else{
							$("#"+file.id+" .uploadify-progress").remove();
							$("#"+file.id).append("<img src='"+resJSON.msg+"' class='img' data='"+resJSON.id+"'><input type='hidden' name='imgid[]' value='"+resJSON.id+"'>");
							$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
							$(".uploadify-queue").sortable({
							 connectWith:'.uploadify-queue-item',
							 deactivate:function (event,ui) {
								$(".cover").remove();
								$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
								ui.item[0].style.zIndex=100;
							  }
							});
						}
						
					}
				}
			},
			'onQueueComplete' : function() {
				$("#upload_avatar-button").show();
				if(QzData.uploadFailImgs.length>0){
					var str="你有"+QzData.uploadFailImgs.length+"张图片因网络原因上传失败，请检查后重新上传。\n";
					for(var imgc=0;imgc<=QzData.uploadFailImgs.length-1;imgc++){
						str+=QzData.uploadFailImgs[imgc]+"\n";
					}
					alert(str);
				}
			　	QzData.uploadFailImgs=[];
			}
		});
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		$("#cat_id").val($(o).attr('data'));
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/skins/loadtag",
			data:"cat_id="+$(o).attr('data'),
			respon:function(res){
				$("#similarTags").html(res.html);
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postSkin:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		
		message=$.trim($("#skin_title").val());
		if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		if(message.length >50){
			myTips("标题字太多了","error");
			return false;
		}

		if(!$("#upload_avatar-queue img").size()>0){
			myTips("请上传头像","error");
			return false;
		}
		
		if(QzData.is_submit==0){
			QzData.is_submit=1;
			$("#skinForm").submit();
			
		}
		return true;
	},
	postThread:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/skins/actthread",
			data:$("#threadForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");
					myTips(res.msg,"error");return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#thread_list").html(res.data);
				$("#thread_list_page").html(res.pagination);
				if (res.msg!=''&&res.msg!==null){
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(thread_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(thread_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").focus();
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/skins/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-20;
					var y=$(o).offset().top-18;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-38;
					var y=$(o).offset().top-18;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'999'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};
ActSign={
	refreshSign:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/sign/refreshsign",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		var cat_id=$(o).attr('data');
		$("#cat_id").val(cat_id);
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/sign/loadtag",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#similarTags").html(res.html);
				if(cat_id==1021){
					$("#lovers_signature").show();
				}else{
					$("#lovers_signature").hide();
				}
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postSubmit:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		
		message=$.trim($("#comm_ipt_1").val());
		if(message==''){
			myTips("请填写内容","error");
			return false;
		}
		if(message.length >50){
			myTips("内容字太多了","error");
			return false;
		}
		message2=$.trim($("#comm_ipt_2").val());
		if(message2.length >50){
			myTips("内容字太多了","error");
			return false;
		}
		if ($("#cat_id").val()==1021) {
			if ($.trim($("#comm_ipt_2").val())=='') {
				alert("你选择了情侣签名，请填写完整");
				return false;
			}
		}
		
		QzTool.Ajax({
			request: "/sign/checkcaptcha",
			data:"captcha="+$("#captcha").val(),
			respon:function(res){
				if(res.status==1){
					myTips(res.msg,"error");
					return false;
				}else{
					if(QzData.is_submit==0){
						QzData.is_submit=1;
						$("#signForm").submit();
					}
					return true;
				}
			}
		});
		
		
		return true;
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
	
		QzTool.Ajax({
			request: "/sign/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-20;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-40;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};

ActName={
	refreshName:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/name/refreshname",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		var cat_id=$(o).attr('data');
		$("#cat_id").val(cat_id);
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/name/loadtag",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#similarTags").html(res.html);
				if(cat_id==1027){
					$("#lovers_signature").show();
				}else{
					$("#lovers_signature").hide();
				}
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postSubmit:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		
		message=$.trim($("#comm_ipt_1").val());
		if(message==''){
			myTips("请填写内容","error");
			return false;
		}
		if(message.length >12){
			myTips("内容字太多了","error");
			return false;
		}
		message2=$.trim($("#comm_ipt_2").val());
		if(message2.length >12){
			myTips("内容字太多了","error");
			return false;
		}
		if ($("#cat_id").val()==1027) {
			if ($.trim($("#comm_ipt_2").val())=='') {
				myTips("你选择了情侣网名，请填写完整","error");
				return false;
			}
		}
		QzTool.Ajax({
			request: "/name/checkcaptcha",
			data:"captcha="+$("#captcha").val(),
			respon:function(res){
				if(res.status==1){
					myTips(res.msg,"error");
					return false;
				}else{
					if(QzData.is_submit==0){
						QzData.is_submit=1;
						$("#nameForm").submit();
						
					}
					return true;
				}
			}
		});
		
		
		return true;
	},
	
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/name/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-20;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-40;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};


ActGroup={
	refreshGroup:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/group/refreshgroup",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		var cat_id=$(o).attr('data');
		$("#cat_id").val(cat_id);
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/group/loadtag",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#similarTags").html(res.html);
				if(cat_id==1032){
					$("#lovers_group").attr({"class":"lovers_group_hide"});
					$("#lovers_group textarea").removeAttr("disabled");
				}else{
					$("#lovers_group").attr({"class":"lovers_group_show"});
					$("#lovers_group textarea").val("").attr("disabled","disabled");
				}
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postSubmit:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		
		message=$.trim($("#comm_ipt_0").val());
		if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		if(message.length >50){
			myTips("标题字太多了","error");
			return false;
		}
		if($.trim($("#comm_ipt_1").val())==''){
			myTips("请填写内容","error");
			return false;
		}
		if ($("#cat_id").val()==1032) {
			if ($.trim($("#comm_ipt_2").val())=='') {
				myTips("你选择了情侣分组，请填写完整","error");
				return false;
			}
		}
		if(QzData.is_submit==0){
			QzData.is_submit=1;
			$("#groupForm").submit();
			
		}
		return true;
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/group/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-20;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-40;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};
ActNote={
	refreshNote:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/note/refreshnote",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	loadUploadNote:function(timestamp,verify,uid){
		$('#upload_avatar').uploadify({
			'swf'      : '/uploadify.swf',
			'uploader' : '/note/upload/',
			'uploadLimit' : 1,
			'formData' : {'timestamp':timestamp,'verify':verify,'uid':uid},
			'onFallback':function(){
				 alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
			},
			'onUploadStart': function(file) {
				
				$("#"+file.id).show();
				$("#upload_avatar-button").hide();
			},
			'onUploadError':function(file){
				$("#"+file.id).hide();
				QzData.uploadFailImgs.push(file.name);
			},
			'onUploadSuccess':function(file,res,response){
				if(response===false){
					$("#"+file.id).hide();
					QzData.uploadFailImgs.push(file.name);
				}else{
					if(res==null||res==''){
						$("#"+file.id).hide();
						QzData.uploadFailImgs.push(file.name);
					}else{
						resJSON=$.parseJSON(res);
						if(resJSON.status!=200){
							$("#"+file.id).remove();
							QzData.uploadFailImgs.push(file.name);
						}else{
							$("#"+file.id+" .uploadify-progress").remove();
							$("#"+file.id).append("<img src='"+resJSON.msg+"' class='img' data='"+resJSON.id+"'><input type='hidden' name='imgid[]' value='"+resJSON.id+"'>");
							$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
							$(".uploadify-queue").sortable({
							 connectWith:'.uploadify-queue-item',
							 deactivate:function (event,ui) {
								$(".cover").remove();
								$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
								ui.item[0].style.zIndex=100;
							  }
							});
						}
						
					}
				}
			},
			'onQueueComplete' : function() {
				$("#upload_avatar-button").show();
				if(QzData.uploadFailImgs.length>0){
					var str="你有"+QzData.uploadFailImgs.length+"张图片因网络原因上传失败，请检查后重新上传。\n";
					for(var imgc=0;imgc<=QzData.uploadFailImgs.length-1;imgc++){
						str+=QzData.uploadFailImgs[imgc]+"\n";
					}
					alert(str);
				}
			　	QzData.uploadFailImgs=[];
			}
		});
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		var cat_id=$(o).attr('data');
		$("#cat_id").val(cat_id);
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/note/loadtag",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#similarTags").html(res.html);
				
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postSubmit:function(){
		message=$.trim($("#comm_ipt_0").val());
		messagelenth=message.length;
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		else if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		else if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		else if(messagelenth>50){
			myTips("标题字太多了","error");
			return false;
		}
		else{
			return true;
		}
	},
	postThread:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/note/actthread",
			data:$("#threadForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");
					myTips(res.msg,"error");return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#thread_list").html(res.data);
				$("#thread_list_page").html(res.pagination);
				if (res.msg!=''&&res.msg!==null){
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(thread_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(thread_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").focus();
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/note/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-20;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-40;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};

ActShow={
	refreshShow:function(cat_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:200px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		QzTool.Ajax({
			request: "/show/refreshshow",
			data:"cat_id="+cat_id,
			respon:function(res){
				$("#refreshDiv").html(res.html);
				$(".pagination").css({"display":"none"});
				$(".wrapContent").css({"margin-bottom":"10px"});
			}
		});	
	},
	loadUploadShow:function(timestamp,verify,uid){
		$('#upload_avatar').uploadify({
			'swf'      : '/uploadify.swf',
			'uploader' : '/show/upload/',
			'formData' : {'timestamp':timestamp,'verify':verify,'uid':uid},
			'onFallback':function(){
				 alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
			},
			'onUploadStart': function(file) {
				
				$("#"+file.id).show();
				$("#upload_avatar-button").hide();
			},
			'onUploadError':function(file){
				$("#"+file.id).hide();
				QzData.uploadFailImgs.push(file.name);
			},
			'onUploadSuccess':function(file,res,response){
				if(response===false){
					$("#"+file.id).hide();
					QzData.uploadFailImgs.push(file.name);
				}else{
					if(res==null||res==''){
						$("#"+file.id).hide();
						QzData.uploadFailImgs.push(file.name);
					}else{
						resJSON=$.parseJSON(res);
						if(resJSON.status!=200){
							$("#"+file.id).remove();
							QzData.uploadFailImgs.push(file.name);
						}else{
							$("#"+file.id+" .uploadify-progress").remove();
							$("#"+file.id).append("<img src='"+resJSON.msg+"' class='img' data='"+resJSON.id+"'><input type='hidden' name='imgid[]' value='"+resJSON.id+"'>");
							$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
							$(".uploadify-queue").sortable({
							 connectWith:'.uploadify-queue-item',
							 deactivate:function (event,ui) {
								$(".cover").remove();
								$("#upload_avatar-queue .img:lt(1)").before('<div class="cover"></div>');
								ui.item[0].style.zIndex=100;
							  }
							});
						}
						
					}
				}
			},
			'onQueueComplete' : function() {
				$("#upload_avatar-button").show();
				if(QzData.uploadFailImgs.length>0){
					var str="你有"+QzData.uploadFailImgs.length+"张图片因网络原因上传失败，请检查后重新上传。\n";
					for(var imgc=0;imgc<=QzData.uploadFailImgs.length-1;imgc++){
						str+=QzData.uploadFailImgs[imgc]+"\n";
					}
					alert(str);
				}
			　	QzData.uploadFailImgs=[];
			}
		});
	},
	selectCat:function(o){
		$("#release_sort a").attr({"class":''});
		$(o).attr({"class":"on"});
		$("#cat_id").val($(o).attr('data'));
		QzData.avatar_tag=[];
		$("#tag_id").val(QzData.avatar_tag);
		QzTool.Ajax({
			request: "/show/loadtag",
			data:"cat_id="+$(o).attr('data'),
			respon:function(res){
				$("#similarTags").html(res.html);
			}
		});
	},
	selectTag:function(o){
		if($(o).attr("class")=='on'){
			$(o).attr({"class":""});
			QzData.avatar_tag.pop($(o).attr('data'));
		}else{
			if(QzData.avatar_tag.length>=3){
				myTips("最多只能选择三个哦！","error");
				return false;
			}
			$(o).attr({"class":"on"});
			QzData.avatar_tag.push($(o).attr('data'));
		}
		$("#tag_id").val(QzData.avatar_tag);
	},
	postShow:function(){
		if($("#cat_id").val()==''||$("#cat_id").val()<=0){
			myTips("请选择分类","error");
			return false;
		}
		if(QzData.avatar_tag.length==0){
			myTips("请选择标签","error");
			return false;
		}
		message=$.trim($("#show_title").val());
		if(message==''){
			myTips("请填写标题","error");
			return false;
		}
		if(message.length >50){
			myTips("标题字太多了","error");
			return false;
		}
		if(!$("#upload_avatar-queue img").size()>0){
			alert("请上传图片");
			return false;
		}
		
		if(QzData.is_submit==0){
			QzData.is_submit=1;
			$("#showForm").submit();
			
		}
		return true;
	},
	postThread:function(){
		message=$.trim($("#textContent").val());
		if(message==''){
			myTips("请写点内容吧","error");
			return false;
		}
		if(message.length >140){myTips("你输入的字太多了","error");return false;}
		QzTool.Ajax({
			request: "/show/actthread",
			data:$("#threadForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					$("#quoteDiv").html("");
					$("#textContent").val("");
					myTips(res.msg,"error");return false;
				}
				$("#quoteDiv").html("");
				$("#textContent").val("");
				$("#thread_list").html(res.data);
				$("#thread_list_page").html(res.pagination);
				if (res.msg!=''&&res.msg!==null){
					myTips(res.msg,"success");
				};
			}
		});
	},
	replieAt:function(thread_id,user_id,user_name){
		$("#quoteDiv").html("回复@"+user_name+": ");
		$("#quoteIdInput").val(thread_id);
		$("#quoteUidInput").val(user_id);
		$("#textContent").focus();
	},
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/show/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-10;
					var y=$(o).offset().top-21;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-28;
					var y=$(o).offset().top-21;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	}
};


ActSpecial={
	vote:function(id,type,divid,o){
		$(".act-msg").remove();
		
		QzTool.Ajax({
			request: "/special/actvote",
			data:"id="+id+"&type="+type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if(res.status==403){
					myTips(res.msg,"error");return false;
				}
				
				if(res.code=='like' || res.code=='drop'){
					var x=$(o).offset().left-10;
					var y=$(o).offset().top-20;
					var ly=y-25;
				}else{
					var x=$(o).offset().left-25;
					var y=$(o).offset().top-20;
					var ly=y-42;
				}
				$("body").append("<div id='act-msg-"+id+"' class='act-msg act-msg-"+res.code+"'></div>");
			   $("#act-msg-"+id).css({"position":"absolute","left":x,"top":y,'z-index':'200'}).animate({"top":ly},100);
				setTimeout(function(){
					$("#act-msg-"+id).fadeOut("200");
				},1000);
			    $("#"+divid).html(res.count);
			}
		});
	},
	refreshFeatured:function(nav_id){
		$("#refreshDiv").html('<div style="width:100%;line-height:176px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		setTimeout(function(){
			QzTool.Ajax({
				request: "/special/refreshfeatured",
				data:"nav_id="+nav_id,
				respon:function(res){
					$("#refreshDiv").html(res.html);
				}
			});
		},200);
	}
};
ActApp={
	reflashAvatar:function(){
		$("#avatarDiv").html('<div style="display:block;width:100%;line-height:287px;_padding-top:130px;_padding-bottom:125px;margin:0 auto;text-align:center;overflow:hidden;zoom:1;"><img src="images/loading.gif"></div>');
		var page=ReflashPageData.page;
		QzTool.Ajax({
			request: "/duba/ajax/avatar",
			data:"page="+page,
			respon:function(res){
				$("#avatarDiv").html(res.html);
				ReflashPageData.page=res.page;
			}
		});
	},
	reflashSign:function(){
		$("#signDiv").html('<div style="display:block;width:100%;line-height:287px;_padding-top:140px;_padding-bottom:136px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		var page=ReflashPageData.page;
		QzTool.Ajax({
			request: "/duba/ajax/sign",
			data:"page="+page,
			respon:function(res){
				$("#signDiv").html(res.html);
				ReflashPageData.page=res.page;
			}
		});
	},
	reflashName:function(){
		$("#nameDiv").html('<div style="display:block;width:670px;_width:150px;line-height:287px;_padding-top:136px;_padding-bottom:140px;margin:0 auto;text-align:center"><img src="images/loading.gif"></div>');
		var page=ReflashPageData.page;
		QzTool.Ajax({
			request: "/duba/ajax/name",
			data:"page="+page,
			respon:function(res){
				$("#nameDiv").html(res.html);
				ReflashPageData.page=res.page;
			}
		});
	}
};
ActReport={
	show:function(mapping_id,mapping_uid,report_type,obj){
		$("#report_show").remove();
		QzTool.Ajax({
			request: "/ajax/report?method=show",
			data:"mapping_id="+mapping_id+"&mapping_uid="+mapping_uid+"&report_type="+report_type,
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if (res.status=='200') {
					var left=$(obj).offset().left+30;
					var top=$(obj).offset().top-15;
					$("body").append(res.html);
					$("#report_show").css({left:left+"px",top:top+"px"}).show();
				} else{
					$("#report_show").remove();
					myTips(res.msg,"error");return false;
				};
			}
		});
	},
	send:function(){
		QzTool.Ajax({
			request: "/ajax/report?method=send",
			data:$("#reportForm").serializeArray(),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if (res.status=='200') {
					$("#report_show").remove();
					myTips(res.msg,"success");
				}else if(res.status=='404'){
					myTips(res.msg,"error");return false;
				}else{
					$("#report_show").remove();
					myTips(res.msg,"error");return false;
				};
				
			}
		});
	}
};
ActAjax={
	login:function(){
		QzTool.Ajax({
			request: "/ajax/login",
			respon:function(res){
				if (res.status!=200) {myTips(res.msg,"error");return false;};
				$("#ajaxlogin").html(res.html);
				var my=mypostion(".newLogin");
				$(".newLogin").css({"position":"absolute","z-index":"9999999","top":my.top+"px","left":my.left+"px"});
				$(".newLogin").show();
				$("#ui-layer").show();
			}
		});
	},
	register:function(){
		QzTool.Ajax({
			request: "/ajax/register",
			respon:function(res){
				if (res.status!=200) {myTips(res.msg,"error");return false;};
				$("#ajaxlogin").html(res.html);
				var my=mypostion(".newLogin");
				$(".newLogin").css({"position":"absolute","z-index":"9999999","top":my.top+"px","left":my.left+"px"});
				$(".newLogin").show();
				$("#ui-layer").show();
			}
		});
	}
};
function sdclose(){
	$("#ajaxlogin").html("");
};


var focusOffset={getPosition:function(d){if(document.selection){d.focus();var c=document.selection.createRange();return{left:c.boundingLeft,top:c.boundingTop,bottom:c.boundingTop+c.boundingHeight}}else{var i=this;var b="{$clone_div}",h="{$cloneLeft}",n="{$cloneFocus}",l="{$cloneRight}";var m='<span style="white-space:pre-wrap;"> </span>';var a=d[b]||document.createElement("div"),q=d[n]||document.createElement("span");var p=d[h]||document.createElement("span");var f=i._offset(d),g=this._getFocus(d),k={left:0,top:0};if(!d[b]){d[b]=a,d[n]=q;d[h]=p;a.appendChild(p);a.appendChild(q);document.body.appendChild(a);q.innerHTML="|";q.style.cssText="display:inline-block;width:0px;overflow:hidden;z-index:-100;word-wrap:break-word;word-break:break-all;";a.className=this._cloneStyle(d);a.style.cssText="visibility:hidden;display:inline-block;position:absolute;z-index:-100;word-wrap:break-word;word-break:break-all;overflow:hidden;"}a.style.left=this._offset(d).left+"px";a.style.top=this._offset(d).top+"px";var o=d.value.substring(0,g).replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br/>").replace(/\s/g,m);p.innerHTML=o;q.style.display="inline-block";try{k=this._offset(q)}catch(j){}q.style.display="none";return{left:k.left,top:k.top,bottom:k.bottom}}},_cloneStyle:function(g,b){if(!b&&g["${cloneName}"]){return g["${cloneName}"]}var a,c,d=/^(number|string)$/;var f=/^(content|outline|outlineWidth)$/;var e=[],h=g.style;for(c in h){if(!f.test(c)){val=this._getStyle(g,c);if(val!==""&&d.test(typeof val)){c=c.replace(/([A-Z])/g,"-$1").toLowerCase();e.push(c);e.push(":");e.push(val);e.push(";")}}}e=e.join("");g["${cloneName}"]=a="clone"+(new Date).getTime();this._addHeadStyle("."+a+"{"+e+"}");return a},_addHeadStyle:function(b){var a=this._style[document];if(!a){a=this._style[document]=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(a)}a.styleSheet&&(a.styleSheet.cssText+=b)||a.appendChild(document.createTextNode(b))},_style:{},_getStyle:"getComputedStyle" in window?function(b,a){return getComputedStyle(b,null)[a]}:function(b,a){return b.currentStyle[a]},_getFocus:function(c){var b=0;if(document.selection){c.focus();var a=document.selection.createRange();if(c.nodeName==="TEXTAREA"){var d=a.duplicate();d.moveToElementText(c);var b=-1;while(d.inRange(a)){d.moveStart("character");b++}}else{if(c.nodeName==="INPUT"){a.moveStart("character",-c.value.length);b=a.text.length}}}else{if(c.selectionStart||c.selectionStart=="0"){b=c.selectionStart}}return(b)},_offset:function(c){var e=c.getBoundingClientRect(),i=c.ownerDocument,f=i.body,a=i.documentElement;var d=a.clientTop||f.clientTop||0,g=a.clientLeft||f.clientLeft||0;var h=e.top+(self.pageYOffset||a.scrollTop)-d,b=e.left+(self.pageXOffset||a.scrollLeft)-g;return{left:b,top:h,right:b+e.width,bottom:h+e.height}}};
function checkAt(o){
	var val=$(o).val();
	if(val.charAt(val.length - 1)=="@"){
		$(".at_list").remove();
		var p=focusOffset.getPosition(o);
		QzTool.Ajax({
			request: "/ajax/athistory",
			data:"div_id="+$(o).attr("id"),
			respon:function(res){
				if(QzTool.ajaxLoginCheck(res)===false){return ;}
				if (res.status==1) {
					var left=p.left-10;
					var top=p.top+20;
					$("body").append(res.data);
					$(".at_list").css({left:left+"px",top:top+"px",zIndex:"99999"}).show();
				} else{
					$(".at_list").remove();
					return false;
				};
			}
		});
	}else{
		$(".at_list").remove();
	};
};