// JavaScript Document

// preloader
function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else{
if (document.layers){ //NS4
document.prepage.visibility = 'hidden';
}
else { //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
// animacao menu
$(function() {
               
	$("ul#menu span").css("opacity","0");			// Definir a opacidade no carregamento da página
    	$("ul#menu span").hover(function () {		// on mouse over
        	$(this).stop().animate({				// animar a opacidade a plena
            	opacity: 1
                        }, 'slow');
                },
                
		function () {								// on mouse out
        	$(this).stop().animate({ 				// animar a opacidade
				opacity: 0
                        }, 'slow');
                });
        });


// funçaõ banner rotativo

$(function() {
$('#produto_banner').cycle({ 
    fx:     'fade', 
    speed:   300, 
    timeout: 3000, 
    next:   '#produto_banner', 
    pause:   1 
});
});


// menu sanfona
$(document).ready(function(){
  $("dd").hide();
  $("dd:#aberto").show();
  $("dt a").click(function(){
   $("dd:visible").slideUp("slow");
   $(this).parent().next().slideDown("slow");
   return false;
  });
 });

// overabel
jQuery.fn.overlabel = function() {
    this.each(function(index) {
        var label = $(this); var field;
        var id = this.htmlFor || label.attr('for');
        if (id && (field = document.getElementById(id))) {
            var control = $(field);
            label.addClass("overlabel-apply");
            if (field.value !== '') {
                label.css("text-indent", "-1000px");
            }
            control.focus(function () {label.css("text-indent", "-1000px");}).blur(function () {
                if (this.value === '') {
                    label.css("text-indent", "0px");
                }
            });
            label.click(function() {
                var label = $(this); var field;
                var id = this.htmlFor || label.attr('for');
                if (id && (field = document.getElementById(id))) {
                    field.focus();
                }
            });
        }
    });
}
$(document).ready(function() {
    $("label.overlabel").overlabel();
    $("#test").click(function() {
//        $("#username-field").attr("value", "Fred").focus().blur();
        $("#username-field").val("Fred").focus().blur();
    });
});


// menu escolha modelo
$(document).ready(function() {
	$("a#bt_incluir").click(function() {
		$("div#fundo_preto").fadeIn("fast");
		$("div#dv-incluir").fadeIn("fast");
	});
	
	$("a#bt_fechar").click(function() {
		$("div#fundo_preto").fadeOut("fast");
		$("div#dv-incluir").fadeOut("fast");
	});
	
		$("a#fechar_fundo").click(function() {
		$("div#fundo_preto").fadeOut("fast");
		$("div#dv-incluir").fadeOut("fast");
	});
});


