$(document).ready(function(){
						   
	$('#price_match_link').click(function() {							  
		$('#price_match').fadeIn(500);								  
		return false;
	});
	
	
	$('#close').click(function() {	
		$('#price_match').fadeOut(500);
	});
	
	
	$('#submit').click(function() {

		var data = '';
		$('#price_match_form input.text, #price_match_form textarea').each(function() {
			data += $(this).attr('name') + '=' + $(this).val() + '&';
		});
		data = data.substr(0, data.length - 1);		
		$.get("match-post.php", data, function(data) {
			if(data) {
				alert("Thank you, we'll reply to you shortly.");
				$('#price_match').fadeOut(500);
			} else {
				alert("There was a problem sending the form.\nPlease make sure you've filled in all the fields.");
			}
		});
		
		return false;
	});
	
});