$(function(){
	
	$('.request a[href^="#send_email"]').live('click',function(){	
		
			A25Core.__validate('.contact_form', 'index/json-validate', function(resp){
	            if (resp.success){
	            	var firstname = $('input[name="firstname"]').val();
	            	var email = $('input[name="email"]').val();

	            	$.post("index/ajax-send-email", {firstname: firstname, email: email}, 
	            				function (data) {
				            		if (data.success){
			                          $('#firstname').val('');     
			                          $('#email').val('');			                         
			                          alert("Message Sent");
			                          }			                      
	            	}, "json");

				} else {
									
	                $.each(resp.errors,function(k,value){
	                	
	                	$("input[name='" +k +"']").parent().find('em').html(value);
	                                                        
	                });
	            }
			});
			return false;
		});
		
		
		
});
