$(document).ready(function () {
    $("#ctl00_txtBusca").Watermark("O que voc\u00EA est\u00E1 procurando?");

    $("a[href^=http://]").click(function () {
        $(this).attr("target", "_blank");
    });

    $("#btCont").click(function () {
        $("#contato").slideToggle();
        $("#ctl00_LabelContatoAviso").hide();
        return false;
    });

    $("ul#navGlobal li").each(function () {
        if (!$(this).hasClass("active")) {
            $(this).hover(
              function () {
                  $(this).children("a").stop().animate({
                      top: "0"
                  }, "fast");
              },
              function () {
                  $(this).children("a").stop().animate({
                      top: "-76px"

                  }, "fast");
              }
           );
        }
    });


});


Cufon.replace("h1, h2");
function mascara(o, f) {
    v_obj = o
    v_fun = f
    setTimeout("execmascara()", 1)
}

function execmascara() {
    v_obj.value = v_fun(v_obj.value)
}

function Mfone(v) {
    v = v.replace(/\D/g, "")
    v = v.replace(/^(\d\d)(\d)/g, "($1) $2")
    v = v.replace(/(\d{4})(\d)/, "$1-$2")
    return v
}

var scrollSpeed = 85; 		// Speed in milliseconds
var step = 1; 				// How many pixels to move per step
var current = 0; 		// The current pixel row
var imageHeight = 3200; 	// Background image height
var headerHeight = 970; 	// How tall the header is.

//The pixel row where to start a new loop
var restartPosition = -(imageHeight - headerHeight);

function scrollBg() {

    //Go to next pixel row.
    current -= step;

    //If at the end of the image, then go to the top.
    if (current == restartPosition) {
        current = 0;
    }

    //Set the CSS of the header.
    $('#header').css("background-position", "" + current + "px 0");


}

//Calls the scrolling function repeatedly
var init = setInterval("scrollBg()", scrollSpeed);