var	_strLFtoTag_ = false ;

/*
//	String.prototype.printText = function()
//	{
//		var	tgtStr = this ;
//		
//		alert( tgtStr ) ;
//		
//		return( tgtStr ) ;
//	
//	}	//	end of printText()
//	
//	
//	String.prototype.replaceVal = function()
//	{
//		var	tgtStr = this ;
//		var	regFmt = new RegExp( "", "g" ) ;
//		
//		for ( ci=0; ci < arguments.length; ci++ ) {
//			valSet = arguments[ci] ;
//			for ( val in valSet ) {
//				regFmt.compile( '##' + val + '##', "g" ) ;
//				tgtStr = tgtStr.replace( regFmt, valSet[val] ) ;
//			}
//		}
//		return( tgtStr ) ;
//	
//	}	//	end of replaceVal()
*/

String.prototype.html2txt = function()
{
	var	tgtStr = this ;
	
	tgtStr = tgtStr.replace( /&/g, '&amp;' ) ;
	tgtStr = tgtStr.replace( /</g, '&lt;' ) ;
	tgtStr = tgtStr.replace( />/g, '&gt;' ) ;
	tgtStr = tgtStr.replace( / /g, ' &nbsp;' ) ;
//	tgtStr = tgtStr.replace( /\"/g, '&quot;' ) ;

	if ( _strLFtoTag_ == true ) {
		tgtStr = tgtStr.replace( /\n/g, '<br />\n' ) ;
	}
	return( tgtStr ) ;

}	//	end of html2txt()


String.prototype.txt2link = function()
{
	var	tgtStr = this ;
	
	tgtStr = tgtStr.replace( /(http[s]*:\/\/[\w\d\~\-\/\.:?=&;#\%]+)/g, '<a href="$1" target="_blank">$1</a>' ) ;
	tgtStr = tgtStr.replace( /(ftp:\/\/[\w\d\~\-\/\.:?=&;\%]+)/g, '<a href="$1" target="_blank">$1</a>' ) ;
	tgtStr = tgtStr.replace( /([A-Za-z0-9\._\-]+@[\-\[\]A-z0-9\._]+)/g, '<a href="mailto:$1">$1</a>' ) ;
	
	tgtStr = tgtStr.replace( / &nbsp;/g, '&nbsp;' ) ;
	
	return( tgtStr ) ;
	
}	//	end of txt2link()


function	changeHtml2Text( text )
{
	text = text.html2txt() ;
	text = text.txt2link() ;
	
	return( text ) ;
	
}	//	end of changeHtml2Text()

/* --- end of protStr.js --- */

