function getObject(idname) {
	return document.getElementById(idname);
}

function makeXmlReq() {
	var http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	//TODO: warn
	return http_request;
}

function hide_display(tid){
	var obj = getObject(tid);
	if (obj)
	  obj.style.display = 'none';
}

function show_display(tid){
	var obj = getObject(tid);
	if (obj){
		if ( obj.nodeName == 'SPAN'){
	  		obj.style.display = 'inline';
		} else {
			obj.style.display = 'block';
		}
	}
}

function PageQuery(qs) {
	if(qs.length > 1)
		this.q = qs.substr(1);
	else 
		this.q = null;
	this.keyValuePairs = new Array();
	if(this.q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { 
		return this.keyValuePairs; 
	}
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { 
		return this.keyValuePairs.length; 
	} 
}

function queryString(key) {	
	var page = new PageQuery(window.location.search); 
	var val = unescape( decodeURI(page.getValue(key)) );
	if (val == 'false') {
		return ''; 
	}
	return val; 
}

function queryInt(key) {
	var page = new PageQuery(window.location.search);
	var val = parseInt(page.getValue(key));
	if (isNaN(val))
		return 0;
	else
		return val;
}

function reLoad() {
	window.location.reload();
	return false;
}

/*************确认处理************/
function isDel(){
	if( !confirm("您确认删除吗? 请注意删除后无法恢复!") )
		return false;
	else
	  return true; 
}