// JavaScript Document

// Config
var path_raiz = 'http://itecne.com.br/madalena/';
///////////////////////////////

function $(id){
    return document.getElementByID(id);
}
function insertObject(str) {
	document.write(str);
}

function flashTopo() {
    insertObject('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="968" height="175">');
    insertObject('<PARAM NAME=movie VALUE="'+path_raiz+'flash/topo.swf">');
    insertObject('<param name="bgcolor" value="#5B001C" />');
	insertObject('<PARAM name="wmode" value="transparent" />');
    insertObject('<param name="flashvars" value="path_raiz='+path_raiz+'">');
    insertObject('<param name="quality" value="high"><embed src="'+path_raiz+'flash/topo.swf" flashvars="path_raiz='+path_raiz+'" bgcolor="#5B001C" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="968" height="175" wmode="transparent"></embed>');
    insertObject('</object>');
}

function Esconde(){
	document.getElementById('flutuante').style.visibility = "hidden";
	}

function flashAbas() {
    insertObject('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="36" height="587">');
    insertObject('<PARAM NAME=movie VALUE="'+path_raiz+'flash/abas.swf">');
    insertObject('<param name="bgcolor" value="#5B001C" />');
    insertObject('<param name="flashvars" value="path_raiz='+path_raiz+'">');
    insertObject('<param name="quality" value="high"><embed src="'+path_raiz+'flash/abas.swf" flashvars="path_raiz='+path_raiz+'" bgcolor="#5B001C" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="36" height="887"></embed>');
    insertObject('</object>');
}

function flashBanners() {
    insertObject('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="589" height="150">');
    insertObject('<PARAM NAME=movie VALUE="'+path_raiz+'flash/rotativo.swf">');
    insertObject('<param name="wmode" value="transparent" />');
    insertObject('<param name="flashvars" value="urlBanners='+path_raiz+'flash/rotativo/&nrBanners=3&tempoBanner1=24&tempoBanner2=24&tempoBanner3=16&tempoBanner4=16&tempoBanner5=16">');
    insertObject('<param name="quality" value="high"><embed src="'+path_raiz+'flash/rotativo.swf" flashvars="urlBanners='+path_raiz+'flash/rotativo/&nrBanners=3&tempoBanner1=24&tempoBanner2=24&tempoBanner3=16&tempoBanner4=16&tempoBanner5=16" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="589" height="150"></embed>');
    insertObject('</object>');
}

function flashAgenda() {
    insertObject('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="420" height="360">');
    insertObject('<PARAM NAME=movie VALUE="'+path_raiz+'flash/agenda.swf">');
    insertObject('<param name="wmode" value="transparent" />');
    //insertObject('<param name="flashvars" value="urlBanners=http://www.itecne.com.br/cascavel/banner/home/&nrBanners=4&tempoBanner1=20&tempoBanner2=23&tempoBanner3=16&tempoBanner4=19&tempoBanner5=0">');
    insertObject('<param name="quality" value="high"><embed src="'+path_raiz+'flash/agenda.swf" flashvars="urlBanners=http://www.itecne.com.br/cascavel/banner/home/&nrBanners=4&tempoBanner1=2&tempoBanner2=23&tempoBanner3=16&tempoBanner4=19&tempoBanner5=0" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="420" height="360"></embed>');
    insertObject('</object>');
}

/*  FORM INTERESSADO */
function mudaSerie(){
    if(document.formulario.curso1.value=='INTEG1'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="1" selected="selected">Integral I - 2 a 5 anos </option>'+
            '<option value="2">Integral II - 5 a 8 anos </option>'+
            '<option value="3">Integral III - 9 a 11 anos </option>'+
            '<option value="4">Integral IV (tarde) - 9 a 11 anos </option>'+
        '</select>';
    }else
    if(document.formulario.curso1.value=='MATERN'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="1" selected="selected">1º período (completam 2 anos no ano)</option>'+
            '<option value="2">2º período (completam 2 anos no ano)</option>'+
        '</select>';
    }else
    if(document.formulario.curso1.value=='JARDIM'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="3" selected="selected">3º período (completam 3 anos no ano)</option>'+
            '<option value="4">4º período (completam 4 anos no ano)</option>'+
            '<option value="5">5º período (completam 5 anos no ano)</option>'+
        '</select>';
    }else
    if(document.formulario.curso1.value=='ENSFU8'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="5" selected="selected">5ª série</option>'+
            '<option value="6">6ª série</option>'+
            '<option value="7">7ª série</option>'+
            '<option value="8">8ª série</option>'+
        '</select>';
    }else
    if(document.formulario.curso1.value=='ENSFU9'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="1" selected="selected">1º ano</option>'+
            '<option value="2">2º ano</option>'+
            '<option value="3">3º ano</option>'+
            '<option value="4">4º ano</option>'+
            '<option value="5">5º ano</option>'+
            '<option value="6">6º ano</option>'+
            '<option value="7">7º ano</option>'+
            '<option value="8">8º ano</option>'+
            '<option value="9">9º ano</option>'+
        '</select>';
    }else if(document.formulario.curso1.value=='ENSMED'){
        document.getElementById('series').innerHTML =
        '<select name="serie" id="serie">'+
            '<option value="1" selected="selected">1º ano</option>'+
            '<option value="2">2º ano</option>'+
            '<option value="3">3º ano</option>'+
        '</select>';
    }
}
function enviarFormInteressado() { 
    urlDaAplicacao = "http://200.150.81.242:8080/cgi-bin/itecne/alunointeressado";
    mensagem = "";

    if (document.formulario.regional.value == "" || document.formulario.regional.value == "nenhum")  mensagem = mensagem + '<tr><td class="td1">O Campo Regional deve ser informado!</td></tr>';
    if (document.formulario.curso1.value == "nenhum") mensagem = mensagem + '<tr><td class="td1">O campo Curso 1 deve ser informado.</td></tr>';
    if (document.formulario.nome.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Nome deve ser informado.</td></tr>';
    if (document.formulario.nome.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo Nome não pode começar com espaço em branco.</td></tr>';
    if (document.formulario.email.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo E-mail não pode começar com espaço em branco.</td></tr>';
    if (document.formulario.cidade.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo Cidade não pode começar com espaço em branco.</td></tr>';
    if ((document.formulario.email.value == "") || (document.formulario.email.value.indexOf("@") == -1) || (document.formulario.email.value.indexOf(".") == -1)) mensagem = mensagem + '<tr><td class="td1">O E-mail informado não é válido.</td></tr>';
    if (document.formulario.cidade.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Cidade deve ser informado.</td></tr>';
    if (document.formulario.estado.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Estado deve ser informado.</td></tr>';
    if (document.formulario.telefoneResidencial.value == "" && document.formulario.telefoneComercial.value == "" && document.formulario.telefoneCelular.value == "") mensagem = mensagem + '<tr><td class="td1">Informe pelo menos um número de Telefone.</td></tr>';

    ja = window.open('','ja','toolbar=0,location=0,diretories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=370,height=180,screenX=150,screenY=150"');
    ja.document.open();
    ja.document.writeln('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">');
    ja.document.writeln('<html>');
    ja.document.writeln('<head>');
    ja.document.writeln('<title>Aluno interessado</title>');
    ja.document.writeln('<style type="text/css">');
    ja.document.writeln('   body    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .td1    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .td2    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: bold; }');
    ja.document.writeln('   .iRed   { background: #FFFFFF; color: #FAB102; font-family: wingdings; font-size: 100px; font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .iGreen { background: #FFFFFF; color: #FAB102; font-family: wingdings; font-size: 100px; font-style: normal; font-weight: normal; }');
    ja.document.writeln('</style>');
    ja.document.writeln('</head>');
    ja.document.writeln('<body>');

    if (mensagem != ""){
        ja.document.writeln('<table border="0" cellpadding="1" cellspacing="1" width="100%">');
        ja.document.writeln('<tr>');
        ja.document.writeln('<td class="iRed"></td>');
        ja.document.writeln('<td><table border="0" cellpadding="1" cellspacing="1" width="100%">' + mensagem + '</table></td>');
        ja.document.writeln('</tr>');
        ja.document.writeln('</table>');
        ja.document.writeln('<div align="right"><input type="button" name="btn" value="Fechar" onclick="self.close()"></div>');
        ja.document.writeln('</body>');
        ja.document.writeln('</html>');
        ja.document.close();
        ja.focus();
    }else{
        ja.document.writeln('<table border="0" cellpadding="1" cellspacing="1" width="100%">');
        ja.document.writeln('<tr>');
        ja.document.writeln('<td class="iGreen"></td>');
        ja.document.writeln('<td class="td2">Processando ...</td>');
        ja.document.writeln('</tr>');
        ja.document.writeln('</table>');
        ja.document.writeln('<form name="form" method="post" action="' + urlDaAplicacao + '">');
        ja.document.writeln('   <input type="hidden" name="nivel" value="">');
        ja.document.writeln('   <input type="hidden" name="unidade" value="">');
        ja.document.writeln('   <input type="hidden" name="serie" value="">');
        ja.document.writeln('   <input type="hidden" name="regional" value="">');
        ja.document.writeln('   <input type="hidden" name="curso1" value="">');
        ja.document.writeln('   <input type="hidden" name="curso2" value="">');
        ja.document.writeln('   <input type="hidden" name="curso3" value="">');
        ja.document.writeln('   <input type="hidden" name="nome" value="">');
        ja.document.writeln('   <input type="hidden" name="nomeDoResponsavel" value="">');
        ja.document.writeln('   <input type="hidden" name="email" value="">');
        ja.document.writeln('   <input type="hidden" name="cidade" value="">');
        ja.document.writeln('   <input type="hidden" name="estado" value="">');
        ja.document.writeln('   <input type="hidden" name="dddResidencial" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneResidencial" value="">');
        ja.document.writeln('   <input type="hidden" name="dddComercial" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneComercial" value="">');
        ja.document.writeln('   <input type="hidden" name="dddCelular" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneCelular" value="">');
        ja.document.writeln('   <input type="hidden" name="comoSoube" value="">');
        ja.document.writeln('   <input type="hidden" name="urlEmail" value="">');
        ja.document.writeln('   <input type="hidden" name="sexo" value="">');
        ja.document.writeln('</form>');
        ja.document.writeln('</body>');
        ja.document.writeln('</html>');
        ja.document.close();
        ja.focus();

        //DESCOBRIR NIVEL
        if(document.formulario.curso1.value=='INTEG1' || document.formulario.curso1.value=='JARDIM' || document.formulario.curso1.value=='MATERN')
            ja.document.form.nivel.value = '6';
        else
            ja.document.form.nivel.value = '2';

        ja.document.form.unidade.value = document.formulario.unidade.value;
        ja.document.form.regional.value = document.formulario.regional.value;
        ja.document.form.curso1.value = document.formulario.curso1.options[document.formulario.curso1.selectedIndex].value;
        ja.document.form.nome.value 				= document.formulario.nome.value;
        ja.document.form.nomeDoResponsavel.value 		= document.formulario.nomeDoResponsavel.value;
        ja.document.form.email.value 				= document.formulario.email.value;
        ja.document.form.cidade.value 				= document.formulario.cidade.value;
        ja.document.form.estado.value 				= document.formulario.estado.value;
        ja.document.form.dddResidencial.value 		= document.formulario.dddResidencial.value;
        ja.document.form.telefoneResidencial.value 	= document.formulario.telefoneResidencial.value;
        ja.document.form.dddComercial.value 		= document.formulario.dddComercial.value;
        ja.document.form.telefoneComercial.value 	= document.formulario.telefoneComercial.value;
        ja.document.form.dddCelular.value 			= document.formulario.dddCelular.value;
        ja.document.form.telefoneCelular.value 		= document.formulario.telefoneCelular.value;
        ja.document.form.comoSoube.value 			= document.formulario.comoSoube.options[document.formulario.comoSoube.selectedIndex].value;
        ja.document.form.urlEmail.value 			= document.formulario.urlEmail.value;
        ja.document.form.serie.value 				= document.formulario.serie.value;;

        for(i=0;i < document.formulario.sexo.length; i++){
            if(document.formulario.sexo[i].checked)
                ja.document.form.sexo.value = document.formulario.sexo[i].value;
        }

        ja.document.form.submit();
    }
}

function enviarFormInteressado() {
    urlDaAplicacao = "http://200.150.81.242:8080/cgi-bin/itecne/alunointeressado";
    mensagem = "";

    if (document.formulario.regional.value == "" || document.formulario.regional.value == "nenhum")  mensagem = mensagem + '<tr><td class="td1">O Campo Regional deve ser informado!</td></tr>';
    if (document.formulario.curso1.value == "nenhum") mensagem = mensagem + '<tr><td class="td1">O campo Curso 1 deve ser informado.</td></tr>';
    if (document.formulario.nome.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Nome deve ser informado.</td></tr>';
    if (document.formulario.nome.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo Nome não pode começar com espaço em branco.</td></tr>';
    if (document.formulario.email.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo E-mail não pode começar com espaço em branco.</td></tr>';
    if (document.formulario.cidade.value.substring(0,1) == " ") mensagem = mensagem + '<tr><td class="td1">O campo Cidade não pode começar com espaço em branco.</td></tr>';
    if ((document.formulario.email.value == "") || (document.formulario.email.value.indexOf("@") == -1) || (document.formulario.email.value.indexOf(".") == -1)) mensagem = mensagem + '<tr><td class="td1">O E-mail informado não é válido.</td></tr>';
    if (document.formulario.cidade.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Cidade deve ser informado.</td></tr>';
    if (document.formulario.estado.value == "")  mensagem = mensagem + '<tr><td class="td1">O campo Estado deve ser informado.</td></tr>';
    if (document.formulario.telefoneResidencial.value == "" && document.formulario.telefoneComercial.value == "" && document.formulario.telefoneCelular.value == "") mensagem = mensagem + '<tr><td class="td1">Informe pelo menos um número de Telefone.</td></tr>';

    ja = window.open('','ja','toolbar=0,location=0,diretories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=370,height=180,screenX=150,screenY=150"');
    ja.document.open();
    ja.document.writeln('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">');
    ja.document.writeln('<html>');
    ja.document.writeln('<head>');
    ja.document.writeln('<title>Aluno interessado</title>');
    ja.document.writeln('<style type="text/css">');
    ja.document.writeln('   body    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .td1    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .td2    { background: #FFFFFF; color: #666666; font-family: Verdana;   font-size: 10px;  font-style: normal; font-weight: bold; }');
    ja.document.writeln('   .iRed   { background: #FFFFFF; color: #FAB102; font-family: wingdings; font-size: 100px; font-style: normal; font-weight: normal; }');
    ja.document.writeln('   .iGreen { background: #FFFFFF; color: #FAB102; font-family: wingdings; font-size: 100px; font-style: normal; font-weight: normal; }');
    ja.document.writeln('</style>');
    ja.document.writeln('</head>');
    ja.document.writeln('<body>');

    if (mensagem != ""){
        ja.document.writeln('<table border="0" cellpadding="1" cellspacing="1" width="100%">');
        ja.document.writeln('<tr>');
        ja.document.writeln('<td class="iRed"></td>');
        ja.document.writeln('<td><table border="0" cellpadding="1" cellspacing="1" width="100%">' + mensagem + '</table></td>');
        ja.document.writeln('</tr>');
        ja.document.writeln('</table>');
        ja.document.writeln('<div align="right"><input type="button" name="btn" value="Fechar" onclick="self.close()"></div>');
        ja.document.writeln('</body>');
        ja.document.writeln('</html>');
        ja.document.close();
        ja.focus();
    }else{
        ja.document.writeln('<table border="0" cellpadding="1" cellspacing="1" width="100%">');
        ja.document.writeln('<tr>');
        ja.document.writeln('<td class="iGreen"></td>');
        ja.document.writeln('<td class="td2">Processando ...</td>');
        ja.document.writeln('</tr>');
        ja.document.writeln('</table>');
        ja.document.writeln('<form name="form" method="post" action="' + urlDaAplicacao + '">');
        ja.document.writeln('   <input type="hidden" name="nivel" value="">');
        ja.document.writeln('   <input type="hidden" name="unidade" value="">');
        ja.document.writeln('   <input type="hidden" name="serie" value="">');
        ja.document.writeln('   <input type="hidden" name="regional" value="">');
        ja.document.writeln('   <input type="hidden" name="curso1" value="">');
        ja.document.writeln('   <input type="hidden" name="curso2" value="">');
        ja.document.writeln('   <input type="hidden" name="curso3" value="">');
        ja.document.writeln('   <input type="hidden" name="nome" value="">');
        ja.document.writeln('   <input type="hidden" name="nomeDoResponsavel" value="">');
        ja.document.writeln('   <input type="hidden" name="email" value="">');
        ja.document.writeln('   <input type="hidden" name="cidade" value="">');
        ja.document.writeln('   <input type="hidden" name="estado" value="">');
        ja.document.writeln('   <input type="hidden" name="dddResidencial" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneResidencial" value="">');
        ja.document.writeln('   <input type="hidden" name="dddComercial" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneComercial" value="">');
        ja.document.writeln('   <input type="hidden" name="dddCelular" value="">');
        ja.document.writeln('   <input type="hidden" name="telefoneCelular" value="">');
        ja.document.writeln('   <input type="hidden" name="comoSoube" value="">');
        ja.document.writeln('   <input type="hidden" name="urlEmail" value="">');
        ja.document.writeln('   <input type="hidden" name="sexo" value="">');
        ja.document.writeln('</form>');
        ja.document.writeln('</body>');
        ja.document.writeln('</html>');
        ja.document.close();
        ja.focus();

        //DESCOBRIR NIVEL
        if(document.formulario.curso1.value=='INTEG1' || document.formulario.curso1.value=='JARDIM' || document.formulario.curso1.value=='MATERN')
            ja.document.form.nivel.value = '6';
        else
            ja.document.form.nivel.value = '2';

        ja.document.form.unidade.value = document.formulario.unidade.value;
        ja.document.form.regional.value = document.formulario.regional.value;
        ja.document.form.curso1.value = document.formulario.curso1.options[document.formulario.curso1.selectedIndex].value;
        ja.document.form.nome.value 				= document.formulario.nome.value;
        ja.document.form.nomeDoResponsavel.value 		= document.formulario.nomeDoResponsavel.value;
        ja.document.form.email.value 				= document.formulario.email.value;
        ja.document.form.cidade.value 				= document.formulario.cidade.value;
        ja.document.form.estado.value 				= document.formulario.estado.value;
        ja.document.form.dddResidencial.value 		= document.formulario.dddResidencial.value;
        ja.document.form.telefoneResidencial.value 	= document.formulario.telefoneResidencial.value;
        ja.document.form.dddComercial.value 		= document.formulario.dddComercial.value;
        ja.document.form.telefoneComercial.value 	= document.formulario.telefoneComercial.value;
        ja.document.form.dddCelular.value 			= document.formulario.dddCelular.value;
        ja.document.form.telefoneCelular.value 		= document.formulario.telefoneCelular.value;
        ja.document.form.comoSoube.value 			= document.formulario.comoSoube.options[document.formulario.comoSoube.selectedIndex].value;
        ja.document.form.urlEmail.value 			= document.formulario.urlEmail.value;
        ja.document.form.serie.value 				= document.formulario.serie.value;;

        for(i=0;i < document.formulario.sexo.length; i++){
            if(document.formulario.sexo[i].checked)
                ja.document.form.sexo.value = document.formulario.sexo[i].value;
        }

        ja.document.form.submit();
    }
}

// VALIDAÇAO DE FORMULÁRIO
function validaForm(formulario){

    var obrigatorio;
    var ok = true;
    var tipoInput;
    var titulo = "";

    for (var i=0;i<document.getElementById(formulario).length;i++){
        tipoInput = document.forms[formulario].elements[i].type.toUpperCase();
        obrigatorio = document.forms[formulario].elements[i].getAttribute('obrigatorio');
        titulo = document.forms[formulario].elements[i].name.toUpperCase().replace('_', ' ');

        if(tipoInput == 'RADIO' && nomeGrupo != document.forms[formulario].elements[i].name){
            var nomeGrupo = document.forms[formulario].elements[i].name;
            var tamanhoGrupo = document.forms[formulario].elements[nomeGrupo].length;
            var checado = 0;
            for(j=0; j<tamanhoGrupo; j++){
                if (obrigatorio && document.forms[formulario].elements[nomeGrupo][j].checked){
                    checado = 1;
                }
            }
            if (obrigatorio && checado == 0){
                ok = false;
                break;
            }
        }

        if(tipoInput == "CHECKBOX"){
            if (obrigatorio && !document.forms[formulario].elements[i].checked){
                ok = false;
                break;
            }
        } else if (tipoInput == "TEXT" || tipoInput == "TEXTAREA" || tipoInput == "PASSWORD"){
            if (obrigatorio && document.forms[formulario].elements[i].value == ''){
                ok = false;
                break;
            }
        } else if (tipoInput == "SELECT-ONE"){
            if (obrigatorio && document.forms[formulario].elements[i].value == 0){
                ok = false;
                break;
            }
        }
    }

    //Se campos obrigatórios foram preenchidos retorna true
    if(ok){
        document.getElementById(formulario).submit();
    }else{
        alert('Preencha os campos obrigatórios!');
    }
}

function abreSistema()
{
    var login = $('awlogin').value;
    var senha = $('awsenha').value;
	var url = "http://itecne.com.br/";
	var numPossibilidades = 0;
	var aleat1 = 0;
	var aleat2 = 0;
	var aleat3 = 0;
    
	if($('rbalunos').checked)
		url += "alunos";
	else
	if($('rbresponsaveis').checked)
		url += "responsaveis";
	else
		url += "professores";
	
	numPossibilidades = 999999999 - 0;
   	aleat1 = Math.random() * numPossibilidades;
   	aleat1 = Math.floor(aleat1);

	numPossibilidades = 999999999 - 0;
   	aleat2 = Math.random() * numPossibilidades;
   	aleat2 = Math.floor(aleat2);

	numPossibilidades = 999999999 - 0;
   	aleat3 = Math.random() * numPossibilidades;
   	aleat3 = Math.floor(aleat3);
	
	url += "?hashLogin=" + String(aleat1) + "%" + login + "%" + String(aleat2) + "%" + senha + "%" + String(aleat3);
	location.href = url;
//	open(url, 'new', 'width=screen.availWidth, height=screen.availHeight, left=0, top=0, bottom=0, right=0');

	/*
    if($('rbresponsaveis').checked){
        alert('a');
        location.href='http://itecne.com.br/responsaveis/php/sistema_login.php?login='+login+'&senha='+senha;
    }
	*/
}
