// JavaScript Document
	var isIE=((document.all&&document.getElementById&&!window.opera)?true:false); 
	var isMozilla=((!document.all&&document.getElementById&&!window.opera)?true:false); 
	var isOpera=((window.opera)?true:false);
	var isNS4 = ((document.layers)?true:false);
//取得元素
function getRef(id) {
	if(typeof(id) == "object") return id;
	if (isIE) return document.getElementById(id);
	if (isNS4) return document.layers[id];
	if (isMozilla) return document.getElementById(id);		
	if (isOpera) return document.getElementById(id);
}

function chg(n) {
	var tmp=null;
	var tmp2=null;
	for(var i=1;i<6;i++) {
		tmp = getRef("category"+i);
		tmp2=getRef("categoryconts"+i);
		if(tmp) {
			tmp.src = tmp.src.replace("_2.gif",".gif")
			tmp2.style.display="none";
		}
	}
	tmp = getRef("category"+n);
	tmp2 = getRef("categoryconts"+n);
	if(tmp) {
		tmp.src = tmp.src.replace(".gif","_2.gif");
		tmp2.style.display="block";
	}
}

function chgQuickMenu(n,t) {
	var tmp=null;
	tmp = getRef("quick_list"+n);
	if(tmp.className.toString() == "dNone") {
		for(var i=0;i<t;i++) {
			tmp = getRef("quick_list"+i);
			if(tmp) {
				tmp.className="dNone";
			}
		}
		tmp = getRef("quick_list"+n);
		tmp.className="dBlock";
	} else {
		tmp = getRef("quick_list"+n);
		tmp.className="dNone";
	}
}

function chgImg(obj) {
	if(obj) {
		var sc = obj.src.toLowerCase();
		if(sc.indexOf("_on.gif") != -1) {
			obj.src = sc.replace("_on.gif",".gif");
		} else {
			obj.src = sc.replace(".gif","_on.gif");
		}
	}
}

function chgCate(id,t,total) {
	var oc=null;
	var ot=null;
	var nn=null;
	var nc=null;
	var nt=null;
	var i;
	switch(t) {
		case 0:
			nn="z_title";			
			nc="content"
			nt="category"
			break;
		case 1:
			nn="t_item";			
			nc="citem"
			nt="titem"
			break;
	}
	
	for(i=0;i<=total;i++){
		ot=getRef(nt+i);
		oc=getRef(nc+i);
		if(i == id){
			if(ot) ot.className = nn+"_on";
			if(oc) oc.className = "dblock";
		} else {
			if(ot) ot.className = nn;
			if(oc) oc.className = "dnone";
		}
	}
}

function getNodeName(obj) {
	var tmp=obj.parentNode.nodeName;
	var i=0;
	while(i<10) {
	tmp = tmp + "___" + getNodeName(obj.parentNode)
	i++;
	}
	return tmp;
}

function xxx(obj) {
	var tmp=obj.nodeName + getNodeName(obj);
		alert(tmp)
}
function CheckEmpty(o,t) {
	var obj = getRef(o);
	if(obj) {
		if(obj.value == "") {
			alert("" + t + " 不能为空!");
			obj.focus();
			return false;
		}
	}
	return true;
}

function CheckNum(o,t) {
	var obj = getRef(o);
	if(obj) {
		if( obj.value == "" || isNaN(obj.value)) {
			alert("" + t + " 必须是一个数字!");
			obj.focus();
			return false;
		}
	}
	return true;
}

function CheckEmail(o,t) {
	var obj=getRef(o);
	var myReg = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
	if(obj) {
		if(obj.value=="" || myReg.test(obj.value)== false){
			alert("" + t + " 不是一个有效的Email地址");
			obj.focus();
			return false;
		}
	}
	return true;
}

function chkLogin(obj) {
	if(!CheckEmpty(obj.userid,"数字ID")) return false;
	if(!CheckEmpty(obj.userpsw,"密 码")) return false;
	return true
}

	rnd.today=new Date(); 

    rnd.seed=rnd.today.getTime(); 

    function rnd() { 

　　　　rnd.seed = (rnd.seed*9301+49297) % 233280; 

　　　　return rnd.seed/(233280.0); 

    }; 

    function rand(number) { 

　　　　return Math.ceil(rnd()*number); 

    }; 

function init() {
	var u=document.location.href.toString();
	if(u.indexOf("#") != -1) {
		var cnum=u.split("#")[1];
		if(!isNaN(cnum)) chgCate(parseInt(cnum),0,6);	
	}
}



var win;

function newWin(u,t) {
	var wd = 600;
	var ht = 500;
	if (!u) return;
	u=u.replace("\\","/");
	u=u.replace("../","");
	var win = new Window({className: "alphacube", title: ""+t+"", 
                      top:70, left:100, width:wd, height:ht, 
                      url:""+u+"", showEffectOptions: {duration:1.5}})
	win.showCenter(true);	
}

function setSize(obj) {
	if(!win || !obj) return;
	var wd=parseInt(obj.width)+50
		wd=wd>500?wd:500;
	var ht=parseInt(obj.height)+50
		ht=ht>400?ht:400;
	win.setSize(wd,ht);
}