$(document).ready(function(){
	//$(document).pngFix();
	
	$("#submit").click(function(){					   				   
		$(".error").hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		var emailToVal = $("#khjjth-khjjth").val();
		if(emailToVal == '') {
			$.prompt('Please enter an email address to subscribe to the newsletter');
			hasError = true;
		} else if(!emailReg.test(emailToVal)) {	
			$.prompt('Please enter a <strong><em>valid</em></strong> email address!');
			hasError = true;
		}
		if(hasError == false) {
			$(this).hide();
			$("#signup").append('<img src="http://ftp5.dns-systems.net/~akidman/images/template/loading.gif" alt="Loading" id="loading" />');
			$.post("http://ftp5.dns-systems.net/~akidman/Subscriber.Add.php",
   				{ emailAdd: emailToVal},
   					function(data){
						//if (data == "Success") {
						$("#newsletter").fadeOut("normal", function() {				   							
							$("#newsletter").html('<p class="thanks"><strong>Thank you.</strong><br/>You\'ve successfully subscribed.</p>');
							$("#newsletter").fadeIn();
						});
						/*} else {
						$("#newsletter").fadeOut("normal", function() {
							$("#newsletter").html('<p class="thanks"><strong>Hmm. A problem?</strong><br/>'+data+'</p>');
							$("#newsletter").fadeIn();
						});
							
						}*/
   					}
				 );
		}
		
		return false;
	});
});
