$(document).ready(function () {
    InitCufon(); LoadZoom(); Shadowbox.init();
});

function InitCufon () {
	Cufon.replace('h1', { fontFamily: 'Zurich LtCn BT' 	});
	Cufon.replace('h2', { fontFamily: 'Zurich Cn BT' 	});
	Cufon.replace('h3', { fontFamily: 'Zurich LtCn BT' 	});
	Cufon.replace('h4', { fontFamily: 'Zurich Cn BT' 	});
	Cufon.replace('h5', { fontFamily: 'Zurich Cn BT' 	});
	Cufon.replace('h6', { fontFamily: 'Zurich LtCn BT' });

	Cufon.replace('table thead .topo-centro-titulo-itens', { fontFamily: 'Zurich Cn BT' });
	Cufon.replace('.titulo', { fontFamily: 'Zurich Cn BT' });
}

function buscar() {
    var buscaT = CO.el("buscaT").value;
    if (CO.trim(buscaT) == "") {
        CO.mensagem("Atenção! Informe o que você quer buscar.");
        return false;
    } else {
        if (CO.trim(buscaT).length < 3) {
            CO.mensagem("Atenção! Para realizar a busca você deve digitar mais que 2 letras.");
            return false;
        } else {
            CO.el("consultarForm").submit();
        }
    }
}

function OnFocus(o) {
    if (o.value == o.title) {
        o.value = '';
    }
}

function OnBlur(o) {
    if (o.value == "") {
        o.value = o.title
    }
}

function enter(field, evt) {
    var keyCode = document.layers ? evt.which : document.all ? evt.keyCode : evt.keyCode;
    if (keyCode == 13) { field.blur(); return false; }
}

function LoadZoom() {
    if ($(".image-zoom").length > 0) {
        var width = 300;
        var height = 300;

        var node = $("<div></div>");

        node.addClass('jqZoomWindow');
        $("#show #include #image").append(node);

        if (node.css("width") != "auto") {
            //width = parseInt(node.css("width").replace("px", ""));
        }
        if (node.css("height") != "auto") {
            //height = parseInt(node.css("height").replace("px", ""));
        }
        node.remove();

        var optionsZoom = {
            //zoomType: "reverse",
            preloadText: "",
            zoomWidth: width,
            zoomHeight: height
        };
        $(".image-zoom").jqzoom(optionsZoom);
    }
}

function ShadowOpen(titulo, url, w, h) {
    Shadowbox.init();
    Shadowbox.open({ type: 'iframe', title: titulo, content: url, height: h, width: w });
}
