// By Strong 2005-06-811:08:51
var _spt = String.prototype;

_spt.trim = function(blnIgnoreCarriage, blnIgnoreInnerWhiteSpace) {
	var temp = this.replace(/^\s*/,"");
	temp = temp.replace(/\s*$/,"");

	blnIgnoreCarriage = blnIgnoreCarriage ? true : false;
	blnIgnoreInnerWhiteSpace = blnIgnoreInnerWhiteSpace ? true : false;

	if(blnIgnoreCarriage && blnIgnoreInnerWhiteSpace) {;}
	else if(blnIgnoreCarriage&&!blnIgnoreInnerWhiteSpace) {
		temp = temp.replace(/\t+/g," ");
		temp = temp.replace(/ +/g," ");
	}
	else if(!blnIgnoreCarriage && blnIgnoreInnerWhiteSpace) {
		temp=temp.replace(/(\n\r)+/g,"");
	}
	else if(!blnIgnoreCarriage && !blnIgnoreInnerWhiteSpace) {
		temp=temp.replace(/\s+/g," ");
	}

	if(temp==" ") { temp=""; }

	return temp;
};

_spt.match = function(strRegExp, strOption) {
	var regEx = new RegExp(strRegExp, strOption ? strOption : "g");
	return this.match(regEx);
};

_spt.remove = function(strRegExp, strOption) {
	var temp = this;
	var regEx = new RegExp(strRegExp, strOption ? strOption : "g");
	temp = temp.replace(regEx, "");
	return temp;
};


_spt.removeHTMLTags2=function(){
var regEx=/<(.*)>/ig;
return  this.replace(regEx,"");
}

//remove ALL HTML TAGS && CONTANTS
_spt.removeHtmlTags=function(){
	var regEx=/<(.*)>.*.<\/\1>/ig;
	return this.replace(regEx,"");
}

//remove HTML TAGS
_spt.removeTags = function() {
	var regEx = /<[\/]?([a-zA-Z0-9]+)[^>^<]*>/ig; /*any tag*/
	return this.replace(regEx,"");
}
//remove BBS TAGS
_spt.removeTags2 = function() {
	var regEx = /\[[\/]?([a-zA-Z0-9]+)[^]^[]*]/ig; /*any tag*/
	return this.replace(regEx,"");
}

//remove QUOTE TAGS
_spt.removequoteTags = function() {
	var regEx = /[[(quote)].*[[\/(quote)]]/ig; /*any tag*/
	return this.replace(regEx,"");
}

_spt.removequoteTags2 = function() {
	var regEx = /[[(.*)]]/ig;
	return this.replace(regEx,"");
}

//remove NEW LINE
_spt.removeNewLine = function() {
	var regEx=/(\r\n)/ig;
	return this.replace(regEx,"");
}

_spt.test = function(strRegExp, strOption) {
	var regEx = new RegExp(strRegExp, strOption ? strOption : "g");
	return regEx.test(this);
};

_spt.getNumFromString = function(){
	var strs="";
	for(i=0;i<this.length;i++){
		if(this.charAt(i)>=0 && this.charAt(i)<=9)
			strs+=this.charAt(i);
		else
		return strs;
	}
	return strs;
};

_spt.cut_str = function(leng){
	return this.substring(0,leng)+'...';
};
