//Javascript for businessplan.html
$(document).ready(function() { 
    var options = { 
        target:        '#form_response',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
 
        // other available options: 
        //url:       url         // override for form's 'action' attribute 
        //type:      type        // 'get' or 'post', override for form's 'method' attribute 
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type) 
        //clearForm: true        // clear all form fields after successful submit 
        resetForm: true        // reset the form after successful submit 
 
        // $.ajax options can be used here too, for example: 
        //timeout:   3000 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#bp_form').ajaxForm(options);
	
	//Setup AJAX link to slide down form
	$('#bp_form_show').click(function() { $('#bp_form_content').slideDown("slow"); });
	
	//Unobsfucate
	$('.obfuscated').defuscate();
	
	//Setup Form Protection
	$("#form_warning").hide();
	
}); 
 
// pre-submit callback 
function showRequest(formData, jqForm, options) { 
   
   //do a check on data
   
   //if fail then return false
   
   //if sucessfull show loading
   $('#upload_loading').show();
   $('#form_submit_button').hide();
   
   
   //return true
   return true;
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
    // for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxForm method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 
	
	$('#upload_loading').hide();
	$('#form_submit_button').show();
	
	$('html, body').animate({scrollTop:0}, 'slow');
	$('#bp_form_content').hide();
	$('#bp_step0').hide();
	$('#bp_submit_blurb').hide();
	$('#bp_success').fadeIn('slow');
	
	return true;
} 


//Thickbox
jQuery(function($){
$("#form_email_input").Watermark("Enter Email Address");
});
