/*
 * SimpleModal Contact Form
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2009 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: contact.js 212 2009-09-03 05:33:44Z emartin24 $
 *
 */

j$(function(){
	j$('#bntSubmit').click(function (e) {
		e.preventDefault();
		if(j$("#Mail").val() == ""){
			alert("E-mail address cannot be left empty!");return false;
		}else{
			var dataString = 'name='+ j$("#name").val() + '&email=' + j$("#Mail").val() + '&Notes=' + j$("#Notes").val(); 
		// load the contact form using ajax
		j$.ajax({url:"ajax.php?act=add&"+dataString,type: 'post',cache: false,dataType: 'json',success: function(data){
			// create a modal dialog with the data
			if(data['error'] == '0'){
				j$("#bntSubmit").attr("class",'go-1');
				j$("#name").val('');
				j$("#Mail").val('');
				j$("#Notes").val('');
			}
			alert(data['message']);
		}});
		}
	});

	
})
