﻿var opentitle = 1;
var stat = 0;
var moving = false;

function Bar(number)
{
	if(moving){
		return;
	}
	if(opentitle == number){
		return;
	}
	i = opentitle;
	opentitle = number;
	document.all("div"+number).style.display="";
	document.all("flow"+number).style.overflow="hidden";
	document.all("flow"+i).style.overflow="hidden";
	moving = true;
	move(i,number);
}

function move(close,open){
	if(document.all("div"+close).style.height == "0%"){
		document.all("div"+close).style.display = "none";
		document.all("flow"+close).style.overflow="auto";
		document.all("flow"+open).style.overflow="auto";
		stat = 0;
		moving = false;
	}else{
		stat = stat + 10;
		document.all("div"+open).style.height= stat +"%";
		document.all("div"+close).style.height=(100-stat)+"%";
		setTimeout("move("+close+","+open+")",10);
	}
}

function confirmdel(){
	if(window.confirm("确定删除吗？")){
		return true;
	}else{
		return false;
	}
}

function suresubmit(str){
	if(window.confirm(str)){
		return true;
	}else{
		return false;
	}
}

function dialog(url,nwidth,nheight,x,y){
	if(x == ""){
		x = (screen.width-nwidth)/2;
	}
	if(y == ""){
		y = (screen.height-nheight)/2;
	}
	openformat = "height="+nheight+",width="+nwidth+",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,top="+y+",left="+x;
	window.open(url,"cits",openformat)
}

function showObj(objDiv){
		var div = document.all(objDiv);
		div.style.display = "";
}

function hideObj(objDiv){
		var div = document.all(objDiv);
		div.style.display = "none";
}

function change(objDiv){
	var div = document.all(objDiv);
	if(div.style.display == "none"){
		div.style.display = "";
		eval("img"+objDiv).src="images/openfolder2.gif";
		if(document.all("limg"+objDiv)){
			eval("limg"+objDiv).src="images/Lminus.gif";
		}else{
			eval("timg"+objDiv).src="images/Tminus.gif";
		}
	}else{
		div.style.display = "none";
		eval("img"+objDiv).src="images/folder2.gif";
		if(document.all("limg"+objDiv)){
			eval("limg"+objDiv).src="images/lplus.gif";
		}else{
			eval("timg"+objDiv).src="images/tplus.gif";
		}
	}
}

function vote_other_onclick(obj){
	if(obj.value=='其它'){
		obj.value='';
	}
}

function trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

function isStr3(str){
	src = /^\d{3}$/;
	return src.test(str);
}

function isStr2(str){
	src = /^\d{2}$/;
	return src.test(str);
}


function isStr1(str){
	src = /^\d{1}$/;
	return src.test(str);
}

function getXmlHttp(){
	/* Create a new XMLHttpRequest object to talk to the Web server */
	var xmlHttp = false;
	try {
  		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
  		try {
    		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  		} catch (e2) {
    		xmlHttp = false;
  		}
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

//得到一个dom对象
function getDOM(){
var preFixes=["MSXML2", "Microsoft", "MSXML", "MSXML3"];
var o;
for (var i = 0; i < preFixes.length; i++){
try {//尝试创建 DOM对象
o = new ActiveXObject(preFixes[i] + ".DomDocument");
return o;
}catch (e) {};
}
throw new Error("没有找到已经安装的XML解析器");
}