/** 
 HTML MAKER jQuery PlugIn
 Made by Smart Web Development <www.smartwd.com>
 */

(function($j){
	$j.fn.ParseLinks = function() {
		if( this.length < 1 )
			return false;
		var Prefix = "com|co\.il|net|org|org\.il|biz|info|me|ly";
		this.each(function( offset , elem ){
			//BUG[FIXED]:http:// not recognized
			//BUG[FIXED]:get vars not recognized
			var Reg = new RegExp(/(?:http\:\/\/)?((\w*\.?)(\w+\.)(com|co\.il|net|org|org\.il|biz|info|me|ly|tv)((\/.+?\s)|(.*?\s?)))/ig );
			//alert( linkify_plain(elem.innerHTML) )
			//elem.innerHTML = elem.innerHTML.replace( Reg , "<a href=\"http://$1\" target=\"_blank\" style=\"color: #089DD5;\">$1</a>");
			elem.innerHTML = linkify_plain(elem.innerHTML);
		});
	};
	
})(jQuery);
$j(document).ready(function() {
    $j(".tweet_comment_content").ParseLinks();
    $j(".rootweet_msg").ParseLinks();
    //$j(".contentmessage").ParseLinks();
});


var linkify_plain = function(text) {
if( !text ) return text;
      text = text.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi,function(url){
      nice = url;
      if( url.match('^https?:\/\/') )
      {
      nice = nice.replace(/^https?:\/\//i,'')
      }
      else
      url = 'http://'+url;
      return '<a target="_blank" rel="nofollow" href="'+ url +'">http://'+ nice.replace(/^www./i,'') +'</a>';
      });
	  return text;
      }
