/*
 * jQuery aMail plug-in 1.1
 * (c) 2009 Max Ya  ( http://iHackWeb.com )
 * Inspired by epemail plugin/
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * 
 * HOW TO USE
 
 MOD by Nika Gerova !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 3 times cut 'NOSPAM'
 
 THE DOM
	example: $('#email').amail('||','|','NOSPAM');
 
 THE PAGE CODE
	Using Example:  <a class="amail" title="my email" href="lim||fromNOSPAMru|com"><img src="my_img.png"></a>  
	it will be <a title="my email" class="amail" href="mailto:lim@fromru.com"><img src="my_img.png"></a>
	
 *
*/
$.fn.amail = function(sAt,sDot,sRepl){

	if (!sAt)
		sAt = '||';
		
	if (!sDot)
		sDot = '|';
	
	if (!sRepl)
		sRepl = 'NOSPAM';
	
	
	this.each(function() {
					  
		el = $(this);
		var mail = el.attr('href').replace(sRepl,'').replace(sRepl,'').replace(sRepl,'').replace(sAt,'@').replace(sDot,'.');
		el.each(function(){
		el.attr('href','mailto:' + mail);
		/*if(el.attr('title')){
			el.html(el.attr('title'));
		}else{
			el.html(mail);
			}*/
		});
	});
};
