/*
	email obfusicator
*/
Email=Class.create();
Email.prototype=
{
	hasInit:false,
	wrapper:"",
	elWrapper:null,
	key1:"",
	key2:"",
	
	initialize:function(args)
	{
		args=getDefaults(args,{
			wrapper:this.wrapper,
			key1:this.key1,
			key2:this.key2
		});
		
		this.hasInit=true;
		
		if(args.wrapper!="" && $(args.wrapper))
		{
			this.wrapper=args.wrapper;
			this.elWrapper=$(args.wrapper);
		} else {
			this.hasInit=false;
		}
		
		if(args.key1!="" && args.key2!="")
		{
			this.key1=args.key1;
			this.key2=args.key2;
		} else {
			this.hasInit=false;
		}
		
		if(this.hasInit)
		{
			Event.observe(this.elWrapper,'click',this.clicked.bind(this));			
			this.elWrapper.update(this.key1 + "@" + this.key2);
		}	
	},
	
	clicked:function(e)
	{
		this.elWrapper.href="mailto:" + this.key1 + "@" + this.key2;
	}
}
