$(function(){
	$("#refreshimg").click(function(){
		$.post('newsession.php');
		$("#captchaimage").load('image_req.php');
		return false;
	});
	
	$("#contactForm").validate({
		rules: {
			captcha: {
				required: true,
				remote: "process.php"
			}
		},
		messages: {
			captcha: "Correct captcha is required. Click the captcha to generate a new one"	
		},
		submitHandler: function() {
			var options = { 
	        target:        '#responseHere',   // target element(s) to be updated with server response 
//	        beforeSubmit:  showRequest,  // pre-submit callback 
//	        success:       showResponse,  // post-submit callback 
	        url:       "contact-post.php"         // override for form's 'action' attribute 
		    }; 			
			$("#contactForm").ajaxSubmit(options); 
		},
		onkeyup: false
		});
	});

function myFunction(reponseText, responseXML){
	$('responseHere').set('html', reponseText);
	$('responseHere').tween('background-color', '#ffffff', '#FFEF95');
}

function showRequest(formData, jqForm, options) { 
    var queryString = $.param(formData); 
    alert('About to submit: \n\n' + queryString); 
    return true; 
} 
 
function showResponse(responseText, statusText)  { 
    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
} 
