function validate()
{
	var txt = "";
	
	if ($('#email').val().replace(/^\s+|\s+$/g,"") == '')
	{
		txt = "<br />Please fill in the email field!";
	}
	if ($('#title').val().replace(/^\s+|\s+$/g,"") == '')
	{
		txt += "<br />Please fill in the name/company field!";
	}
	if ($('#phone').val().replace(/^\s+|\s+$/g,"") == '')
	{
		txt += "<br />Please fill in the phone field!";
	}
	if ($('#msg').val().replace(/^\s+|\s+$/g,"") == '' || $('#msg').val().replace(/^\s+|\s+$/g,"") == "Write your message here...")
	{
		txt += "<br />Please enter your message!";
	}
	
	if (txt == "")
	{
		txt = "Thank you! Your message has been sent!";
		$.ajaxSetup ({
			cache: false
		});
		
		$.ajax({
			url: 'contact.php',
			type: 'POST',
			dataType: 'html',
			data:( {
					email : $('#email').val(),
					title : $('#title').val(),
					phone : $('#phone').val(),
					msg : $('#msg').val()
				}
			),
			error: function(){
				tb_show("Message", "#TB_inline?height=150&width=300");
				$('#TB_ajaxContent').append("An error occuried!");
			},
			success: function(xml){
				tb_show("Message", "#TB_inline?height=150&width=300");
				$('#TB_ajaxContent').append(txt);
			}
		});

		
		
		/*$.ajax({ url: "contact.php", data:dat,
			success: function() {
				tb_show("Message", "#TB_inline?height=150&width=300");
				$('#TB_ajaxContent').append(txt);
			},
			error: function() {
				tb_show("Message", "#TB_inline?height=150&width=300");
				$('#TB_ajaxContent').append("An error occuried!");
			}
		});*/
	}
	else
	{
		tb_show("Message", "#TB_inline?height=150&width=300");
		$('#TB_ajaxContent').append(txt);
	}
	return false;

}

