/*ver 1.1.2;last update:07.01.2004*/
String.prototype.trim=function(blnIgnoreCarriage,blnIgnoreInnerWhiteSpace){
	var temp=this.replace(/^(\s)*|(\s)*$/,"");/*remove leading spaces.*/
	temp=temp.replace(/(\s)*$/,"");/*remove trailing spaces.*/
	if(!blnIgnoreCarriage)blnIgnoreCarriage=false;
	if(!blnIgnoreInnerWhiteSpace)blnIgnoreInnerWhiteSpace=false;
	/*v.o. may require testing and modification...*/
	if(blnIgnoreCarriage&&blnIgnoreInnerWhiteSpace)			;
	else if(blnIgnoreCarriage&&!blnIgnoreInnerWhiteSpace)	temp=temp.replace(/ +/g," ");
	else if(!blnIgnoreCarriage&&blnIgnoreInnerWhiteSpace)	temp=temp.replace(/([\t\n\r])+/g,"");
	else if(!blnIgnoreCarriage&&!blnIgnoreInnerWhiteSpace)	temp=temp.replace(/(\s)+/g," ");

	if(temp==" ")temp="";/*if what in hand is only " " remove it as well.*/
	return temp;
	}
/*v.o. caveat: do not use "\\" as strRegExp; it blows up!*/	
String.prototype.getLastPortion=function(strRegExp){
	var RegEx=new RegExp(strRegExp,"g");
	var aryResult=this.split(RegEx);
	var temp;
	for(i = 0;i<aryResult.length;i++)temp=aryResult[i];
	return temp;
}
String.prototype.getFirstPortion=function(strRegExp){
	var RegEx=new RegExp(strRegExp,"g");
	var aryResult = this.split(RegEx);
	if(aryResult.length <= 0)return aryResult;
	if(aryResult.length == 1)return aryResult[0];
	var temp="";
	for(i=0;i<aryResult.length-1;i++){
		if(i==0)temp=aryResult[i];
		else temp+="/"+aryResult[i];}
	return temp;}
String.prototype.remove=function(strRegExp){
	var temp=this;
	var regEx=new RegExp(strRegExp,"g");
	temp=temp.replace(regEx,"");
	return temp;}
String.prototype.test = function(strRegExp,strOption) {
	if(!strOption)strOption="g";
	var RegEx=new RegExp(strRegExp,strOption);
	return RegEx.test(this);}