
	$(document).ready(function(){
		
		$.tracking = false;
		if( $(".main-directions").length > 0 ){
			$("#pwp-map").googleMap({
				center: "4589 Swan Dr, Evans, GA 30809",
				directions: 'pwp-directions'
			}).load();
		}
		
	});
	
	/*
	*	Sends an email to the administrator from the website. 
	*/
	function sendEmail(class_name, subject){

		$classname = "." + class_name + " input";
		$classname += ", ." + class_name + " select";
		$classname += ", ." + class_name + " textarea";
		
		if( validate($classname) ){
			$send = {};
			$send['subject'] = subject;
			$send['content'] = {};
			$($classname).each(function(){
				$send['content'][$(this).attr("name")] = $(this).val();
			});
			
			$.post("/scripts/page_email.php",
			    $send,
				function(data){
					$("#stylized").slideUp("normal", function() {
						$("#stylized").before('<p class="contactus">Thank you for sending us your comments or concerns. We\'ll be in touch shortly. </p>');
					});
				}
			);
		}
		
	}
	
	function validate(classname){
		
		$(".need-input").each(function(){
			$(this).removeClass("need-input");
		});
		
		$(".required").each(function(){
			
			if( $(this).is("input") ){
				if( $(this).val() == "" )
					$(this).addClass("need-input");
			}else if( $(this).is("select") ){
				if( $(this).val() == "" )
					$(this).addClass("need-input");
			}else if( $(this).is("textarea") ){
				if( $(this).val() == "" )
					$(this).addClass("need-input");
			}
			
		});
		
		if( $(".need-input").length > 0 )
			return false;
		
		return true;
	}
	


