String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function OpenNewLen(url,wLen,hLen)
{
	var leftLen = screen.width/2-wLen/2;
	var topLen = screen.height/2-hLen/2-30;
	ContentWindow=window.open(url,"_blank","width="+wLen+",height="+hLen+",directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=no,top="+topLen+",left="+leftLen);
}
function OpenNewLenWithName(url,wLen,hLen,name)
{
	var leftLen = screen.width/2-wLen/2;
	var topLen = screen.height/2-hLen/2-30;
	ContentWindow=window.open(url,name,"width="+wLen+",height="+hLen+",directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=no,top="+topLen+",left="+leftLen);
}
function validateRegExp(strPattern, strValue)
{
	var oREGEXP = new RegExp(strPattern);
	return oREGEXP.test(strValue);
}

function setSelectByText(obj,val){
	for (i=0; i<obj.options.length; i++){
		if(obj.options[i].text==val){
			obj.options[i].selected = true;
		}
	}		
}	


/**this script are used by ecside**/
function getAttValue(attName){
	var crow=ECSideUtil.getGridObj("ec").selectedRow;
	if(crow!=null){			
		return crow.getAttribute(attName);
	}
	else{
		return null;
	}
}	

/**this script are used by ecside**/
function getValueByColumnId(sIDValue){
	var crow=ECSideUtil.getGridObj("ec").selectedRow; 
	if(crow!=null){ 		
		var aTds=crow.getElementsByTagName("td"); 
		for(var i=0;i<aTds.length;i++){
			if(aTds[i].id==sIDValue){
				return aTds[i].innerText;
			}
		}			
		return null;
	}
	else{
		return null;
	}
}
