function addloadevent(thefunc){
var oldfunc=window.onload;
if (typeof oldfunc!='function'){
window.onload=thefunc;
}
else{
window.onload=function(){
		oldfunc();
		thefunc();
		}
	}
}


function createxmlhttp()
{
xmlhttpobj = false;
try{
xmlhttpobj = new XMLHttpRequest;
}catch(e){
try{
xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
}catch(e2){
try{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlhttpobj = false;
}
}
}
return xmlhttpobj;
} 

function jiafen(topicid,act){
var xmlhttpobj=createxmlhttp();
if (act=="add"){
var url="http://www.365ebuy.com/bbs/jiafen.asp?topicid="+topicid+"&point=1&rdm="+Math.random();
}
else if (act=="minus"){
var url="http://www.365ebuy.com/bbs/jiafen.asp?topicid="+topicid+"&point=-1&rdm="+Math.random();
}
xmlhttpobj.open("get",url,"true")
xmlhttpobj.onreadystatechange=callback;
xmlhttpobj.send(null);
}

function callback(){
if(xmlhttpobj.readyState==4){
	if(xmlhttpobj.status==200){
		var theresult=xmlhttpobj.responseText;
		if(theresult=="voted"){
			alert('您已经评价过该帖，不能重复投票');
			}
		if (theresult=="can not vote yourself"){
			alert('不能评价自己的帖子哦！')
			}
		else if(theresult=="success"){
			alert('感谢您，评价成功！');
			window.location.reload();
			}
		else if (theresult=='unlogged'){
			alert ('亲爱的，您需要先登陆再评价');
			}
		else if(theresult=='too many votes'){
			alert('每人每天最多评价5次，您已经到达评价上限')
		}
		}
		
}
} 



function getin(){
var user=document.getElementById("username");
username=user.value;
var thepass=document.getElementById("pwd");
pwd=thepass.value;
if (username==""){
	user.focus();
}
else if (pwd==""){
	thepass.focus();
}
else{
	var xmlhttpobj=createxmlhttp();
	var url="http://www.365ebuy.com/getin.asp?username="+username+"&thepass="+pwd+"&rdm="+Math.random();
	xmlhttpobj.open("get",url,"true");
	xmlhttpobj.onreadystatechange=logit;
	xmlhttpobj.send(null);
}
}
function logit(){
if (xmlhttpobj.readyState==4){
	if(xmlhttpobj.status==200){
	var theresult=xmlhttpobj.responseText;
	if (theresult=="can not be empty"){
		alert('用户名或密码不能为空');
	}
	else if (theresult=="wrong pin"){
		alert('用户名或密码有误');
		document.getElementById("username").focus();
	}
	else if (theresult=="success"){
		window.location.reload();	
	}
	}
}
}


function cite(content){
	var Asai_bIsIE5=document.all;
	if (Asai_bIsIE5){
		var AsaiIFrame=frames["Asai_Composition"];}
	else{
		var AsaiIFrame=document.getElementById("Asai_Composition").contentWindow;
	}
	AsaiIFrame.focus();
	if(content!=''){AsaiIFrame.document.body.innerHTML+='[quote]'+content+'[/quote]';}
}

function jiangli(rid,act)
{var arr = showModalDialog("inc/jiangli.asp?rid="+rid+"&act="+act+"", "", "dialogWidth:500px; dialogHeight:290px; status:1; help:0");
window.location.reload();
}

function gomail(uid){
var arr = showModalDialog("inc/gomail.asp?uid="+uid+"", "", "dialogWidth:500px; dialogHeight:290px; status:1; help:0");
}

function topicman(id,act){
var arr = showModalDialog("inc/topicman.asp?id="+id+"&act="+act+"", "", "dialogWidth:500px; dialogHeight:290px; status:1; help:0");
window.location.reload();
}
