function $e(element){
	if (typeof element == 'string')
	    element=document.getElementById(element);
	return element;
}
function $f(name){
	return document.forms[name];
}
function show(id){
	var arr=[];
	if (arguments.length > 1) {
		for (var i = 0; i < arguments.length; i++)
			arr.push(arguments[i]);
  	}else
		arr[0]=id;
	for(var e=0;e<arr.length;e++)
		$e(arr[e]).style.display='';
}
function hide(id){
	var arr=[];
	if (arguments.length > 1) {
		for (var i = 0; i < arguments.length; i++)
			arr.push(arguments[i]);
  	}else
		arr[0]=id;
	for(var e=0;e<arr.length;e++)
		$e(arr[e]).style.display='none';
}
function setStyle(el,styleName,value){
	$e(el).style[styleName]=value;
}
//
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}
String.prototype.padRight = function(tL,fC) {
	var str=this;
	while(str.length < tL)
		str=str.concat(fC);
	return str;
}
String.prototype.padLeft = function(tL,fC) {
	var str=this;
	while(str.length < tL)
		str=fC.concat(str);
	return str;
}
String.prototype.stripTags=function(){
	if(typeof this=='string')
		return this.replace(/(<([^>]+)>)/ig,"");
	else return '';
}
Array.prototype.inArray=function(str){
	for(var i in this){
		if(this[i]==str)
			return true;
	}
	return false;
}

function checkAll(el,ma){
	if(typeof el=='string') el=$e(el);
	var e=el.getElementsByTagName('input');
	for(var i=0;i<e.length;i++)
		if(e[i].type=='checkbox')
			e[i].checked=(ma==undefined)?true:(e[i].name.indexOf(ma)==0?true:e[i].checked);
}
function uncheckAll(el,ma){
	if(typeof el=='string') el=$e(el);
	var e=el.getElementsByTagName('input');
	for(var i=0;i<e.length;i++)
		if(e[i].type=='checkbox')
			e[i].checked=(ma==undefined)?false:(e[i].name.indexOf(ma)==0?false:e[i].checked);
}
//
function evalResponse(o){
	if(o){
		return eval("("+o.responseText+")");
	}else{
		return 'empty';
	}
}
function removeElement(id){
	var el=$e(id);
	var pa=el.parentNode;
	pa.removeChild(el);
}


function pvalert(text,theme,container,gotop){
	var a=new PAlert;
	a.setContainer((container!=undefined?container:'palert'));
	a.setImagesDir(Site_URL+'/images/');
	a.setGoTop(gotop==undefined?true:gotop);
	a.show(text,theme);
}

