function popUp(a, b, c, d)
{
    var name = 'POPUP';
    var page = a;
    var lenX = b;
    var lenY = c;
    var scrl = d != '' && d != null ? d : 1;
    var posX = parseInt((screen.width / 2) - (lenX / 2));
    var posY = parseInt((screen.height / 2) - (lenY / 2));
    var attr = 'width=' + lenX + ',height=' + lenY + ',left=' + posX + ',top=' + posY + ',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no';
    //var attr = 'width=' + lenX + ',height=' + lenY + ',left=' + posX + ',top=' + posY + ',scrollbars=' + scrl;
	
    window.open(page, name, attr);

    void(0);
}


function showFlash(a, b, c)
{
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="' + b + '" height="' + c + '">');

    document.write('<param name=movie value="' + a + '">');

    document.write('<param name=quality value=high>');

    document.write('<param name=scale value=noscale>');

    document.write('<param name="wmode" value="transparent">');

    document.write('<embed src="' + a + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + b + '" height="' + c + '" wmode="transparent">');

    document.write('</embed>');

    document.write('</object>');

}


function checkSend()

{

    var fields = ['nome', 'email2', 'telefone_1', 'telefone_2', 'cidade', 'mensagem'];

    var alerts = ['Campo NOME n�o preenchido\n', 'Campo E-mail n�o preenchido\n', 'Campo DDD (Telefone) n�o preenchido\n', 'Campo Telefone n�o preenchido\n', 'Campo Cidade n�o preenchido\n', 'Campo Mensagem n�o preenchido\n'];

    var errors = '';

    var mykeys;

    for(i = 0; i < fields.length; i++)

    {

            mykeys = document.getElementById(fields[i]).value;

            errors = (mykeys == '' || mykeys == null) ? errors + alerts[i] : errors;

        }

    if(errors != '' && errors != null)

    {

        errors = 'Foram encontrados os seguintes erros:\n\n' + errors;

        alert(errors);

        return false;

    }

    else

    {

        var cidades = ['It�polis', 'Jundia�'];

        var selcity = document.getElementById('local').options[document.getElementById('local').options.selectedIndex].value;

        alert('Voc� optou por enviar o e-mail para ' + cidades[selcity]);

        return true;

    }

}







function testNewsletter()

{

    var nome = document.getElementById('usrName').value;

    var mail = document.getElementById('usrEmail').value;

    var teste = new Array(false, false);

    if(nome == 'seu nome' || nome == '' || nome == null)

    {

        alert('Preencha corretamente o campo "Nome"');

    }

    else

    {

        teste[0] = true;

    }

    if(mail == 'seu e-mail' || mail == '' || mail == null)

    {

        alert('Preencha corretamente o campo "E-mail"');

    }

    else

    {

        teste[1] = true;

    }

    if(teste[0] != false && teste[1] != false)

    {

        return true;

    }

    else

    {

        return false;

    }

}





function checkRecheque()

{

    var resultado = false;

    var mensagem = '';

    var campo;

    var campos = [

    ['agenda-nome-1', 'Nome'],

    ['email', 'E-mail'],

    ['cod-anac-1', 'C�digo ANAC'],

    ['agenda-telefone-1-2', 'DDD'],

    ['agenda-telefone-2-2', 'Telefone']

    ];



    for(i = 0; i < campos.length; i++)

    {

            campo = document.getElementById(campos[i][0]).value;

            if(campo == '' || campo == null)

            {

                mensagem += 'Campo ' + campos[i][1] + ' n�o preenchido\n';

            }

        }

    if(mensagem != '')

    {

        mensagem = 'Os seguintes erros foram encontrados:\n\n' + mensagem;

        alert(mensagem);

    }

    else

    {

        resultado = true;

    }

    return resultado;

}



function checkRecheque2()

{

    var resultado = false;

    var mensagem = '';

    var campo;

    var campos = [

    ['agenda-nome', 'Nome'],

    ['agenda-email', 'E-mail'],

    ['cod-anac', 'C�digo ANAC'],

    ['agenda-telefone-1', 'DDD'],

    ['agenda-telefone-2', 'Telefone']

    ];



    for(i = 0; i < campos.length; i++)

    {

            campo = document.getElementById(campos[i][0]).value;

            if(campo == '' || campo == null)

            {

                mensagem += 'Campo ' + campos[i][1] + ' n�o preenchido\n';

            }

        }

    if(mensagem != '')

    {

        mensagem = 'Os seguintes erros foram encontrados:\n\n' + mensagem;

        alert(mensagem);

    }

    else

    {

        resultado = true;

    }

    return resultado;

}

function swapFaq(id)
{
    //var node = document.getElementById('#faq_' + id);
    //node.style.display = node.style.display != 'block' ? 'block' : 'none';
    if($('#faq_' + id).css('display') == 'block'){
        $('#faq_' + id).css('display', 'none');
        $('#colum').height( ($('#colum').height() - $('#faq_' + id).height()) )
        $('#interna').height( ($('#interna').height() - $('#faq_' + id).height()) )
    }
    else{
        $('#faq_' + id).css('display', 'block');
        $('#colum').height( ($('#colum').height() + $('#faq_' + id).height()) )
        $('#interna').height( ($('#interna').height() + $('#faq_' + id).height()) )
    }
}
