// JavaScript Document
function trim(str){return str.replace(/(^\s*)|(\s*$)/g,"");} //javascript去掉空格函数
function Cxmlhttp(){		//xmlhttp组件创建
	try{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(e){
		try{

		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
		    xmlhttp = false;
		}
	}
	
	if(!xmlhttp && typeof XMLHttpRequest!='undefined')
	{
	 xmlhttp =new XMLHttpRequest();
	}
	return xmlhttp;
}

function trim(str){return str.replace(/(^\s*)|(\s*$)/g,"");} //javascript去掉空格函数

function addfavor(){
	try{
		window.external.addFavorite(document.URL,document.title);	
	}catch(e){
		alert('添加收藏失败,请使用Ctrl+D进行添加');	
	}
}

/*
window.onscroll=function(){		//导航条自动滚动
	try{
		nav=document.getElementById("div_nav_k");
		if(document.body.scrollTop>120){
			nav.style.position='fixed';
			nav.style.top=0+'px';
			nav.style.opacity=0.9;
			nav.style.zIndex=999;
		}else{
			nav.style.position='';
			nav.style.top='';
			nav.style.opacity='';
			nav.style.zIndex='';
		}
	}catch(e){
		//浏览器不支持此功能
	}
}
*/

function ZanNumAdd(htype,id,num){
if(htype!='qiandao'){
	var cnum = $('#hs-id-'+htype+'-zannum-'+id).html();
	if(trim(cnum)=='') cnum=0;
	$('#hs-id-'+htype+'-zannum-'+id).html(parseInt(cnum)+num);	
}else{
	if(uid!=0){
		ExpTd(QDexp,QDtd);
		content='恭喜您，获得签到奖励：<Br>经验+'+QDexp+'，天豆+'+QDtd;	
	}else{
		content='登陆后签到会有经验和天豆奖励哦~';	
	}
	hs_js_alert('签到成功',content);
}
}

function Zan(htype,id){
	xmlhttp=Cxmlhttp();
	xmlhttp.open("GET","zan.asp?htype="+htype+"&id="+id);
	xmlhttp.send(null);
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			resulttext=xmlhttp.responseText;
			if(resulttext=="True"){
				ZanNumAdd(htype,id,1);
			}else{
				if(htype=='qiandao'){
					hs_js_alert('提 示','亲，您已经签过到了');
				}else{
					//hs_js_alert('提 示','亲，您已经表过态了');
				}
			}
		}
	}
}

function NewUrl(url,target){
	window.open(url,target);
}

function ExpTd(uexp,utd){
	document.getElementById("hs-id-exp").innerHTML=parseInt(document.getElementById("hs-id-exp").innerHTML)+uexp;
	document.getElementById("hs-id-td").innerHTML=parseInt(document.getElementById("hs-id-td").innerHTML)+utd;
}
function GoGetUrl(str,url,target){
	var array=new Array();
	array=str.split(",");
	var get=url;
	for(i=0;i<array.length;i++){
		get=get+"&"+array[i]+"="+document.getElementById(array[i]).value
	}
	//alert(get);
	window.open(get,target);
}