function HMrequestText(u,d,r,p){
	var o=HMTry(
		function(){return new XMLHttpRequest()},
		function(){return new ActiveXObject("Microsoft.XMLHttp")},
		function(){return new ActiveXObject("Msxml2.XMLHTTP")}
	);
	if(!o)return;
	!d?o.open("get",u,true):(o.open("post",u,true),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8"));
	o.onreadystatechange = function(){
		if(o.readyState==4){
			if(o.status==200){
				var t=o.responseText;
				p==1?r(t):HMgetElement(r).innerHTML=t
			}else{
				alert("请求的页面不存在或者发生错误！")
			}
		}
	}
	o.send(d)
}
function HMTry(){
	for(var i=0;i<arguments.length;i++){try{return arguments[i]()}catch(e){}}
	return null
}
function HMgetElement(e){
	return typeof(e)=="string"?(!!document.getElementById(e)?document.getElementById(e):null):e
}
function HMGetTop(e){
	var t=e.offsetTop;
	while(e.offsetParent){e=e.offsetParent;t+=e.offsetTop}
	return t
}
function HMGetLeft(e){
	var l=e.offsetLeft;
	while(e.offsetParent){e=e.offsetParent;l+=e.offsetLeft}
	return l
} 
function HMopenElement(e){
	var s=HMgetElement(e).style;
	s.display=s.position=="absolute"?"block":""
}
function HMcloseElement(e){
	HMgetElement(e).style.display="none"
}
function HMinsertData(e,d){
	var o=HMgetElement(e),v=o.value,l,f="",t=0;;
	if(HMisNone(v)){o.value=d;return}
	l=v.split(",");
	for(var i=0;i<l.length;i++)l[i]==d?t=1:f+=l[i]+",";
	o.value=t?f.replace(/^(.*?),$/g,"$1"):v+","+d
}
function HMfloatDiv(eId,cId){
	var cObj=HMgetElement(cId),tObj=HMgetElement(eId),_x,_y,ds=false,st=tObj.style;
	st.position="absolute";
	cObj.onmousedown=function(e){
		e=e||event;
		document.all?(cObj.onmousemove=omm,cObj.setCapture()):
			document.addEventListener("mousemove",omm,true);
		_x=e.clientX,_y=e.clientY,ds=true,cObj.style.cursor="move"
	}
	cObj.onmouseup=function(e){
		document.all?cObj.releaseCapture():document.removeEventListener("mousemove",omm,true);
		ds=false,cObj.style.cursor=""
	}
	var omm=function(e){
		if(!ds)return;
		e=e||event;
		var dx=tObj.offsetLeft,dy=tObj.offsetTop,tx=e.clientX,ty=e.clientY;
		var fl=tx-_x+dx,ft=ty-_y+dy,db=document.body;
		if(fl>0&&(fl+tObj.clientWidth)<db.clientWidth){st.left=fl+"px";_x=tx}
		if(ft>0&&(ft+tObj.clientHeight)<db.clientHeight){st.top=ft+"px";_y=ty}
	}
}
function HMprint(t){document.write(t)}
function HMgetRadio(r){
	if(isNaN(r.length))return r.checked?r.value:"";
	for(var i=0;i<r.length;i++)if(r[i].checked)return r[i].value;
	return ""
}
function HMisNone(t){return !t||t.replace(/\s/g,"")==""}
function HMGetQuery(key){
	var url=window.location.toString(),space=url.indexOf("#");
	if(space>0)url=url.substr(0,space);
	space=url.indexOf("?");
	var urlVal=url.substr(space+1,url.length).split("&"),dSpace;
	for(var i=0;i<urlVal.length;i++){
		dSpace=urlVal[i].indexOf("=");
		if(dSpace>=0)if(urlVal[i].substr(0,dSpace)==key)return urlVal[i].substr(dSpace+1,urlVal[i].length)
	};
	return ""
}
function HMGetPage(){
	var p=HMGetQuery("page");
	return isNaN(p)||HMisNone(p)?1:(parseInt(p)<1?1:parseInt(p))
}
function HMCopyText(text){
	if(document.all){clipboardData.setData("text",text)}
	else{
		try{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		}catch(e){
			alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
			return false
		};
		var clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
		if(!clip)return false;
		var trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
		if(!trans)return false;
		trans.addDataFlavor("text/unicode");
		var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		str.data=text;
		trans.setTransferData("text/unicode",str,text.length*2);
		var clipid=Components.interfaces.nsIClipboard;
		if(!clip)return false;
		clip.setData(trans,null,clipid.kGlobalClipboard)
	};
	return true
}
function HMleachSql(t){
	return t.replace(/[\'\`\,\?\"\-\_\+\=\"\^\$\#\&\s\|\%\*\(\)\[\]\{\}\:\;\<\>\/\\\!\?\.\~\@]/g,"")
}
function HMFeedback(){
	window.open(HMSITEROOT+"core/HMFeedback.asp?url="+encodeURIComponent(window.location.toString()),"","width=400,height=240,top=150,left=200")
}
function HMTrim(t){return t.replace(/\s*(\S[\s\S]*?\S)\s*/,"$1")}
function HMisIe(){return !!document.all}
function HMEventElement(e){return document.all?event.srcElement:e.target}
function HMCreateDiv(e){HMprint("<div id='"+e+"'></div>")}
function HMForm(fn,ec){
	var form=typeof(fn)=="string"?document.forms[fn]:fn;
	this.getForm=function(){return form};
	this.getValue=function(n){
		if(!form[n])return"";
		var ele,val="",pro=form[n];
		ele=pro.length?pro[0]:pro;
		switch(ele.tagName.toLowerCase()){
			case "input":
				switch(ele.type.toLowerCase()){
					case "radio":val=getRadio(n);break;
					case "checkbox":val=getCheckbox(n);break;
					default :val=getText(n);
				}
				break;
			case "textarea":val=getText(n);break;
			case "option":val=getSelect(n);break;
		};
		return ec?encodeURIComponent(val):val
	};
	var getText=function(n){return form[n].value},
	getSelect=function(n){
		var sel=form[n],val;
		if(sel.multiple){
			for(var i=0;i<sel.length;i++)if(sel[i].selected)val+=sel[i].value+",";
			return val.substr(0,val.length-1)
		}else{return sel.options[sel.selectedIndex].value}
	},
	getRadio=function(n){
		var rad=form[n];
		if(rad.length){for(var i=0;i<rad.length;i++)if(rad[i].checked)return rad[i].value}
		else{if(rad.checked)return rad.value};
		return ""
	},
	getCheckbox = function(n){
		var ckb=form[n],val="";
		if(ckb.length){
			for(var i=0;i<ckb.length;i++)if(ckb[i].checked)val+=ckb[i].value+",";
			return val.substr(0,val.length-1)
		}else{return ckb.checked?ckb.value:""}
	}
}
function HMBackTop(){
	document.body.scrollTop=0;
	document.documentElement.scrollTop=0
}
function HMLoadCode(){
	var o=HMgetElement("HMCode");
	if(o)o.src=HMSITEROOT+"core/HMCode.asp?"+Math.random()
}
//纯脚本幻灯片
var HMJSlide=function(){
	if(!window.HMSlide)window.HMSlide={};
	this.width=300;
	this.height=200;
	var list=[],id="HMSlide_"+(new Date()).getTime(),ie=!!document.all,num=0;
	window.HMSlide[id]=this;
	this.add=function(){list[list.length]=arguments};
	this.show=function(){
		function CE(p){return document.createElement(p)};
		var topDiv,pLink,photo,theme,tool,tLink,st;
		HMCreateDiv(id);
		topDiv=CE("div");
		st=topDiv.style;
		st.width=this.width+"px";
		st.border="1px #000 solid";
		pLink=CE("a");
		pLink.target="_blank";
		pLink.id=id+"_link";
		photo=CE("img");
		photo.border=0;
		photo.id=id+"_photo";
		photo.width=this.width;
		photo.height=this.height;
		pLink.appendChild(photo);
		tool=CE("div");
		st=tool.style;
		st.background="#000";
		st.textAlign="right";
		st.lineHeight="20px";
		st.fontWeight="bold";
		tool.id=id+"_tool";
		for(var i=0;i<list.length;i++){
			tLink=CE("a");
			tLink.href="javascript:;";
			st=tLink.style;
			st.margin="0 5px 0 0";
			st.color="#999";
			st.textDecoration="none";
			tLink.innerHTML=i+1;
			tLink.onclick=function(){
				eval("window.HMSlide[id].goto(this.innerHTML-1)")};
			tool.appendChild(tLink);
		};
		theme=CE("div");
		st=theme.style;
		st.textAlign="center";
		st.fontWeight="bold";
		st.lineHeight="20px";
		theme.id=id+"_theme";
		topDiv.appendChild(pLink);
		topDiv.appendChild(tool);
		topDiv.appendChild(theme);
		HMgetElement(id).appendChild(topDiv);
		this.play();
	};
	this.play=function(){
		eval("this.goto(num)");
		num++;
		if(num==list.length)num=0;
		setTimeout("HMSlide['"+id+"'].play()",3000)
	};
	this.goto=function(n){
		var obj=HMgetElement(id+"_tool").getElementsByTagName("a"),i;
		for(i=0;i<obj.length;i++)obj[i].style.color=(obj[i].innerHTML==n+1)?"#C00":"#999";
		HMgetElement(id+"_theme").innerHTML=list[n][1];
		HMgetElement(id+"_link").href=list[n][2];
		obj=HMgetElement(id+"_photo");
		if(ie){
			obj.style.filter="revealTrans(Duration=0.6,Transition="+parseInt(Math.random()*30)+")";
			obj.filters.revealTrans.Apply();
		};
		obj.src=list[n][0];
		if(ie)obj.filters.revealTrans.Play()
	}
}
function HMDownload(id){
	window.open(HMSITEROOT+"core/HMDownload.asp?id="+id,"","width=200,height=200,left=300,top=200")
}
(function(){
	try{
	var lost=function(){window.location=HMSITEROOT+HMSTOPURL};
	if(HMSITESTATE!=1){lost();return};
	if(HMCLOSETIME!=""){var t=HMCLOSETIME.split(",");
	for(var i=0;i<t.length;i++)if(parseInt(t[i])==(new Date()).getHours()){lost();return}};
	var d=new Date(document.lastModified),
	n=encodeURIComponent(d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds());
	HMrequestText(HMSITEROOT+"core/HMLoadPage.asp?"+"channel="+HMChannelId+"&sub="+HMSubId+"&id="+HMDataId+"&page="+HMPage+"&updateTime="+n+"&file="+HMFile+"&"+Math.random(),null,function(s){s=parseInt(s);if(s==1)lost()},1)
	}catch(e){}
})();