jQuery(document).ready(function(){
    $('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
	$('#contactform').submit(function(){				  
		var action = $(this).attr('action');
		$.post(action, { 
			id_blog: $('#id_blog').val(),
			name: $('#name').val(),
			email: $('#email').val(),
			inquiry: $('#inquiry').val(),
			code: $('#code').val()
		},
			function(data){
				$('#contactform #submit').attr('disabled','');
				$('.response').remove();
				$('#contactform').before('<p class="response">'+data+'</p>');
				$('.response').slideDown();
				if(data=='Thank you for your submission!') $('#contactform').slideUp();
			}
		); 
		refreshCaptcha();
		return false;
	});
});
function refreshCaptcha(){
	var now = new Date();
	document.getElementById('code').value='';
	document.getElementById('captcha').src="includes/captcha.php?"+now.getTime();
}
