function centraliza(largura, altura) {
    window.moveTo((window.screen.width - largura) / 2, (window.screen.height - altura) / 2);
}

function abreJanela(arquivo, nome, barra, largura, altura) {
    window.open(arquivo, nome, "resizable=no,toolbar=no,status=no,menubar=no,scrollbars=" + barra + ",width=" + largura + ",height=" + altura);
}

function redimenciona() {
    var i = 0;
    function resize() {
        if (navigator.appName == 'Netscape') i = 40;
        if (document.images[0]) window.resizeTo(document.images[0].width + 50, document.images[0].height + 80 - i);
        if (window.moveTo((window.screen.width - document.images[0].width) / 2, (window.screen.height - document.images[0].height) / 2));
    }
}

function montaSWF(arquivo, largura, altura, action) {

    var now = new Date();
    var dia = now.getDay();
    var mes = now.getMonth();
    var ano = now.getFullYear();
    var hora = now.getHours();
    var mintuto = now.getMinutes();
    var segundo = now.getSeconds();
    var data = ano + "" + mes + "" + dia + "" + hora;

    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + largura + '" height="' + altura + '">');
    document.write('<param name="movie" value="swf/' + arquivo + '.swf?ieSux=' + data + '" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="menu" value="false" />');
    document.write('<param name="wmode" value="transparent" />');
    document.write('<param name="FlashVars" value="' + action + '&clearCache=' + data + '" />');
    document.write('<embed FlashVars="' + action + '&clearCache=' + data + '" wmode="transparent" menu="false" src="swf/' + arquivo + '.swf?ieSux=' + data + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '"></embed>');
    document.write('</object>');
}

function menudrop(n) {
    var div = document.getElementById("menudrop" + n);
    if (div.style.display == "none")
        div.style.display = '';
    else
        div.style.display = 'none';
}

function mascara(o, f) {
    v_obj = o;
    v_fun = f;
    setTimeout("execmascara()", 1);
}
function execmascara() {
    v_obj.value = v_fun(v_obj.value);
}
function alphanum(v) {
    v = v.replace(/[^a-zA-Z0-9-]/g, "");                    //Remove tudo o que não é dígito
    return v;
}


var offX = -700;          // X offset from mouse position
var offY = -200;          // Y offset from mouse position
var offX2 = 10;          // X offset from mouse position
var offY2 = 10;          // Y offset from mouse position

function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}

function follow(evt,divName) 
{
	if (document.getElementById) {
		var obj = document.getElementById(divName).style;
		obj.display = '';
		obj.left = (parseInt(mouseX(evt))+offX) + 'px';
		obj.top = (parseInt(mouseY(evt))+offY) + 'px';
	}
}
function follow2(evt,divName) 
{
	if (document.getElementById) {
		var obj = document.getElementById(divName).style;
		obj.display = '';
		obj.left = (parseInt(mouseX(evt))+offX2) + 'px';
		obj.top = (parseInt(mouseY(evt))+offY2) + 'px';
	}
}
function Hd(divName)
{
    document.getElementById(divName).style.display = 'none';
}
function ShowDiv(divName)
{
    document.getElementById(divName).style.display = 'block';
}

function DivAbreFecha(divName) {

    if (document.getElementById(divName).style.display == 'block') {
        document.getElementById(divName).style.display = 'none';
        document.images["imgNavegue"].src = "/img/global/tilt/naveguepelascategorias - baixo.jpg";
        
    }
    else {
        document.getElementById(divName).style.display = 'block';
        document.images["imgNavegue"].src = "/img/global/tilt/naveguepelascategorias - cima.jpg";
    }


}


function AbasProdutosDetalhes(divName1,divName2) {

    document.getElementById(divName1).style.display = 'block';
    document.getElementById(divName2).style.display = 'none';

}
