/* When adding a case all text [inside brackets] are hidden for the user until
 * he/she clicks on view solution. This function replaces the brackets from db with
 * the correct div to conceal it.
 *A function to replace all [ in the text
 */
$(document).ready(function(){

	//Options for ajaxForm
    var options = {
    		target:		'#contact-form',
			beforeSubmit: showLoading,
			success:	contactAdd
	}

	function showLoading(formData, jqForm, options) {
		$('#loading-div').show();	
		return true;
	}

    function contactAdd(html) {
    	$('#contact-form').html(html);
    	$('#contact-form form').ajaxForm(options);
		$('#loading-div').hide();
    }
    
	$('#contact-form form').ajaxForm(options);
});
