$(document).ready(function () {
	
	$("#submit").click(function() {
		
		n = urlencode(document.getElementById("senderName").value);
		e = urlencode(document.getElementById("senderEmail").value);
		
		if(e.length > 0){
			//alert(n+" "+e+" "+c+" "+h+" emails:"+receiveEmails)
			$.ajax({
			method: "get",url: "inc/db_send_contact.php",data: "n="+n+"&e="+e,
				success: function(html) {
				$("#thanks").html(html);
	 			}
 			});
		} 
		else {
			$(".required").show();
		}
	});
	
	$(".yes").click(function() {
		receiveEmails = "yes";
		emailOptions();
	});
	
	$(".no").click(function() {
		receiveEmails = "no";
		emailOptions();
	});
});

function urlencode(str) {
	return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}