﻿$(document).ready(function(){
	$("#submitForm").click( function(){
		submitForm();
	});
});


function submitForm()
{
	var clientName = $("#name").val();
	var clientEmail = $("#email4").val();
	if(clientName == "Enter Name..." || clientName == "" || clientEmail == "Enter Email..." || clientEmail == "" )
	{
		alert("You must enter a valid email and name to sign up.");
	}
	else
	{
		$.ajax({
		   type: "POST",
		   url: "newsletter.php",
		   data: "name="+clientName+"&email="+clientEmail,
		   success: function(msg){
			 if(msg == 1)
			 {
				 alert( "Your all signed up, thanks for signing up and we will be in touch soon!!!");			 
			 }
			 else
			 {
				 alert( "Sorry but there was a problem sending your details to our mailing list");
			 }
		   }
		});	
	}
 }
