// feedback.js : functions for providing feedback

$(document).ready(function(){
			// add slider
	
	// check if we have a #success in the 
	$("#how_much_slider").slider({
		min: 0,
		max: 70,
		values: [5],
		slide: function(event, ui) {
			$("#how_much_slider_value").html('<span style="font-size: 18px">$ ' + ui.values[0] + "</span>");
			
			$("#how_much").val(ui.values[0]);
			
			//$("#how_much_higher").val(ui.values[1]);
		}
	});
	
	$("#use_for_other_field").click(function(){
		// select check box
		$("#use_for_other").attr("checked", "true");
	});
	
	$("#what_business").change(function(){
		// see if other has been checked, if so, show the form item
		//alert();
		if( $(this).val() == 'other'){
			// show other field
			$(".what_business_other").show("fast");
		} else {
			$(".what_business_other").hide("fast");
		}
	});
	
	$("#submit").click(function(){
		// hide the form
		$("#feedback_form").hide();
		$("#introduction").hide();
		
		// gather all the form data
		
		$("#feedback_form").ajaxForm({ 
		
			beforeSubmit: function(){
				// clear the _redir form element
				$("#_redir").attr("value", "false");
			},
			success: function(response, status){
				//alert("we made it!");
				//alert(response);
				$('#thankyou_message').show('slow');
				
			}});
		// and submit to the server
		
		// process the response
	});
	
	
});