jQuery(document).ready(function(){
	
	$('.surveyform').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#sendsurvey')
			.after('<img src="/images/ajax.gif" width="31" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			smokefree_name: $('#smokefree_name').val(),
			smokefree_email: $('#smokefree_email').val(),
			smokefree_county: $('#smokefree_county').val(),
			smokefree_businessname: $('#smokefree_businessname').val(),
			smokefree_town: $('#smokefree_town').val(),
			smokefree_business: $('#smokefree_business').val(),
			smokefree_policies: $('#smokefree_policies').val(),
			smokefree_learnmore: $('#smokefree_learnmore').val()
			
		
		},
			function(data){
				$('#contactformy #sendsurvey').attr('disabled','');
				$('.response').remove();
				$('#contactformy').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				$('#contactformy img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='<h2>Your message was successfully sent!<h2>') $('#contactformy').slideUp();
			}
		);
		
		return false;
	
	});
	
	$('.contactform').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#sendcontact')
			.after('<img src="/images/ajax.gif" width="31" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			smokefree_name:    $('#smokefree_name').val(),
			smokefree_email:   $('#smokefree_email').val(),
			smokefree_message: $('#smokefree_messsage').val()
		
		},
			function(data){
				$('#contactformy #sendcontact').attr('disabled','');
				$('.response').remove();
				$('#contactformy').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				$('#contactformy img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='<h2>Your message was successfully sent!<h2>') $('#contactformy').slideUp();
			}
		);
		
		return false;
	
	});
	
	
	
	
	
		
//START THE PER PLEDGE SENDER
	
	$('.perpledgeform').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#sendperpledge')
			.after('<img src="/images/ajax.gif" width="31" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			smokefree_name:         $('#smokefree_name').val(),
			smokefree_address:      $('#smokefree_address').val(),
			smokefree_email:        $('#smokefree_email').val(),
			smokefree_cell:         $('#smokefree_cell').val(),
			smokefree_phone:        $('#smokefree_phone').val(),
			smokefree_text:         $('#smokefree_text').val(),
			smokefree_web:          $('#smokefree_web').val(),
			smokefree_comm:         $('#smokefree_comm').val(),
			smokefree_letters:      $('#smokefree_letters').val(),
			smokefree_petition:     $('#smokefree_petition').val(),
			smokefree_meet:         $('#smokefree_meet').val(),
			smokefree_speak:        $('#smokefree_speak').val(),
			smokefree_other:        $('#smokefree_other').val()
			
			
		
		},
			function(data){
				$('#contactformy #sendperpledge').attr('disabled','');
				$('.response').remove();
				$('#contactformy').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				$('#contactformy img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='<h2>Your message was successfully sent!<h2>') $('#contactformy').slideUp();
				
			}
		);
		
		return false;
	
	}); ///END PER PLEDGE SENDER
	
	
	
	
	
	
	
	
	
	
	//START ADD RESTAURANT FORM
	
	$('.addrestaurant').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#addrestaurant')
			.after('<img src="/images/ajax.gif" width="31" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			restaurant_name:      $('#restaurant_name').val(),
			restaurant_email:     $('#restaurant_email').val(),
			restaurant_phone:     $('#restaurant_phone').val(),
			restaurant_manager:   $('#restaurant_manager').val(),
			restaurant_address:   $('#restaurant_address').val(),
			restaurant_city:      $('#restaurant_city').val(),
			restaurant_zip:       $('#restaurant_zip').val(),
			restaurant_contact:   $('#restaurant_contact').val(),
			
		
		},
			function(data){
				$('#contactformy #addrestaurant').attr('disabled','');
				$('.response').remove();
				$('#contactformy').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				$('#contactformy img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='<h2>Your message was successfully sent!<h2>') $('#contactformy').slideUp();
				
			}
		);
		
		return false;
	
	}); ///END THE ADD RESTAURANT FORM
	
	
	
	
	
	
	

	
	
	
	
	
	
	//START THE PLEDGE SENDER
	
	$('.orgpledgeform').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#sendorgpledge')
			.after('<img src="/images/ajax.gif" width="31" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			smokefree_name:         $('#smokefree_name').val(),
			smokefree_organization: $('#smokefree_organization').val(),
			smokefree_title:        $('#smokefree_title').val(),
			smokefree_contact:      $('#smokefree_contact').val(),
			smokefree_address:      $('#smokefree_address').val(),
			smokefree_email:        $('#smokefree_email').val(),
			smokefree_cell:         $('#smokefree_cell').val(),
			smokefree_phone:        $('#smokefree_phone').val(),
			smokefree_text:         $('#smokefree_text').val(),
			smokefree_web:          $('#smokefree_web').val(),
			smokefree_pubs:         $('#smokefree_pubs').val(),
			smokefree_distribute:   $('#smokefree_distribute').val(),
			smokefree_spokes:       $('#smokefree_spokes').val(),
			smokefree_desrep:       $('#smokefree_desrep').val(),
			smokefree_sendrep:      $('#smokefree_sendrep').val(),
			smokefree_educate:      $('#smokefree_educate').val()
			
			
		
		},
			function(data){
				$('#contactformy #sendorgpledge').attr('disabled','');
				$('.response').remove();
				$('#contactformy').before('<span class="response">'+data+'</span>');
				$('.response').slideDown();
				$('#contactformy img.loader').fadeOut(500,function(){$(this).remove()});
				if(data=='<h2>Your message was successfully sent!<h2>') $('#contactformy').slideUp();
				
			}
		);
		
		return false;
	
	}); ///END PLEDGE SENDER

	
});
