jQuery(document).ready(function(){

jQuery('#contactform').submit(function(){

	var action = jQuery(this).attr('action');

	jQuery('#submit')
		.before('<img src="'+$_SKIN_URL+'quickcontact/images/opc-ajax-loader.gif" class="loader" style="padding-right:10px;"/>')
        
		.attr('disabled','disabled');

    
	jQuery.post(action, { 
		name: jQuery('#name').val(),
		email: jQuery('#email').val(),
		phone: jQuery('#phone').val(),
		subject: jQuery('#subject').val(),
		content: jQuery('#content').val(),
		contact_type_title: jQuery('#contact_type_title').val(),
		page_title: jQuery('#page_title').val(),
		page_link: jQuery('#page_link').val(),
		send_email_to: jQuery('#send_email_to').val(),
		security_code: jQuery('#security_code').val(),
		codemd5: jQuery('#codemd5').val()
	},
		function(data){
			jQuery('#contactform #submit').attr('disabled','');
			jQuery('.response').remove();
			jQuery('#contactform').before('<span class="response">'+data+'</span>');
			jQuery('.response').slideDown();
			
			if ( jQuery('.response').text().indexOf('Thank you') != -1 ) { 
				jQuery('#subject').val('');
				jQuery('#content').val('');
			}
			jQuery('#contactform img.loader').fadeOut(500,function(){jQuery(this).remove()});
		}
	);

	return false;

});
});