
	// 函数: 切换对象的显示方式
	// 参数: 
	function switchdisplay(obj) {
		document.getElementById(obj).style.display = document.getElementById(obj).style.display==""?"none":"";
	}
	
	// 函数: 根据 ID 获取一个对象
	function getObjById(obj) { 
		if(document.getElementById) { return document.getElementById(obj); }
		else { alert("浏览器不支持!"); }
	}
	
	function winopen(u, w, s) {
		window.open(u, w, s);
	}

// 函数: 获取一个对象在页面的位置
	function getpos(e) {
		var left = 0;
		var top  = 0;
		while (e.offsetParent) {
			left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
			top  += e.offsetTop  + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
			e     = e.offsetParent;
		}
		left += e.offsetLeft + (e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);
		top  += e.offsetTop  + (e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);
		return {x:left, y:top};
	}
	
	// 函数: 获取一个对象在页面的左边位置
	function getleft(e) {
		var posleft = 0;
		while(e!=null) {
			posleft += e["offsetLeft"];
			e = e.offsetParent;
		}
		return posleft;
	}

	function hide(obj) {
		document.getElementById(obj).style.display = "none";
	}
	
	function show(obj) {
		document.getElementById(obj).style.display = "";
	}

	// 函数: 获取一个对象在页面的上边位置
	function gettop(e) {
		var postop = 0;
		while(e!=null) {
			postop += e["offsetTop"];
			e = e.offsetParent;
		}
		return postop;
	}
	
	// 函数: 创建 xmlhttp 实例 
	function createXmlHttpRequest() {

		if (window.XMLHttpRequest) req = new XMLHttpRequest();
		else if (window.ActiveXObject) req = new ActiveXObject("Microsoft.XMLHTTP");
		return req;
	}


	// 函数: 获取一个按键的值
	function presskey(evt) {
		evt = (evt)?evt:((window.event)?event:null);
		if (evt) return evt.keyCode;
		return true;		
	}


	// 函数: 判断一个字符串是否数字
	function isNumber(oNum) {
		if(!oNum) return false;
		var strP=/^\d+(\.\d+)?$/;
		if(!strP.test(oNum)) return false;
		try { if(parseFloat(oNum)!=oNum) return false; }
		catch(ex) { return false; }
		return true;
	}


	/* 页面跳转转换 */
	function GotoPage(url, page) {
		if(url && isNumber(page)) {
			url = url.replace("[PAGE]", page);
			location.href = url;
		}
		return false;
	}

	