jQuery(function( $ ) {
	
	var methods =  {

		changemt: function()
		{
			methods.ismt = true;
			$(this).filter( function()	{
				if(!$(this).attr('href')){ return false;}
				if($(this).attr("href").match(/^[a-zA-Z0-9#*_-]+$/g) && $(this).attr("href").length>1) {					
					var nh = $(this).attr("href").replace(/#/g,'.').replace(/\*/g,'@');					
					$(this).attr({'href':'ma'+'ilt'+'o:'+nh});
				} else {
					return false;
				}
			});
		},
		changemc: function()
		{
			if(methods.ismt)
			{
				var nr = new RegExp("[a-zA-Z#_-]{2,}\\*([a-zA-Z0-9_-]+#){1,7}[a-zA-Z]{2,3}","gi");
				$(this).find("*").filter(function(){
					var mx = 0;
					while(t = nr.exec($(this).html()))
					{					
						var k = t[0].replace(/#/g,'.').replace(/\*/g,'@');
						$(this).html($(this).html().replace(t[0],k));
						mx++;
						if(mx>methods.max) break;
					}
					nr.lastIndex = 0;
				})
			}
			else
			{
				//alert("Előbb a hrefbol kell cserelni!");
			}
		},
		ismt: false,
		max:1000
	};
		
	$.fn.msecret = function( method )	{
		// Method calling logic
		if ( methods[method] ) {
		  return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
		} else if ( typeof method === 'object' || ! method ) {
		  return methods.changemt.apply( this, arguments );
		}
	}
});
