/* ------------------------- ANTI-SPAM FUNCTION ------------------------- */

jQuery.fn.safeMail = function()
{
	return this.each(function()
	{
 		var mailtoHref = $(this).attr('href');
		mailtoHref = mailtoHref.replace(mailtoHref,"mailto:" + mailtoHref);
		mailtoHref = mailtoHref.replace("[at]","@");
		mailtoHref = mailtoHref.replace("[dot]",".");
 
		var mailtoText = $(this).text();
		mailtoText = mailtoText.replace("[at]","@");
		mailtoText = mailtoText.replace("[dot]",".");
		$(this).text(mailtoText);
 
		var mailtoTitle = mailtoHref.replace("mailto:","Email: ");
		$(this).attr('title',mailtoTitle);
 
		$(this).click(function()
		{
			window.location.href = mailtoHref;
			return false;
		});
	});
};

$(document).ready(function()
{
	$("a[rel='email']").safeMail();
	
	$("a[rel='facebox']").facebox();

	$(".buttons img").hover(function()
	{
    	$(this).stop().animate({ opacity: "1.0" }, 250);
    },
    function ()
    {
    	$(this).stop().animate({ opacity: ".8" }, 250);
    }
    );
    
    $(".buttons input").hover(function()
	{
    	$(this).stop().animate({ opacity: "1.0" }, 250);
    },
    function ()
    {
    	$(this).stop().animate({ opacity: ".8" }, 250);
    }
    );
    
    $(".buttons img").click(function()
    {
    	javascript:location='mailto:martin@maniaevents.com?subject=Table reservation enquiry';
    	return false;
    });

});