$(document).ready(function(){
	$("#subscription_form").submit(function(){
		
		var email = $("#email").val();
	  var name	= $("#uname").val();
		//alert(email);
		//alert(name);
	  if(email=="" || name==""){
		   $.prompt('Username or email can not be blank!');  
		}
		else if(email==""){
		$.prompt('Email address can not be blank!');  
		//	$("#sign_up_result").css("display","inline");
		}		
		else{
			 $.ajax({
			 type:  "post",
			 url: 	"http://www.tevs.com.au/ajax/subscriber.ajx.php",
			 data:  $("#subscription_form").serialize(),
			 success: function(msg){
			 //alert(msg);
			 //console.log("The status of "+msg.indexOf("failure"));
			 if(msg.indexOf("failure")=='-1'){
			 $.prompt('You have successfully subscribed!!!');
			
			}
			else
				{				 
					var error	= msg.split("#");
					$.prompt(error[1]);
					//alert(error[1]);
					//$("#sign_up_result").html(error[1]);
					$("#sign_up_result").css("display","none");						
				}
			 }
			});//end ajax
			//alert(url);
		} //end else

	  });
	
	//window.parent.Shadowbox.close();

});