$().ready(function() {

	captcha_dir= "/captcha/";
	
	var loader = jQuery('<div id="loader"><img src="js/loading.gif" alt="loading..." /></div>')
		.css({top: "1px", left: "1px"})
		.hide()
		.appendTo("#comform"); //.appendTo("#dataform");
	jQuery().ajaxStart(function() {
		loader.show();
		$("#resultadoc").hide();
	}).ajaxStop(function() {
		loader.hide();
		$("#resultadoc").show();
	});
	
	$("#refreshimg").livequery('click', function(){
		$.post(captcha_dir + 'newsession.php');
		$("#captchaimage").load(captcha_dir + 'image_req.php');
		return false;
	});
	
	$("#comform").validate({
		rules: {
			nome: "required",
			mensagem: "required",
			captcha: {
				required: true,
				remote: captcha_dir + "process.php"
			}
		},
		messages: {
			nome: "Por favor preencha o seu nome",
			mensagem: "Por favor escreva a sua pergunta",
			captcha: "Por favor confira o teste"
		},
		submitHandler: function(form){
			var options = {target: '.comentB', clearForm:true};
			$(form).ajaxSubmit(options);
			return false;
		}
		
	});

	
	/*$(".notLogin2").livequery('click',function(){
		$("#layerLogin").modal({onShow: modalShow, onClose: modalClose});
		$("#formLogin_url2").val($("#url").val());
		$("#formLogin_texto2").val($("#mensagem").val());
    	return false;
	});	*/
	

});