document.domain = "www.phcppsu.com.cn" 
String.prototype.trim = function(){
	return this.replace(/(^[ |กก]*)|([ |กก]*$)/g, "");
}
String.prototype.getQuery = function(name){
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	var r = this.substr(this.indexOf("\?")+1).match(reg);
	if(r!=null){
		return unescape(r[2]);
	}
	return null;
}
String.prototype.cn_length = function(){
	var i, sum;
	sum = 0;
	for(i=0; i < this.length; i++){
		sum ++;
		if (this.charCodeAt(i) > 255){
	  		sum ++;
	  	}
	}
	return sum;
}
String.prototype.cn_substring = function(len){
	var a = 0;
	var tmp = "";
	for (var i = 0; i < len; i++){
		if (this.charCodeAt(i) > 255){
			a += 2;
		}
		else{
			a++;
		}
		if(a > len){
			return tmp;
		}
		tmp += this.charAt(i); 
	}
	return tmp;
}


function setCopy(_sTxt){
	try {
		clipboardData.setData('Text',_sTxt)
		return true;
	}
	catch(e){
		return false;
	}
}
function $(s){
	if(document.getElementById){
		return document.getElementById(s);
	}
	else{
		return document.all[s];
	}
}
function $n(s, o){
	if (o == null){
		return document.getElementsByName(s);
	}
	else{
		return o.getElementsByName(s);
	}
}
function $t(s, o){
	if (o == null){
		return document.getElementsByTagName(s);
	}
	else{
		return o.getElementsByTagName(s);
	}
}
function $r(s){
	for (var i = 0; i < $n(s).length; i++){
		if ($n(s)[i].checked)
			return $n(s)[i]; 
	}
}
function $$(s){
	return document.frames?document.frames[s]:$(s).contentWindow;
}
function $c(s){
	return document.createElement(s);
}
function exist(s){
	return s != null;
}
function dw(s){
	document.write(s);
}
function hidden(obj){
	obj.style.display = (obj.style.display == 'none') ? '' : 'none';
}

function getXY(obj){
	var o		= new Object();
	o.left		= 0;
	o.top		= 0;
	o.right		= 0;
	o.bottom		= 0;
	var oWidth	= obj.offsetWidth;
	var oHeight	= obj.offsetHeight;
	while(obj){
		o.left += obj.offsetLeft;
		o.top += obj.offsetTop;
		obj = obj.offsetParent;
	}
	o.right = o.left + oWidth;
	o.bottom = o.top + oHeight;
	return o;
}
function isNull(_sVal){
	return (_sVal === "" || _sVal == null || _sVal == "undefined");
}
function removeNode(s){
	if(exist(s)){
		s.removeNode?s.removeNode(true):s.parentNode.removeChild(s);
	}
}


