Hacked By$PoodleCorp


var FORM = {

	/**
	 * Create response tag depending
	 * on the form that is being submitted
	 * @param  target - the form being submitted
	 * @param  submitBtn
	 * @param response elem
	 */
	createTag : function(submitBtn, responseTag) {
		submitBtn.val('SENDING...');
		$(document).find('.response-tag').remove();
	},

	/**
	 * Show success message
	 * @param  submitBtn
	 */
	showSuccess : function(submitBtn, responseTag) {
		submitBtn.val('SENT');
		$(document).find('.response-tag').remove();
		responseTag.text('Your message has been received. We will be in touch shortly. Thank you!').insertAfter(submitBtn.parent());
		setTimeout(function() {
			submitBtn.val('SEND');
			$(document).find('.response-tag').remove();
		}, 7000);
	},

	/**
	 * Show error message
	 * @param  submitBtn
	 */
	showError : function(submitBtn, responseTag, errors) {
		submitBtn.val('SEND');
		$(document).find('.response-tag').remove();
		responseTag.html('An error has occurred.
' + errors).insertAfter(submitBtn.parent()); } }; var Forms = { init : function() { $('form.ajax input[type="submit"]').on('click touchend', this.validate); $('form.ajax').on('submit', this.submitForm); }, validate : function(e) { e.preventDefault(); var form = $(e.target).closest($('form')); if (form.checkValidity()) { form.submit(); } }, submitForm : function(e) { e.preventDefault(); var form = $(this); var submitBtn = form.find('input[type=submit]'); var responseTag = $("

").addClass("response-tag"); Response.createTag(submitBtn, responseTag); $.ajax({ url : form.attr('action'), type : form.attr('method'), dataType : 'json', data : form.serialize(), }) .done(function(data) { var form = submitBtn.closest('form'); console.log(data.success); if (data.success === true) { Response.showSuccess(submitBtn, responseTag); } else { console.log('else'); Response.showError(submitBtn, responseTag, data.errors); } }) .error(function(data){ console.dir(data); Response.showErro(submitBtn, responseTag, data.errors); }); return false; }, }; $(document).ready(function() { if (typeof webshim !== "undefined") { webshim.setOptions("forms", { lazyCustomMessages: false, replaceValidationUI: true, customDatalist: "auto", list: { "filter": "^" } }); webshim.polyfill('forms'); } Forms.init(); });


var Response = {

	/**
	 * Create response tag depending
	 * on the form that is being submitted
	 * @param  target - the form being submitted
	 * @param  submitBtn
	 * @param response elem
	 */
	createTag : function(submitBtn, responseTag) {
		submitBtn.val('SENDING...');
		$(document).find('.response-tag').remove();
	},

	/**
	 * Show success message
	 * @param  submitBtn
	 */
	showSuccess : function(submitBtn, responseTag) {
		submitBtn.val('SENT');
		$(document).find('.response-tag').remove();
		responseTag.text('Your message has been received. We will be in touch shortly. Thank you!').insertAfter(submitBtn.parent());
		setTimeout(function() {
			submitBtn.val('SEND');
			$(document).find('.response-tag').remove();
		}, 7000);
	},

	/**
	 * Show error message
	 * @param  submitBtn
	 */
	showError : function(submitBtn, responseTag, errors) {
		submitBtn.val('SEND');
		$(document).find('.response-tag').remove();
		responseTag.html('An error has occurred.
' + errors).insertAfter(submitBtn.parent()); } }; var Forms = { init : function() { $('form.ajax input[type="submit"]').on('click touchend', this.validate); $('form.ajax').on('submit', this.submitForm); }, validate : function(e) { e.preventDefault(); var form = $(e.target).closest($('form')); if (form.checkValidity()) { form.submit(); } }, submitForm : function(e) { e.preventDefault(); var form = $(this); var submitBtn = form.find('input[type=submit]'); var responseTag = $("

").addClass("response-tag"); Response.createTag(submitBtn, responseTag); $.ajax({ url : form.attr('action'), type : form.attr('method'), dataType : 'json', data : form.serialize(), }) .done(function(data) { var form = submitBtn.closest('form'); console.log(data.success); if (data.success === true) { Response.showSuccess(submitBtn, responseTag); } else { console.log('else'); Response.showError(submitBtn, responseTag, data.errors); } }) .error(function(data){ console.dir(data); Response.showErro(submitBtn, responseTag, data.errors); }); return false; }, }; $(document).ready(function() { if (typeof webshim !== "undefined") { webshim.setOptions("forms", { lazyCustomMessages: false, replaceValidationUI: true, customDatalist: "auto", list: { "filter": "^" } }); webshim.polyfill('forms'); } Forms.init(); });


var FORM = {

	/**
	 * Create response tag depending
	 * on the form that is being submitted
	 * @param  target - the form being submitted
	 * @param  submitBtn
	 * @param response elem
	 */
	createTag : function(submitBtn, responseTag) {
		submitBtn.val('SENDING...');
		$(document).find('.response-tag').remove();
	},

	/**
	 * Show success message
	 * @param  submitBtn
	 */
	showSuccess : function(submitBtn, responseTag) {
		submitBtn.val('SENT');
		$(document).find('.response-tag').remove();
		responseTag.text('Your message has been received. We will be in touch shortly. Thank you!').insertAfter(submitBtn.parent());
		setTimeout(function() {
			submitBtn.val('SEND');
			$(document).find('.response-tag').remove();
		}, 7000);
	},

	/**
	 * Show error message
	 * @param  submitBtn
	 */
	showError : function(submitBtn, responseTag, errors) {
		submitBtn.val('SEND');
		$(document).find('.response-tag').remove();
		responseTag.html('An error has occurred.
' + errors).insertAfter(submitBtn.parent()); } }; var Forms = { init : function() { $('form.ajax input[type="submit"]').on('click touchend', this.validate); $('form.ajax').on('submit', this.submitForm); }, validate : function(e) { e.preventDefault(); var form = $(e.target).closest($('form')); if (form.checkValidity()) { form.submit(); } }, submitForm : function(e) { e.preventDefault(); var form = $(this); var submitBtn = form.find('input[type=submit]'); var responseTag = $("

").addClass("response-tag"); Response.createTag(submitBtn, responseTag); $.ajax({ url : form.attr('action'), type : form.attr('method'), dataType : 'json', data : form.serialize(), }) .done(function(data) { var form = submitBtn.closest('form'); console.log(data.success); if (data.success === true) { Response.showSuccess(submitBtn, responseTag); } else { console.log('else'); Response.showError(submitBtn, responseTag, data.errors); } }) .error(function(data){ console.dir(data); Response.showErro(submitBtn, responseTag, data.errors); }); return false; }, }; $(document).ready(function() { if (typeof webshim !== "undefined") { webshim.setOptions("forms", { lazyCustomMessages: false, replaceValidationUI: true, customDatalist: "auto", list: { "filter": "^" } }); webshim.polyfill('forms'); } Forms.init(); });