/*
	Scripts for Alpha Theme
	Design by Argyll Studios 2009
	www.argyllstudios.com
	
	**** Note ****
	 - This JS file requires jQuery to work. It is currently being pulled in via Google's Ajax Libraries
	 - http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery
	
*/

/* Contact Form Submission */
function initCF() {
	$("#contact_form").submit(function(){
		var str = $("form").serialize();
	 	$.ajax({
			type: "POST",
			url: "contactProcess.php",
			data: str,
			success: function(msg){
				$("#note").ajaxComplete(function(event, request, settings){
					if(msg == 'OK'){ // Message Sent? Show the 'Thank You' message and hide the form
						result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
						$("#contact_form").hide();
					}else{
						result = msg;
					}
					$(this).html(result);
				});
			}});
		return false;
	});
}

/* Initiates Contact Panel */
$(document).ready(function(){
	$("a#open_contact").click(function(){
		$("#contact_area").slideToggle("slow");
		initCF();
		return false;
	});
});
