﻿//滑动菜单1
function ShowTabs(ID) {
        for (i = 0; i < 5; i++) {
            if (i == ID) {
                document.getElementById("TabTitle" + i).className = "zqcc7m_newson1";
                document.getElementById("Tab" + i).style.display = "";
            }
            else {
                document.getElementById("TabTitle" + i).className = "zqcc7m_newson2";
                document.getElementById("Tab" + i).style.display = "none";
            }
        }
    }

//滑动菜单2
 function ShowTabs2(ID) {
        for (i = 0; i < 5; i++) {
            if (i == ID) {
                document.getElementById("TabTitla" + i).className = "zqcc7m_newson1";
                document.getElementById("Taa" + i).style.display = "";
            }
            else {
                document.getElementById("TabTitla" + i).className = "zqcc7m_newson2";
                document.getElementById("Taa" + i).style.display = "none";
            }
        }
    }

//滑动菜单3
 function ShowTabs3(ID) {
        for (i = 0; i < 4; i++) {
            if (i == ID) {
                document.getElementById("TabTitlc" + i).className = "zqcc7m_newson5";
                document.getElementById("Tac" + i).style.display = "";
            }
            else {
                document.getElementById("TabTitlc" + i).className = "zqcc7m_newson6";
                document.getElementById("Tac" + i).style.display = "none";
            }
        }
    }
 function wjxShowTabs3(ID) {
        for (i = 0; i < 4; i++) {
            if (i == ID) {
                document.getElementById("wjxTabTitlc" + i).className = "zqcc7m_newson5";
                document.getElementById("wjxTac" + i).style.display = "";
            }
            else {
                document.getElementById("wjxTabTitlc" + i).className = "zqcc7m_newson6";
                document.getElementById("wjxTac" + i).style.display = "none";
            }
        }
    }
//滑动菜单4
 function ShowTabs4(ID) {
        for (i = 0; i < 5; i++) {
            if (i == ID) {
                document.getElementById("TabTitld" + i).className = "zqcc7m_newson5";
                document.getElementById("Tad" + i).style.display = "";
            }
            else {
                document.getElementById("TabTitld" + i).className = "zqcc7m_newson6";
                document.getElementById("Tad" + i).style.display = "none";
            }
        }
    }
 function wjxShowTabs4(ID) {
        for (i = 0; i < 5; i++) {
            if (i == ID) {
                document.getElementById("wjxTabTitld" + i).className = "zqcc7m_newson5";
                document.getElementById("wjxTad" + i).style.display = "";
            }
            else {
                document.getElementById("wjxTabTitld" + i).className = "zqcc7m_newson6";
                document.getElementById("wjxTad" + i).style.display = "none";
            }
        }
    }
//滑动菜单5
 function ShowTabs5(ID) {
        for (i = 0; i < 4; i++) {
            if (i == ID) {
                document.getElementById("twob" + i).className = "zqcc7m_newson10";
                document.getElementById("two_minb" + i).style.display = "";
            }
            else {
                document.getElementById("twob" + i).className = "zqcc7m_newson11";
                document.getElementById("two_minb" + i).style.display = "none";
            }
        }
    }
//滑动菜单6
 function ShowTabs6(ID) {
        for (i = 0; i < 3; i++) {
            if (i == ID) {
                document.getElementById("caipiao" + i).className = "zqcc7m_newson10";
                document.getElementById("caipiao_min" + i).style.display = "";
            }
            else {
                document.getElementById("caipiao" + i).className = "zqcc7m_newson11";
                document.getElementById("caipiao_min" + i).style.display = "none";
            }
        }
    }



function trunType(sid)
{
     
   //window.location.href="/Category_"+sid+"/Index.aspx"; 
   //if (document.getElementById("zcw"+sid).value==sid){
     //document.forms["form1"].select.options[1].selected=true; 
    window.location.href="/Category_"+sid+"/Index.aspx";
    //window.location.href="#"+sid;
    //var url=window.location.href;
   //var uid=url.split("#");
    //document.getElementById("zcw"+uid[1]).selected=true;
}
//登录框事件
function chick(){
//document.forms["LoginFrom"].elements["TxtUserName"].value="";
//document.forms["LoginFrom"].elements["TxtUserName"].className="xx";
document.getElementById("TxtUserName").value="";
document.getElementById("TxtUserName").className="xx";
}
function chick2(){
//document.forms["LoginFrom"].elements["TxtPassword"].value="";
//document.forms["LoginFrom"].elements["TxtPassword"].className="xx";
document.getElementById("TxtPassword").value="";
document.getElementById("TxtPassword").className="xx2";
}
//菜单stat
function e(objid)
{
return document.getElementById(objid);
}
function ShowDiv2(div,id){
for(var i=1;e(div+i);i++){
if(id==i){
//焦点样式
e(div+i).className = 'v_onweek'
e(div+'c'+i).style.display = 'block';
}else{
//非焦点样式
e(div+i).className = ''
e(div+'c'+i).style.display = 'none';
}
}
}

function ShowDiv(div,id){
for(var i=1;document.getElementById(div+i);i++){
if(id==i){
//焦点样式
document.getElementById(div+i).className = "a1";

document.getElementById(div+"li"+i).className = "a2";
}else{
//非焦点样式
if(document.getElementById(div+i).className!="hide") document.getElementById(div+i).className = "hide";
if(document.getElementById(div+"li"+i).className !="a1") document.getElementById(div+"li"+i).className = "a1";
}
}
} 
function bookmarksite(){
if (document.all)
window.external.addFavorite(location.href, document.title);
else if (window.sidebar)
window.sidebar.addpanel(document.title, location.href, "")
}
//菜单end
function $i(id){
	return document.getElementById(id);
}
// 扩展内置对象 ===== begin =====
String.prototype.sInclude=function(s){
	var re=new RegExp("(^|,)"+s+"(,|$)","ig");
	return re.test(this, s);
};
String.prototype.sRemove=function(s){
	if(this.sInclude(s)){
		var lc=RegExp.leftContext;
		var rc=RegExp.rightContext;
		if(lc.length>0 && rc.length>0){
			return lc+","+rc;
		}else if(lc.length>0){
			return lc;
		}else if(rc.length>0){
			return rc;
		}else{
			return "";
		}
	}else{
		return this;
	}
};
String.prototype.isRelate=function(){
	var r=/^\w+\:\/\//g;
	return !r.test(this);
};
String.prototype.gbLen=function(){
	var len = this.length;
	for (var i=0; i<this.length; i++) {
		if (this.charCodeAt(i)>255) {
			len++;
		}
	}
	return len;
};
String.prototype.gbIndexOf=function(str){
	var idx=this.indexOf(str);
	return this.substr(0,idx).gbLen()+1;
};
String.prototype.gbLeft=function(len, s){
	var str = '';
	var sp  = s || '';
	var len2 = 0;
	var over=false;
	var ll=0;
	if (len<1 || this.length*2<=len || sp.length>this.length){
		return this;
	}
	for (var i=0; i<this.length; i++) {
		var l = (this.charCodeAt(i)>255) ? 2 : 1;
		if (len2+l>len){
			over=true;
			break;
		}else{
			len2+=l;
			ll++;
		}
	}
	if (over && sp.length>0){
		len2+=s.gbLen();
		while(len2>len){
			ll--;
			len2 -= (this.charCodeAt(ll)>255) ? 2 : 1;
		}
		str = this.substr(0,ll)+ s;
	}else{
		str = this.substr(0,ll);
	}
	return str;
};
String.prototype.trimEnd=function(){
	var str, n;
	n=this.length;
	while(n>=0){
		var c=this.charCodeAt(n-1);
		if(c!=32 && c!=12288){
			break;
		}else{
			n--;
		}
	}
	if(n==0){
		return "";
	}else{
		return this.substr(0,n);
	}
};
String.prototype.trim=function(){
	var s=0,e=this.length-1;
	while(s<this.length){
		var c=this.charCodeAt(s);
		if(c!=32 && c!=12288){
			break;
		}else{
			s++;
		}
	}
	while(e>s){
		var c=this.charCodeAt(e);
		if(c!=32 && c!=12288){
			break;
		}else{
			e--;
		}
	}
	
	if (s>e){
		return "";
	}else{
		return this.substring(s,e+1);
	}
};
Array.prototype.include=function(v){
	for(var i=0;i<this.length;i++){
		if(this[i]==v){
			return true;
		}
	}
	return false;
};
// 扩展内置对象 ===== end =====

var iwms=new Object();

// 转换简繁体 ===== begin =====
iwms.convBig5=function(c){
	if(c==1 || c==0){
		iwms.setCookie("convBig5",c,30);
	}else{
		iwms.setCookie("convBig5",0,-2);
	}
	location.reload();
};
// 转换简繁体 ===== end =====

// 消息位置 =====  begin =====
iwms.msgPos=function(ele,msg){
	var pos=[0,0];
	var vis=[msg.style.display.toString(),msg.style.visibility.toString()];
	with(document.documentElement){
		var cw=clientWidth;
		var sl=scrollLeft;
		var st=scrollTop;
	}
	msg.style.display="block";
	msg.style.visibility="hidden";
	// 在ele下显示
	if (ele){
		var p=iwms.elePos(ele);
/*		do{
			pos[0] += ele.offsetLeft || 0;
			pos[1] += ele.offsetTop  || 0;
			ele=ele.offsetParent;
		}while(ele);
*/
		pos[0]=p.x;
		pos[1]=p.y + p.h;
		
		if (pos[0]+msg.offsetWidth>cw+sl){
			pos[0]=cw+sl-msg.offsetWidth;
			if(pos[0]<0){
				pos[0]=0;
			}
		}
	}else{
		pos[0]=cw+sl-msg.offsetWidth-3;
		pos[1]=st;
	}
	msg.style.display=vis[0];
	msg.style.visibility=vis[1];
	return {x:pos[0],y:pos[1]};
};
iwms.elePos=function(ele){
	var p={'x':0,'y':0,'w':0,'h':0};
	p.h = ele.offsetHeight;
	p.w = ele.offsetWidth;
	do{
		p.x += ele.offsetLeft || 0;
		p.y += ele.offsetTop  || 0;
		ele=ele.offsetParent;
	}while(ele);

	return p;
};
// 消息位置 ===== end =====

// 显示消息 ===== begin =====
iwms.popDivs=new Array();
iwms.popMsg=function(kind,ele,cld,cls)
{
	var div;
	iwms.clearPopTimer(kind);
	// 取div
	for(var i=0;i<iwms.popDivs.length;i++){
		if(iwms.popDivs[i].id=="pop_"+kind){
			div=iwms.popDivs[i];
		}
	}
	if(div==null){
		div=document.createElement("DIV");
		div.id="pop_"+kind;
		iwms.popDivs.push(div);
		div.className=cls?cls:"aj_msg";
		div.onmouseout=function(){iwms.hideMsg(kind,800)};
		div.onmouseover=function(){iwms.clearPopTimer(kind);};
		document.body.appendChild(div);
	}else{
		div.removeChild(div.childNodes[0]);
	}
	if(typeof(cld)=="string"){
		div.innerHTML=cld;
	}else{
		div.appendChild(cld);
	}
	
	var pos=iwms.msgPos(ele,div);
	with(div.style){
		top=pos.y+"px";
		left=pos.x+"px";
		display="block";
		zIndex=100;
	}
	iwms.dropShadow(kind,div);
	ele.onmouseout=function(){iwms.hideMsg(kind,800);};
};


iwms.popTimers=new Array();
iwms.hideMsg=function(kind,time){
//	alert('hide');
	if (time && time>0){
		iwms.popTimers.push([kind,window.setTimeout("iwms.hideMsg('"+kind+"')",time)]);
	}else{
		var div;
		for(var i=0;i<iwms.popDivs.length;i++){
			if(iwms.popDivs[i].id=="pop_"+kind){
				div=iwms.popDivs[i];
			}
		}
		if (div){
			div.style.display="none";
			iwms.clearShadow(kind);
		}
	}
};

iwms.clearPopTimer=function(kind){
//	alert('clear');
	var n=-1;
	for(var i=0;i<iwms.popTimers.length;i++){
		if(iwms.popTimers[i][0]==kind){
			n=i;
			break;
		}
	}
//	alert("timers:"+iwms.popTimers.length+","+n);
	if(n>=0){
		var tm=iwms.popTimers.splice(n,1)[0][1];
//		alert("timer"+tm);
		if(tm){
			window.clearTimeout(tm);
		}
	}
};

// 显示阴影
iwms.shadows=new Array();
iwms.dropShadow = function(kind,ele)
{
	var num=1;
	var arr=null;
	for(var i=0;i<iwms.shadows.length;i++){
		if(iwms.shadows[i][0]==kind){
			arr=iwms.shadows[i][1];
			break;
		}
	}
	if(arr==null){
		arr=[kind,new Array()];
		for(var i=0;i<num;i++){
			var o=document.createElement("DIV");
			o.className="shadow";
			with(o.style){
				position="absolute";
				width=parseInt(ele.offsetWidth)+"px";
				height=parseInt(ele.offsetHeight)+"px";
				top=parseInt(ele.style.top)+(i+1)*1+"px";
				left=parseInt(ele.style.left)+(i+1)*1+"px";
				zIndex=ele.style.zIndex-1;
				var op=Math.floor(100*(num-i)/num);
				if (typeof(opacity)=="string"){
					opacity=(op/100).toString();
				}else{
					filter="alpha(opacity="+ op +")";
				}
			}
			arr[1].push(o);
			document.body.appendChild(o);
		}
		iwms.shadows.push(arr);
	}else{
		for(var i=0;i<arr.length;i++){
			with(arr[i].style){
				width=parseInt(ele.offsetWidth)+"px";
				height=parseInt(ele.offsetHeight)+"px";
				top=parseInt(ele.style.top)+(i+1)*1+"px";
				left=parseInt(ele.style.left)+(i+1)*1+"px";
			}
		}
	}
};

// 隐藏阴影
iwms.clearShadow=function(kind)
{
	var o, n=-1, arr;
	for(var i=0;i<iwms.shadows.length;i++){
		if(iwms.shadows[i][0]==kind){
			n=i;
			break;
		}
	}
	if(n==-1){
		return;
	}
	arr=iwms.shadows.splice(n,1);
	arr=arr[0][1];
	while(o=arr.pop()){
		document.body.removeChild(o);
	}
};
// 显示消息 ===== end =====

// cookie函数 ===== begin =====
iwms.setCookie=function(name, value){		//cookies设置
	var argv = arguments;
	var argc = arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	if(expires!=null){
		var LargeExpDate = new Date ();
		LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24));
	}
	document.cookie = name + "=" + encodeURI(value) + "; path=/;" +((expires == null) ? "" : (" expires=" +LargeExpDate.toGMTString()));
};

iwms.getCookie=function(Name){			//cookies读取
	var search = Name + "=";
	var c=document.cookie;
	if(c.length > 0){
		offset = c.indexOf(search);
		if(offset != -1)	{
			offset += search.length;
			end = c.indexOf(";", offset);
			if(end == -1){
				end = c.length;
			}
			return decodeURI(c.substring(offset, end));
		}
	}
	return "";
};
// cookie函数 ===== end =====

// 图片自适应 ===== begin =====
iwms.imgResize=function(){
	if(iwms.imgCont){
		iwms.imgCont.style.overflowX="hidden";
		iwms.imgCont.style.wordBreak="break-all";
		var imgs = iwms.imgCont.getElementsByTagName("img");
	}else{
		return;
	}
	for(var i=0;i<imgs.length;i++){
		var o=imgs[i];
		if(o.complete){
			iwms.imgLoaded(o);
		}else{
			o.onload=function(){iwms.imgLoaded(this);};
		}
		// 点图片下一页
		if (iwms.imgPage && typeof(pager)=="object" && imgs.length==1 && o.width>200){
			o.style.cursor="pointer";
			if (o.resized=="1"){
				o.setAttribute("title","ctrl+鼠标左键原大小");
				o.onclick=function(eventTag){var evt=eventTag||window.event;evt.ctrlKey ? iwms.imgFullsize(this) : pager.Next()};
			}else{
				o.onclick=function(){pager.Next()};
			}
		}
	}
};

iwms.imgLoaded=function(o){
	var mw=parseInt(iwms.imgCont.clientWidth)-50;
	if (o.width>mw){
		if (o.style.width){
			o.style.width="";
		}
		o.owidth=o.width;	// 保留原大小
		o.oheight=o.height;
		o.otitle=o.title?o.title:"";
		o.width=mw;
		o.removeAttribute("height");
		o.setAttribute("title","点击原始大小查看");
		o.style.cursor="pointer";
		o.style.display="block";
		o.vspace=5;
		o.resized=1;
		if (typeof(o.onclick)!="function"){
			o.onclick=function(){iwms.imgFullsize(this);};
		}
	}
};

iwms.imgFullsize=function(oImg){
	if (oImg.parentElement){
		if (oImg.parentElement.tagName=="A"){
			return;
		}
	}
	var imgDiv,bgDiv,bodyH,bodyW,winW,winH;
	var d=document;
	var de=d.documentElement;
	bgDiv=$i("iwmsBImg");
	imgDiv=$i("iwmsFImg");
	bodyH=de.scrollHeight;
	bodyW=de.scrollWidth;
	if (self.innerHeight) { // all except Explorer
		winW = self.innerWidth;
		winH = self.innerHeight;
	}else if(de && de.clientHeight) { // Explorer 6 Strict Mode
		winW = de.clientWidth;
		winH = de.clientHeight;
	}else if(d.body) { // other Explorers
		winW = d.body.clientWidth;
		winH = d.body.clientHeight;
	}
	
	if (bgDiv==undefined){
		bgDiv=d.createElement("DIV");
		bgDiv.id="iwmsBImg";
		with(bgDiv.style){
			position="absolute";
			left="0px";
			top="0px";
			if (typeof(opacity)=="string"){
				opacity="0.80";
			}else{
				filter="alpha(opacity=80)";
			}
			height=bodyH+"px";
			width=bodyW+"px";
			background="#ddd";
		}
		d.body.appendChild(bgDiv);
	}else{
		with(bgDiv.style){
			height=bodyH+"px";
			width=bodyW+"px";
		}
	}
	
	if (imgDiv==undefined){
		imgDiv=d.createElement("DIV");
		imgDiv.id="iwmsFImg";
		with(imgDiv.style){
			position="absolute";
			top="10px";
			border="1px solid #ccc";
			background="#eee";
			padding="6px";
		}
		imgDiv.onclick=function(){this.style.display='none';$i("iwmsBImg").style.display='none';};
		imgDiv.onmousewheel=iwms.imgZoom;
		imgDiv.title="ctrl+鼠标滚轮缩放\r\n点击图片隐藏";
		d.body.appendChild(imgDiv);
	}
	imgDiv.style.display="";
	bgDiv.style.display="";
	if(bodyW>oImg.owidth){
		imgDiv.style.left=(bodyW-oImg.owidth)/2+"px";
	}else{
		imgDiv.style.left="0px";
	}
	if(winH>oImg.oheight+22){
		imgDiv.style.top=(de.scrollTop+(winH-oImg.oheight)/2-11)+"px";
	}else{
		imgDiv.style.top=(de.scrollTop+10)+"px";
	}
	imgDiv.innerHTML="<img src='"+ oImg.src +"'/>";
};

iwms.imgZoom=function(){
	if (event.ctrlKey){
		var zoom=parseInt(this.style.zoom, 10)||100;
		zoom+=event.wheelDelta/12;
		if (zoom>0) this.style.zoom=zoom+'%';
		return false;
	}else{
		return true;
	}
};
// 图片自适应 ===== end =====

// 显示登陆框 ===== begin =====
iwms.user=iwms.getCookie("iwmsUser");
iwms.logForm=function(h,u){
	var o=$i("login");
	if (typeof(o)=="undefined"){
		return;
	}
	var str="";
	if(typeof(h)=="undefined"){
		h=false;
	}
	if(typeof(u)=="undefined"){
		if(iwms.user.length>0 && iwms.getCookie("iwmsPass").length>0){
			str="您好，"+iwms.user;
			var x = new Ajax('XML');
			var queryString="act=ajax&cmd=userVars";
			x.post(iwms.urlPrefix+'ajax.aspx',queryString,function(r){
				var s=r.documentElement.getElementsByTagName("json")[0].firstChild.data;
				var u;
				eval("u="+s);
				iwms.logForm(h,u);
			}
			);
		}else{
			iwms.logForm(h,{"id":0});
		}
		return;
	}else if(u.id>0){
		str=' <a href="#" target="_self">'+'您好，'+
			iwms.user+
			'<br/>'+
			u.lang_vMoney+
			'数： '+
			u.vMoney+
			'<br/>'+
			u.lang_totalMark+'</a>'+
			' <a href="/memberfunc.aspx" target="_blank" title="积分转换">：'+
			u.totalMark+
			'</a><br/>'+
			(u.expire==null ? '' : u.expire.getFullYear()+'-'+(u.expire.getMonth()+1)+'-'+u.expire.getDate()+' 到期 ('+Math.ceil((u.expire-new Date())/86400000)+'天)<br/>')+
			'<a href="/membernewsadd.aspx" target="_blank">推荐文章(</a> <a href="search.aspx?where=memberid&keyword='+
			u.id+
			'" target="_blank" title="您添加的内容">'+
			u.addNum+
			')</a><br/>'+
			(u.signin>-1 ? '<a href="memberSignIns.aspx" target="_blank">签收文档 ('+u.signin+')</a><br/>' : '')+
			'<a href="../../memberModify.aspx">更改资料</a>'+
			(u.flag>0 ? '&nbsp;<a href="../../admin_login.aspx" target="_blank">管理</a>&nbsp;<a href="../../logout.aspx" target="_self">退出</a>' : '&nbsp;<a href="../../logout.aspx" target="_self">退出登录</a>');
		if(h){
			str=str.replace(/<br\/>/g,"　");
		}
	}else{
		if (h){
			str='<form id="loginForm" method="post" action="../../login.aspx">'+
				'<input type="text" class="inputbg" name="memberName" size="10" maxlength="50" onblur="iwms.logBlur(this)" onfocus="iwms.logFocus(this)"'+
				(iwms.user.length>0?' value="'+iwms.user+'"/>':' value="用户名" style="color:#999"/>')+
				'　<input type="text" class="inputbg" value="密码"  name="hdPass" size="10" style="color:#999" onfocus="iwms.logFocus(this)"/>'+
				'<input type="password" class="inputbg" style="display:none" name="memberPass" size="10" maxlength="50" onblur="iwms.logBlur(this)"/>'+
				'　<select name="keepLogin" style="width:60px">'+
				'<option value="">不保留</option>'+
				'<option value="day">一天</option>'+
				'<option value="week">一周</option>'+
				'<option value="month">一月</option>'+
				'<option value="year">一年</option>'+
				'</select>'+
				'　<button type="submit" onclick="return iwms.logChk(this);" style="width:60px">登 录</button>'+
				'<script type="text/javascript" src="inc/clientDate.js"></script>'+
				'　<a href="../../memberreg.aspx">注册</a>　<a href="../../memberactive.aspx">激活</a>　<a href="../../memberLostpass.aspx">忘记密码</a>'+
				(iwms.guestAdd?'　<a href="membernewsadd.aspx" target="_blank">推荐新闻</a>':'')+
				'</form>';
		}else{
			str='<form id="loginForm" method="post" action="login.aspx" style="padding:5px 0">'+
				'<ul style="list-style:none;margin:0;padding:0;text-align:center;">'+
				'<li><input type="text" class="inputbg" name="memberName" size="15" maxlength="50" onblur="iwms.logBlur(this)" onfocus="iwms.logFocus(this)"'+
				(iwms.user.length>0?' value="'+iwms.user+'"/>':' value="用户名" style="color:#999"/>')+
				' <select name="keepLogin" style="width:60px">'+
				'<option value="">不保留</option>'+
				'<option value="day">一天</option>'+
				'<option value="week">一周</option>'+
				'<option value="month">一月</option>'+
				'<option value="year">一年</option>'+
				'</select>'+
				'</li><li style="padding:10px 0"><input type="text" class="inputbg" value="密码"  name="hdPass" size="15" style="color:#999" onfocus="iwms.logFocus(this)"/>'+
				'<input type="password" class="inputbg" style="display:none" name="memberPass" size="15" maxlength="50" onblur="iwms.logBlur(this)"/>&nbsp;<button type="submit" onclick="return iwms.logChk(this);" style="width:60px">登 录</button></li>'+
				'<li><script type="text/javascript" src="inc/clientDate.js"></script>'+
				'<a href="memberreg.aspx">注册</a>　<a href="memberactive.aspx">激活</a>　<a href="memberLostpass.aspx">忘记密码</a>'+
				(iwms.guestAdd?'<br/><a href="membernewsadd.aspx" target="_blank">推荐新闻</a></li>':'</li>')+
				'</ul>'+
				'</form>';
		}
	}
	o.innerHTML=str;
};

iwms.logChk=function(o){
	var f=o.form;
	if (f.memberName.value=="" || f.memberName.style.color=="#999"){
		alert("请填写会员名");
		f.memberName.focus();
		return false;
	}
	if (f.memberPass.value==""){
		alert("请填写密码");
		f.hdPass.focus();
		return false;
	}
	if(f.referer){
		f.referer.value=window.location;
	}
	return true;
};

iwms.logBlur=function(o){
	var f=o.form;
	if(o.value.length==0){
		if(o.type=="text"){
			o.value="用户名";
			o.style.color="#999";
		}else{
			o.style.display="none";
			f.hdPass.style.display="";
		}
	}
};

iwms.logFocus=function(o){
	var f=o.form;
	if(o.name=="hdPass"){
		o.style.display="none";
		var p=f.memberPass;
		p.style.display="";
		p.focus();
	}else if(o.style.color.length>0){
		o.value="";
		o.style.color="";
	}
};
// 显示登陆框 ===== end =====

// 文章digg ===== begin =====
iwms.diggIt = function(ele,id){
	var digged=iwms.getCookie("iwmsDigged");
	digged = digged.length==0 ? [] : digged.split(',');
	if(digged.include(id)){
		ele.innerHTML="已投票!";
		ele.onclick=function(){return false;};
		ele.style.color="#999";
		return
	}
	var x = new Ajax("XML",ele);
	var queryString = 'act=ajax&cmd=digg&aid='+id;
	x.post(iwms.urlPrefix+'ajax.aspx',queryString,function(r){
		var success=r.documentElement.getElementsByTagName("success")[0].firstChild.data=="1";
		if (success){
			var o=ele.parentNode.parentNode.getElementsByTagName("LI")[0];
			o.innerHTML=parseInt(o.innerHTML)+1;
			ele.innerHTML="已投票!";
			ele.onclick=function(){location.href=iwms.urlPrefix+'hot.aspx'};
			ele.style.color="#999";
			if(digged.length>9){
				digged=digged.slice(digged.length-9);
			}
			digged.push(id);
			iwms.setCookie("iwmsDigged",digged.toString(),30);
		}else{
			x.message("digg操作失败",2000);
		}
	}
	);
};
// 文章digg ===== end =====

// 菜单脚本 ===== begin =====
var linkset=[];

var menu=function(){
};

menu.container=null;	// 外容器
menu.ele=null;	// 显示菜单链接
menu.done=false;

menu.show=function(e,idx,p,paging){
	//p为当前页数,paging为当前是不是翻页
	if (!menu.done){
		return false;
	}
	if (!document.all&&!document.getElementById&&!document.layers){
		return false;
	}

	menu.ele=e;
	var cur=linkset[idx];
	var pSize=25;	//每页连接数
	var pNum=Math.floor((cur.length-1)/pSize)+1;		//页数
	
	// 无下级不显示
	if(cur.length==0){
		return;
	}
	
	if (menu.container==null){
		var o=document.createElement("DIV");
		menu.container=o;
	}
	
	//设置菜单内容
	if (pNum==1){
		menu.addItem(cur);
	}else{
		cur=cur.slice( (p-1)*pSize, p*pSize );
		menu.addItem(cur);
		var o_d=document.createElement("DIV");
		o_d.className="menuitems";
		o_d.style.textAlign="right";
		o_d.style.paddingRight="10px";
		o_d.style.whiteSpace="nowrap";
		var o_a=document.createElement("FONT");
		o_a.face="arial";
		o_a.innerHTML="&#9668;";
		if (p==1){
			o_a.color="#cccccc";
		}else{
			o_a.style.cursor="pointer";
			o_a.onclick=new Function("menu.show(menu.ele,"+ idx +","+ (p-1) +",true);iwms.hideMsg('menu',1500);");
		}
		o_d.appendChild(o_a);
		o_a=document.createElement("FONT");
		o_a.face="arial";
		o_a.innerHTML="&#9658;";
		if (p==pNum){
			o_a.color="#cccccc";
		}else{
			o_a.style.cursor="pointer";
			o_a.onclick=new Function("menu.show(menu.ele,"+ idx +","+ (p+1) +",true);iwms.hideMsg('menu',1500);");
		}
		o_d.appendChild(o_a);
		menu.container.appendChild(o_d);
	}
	
	iwms.popMsg("menu",e,menu.container,"menuskin");
	return false;
};

menu.addItem=function(arr)
{
	for(var i=menu.container.childNodes.length;i--;i>=0){
		menu.container.removeChild(menu.container.childNodes[i]);
	}
	for(var i=0; i<arr.length; i++){
		var a = arr[i];
		var o_d=document.createElement("DIV");
		o_d.className="menuitems";
		o_d.onmouseover=new Function("menu.highlight(this,'on');");
		o_d.onmouseout=new Function("menu.highlight(this,'off');");
		var o_a=document.createElement("A");
		if (iwms.urlPrefix.length>0 && a[1].isRelate()){
			o_a.href=iwms.urlPrefix+a[1];
		}else{
			o_a.href=a[1];
		}
		if (a[2]){
			o_a.target="_blank";
		}
		o_a.innerHTML=a[0];
		o_d.appendChild(o_a);
		menu.container.appendChild(o_d);
	}
};

menu.highlight=function(ele,state){
	ele.id=(state=="on") ? "mouseoverstyle" : "";
};
// 菜单脚本 ===== end =====

// 显示flash ===== begin =====
function Flash(file, w, h)
{
	document.write("<div style=\"padding:5px\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+
		w+
		"\" height=\""+
		h+
		"\"><param name=\"movie\" value=\""+
		iwms.urlPrefix+file+
		"\"> <param name=\"quality\" value=\"high\"><param name=\"wmode\" value=\"opaque\"><embed src=\""+
		file+
		"\" loop=\"false\" menu=\"false\" quality=\"high\" width=\""+
		w+
		"\" height=\""+
		h+
		"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed></object></div>");
}
// 显示flash ===== end =====


// 调查功能 ===== begin =====
function pollCheck(o,checkMax){
	var checkNum = 0;
	var f = o.form;
	for(var i=0; i<f.elements.length; i++){
		var c = f.elements[i];
		if (c.name==o.name && c.checked){
			checkNum++;
		}
	}
	if (checkNum>checkMax){
		alert("最多选择"+ checkMax +"项!");
		o.checked = false;
	}
}

function ViewPoll(id) {
	window.open(iwms.urlPrefix+"pollView.aspx?act=result&id="+id, "iwmsPoll","width=500,height=400,left=0,top=0,scrollbars=1,status=1,resizable=1");
}
// 调查功能 ===== end =====

// 友情链接滚动 ===== begin =====
var rollspeed=30;
var myInter;
var ff=navigator.userAgent.indexOf("Firefox")>=0;
function MarqueeV(){
	var oV=$i("oRollV");
	var oV1=$i("oRollV1");
	var oV2=$i("oRollV2");
	if (oV.scrollTop>=(ff ? oV.scrollHeight/2 : oV1.scrollHeight)){
		oV.scrollTop=1;	
	}else{
		oV.scrollTop++;
	}
}
function StartRollV() {
	var oV=$i("oRollV");
	var oV1=$i("oRollV1");
	var oV2=$i("oRollV2");
	if (oV&&oV1&&oV2) {
		if (parseInt(oV.style.height)>=oV1.scrollHeight) {
			oV.style.height = oV1.scrollHeight+"px";
			return;
		}
		oV2.innerHTML=oV1.innerHTML;
		myInter=setInterval(MarqueeV,rollspeed);
		oV.onmouseover=function() {clearInterval(myInter)};
		oV.onmouseout=function() {myInter=setInterval("MarqueeV()",rollspeed)};
	}
}

// 友情链接高度
function linkSize()
{
	var o1,o2;
	o1 = $i("siteNav");
	o2 = $i("oRollV");
	if (o1&&o2){
		if (parseInt(o2.style.height)+25<parseInt(o1.clientHeight)){
			o2.style.height = (parseInt(o1.clientHeight) - 28) + "px";
		}
	}
}
// 友情链接滚动 ===== end =====

// 公告翻转 ===== begin =====
var bRoll=new Object();
bRoll.delay=3000;
bRoll.timer=0;
bRoll.height=0;
bRoll.count=0;
bRoll.roll=function(){
	var b=$i("bulletinBody");
	if(bRoll.count==bRoll.height){
		if(b.scrollHeight-bRoll.height<=b.scrollTop){
			b.scrollTop=b.scrollHeight/2-bRoll.height;
		}
		bRoll.count=0;
		bRoll.timer=setTimeout('bRoll.roll()',bRoll.delay);
	}else{
		b.scrollTop++;
		bRoll.count++;
		bRoll.timer=setTimeout('bRoll.roll()',10);
	}
};
bRoll.clear=function(){
	if(bRoll.count==0){
		clearTimeout(bRoll.timer);
		bRoll.timer=0;
	}
};
bRoll.init=function(arr){
	document.write('<div id="bulletin" class="bulletin"></div>');
	var o,oD,oU,oL;
	o=$i("bulletin");
	bRoll.height=o.scrollHeight;
	oD=document.createElement("DIV");
	oU=document.createElement("UL");
	o.onmouseover=bRoll.clear;
	o.onmouseout=function(){if(!bRoll.timer){bRoll.timer=setTimeout('bRoll.roll()',bRoll.delay);}};
	for(var i=0;i<arr.length;i++){
		var a=arr[i];
		if(iwms.urlPrefix.length>0 && a[1].isRelate()){
			a[1]=iwms.urlPrefix+a[1];
		}
		oL=document.createElement("LI");
		oL.innerHTML='<a href="'+a[1]+'" target="_blank">'+a[0]+'</a><em>('+a[2]+')</em></a></li>';
		oU.appendChild(oL);
	};
	oD.appendChild(oU);
	oD.id="bulletinBody";
	oD.innerHTML+='<br style="clear:both"/>'+oD.innerHTML;
	o.appendChild(oD);
	bRoll.timer=setTimeout('bRoll.roll()',bRoll.delay);
};
// 公告翻转 ===== end =====


// 头条图片幻灯 ===== begin =====
var imgSlide=new Object();
imgSlide.idx=0;
imgSlide.timer;
imgSlide.imgs;

imgSlide.show=function (value){
	imgSlide.idx=value;
	imgSlide.setNum(value);
	imgSlide.setImg(value);
	imgSlide.setTitle(value);
};
imgSlide.setNum=function (value){
	var o=$i("slNum");
	for(var i=0;i<imgSlide.imgs.length;i++){
		if(value==i){
			o.getElementsByTagName("a")[i].className='slOn';
		}else{	
			o.getElementsByTagName("a")[i].className='slOff';
		}
	}
};
imgSlide.setImg=function (value){
	var o=$i("slImg");
	if(o.filters!=null && o.filters[0]!=null){
		o.filters[0].apply();
	}
	o.getElementsByTagName("A")[0].href=imgSlide.imgs[value][1];
	o.getElementsByTagName("IMG")[0].src=imgSlide.imgs[value][2];
	
	if(o.filters!=null && o.filters[0]!=null){
		o.filters[0].play();
	}
};

imgSlide.setTitle=function (v){
	var a=$i("slLink").getElementsByTagName("A")[0];
	a.href=imgSlide.imgs[v][1];
	a.innerHTML=imgSlide.imgs[v][0];
};

imgSlide.clear=function (){
	clearInterval(imgSlide.timer);
};

imgSlide.start=function (){
	imgSlide.timer=setInterval("imgSlide.next()", 3000);
};

imgSlide.next=function (){
	imgSlide.idx++;
	if(imgSlide.idx>imgSlide.imgs.length-1){imgSlide.idx=0;}
	imgSlide.show(imgSlide.idx);
};

imgSlide.init=function(w,h,arr,len){
	var o,u,l,a,v1;
	var d=document;
	d.write('<div id="slImg" style="width:'+w+'px;height:'+h+'px"></div><div id="slTitle" style="width:'+w+'px"><div id="slNum"></div><div id="slLink"></div></div>');
	var o=$i("slNum");
	var u=d.createElement("UL");
	if(arr.length==0){
		v1=["请先添加头条图片新闻","###","style/iwms/no_picture.gif"];
	}else{
		v1=arr[0];
	}
	
	for(var i=0;i<arr.length;i++){
		// 标题截取
		arr[i][0]=arr[i][0].gbLeft(len,"...");
		// 加相对链接
		if(iwms.urlPrefix.length>0){
			if(arr[i][1].isRelate()){
				arr[i][1]=iwms.urlPrefix+arr[i][1];
			}
			if(arr[i][2].isRelate()){
				arr[i][2]=iwms.urlPrefix+arr[i][2];
			}
		}
	}
	imgSlide.imgs=arr;
	
	for(var i=0;i<imgSlide.imgs.length;i++){
		l=d.createElement("LI");
		a=d.createElement("A");
		a.href="###";
		a.innerHTML=(i+1);
		a.className=(i==0?"slOn":"slOff");
		a.onmouseover=imgSlide.clear;
		a.onclick=new Function("imgSlide.show("+i+")");
		a.onmouseout=imgSlide.start;
		l.appendChild(a);
		u.appendChild(l);
	}
	o.appendChild(u);
	
	o=$i("slImg");
	a=d.createElement("A");
	a.href=v1[1];
	a.target="_blank";
	l=d.createElement("IMG");
	l.src=v1[2];
	if(arr.length>1){
		l.onmouseover=imgSlide.clear;
		l.onmouseout=imgSlide.start;
	}
	l.width=w;
	l.height=h;
	a.appendChild(l);
	o.appendChild(a);

	o=$i("slLink");
	if(arr.length>1){
		o.onmouseover=imgSlide.clear;
		o.onmouseout=imgSlide.start;
	}
	a=document.createElement("A");
	a.className="bla";
	a.href=v1[1];
	a.innerHTML=v1[0];
	a.target="_blank";
	o.appendChild(a);
	
	if(arr.length>1){
		imgSlide.start();
	}
};
// 头条图片幻灯 ===== end =====

// Ajax类 ===== begin =====
function Ajax(recvType,ele) {
	this.srcEle=null;
	this.recvType = recvType ? recvType : 'HTML';	//HTML XML
	this.resultHandle=null;
	this.float=true;
	this.id=Ajax.instance.length;
	Ajax.instance.push(this);
	if (typeof(ele)=="object"){
		this.srcEle=ele;
	}else if (typeof(ele)=="string"){
		this.msgDiv = $i(ele);
		if (this.msgDiv!=null){
			this.float=false;
		}
	}
	if (this.float){
		this.msgDiv = $i("iwmsAjaxMsg");
	}
	if (this.msgDiv==null){
		var o=document.createElement("DIV");
		o.id="iwmsAjaxMsg";

		if (this.srcEle){
			o.className="aj_msg";
		}else{
			o.className="aj_msg aj_msgTop";
		}
		o.style.display="none";

		with(o.style){
			display="none";
			zIndex=101;
			
		}
		if (this.srcEle){
			this.srcEle.ownerDocument.body.appendChild(o);
		}else{
			document.body.appendChild(o);
		}
		this.msgDiv=o;
	}else if(this.float){
		if (this.srcEle){
			this.msgDiv.className="aj_msg";
		}else{
			this.msgDiv.className="aj_msg aj_msgTop";
		}
	}
//	alert(this.msgDiv);

	this.message = function(msg,hideTime){
		if (Ajax.timer){
			window.clearTimeout(Ajax.timer);
			Ajax.timer=null;
		}
		
		if (this.float){
			this.msgDiv.innerHTML=msg;
			var pos=iwms.msgPos(this.srcEle,this.msgDiv);
			with(this.msgDiv.style){
				top=pos.y+"px";
				left=pos.x+"px";
				display="block";
			}
			iwms.dropShadow("ajax",this.msgDiv);
		}else{
			this.msgDiv.innerHTML=msg;
			this.msgDiv.style.visibility="visible";
		}
		
		if(hideTime){
			this.hideMessage(hideTime);
		}
	};
	
	this.hideMessage = function(time){
		if (time && time>0){
			Ajax.timer=window.setTimeout("Ajax.getInstance("+this.id+").hideMessage()",time);
		}else{
			if (this.float){
				this.msgDiv.style.display="none";
				iwms.clearShadow("ajax");
			}else{
				this.msgDiv.style.visibility="hidden";
				this.msgDiv.innerHTML="";
			}
		}
	};
	
	this.createXMLHttpRequest = function() {
		var request = null;
		if(window.XMLHttpRequest) {
			request = new XMLHttpRequest();
			if(request.overrideMimeType) {
				request.overrideMimeType('text/xml');
			}
		}else if(window.ActiveXObject) {
			var versions = ['Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];
			for(var i=0; i<versions.length; i++) {
				try {
					request = new ActiveXObject(versions[i]);
					if(request) {
						return request;
					}
				} catch(e) {
					//alert(e.message);
				}
			}
		}
		if(request){
			this.message("成功建立xmlhttp对象",2000);
		}else{
			this.message("建立xmlhttp对象失败",2000);
		}
		
		return request;
	};

	this.XMLHttpRequest = this.createXMLHttpRequest();

	this.processHandle = function() {
		if(this.XMLHttpRequest.readyState == 1){
			this.message('正在建立连接...');
		}else if(this.XMLHttpRequest.readyState == 2){
			this.message('正在发送数据...');
		}else if(this.XMLHttpRequest.readyState == 3){
			this.message('正在接受数据...');
		}else if(this.XMLHttpRequest.readyState == 4){
			if(this.XMLHttpRequest.status == 200){
				this.message('正在处理数据...',1000);
//alert("ajax return:"+this.XMLHttpRequest.responseText)
				if(this.recvType == 'HTML'){
					this.resultHandle(this.XMLHttpRequest.responseText);
				}else if(this.recvType == 'XML'){
					this.resultHandle(this.XMLHttpRequest.responseXML);
				}
			}else{
				this.message('连接服务器失败，请重新尝试！'+this.XMLHttpRequest.responseText,2000);
			}
		}
	};

	this.get = function(targetUrl, resultHandle) {
		if (this.XMLHttpRequest==null){
			return;
		}
		this.XMLHttpRequest.onreadystatechange = new Function("Ajax.instance["+this.id+"].processHandle();");
		this.resultHandle = resultHandle;
		if(window.XMLHttpRequest) {
			this.XMLHttpRequest.open('GET', targetUrl);
			this.XMLHttpRequest.send(null);
		} else {
		        this.XMLHttpRequest.open("GET", targetUrl, true);
		        this.XMLHttpRequest.send();
		}
	};

	this.post = function(targetUrl, sendString, resultHandle) {
		if (this.XMLHttpRequest==null){
			return;
		}
		if (Ajax.actFreq()){
			this.message("操作过于频繁，请稍后操作！",3000);
			return;
		}
		this.XMLHttpRequest.onreadystatechange = new Function("Ajax.instance["+this.id+"].processHandle();");
		this.resultHandle = resultHandle;
		this.XMLHttpRequest.open('POST', targetUrl);
		this.XMLHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		this.XMLHttpRequest.setRequestHeader("charset","gb2312");
		this.XMLHttpRequest.send(sendString);
	};
	
}

Ajax.actTime=new Date();	// 控制可操作时间,间隔5秒
Ajax.instance=new Array();
Ajax.timer;

// 是否操作频繁
Ajax.actFreq=function(){
	var d=new Date();
	if(d<Ajax.actTime){
		return true;
	}else{
		Ajax.actTime=d.setSeconds(d.getSeconds()+2);
		return false;
	}
};


Ajax.getInstance=function(id){
	for(var i=0;i<Ajax.instance.length;i++){
		if(Ajax.instance[i].id==id){
			return Ajax.instance[i];
		}
	}
};


Ajax.getFormData = function(fm) {
	var str="";
	for(var i=0;i<fm.elements.length; i++){
		var tmp=Ajax.getControlValue(fm.elements[i]);
		if (tmp.length==0){
			continue;
		}
		if (str.length>0){
			str+="&";
		}
		str+=tmp;
	}
	return str;
};


Ajax.getControlValue = function(ctl) {
	if (ctl.name==null || ctl.name.length==0 || ctl.name=="__VIEWSTATE" || ctl.type=="submit" || ctl.type=="reset" || ctl.tagName=="BUTTON"){
		return "";
	}
	var str=escape(ctl.name)+"=";
	if (ctl.tagName=="TEXTAREA" || ctl.type=="text" || ctl.type=="password" || ctl.type=="hidden"){
		str+=escape(ctl.value);
	}else if (ctl.type=="checkbox"){
		str+=ctl.checked ? "1" : "0";
	}else if (ctl.type=="radio"){
		if (ctl.checked){
			str+=escape(ctl.value);
		}else{
			str="";
		}
	}else if (ctl.tagName=="SELECT"){
		if(ctl.multiple){
			var tmp="";
			for(var j=0;j<ctl.options.length;j++){
				if (ctl.options[j].selected){
					if (tmp.length>0){
						tmp+=",";
					}
					tmp+=escape(ctl.options[j].value);
				}
			}
			str+=tmp;
		}else{
			str+=escape(ctl.value);
		}
	}
	return str.replace(/\+/g,"%2B");
};
// Ajax类 ===== end =====

