function chksearch(){
	var type = $("#type").val();
	var query = $.trim($("#query").val());
	if (type == null) {type = "tag"}
	if (query == "") {
		alert("\u8bf7\u8f93\u5165\u641c\u7d22\u5173\u952e\u5b57\uff01");
		$("#query").focus();
		return false;
	} else {
		window.location.href = "/search/" + type + "/" + encodeURI(query) + ".html";
	}
	return false;
}

//搜索
$(document).ready(
	function(){
		$("#options").find("a").each(
			function(){
				$(this).click(
					function(){
						$("#cursel").text(this.innerHTML);
						$("#options").toggle();
						$("#type").attr("value", $(this).attr("name"));
						$("#query").css({"background": "#FFFFFF"});
					}
				)
				
			}
		)
		$("#cursel").click(
			function(){
				$("#options").toggle().find("a").each(
					function(){
						$(this).parent().attr("className", $(this).text() == $("#cursel").text() ? "current" : "");
					}
				)
			}
		)
	}
)

//刷新验证码
function refreshimg(obj){
	var randnum = Math.random();
	$("#" + obj).html('<img src="./source/include/checkcode.php?s=' + "'" + randnum + "'" + '" alt="看不清楚?换一张" onclick="refreshimg();" style="cursor: pointer;">');
}

//点出统计
function clickout(wid) {
	$(document).ready(function(){$.ajax({type: "GET", url: "./common/outstat.php", data: "web_id=" + wid, cache: false, success: function(data){}});});
};

//错误报告
function report(obj, wid) {
	$(document).ready(function(){if (confirm("确认报告此错误吗？")){ $("#" + obj).html("正在提交，请稍候..."); $.ajax({type: "GET", url: "./common/report.php", data: "web_id=" + wid, cache: false, success: function(data){$("#" + obj).html(data);}})};});
};
