$(document).ready(function() {
    // add ENTER callbacks
    addEnterCallback('#contact-panel', '#send-contact-button');
});

// When the user clicks on "Close"
window.onCloseContactSentPopup = function() {
	hidePopup('contact-sent-popup');
};

// When the user clicks on "Send"
window.onClickSendContact = function() {
	$('#contact-panel .error').html('');
	
	blockButton($('#send-contact-button'), 'Please wait..');
	
	// call contact service
	ajaxCall({
		type: 'GET',
		url: g_contactSendUrl,
		cache: false,
		data: {
			name: $('#contactName').val(),
			email: $('#contactEmail').val(),
			subject: $('#contactSubject').val(),
			message: $('#contactMessage').val()
		},
		onSuccess: function(data){
			unblockButton($('#send-contact-button'));
		},
		onError: function (code, error) {
			unblockButton($('#send-contact-button'));
		}
	 });
};
