//SWFOBJECT
swfobject.registerObject("swfmascote", "8.0.0","../swf/expressInstall.swf");

//JQUERY
$(document).ready(function(){
	$('.nav .headlink').hover(
		function() { 
			$($(this).attr('href')).show();
			$($(this).attr('href')).hover(
				function(){
					$(this).show();
				},
				function(){
					$(this).hide();
				}
			);
		},
		function() { 
			$($(this).attr('href')).hide();
		}
	);
	
	function responseCad(data){
		$('#btn_cadastrar').removeAttr("disabled");
		if(data.replace(/\s/g,"") == 'true'){
			alert('Cadastro efetuado com sucesso!');
			$("#fcadastro").resetForm();
		}
		else alert('ERRO: ' + data);
	}
	
	$("#fcadastro").validate({
		errorElement: "div",
		submitHandler: function(form) {
			var c  = confirm('Confirma o cadastro?');
			if(c){
				$("#btn_cadastrar").attr("disabled", true); 
				$(form).ajaxSubmit({
					dataType: 'html',
					success: responseCad
				});
				return false
			}
		}
	});
});

