﻿//内容检索
function RZ_Search(){
	var form = $(this).parents("form");
	var keyword = form.find("input[name='keyword']");
	if($.trim(keyword.val())!="")
		form.submit();
}

/*添加点击数
el_hits:显示点击数的元素
*/
function RZ_LoadHits(el_hits){
	var recordid=el_hits.attr("recordid");
	var proc=el_hits.attr("type");
	if (proc!=undefined && proc!="")
	{
		var cookieid=$.cookie(RZ_APP_PRE+proc+"hits"+recordid);
		if (cookieid==null||cookieid=="")
		{
			$.ajax({
			  url: RZ_ROOT+"asp/hits_add.asp?proc="+proc+"&id="+recordid,
			  cache: false,
			  success: function(data){
				if (data!="")
				  {
					el_hits.text(data);
					$.cookie(RZ_APP_PRE+proc+"hits"+recordid,data);
				  }
			  }
			}); 
		}else{
			$.ajax({
			  url: RZ_ROOT+"asp/hits_count.asp?proc="+proc+"&id="+recordid,
			  cache: false,
			  success: function(data){
				if (data!="")
				  {
					el_hits.text(data);
				  }
			  }
			}); 
		}
	}
}

function RZ_TotalRecord_Minus(){
	if (isInteger($("#RZ_TotalRecord").text()))
	{
		$("#RZ_TotalRecord").text(parseInt($("#RZ_TotalRecord").text())-1);
	}
}




function RZ_ShowDialog(){
	var params=$(this).attr("params");
	var atitle=$(this).attr("title");
	var awidth=$(this).attr("width");
	var aheight=$(this).attr("height");
	var dialog=$(this).attr("dialog");
	var aurl=$(this).attr("url");
	var aid=$(this).attr("id");
	if(atitle==undefined)
		atitle='';
	if (awidth==undefined)
		awidth=500;
	if (aheight==undefined)
		aheight=300;
	if (aurl==undefined){
		aurl=RZ_ROOT+"asp/ajaxLoadDialog.asp";
	}
	$("#RZ_WindowLayer").empty();
	$("#RZ_WindowLayer").html("<div class='loading'></div>");
	$.ajax({
		type: "POST",
		url: aurl,
		data: "dialog="+dialog+"&"+params,
		cache:false,
		success: function(response){
			$("#RZ_WindowLayer").html(response);
			$('#RZ_Window').window({
				title: ''+atitle,
				width: awidth,
				height: aheight,
				modal: true,
				collapsible:false
			});
			$('#RZ_Window').window('open');
			$("#RZ_Checkcode_Img").attr("src",RZ_ROOT+"asp/code.asp?t="+(new Date()).getTime());
			$("#RZ_Checkcode_Img").bind("click",function(){$(this).attr("src",RZ_ROOT+"asp/code.asp");});
		}
	});
}



function RZ_SaveVote(itemids, voteid){
	$.ajax({
		type: "POST",
		url: RZ_ROOT+"asp/vote_save.asp",
		cache:false,
		data:"itemids="+itemids+"&voteid="+voteid,
		success: function(response){
			if (response=="SUCCESS0"||response=="SUCCESS1")
			{
				$.messager.alert(getText("INFORMATION"),getText("VOTE_SUCCESS"),'info');
			}else{
				$.messager.alert(getText("INFORMATION"),response,'info');
			}
		}
	});
}

$(document).ready(function(){
	//关闭对话框
	$('#RZ_Window').window('close');
	$(".RZ_ShowDialog").bind("click",RZ_ShowDialog);
});


