$(document).ready(function()
{
    //Corners
    //$("div").corner();
    $("div.lcolDiv").corner();
    $("div.midcolDiv").corner();
    $("div.rcolDiv").corner();
    $("div#banner").corner();
     //Pretty photo
    $("a[rel^='prettyPhoto']").prettyPhoto();
    //Special font for banner
    $("h1.banner").sifr({path:'fonts/',font:'1942report'});
    
    $("input[type='button']").click(function ()
    {
    	if($(this).hasClass("NewsletterButton"))
    	{    
	    	var EmailValue = $("input#email").val();
	    	if(EmailValue == "")
	    	{
	    		alert("Please type in you email address.");
	    	}
	    	else
		    {
	
	    		var ButtonId = $(this).attr("id");
	    		var mode = (ButtonId == "addButton") ? "add" : "delete";
	    		
	    		$.ajax({
	    			type: "POST",
	    			url:  "controllers/SubscriptionController.php",
	    			data: "mode="+mode+"&email="+EmailValue,
	    			success: function(result)
	    			{
	    				var a = eval('(' + result + ')');
	    				if(a._Error)
	    				{
	    					alert(a._txtErrorText);
	    				}
	    				else
	    				{
	    					$("p#Response").empty();
	    					$("p#Response").html(a._txtSuccessText);
	    				}
	    			}
	    		});
	    	}
    	}
    });

});
