
$(document).ready(function(){	
  
			
	$("#contact-link, #contact-link-img").click(function() {
	
		$(".header, #container, .container-bottom").fadeOut();
		
		$("#contact-block").fadeIn();
				
		$("#contact-block").animate({
			
				"top":"75px"},"slow");
		
		
				
/*		$("#container, .header, .container-bottom").animate({"opacity":"0.50"},"slow");  */
	});
	   
	$("#contact-hide, .contact-hide").click(function() {
	
			 
		 $("#contact-block").animate({
				
				"top":"-=75px",
				"marginBottom" : "100px"},"slow");
				
		$("#contact-block").fadeOut();
				
		$(".header, #container, .container-bottom").fadeIn();
		
		/*$("#container, .header, .container-bottom").animate({"opacity":"1.00"},"slow");*/
	});
	
	$("#submit-request-info").click(function() {
		
		$("#loading-box").show(500);
		
		$("#contact-block").fadeOut();
		
		
		$.ajax({
			type: 'POST',
			url: 'post.php',
			dataType : 'json',
			data : {
				firstname : $('#first-name').val(),
				lastname : $('#last-name').val(),
				phone : $('#phone').val(),
				email : $('#email').val(),
				address : $('#address').val(),
				city : $('#city').val(),
				state : $('#state').val(),
				zip : $('#zip').val(),
				country : $('#country').val(),
				email : $('#email').val(),
				fax : $('#fax').val(),
				phone : $('#phone').val(),
				bought_from_us : $('#bought-from-us').val(),
				how_found_website : $('#how-found-website').val(),
				message : $('#message').val()
			},
			success : function(data){
				
				$('#message').text('');
				
				$("#loading-box").fadeOut();
				
				$("#contact-block").fadeIn();
				
				$('#message').removeClass().addClass((data.error === true) ? 'error' : 'success');
				//.text(data.msg).fadeIn();
				
				$('#message').fadeIn();
				
				$.each(data, function(k,v) {
 						   
						   if(k == 'msg'){
						   $('#message').append(v);
						   }
				});
				
				/*if (data.error === true)*/
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				$("#loading-box").fadeOut();
				
				$("#contact-block").fadeIn;
				
				$('#message').removeClass().addClass('error')
				.text('There was an error.').fadeIn();
				
				
				
				
			}		
		});
		return false;
	});

	

});	

