/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$(document).ready(function(){

	$("#subscribe").bind("click", sendData);


});

function sendData(){
	$("#subscribe").unbind("click", sendData);
	$.ajax({
			type: "POST",
			url: "utils/subscribeMC.php",
			data: "subscribe=true&name=" + $("#name").val() + "&email=" + $("#email").val(),
			success: function (msg){
				if(msg != "true"){
				
					$("#errorMsg").html(msg);
					$("#subscribe").bind("click", sendData);
					
				}
				else {
					$("#subscribeForm").fadeOut("slow", function(){
						$("#thankYou").slideDown("slow");
					});
				}
			}
		});
}
