<!--

src = ["http://www.nucleon.com.br/_img/representadas/1.gif", "http://www.nucleon.com.br/_img/representadas/4.jpg", "http://www.nucleon.com.br/_img/representadas/5.gif", "http://www.nucleon.com.br/_img/representadas/15.jpg", "http://www.nucleon.com.br/_img/representadas/3.gif", "http://www.nucleon.com.br/_img/representadas/2.gif", "http://www.nucleon.com.br/_img/representadas/7.gif"]
ads=[]; ct=0;
function switchAd()
{
    var n=(ct+1)%src.length;
    if (ads[n] && (ads[n].complete || ads[n].complete==null))
        document['Ad_Image'].src = ads[ct=n].src;

    ads[n=(ct+1)%src.length] = new Image;
    ads[n].src = src[n];
    setTimeout("switchAd()", 2000);
}

onload = function()
{
    if (document.images)
        switchAd();

    imagem_lista = Array('http://www.nucleon.com.br/_img/layout/empresa-on.gif', 'http://www.nucleon.com.br/_img/layout/servicos-on.gif', 'http://www.nucleon.com.br/_img/layout/promocoes-on.gif', 'http://www.nucleon.com.br/_img/layout/contato-on.gif', 'http://www.nucleon.com.br/_img/layout/menu-on.gif', "http://www.nucleon.com.br/_img/representadas/1.gif", "http://www.nucleon.com.br/_img/representadas/4.jpg", "http://www.nucleon.com.br/_img/representadas/5.gif", "http://www.nucleon.com.br/_img/representadas/15.jpg", "http://www.nucleon.com.br/_img/representadas/3.gif", "http://www.nucleon.com.br/_img/representadas/2.gif", "http://www.nucleon.com.br/_img/representadas/7.gif", 'http://www.nucleon.com.br/_img/mapa/mapa.gif');
    imagem_qtd = imagem_lista.length;
    for (i = 0; i < imagem_qtd; i++) {
        var preload = new Image();
        preload.src = imagem_lista[i];
    }

}

function chgclass(id, classe)
{
    obj           = document.getElementById(id);
    obj.className = classe;
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input, len, e)
{
    var keyCode = (isNN) ? e.which : e.keyCode;
    var filter  = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if ((input.value.length >= len) && !containsElement(filter, keyCode)) {
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input)+1) % input.form.length].focus();
    }

    function containsElement(arr, ele)
    {
        var found = false, index = 0;
        while (!found && index < arr.length)
            if (arr[index] == ele)
                found = true;
            else
                index++;
        return found;
    }

    function getIndex(input)
    {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
        if (input.form[i] == input)
            index = i;
        else
            i++;
    return index;
    }
    return true;
}

function apenas_numeros(variavel)
{
    var varcode = variavel.keyCode;
    if (varcode == 0)
        varcode = variavel.charCode;
    
    if (((varcode < 45) || (varcode > 57)) && (varcode > 0) && (varcode != 116) && (varcode != 8) && (varcode != 46))
        return false;

    letra = String.fromCharCode(varcode);
    
    if (letra == '-' || letra == '.')
        return false;
}

function chkcep()
{

    makePOSTRequest('../ajax/contato-endereco/', 'ceppre='+escape(document.contato.ceppre.value)+'&cepsuf='+escape(document.contato.cepsuf.value)+'&buscar=1', 'contato_endereco_ajax', 1);
    document.contato.complemento.focus();

}

function chkmail()
{

    makePOSTRequest('../ajax/contato-email/', 'email='+escape(document.contato.email.value)+'&validar=1', 'contato_email_ajax', 1);

}

function formatatel(tipo)
{
    
    if (tipo == 'tel') {
        var campu = document.contato.tel.value.replace("-", "");

        if (campu.length == 2)
            document.contato.tel.value = campu.charAt(0)+'-'+campu.charAt(1);
        else if (campu.length == 3)
            document.contato.tel.value = campu.charAt(0)+'-'+campu.charAt(1)+campu.charAt(2);
        else if (campu.length == 4)
            document.contato.tel.value = campu.charAt(0)+campu.charAt(1)+'-'+campu.charAt(2)+campu.charAt(3);
        else if (campu.length == 5)
            document.contato.tel.value = campu.charAt(0)+campu.charAt(1)+'-'+campu.charAt(2)+campu.charAt(3)+campu.charAt(4);
        else if (campu.length == 6)
            document.contato.tel.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+'-'+campu.charAt(3)+campu.charAt(4)+campu.charAt(5);
        else if (campu.length == 7)
            document.contato.tel.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+'-'+campu.charAt(3)+campu.charAt(4)+campu.charAt(5)+campu.charAt(6);
        else if (campu.length == 8)
            document.contato.tel.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+campu.charAt(3)+'-'+campu.charAt(4)+campu.charAt(5)+campu.charAt(6)+campu.charAt(7);
    } else if (tipo == 'fax') {
        var campu = document.contato.fax.value.replace("-", "");

        if (campu.length == 2)
            document.contato.fax.value = campu.charAt(0)+'-'+campu.charAt(1);
        else if (campu.length == 3)
            document.contato.fax.value = campu.charAt(0)+'-'+campu.charAt(1)+campu.charAt(2);
        else if (campu.length == 4)
            document.contato.fax.value = campu.charAt(0)+campu.charAt(1)+'-'+campu.charAt(2)+campu.charAt(3);
        else if (campu.length == 5)
            document.contato.fax.value = campu.charAt(0)+campu.charAt(1)+'-'+campu.charAt(2)+campu.charAt(3)+campu.charAt(4);
        else if (campu.length == 6)
            document.contato.fax.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+'-'+campu.charAt(3)+campu.charAt(4)+campu.charAt(5);
        else if (campu.length == 7)
            document.contato.fax.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+'-'+campu.charAt(3)+campu.charAt(4)+campu.charAt(5)+campu.charAt(6);
        else if (campu.length == 8)
            document.contato.fax.value = campu.charAt(0)+campu.charAt(1)+campu.charAt(2)+campu.charAt(3)+'-'+campu.charAt(4)+campu.charAt(5)+campu.charAt(6)+campu.charAt(7);
    }
}

function contato_submit() {

    var parametros = '';
    parametros += 'nome='+escape(document.contato.nome.value);
    parametros += '&email='+escape(document.contato.email.value);
    parametros += '&empresa='+escape(document.contato.empresa.value);
    parametros += '&departamento='+escape(document.contato.departamento.value);
    parametros += '&ceppre='+escape(document.contato.ceppre.value);
    parametros += '&cepsuf='+escape(document.contato.cepsuf.value);
    parametros += '&cidade='+escape(document.contato.cidade.value);
    parametros += '&estado='+escape(document.contato.estado.value);
    parametros += '&bairro='+escape(document.contato.bairro.value);
    parametros += '&endereco='+escape(document.contato.endereco.value);
    parametros += '&complemento='+escape(document.contato.complemento.value);
    parametros += '&telddd='+escape(document.contato.telddd.value);
    parametros += '&tel='+escape(document.contato.tel.value);
    parametros += '&faxddd='+escape(document.contato.faxddd.value);
    parametros += '&fax='+escape(document.contato.fax.value);
    parametros += '&comentarios='+escape(document.contato.comentarios.value);
    parametros += '&fonte='+escape(document.contato.fonte.value);

    scroll(0, 170);
    makePOSTRequest('../ajax/contato-enviar/', parametros, 'contato_form', 1);

}

function mapa() {

    window.open('http://www.nucleon.com.br/mapa/', '_blank', 'left=150, top=80, directories=no, height=460, location=no, menubar=no, resizable=no, status=no, toolbar=no, width=420');

}

function promocoes() {

    window.open('http://www.nucleon.com.br/promocoes/', '_blank', 'left=150, top=80, directories=no, height=180, location=no, menubar=no, resizable=no, status=no, toolbar=no, width=420');

}
//-->
