﻿function killErrors() {return true;}
window.onerror = killErrors;
var Ajax_msg="获取失败";
function Get_Digg(t0,t1)
{
	$('#'+t1).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url: "/Include/Digg.asp?id="+t0+"",
	timeout: 20000,
	error: function(){$('#'+t1).html(Ajax_msg);},
	success: function(t0){$('#'+t1).html(t0);}
	});
}

function Digg(t0,t1,t2)
{
	$('#'+t2).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url: "/Include/Digg.asp?id="+t0+"&action=Digg",
	timeout: 20000,
	error: function(){$('#'+t2).html(Ajax_msg);},
	success: function(t3){$('#'+t2).html(t3.substring(1));if(t3.substring(0,1)==0){Get_Digg(t0,t1)}}
	});
}

function Digg_Action(t0,t1,t2,t3,t4,t5)
{
	$.ajax({
	type: "get",
	cache:false,
	url: "/Include/Digg.asp?id="+t0+"&action="+t1+"",
	timeout: 20000,
	error: function(){alert(Ajax_msg);},
	success: function(t6){
		var t7=t6.split(':');
		var sUp=parseInt(t7[0]);
		var sDown=parseInt(t7[1]);
		var sTotal=sUp+sDown;
		if(sTotal==0)
		{
			var spUp=0;var spDown=0;
		}
		else
		{
		var spUp=(sUp/sTotal)*100;
		spUp=Math.round(spUp*10)/10;
		var spDown=100-spUp;
		spDown=Math.round(spDown*10)/10;
		}
		var t8=t7[2];
		if (t8==1)
		{
			$('#'+t2).html(spUp+"%("+sUp+")");
			$('#'+t3).html(spDown+"%("+sDown+")")
			$('#'+t4)[0].style.width=spUp+'%';
			$('#'+t5)[0].style.width=spDown+'%';
		}
		else{alert('您不是已表过态了嘛！');}
		}
	});
}

function get_comment(t0,t1)
{
	$('#'+t1).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url: "/Include/gethits.asp?id="+t0+"&action=2",
	timeout: 20000,
	error: function(){$('#'+t1).html(Ajax_msg)},
	success: function(t0){$('#'+t1).html(t0);}
	})
}

function checkcomment(theform)
{
	if (trim(theform.username.value)=='')
	{alert('姓名不能为空');
		theform.username.focus();
		theform.username.value='';
		return false
	}
	if (trim(theform.content.value)=='')
	{alert('内容不能为空');
		theform.content.focus();
		theform.content.value='';
		return false
	}
	var param;
	param="/Include/comment.asp?action=save";
	param+="&username="+escape(trim(theform.username.value));
	param+="&content="+escape(trim(theform.content.value));
	param+="&id="+escape(trim(theform.id.value));
	$('#showmsg').html("<img src=/images/loading.gif>");
	$.ajax({
	type:"get",
	cache:false,
	url:param,
	timeout:20000,
	error:function(){$('#showmsg').html(Ajax_msg);},
	success:function(t0)
	{
		$('#showmsg').html(t0.substring(1));
		if(t0.substring(0,1)==0){theform.username.value='';theform.content.value='';get_comment(theform.id.value,'show_i_commentnum');load_comment(theform.id.value,'comment_list');}
		}
	});
	return false
}


function load_comment(t0,t1)
{
	$('#'+t1).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url:"/Include/comment.asp?id="+t0+"&t0="+t1+"",
	timeout: 20000,
	error:function(){$('#'+t1).html(Ajax_msg)},
	success:function(t0){$('#'+t1).html(t0.substring(1));}
	})
}

function get_comment_page(t0,t1,t2)
{
	$('#'+t2).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url:"/Include/comment.asp?id="+t1+"&page="+t0+"&t0="+t2+"",
	timeout:20000,
	error:function(){$('#'+t2).html(Ajax_msg)},
	success:function(t0){$('#'+t2).html(t0);}
	})
}

function get_hits(t0,t1,t2,t3)
{
	$('#'+t3).html("<img src=/images/loading.gif>");
	$.ajax({
	type: "get",
	cache:false,
	url: "/Include/gethits.asp?id="+t0+"&action="+t1+"&t="+t2+"",
	timeout: 20000,
	error: function(){$('#'+t3).html(Ajax_msg);},
	success: function(t0){$('#'+t3).html(t0);}
	});
}

function trim(s){return  s.replace(/(^\s*)|(\s*$)/g,  "");} 


function checkcFeedback(theform)
{
	if (trim(theform.Ea_title.value)=='')
	{alert('主题不能为空');
		theform.Ea_title.focus();
		theform.Ea_title.value='';
		return false
	}
	if (trim(theform.TrueName.value)=='')
	{alert('姓名不能为空');
		theform.TrueName.focus();
		theform.TrueName.value='';
		return false
	}
	if (trim(theform.QQ.value)=='')
	{alert('QQ不能为空');
		theform.QQ.focus();
		theform.QQ.value='';
		return false
	}	
	if (trim(theform.content.value)=='')
	{alert('内容不能为空');
		theform.content.focus();
		theform.content.value='';
		return false
	}
	var param;
	param="/Include/FeedBack_Save.asp?action=save";
	param+="&Ea_title="+escape(trim(theform.Ea_title.value));
	param+="&TrueName="+escape(trim(theform.TrueName.value));
	param+="&Sex="+escape(trim(theform.Sex.value));
	param+="&QQ="+escape(trim(theform.QQ.value));
	param+="&Email="+escape(trim(theform.Email.value));
	param+="&content="+escape(trim(theform.content.value));
	param+="&id="+escape(trim(theform.id.value));
	$('#showmsg').html("<img src=/images/loading.gif>");
	$.ajax({
	type:"get",
	cache:false,
	url:param,
	timeout:20000,
	error:function(){$('#showmsg').html(Ajax_msg);},
	success:function(t0)
	{
		$('#showmsg').html(t0.substring(1));
		if(t0.substring(0,1)==0){theform.Ea_title.value='';theform.TrueName.value='';theform.QQ.value='';theform.Email.value='';theform.content.value='';}
		}
	});
	return false
}
