$(function(){
	$('form.form').validate({
		errorPlacement: function(error, element){ 
			error.hide(); 
			element.css('border','1px solid #C00'); 
		},
		submitHandler: function(form){
			('<input type="hidden" name="action" value="submit" />');
			$.post('./contact.php?action=submit', $(form).serialize(), function(err){
				if(err!=''){
					alert(err);
				}else{
					$(form).replaceWith('<strong>Thank you for contacting us. We will be in touch shortly.</strong>');
				}
			});
		}
	});
	$('form.inquiry-form').validate({
		errorPlacement: function(error, element){ 
			error.hide(); 
			element.css('border','1px solid #C00'); 
		},
		submitHandler: function(form){
			$(form).append('<input type="hidden" name="action" value="go" />');
			$.post($(form).attr('action'), $(form).serialize(), function(response){ $('table.contact').fadeOut('fast', function(){ $(this).replaceWith('<p>'+response+'</p>').fadeIn('fast'); }); });
		}
	});
	
	$('.download').live('click', function(){
		window.location='/download.php?file=' + $(this).attr('href');
		return false;
	});
	$('#footer div.newsletter img.link').live('click', function(){
		$(this).fadeOut('fast', function(){ $(this).closest('div').load('ccform.htm', function(){ $(this).fadeIn('fast'); }); });
	});
});
