/**
 * @author Cosmin Harangus
 */
function Contact(){
	this.index = function(){
		__validateForm(".page_contact", "contact/json-validate-contact-form")
	};
	
	function __validateForm(__wrap, url){
		$(__wrap+" button[name='__submit']").click(function(){
			var name=$(this).attr('name');
			$(".error_message").hide();
			A25Core.__validate(__wrap, url, function(resp){
				$(".error_message em").each(function (){
					if ($(this).html()!="") $(this).parents(".error_message").show(); 
				})
				if (resp.success){
					A25Core.__submitForm(__wrap+' form', name);
				}
			});
			return false;
		});
	}
};
var Page = new Contact();