function lercookie() {
	cookie = document.cookie.substring(document.cookie.indexOf(""),document.cookie.indexOf("end"));
	if (cookie=="") document.membros.login.value="";
	else document.membros.login.value=""+cookie+"";
}

function lockaccess() {
	L = document.membros.login.value;
	S = document.membros.senha.value;
	if (L=="" || S=="") document.membros.acesso.disabled=true, document.membros.lembrar.disabled=true;
	else document.membros.acesso.disabled=false, document.membros.lembrar.disabled=false;
}

function logar() {
	L = document.membros.login.value;
	S = document.membros.senha.value;
	if (L.length < 3) alert("O nome de usuário precisa ter pelo menos 3 caracteres!");
	else if (S.length < 3) alert("A senha do usuário precisa ter pelo menos 3 caracteres!");
	else {
	
	//CRIE UMA SUBPASTA CHAMADA "usuarios" E COLOQUE AS PÁGINAS DENTRO//
	
	if (L=="target" && S=="tgtadmin") abrir('index.php');
	else if (L=="PROF-IMP01" && S=="ACESSO") abrir('IMP01.php');
	else if (L=="TGT-IMP01" && S=="ADMIN") abrir('IMP01.php');
	else if (L=="IMP01-01" && S=="AWJ04") abrir('IMP01.php');
	else if (L=="IMP01-02" && S=="ABW04") abrir('IMP01.php');
	else if (L=="IMP01-03" && S=="CSM04") abrir('IMP01.php');
	else if (L=="IMP01-04" && S=="CAR04") abrir('IMP01.php');
	else if (L=="IMP01-05" && S=="DIS04") abrir('IMP01.php');
	else if (L=="IMP01-06" && S=="FDN04") abrir('IMP01.php');
	else if (L=="IMP01-07" && S=="FKH04") abrir('IMP01.php');
	else if (L=="IMP01-08" && S=="FEZ04") abrir('IMP01.php');
	else if (L=="IMP01-09" && S=="JCM04") abrir('IMP01.php');
	else if (L=="IMP01-10" && S=="MAG04") abrir('IMP01.php');
	else if (L=="IMP01-11" && S=="NET04") abrir('IMP01.php');
	else if (L=="IMP01-12" && S=="OSN04") abrir('IMP01.php');
	else if (L=="IMP01-13" && S=="RJB04") abrir('IMP01.php');
	else if (L=="IMP01-14" && S=="RFN04") abrir('IMP01.php');
	else if (L=="IMP01-15" && S=="IMP15") abrir('IMP01.php');
	else if (L=="IMP01-16" && S=="IMP16") abrir('IMP01.php');
	else if (L=="IMP01-17" && S=="IMP17") abrir('IMP01.php');
	else if (L=="IMP01-18" && S=="IMP18") abrir('IMP01.php');
	else if (L=="IMP01-19" && S=="IMP19") abrir('IMP01.php');
	else if (L=="IMP01-20" && S=="IMP20") abrir('IMP01.php');
	else if (L=="IMP130" && S=="WAL130") abrir('IMP01.php');
	else if (L=="PROF-IMP02" && S=="ACESSO") abrir('IMP02.php');
	else if (L=="TGT-IMP02" && S=="ADMIN") abrir('IMP02.php');
	else if (L=="IMP02-01" && S=="ASN05") abrir('IMP02.php');
	else if (L=="IMP02-02" && S=="CAR05") abrir('IMP02.php');
	else if (L=="IMP02-03" && S=="CFB05") abrir('IMP02.php');
	else if (L=="IMP02-04" && S=="DAM05") abrir('IMP02.php');
	else if (L=="IMP02-05" && S=="DFP05") abrir('IMP02.php');
	else if (L=="IMP02-06" && S=="MAF05") abrir('IMP02.php');
	else if (L=="IMP02-07" && S=="MLN05") abrir('IMP02.php');
	else if (L=="IMP02-08" && S=="MOP05") abrir('IMP02.php');
	else if (L=="IMP02-09" && S=="OSC05") abrir('IMP02.php');
	else if (L=="IMP02-10" && S=="RFQ05") abrir('IMP02.php');
	else if (L=="IMP02-11" && S=="RAZ05") abrir('IMP02.php');
	else if (L=="IMP02-12" && S=="RLL05") abrir('IMP02.php');
	else if (L=="IMP02-13" && S=="RUT05") abrir('IMP02.php');
	else if (L=="IMP02-14" && S=="SEB05") abrir('IMP02.php');
	else if (L=="IMP02-15" && S=="VZS05") abrir('IMP02.php');
	else if (L=="IMP02-16" && S=="WFC05") abrir('IMP02.php');
	else if (L=="IMP02-17" && S=="IMP17") abrir('IMP02.php');
	else if (L=="IMP02-18" && S=="IMP18") abrir('IMP02.php');
	else if (L=="IMP02-19" && S=="IMP19") abrir('IMP02.php');
	else if (L=="IMP02-20" && S=="IMP20") abrir('IMP02.php');
	else if (L=="IMP02-21" && S=="IMP21") abrir('IMP02.php');
	else if (L=="IMP02-22" && S=="IMP22") abrir('IMP02.php');
	else if (L=="IMP230" && S=="WAL230") abrir('IMP02.php');
	else if (L=="PROF-IMP03" && S=="ACESSO") abrir('IMP03.php');
	else if (L=="TGT-IMP03" && S=="ADMIN") abrir('IMP03.php');
	else if (L=="IMP301" && S=="ACS301") abrir('IMP03.php');
	else if (L=="IMP302" && S=="AAF302") abrir('IMP03.php');
	else if (L=="IMP303" && S=="CBS303") abrir('IMP03.php');
	else if (L=="IMP304" && S=="CAS304") abrir('IMP03.php');
	else if (L=="IMP305" && S=="ESC305") abrir('IMP03.php');
	else if (L=="IMP306" && S=="FEG306") abrir('IMP03.php');
	else if (L=="IMP307" && S=="ICM307") abrir('IMP03.php');
	else if (L=="IMP308" && S=="JCP308") abrir('IMP03.php');
	else if (L=="IMP309" && S=="MCL309") abrir('IMP03.php');
	else if (L=="IMP310" && S=="OSN310") abrir('IMP03.php');
	else if (L=="IMP311" && S=="RNM311") abrir('IMP03.php');
	else if (L=="IMP312" && S=="RSS312") abrir('IMP03.php');
	else if (L=="IMP313" && S=="LUM313") abrir('IMP03.php');
	else if (L=="IMP314" && S=="AZB314") abrir('IMP03.php');
	else if (L=="IMP315" && S=="ADGB15") abrir('IMP03.php');
	else if (L=="IMP316" && S=="RFV316") abrir('IMP03.php');
	else if (L=="TGT-OR01" && S=="ADMIN") abrir('IMP03.php');
	else if (L=="PROF-IMP04" && S=="ACESSO") abrir('IMP04.php');
	else if (L=="TGT-IMP04" && S=="ADMIN") abrir('IMP04.php');
	else if (L=="IMP401" && S=="MUR401") abrir('IMP04.php');
	else if (L=="IMP402" && S=="ERO402") abrir('IMP04.php');
	else if (L=="IMP403" && S=="NIV403") abrir('IMP04.php');
	else if (L=="IMP404" && S=="MAR404") abrir('IMP04.php');
	else if (L=="IMP405" && S=="HEN405") abrir('IMP04.php');
	else if (L=="IMP406" && S=="VIR406") abrir('IMP04.php');
	else if (L=="IMP407" && S=="LUI407") abrir('IMP04.php');
	else if (L=="IMP408" && S=="NED408") abrir('IMP04.php');
	else if (L=="IMP409" && S=="PAT409") abrir('IMP04.php');
	else if (L=="IMP410" && S=="DAN410") abrir('IMP04.php');
	else if (L=="IMP507" && S=="ALUNO") abrir('IMP05.php');
	else if (L=="PROF-OR01" && S=="ACESSO") abrir('OR1.php');
	else if (L=="0R3-01" && S=="ASN03") abrir('OR1.php');
	else if (L=="0R3-02" && S=="CAR03") abrir('OR1.php');
	else if (L=="0R3-03" && S=="CFB03") abrir('OR1.php');
	else if (L=="0R3-04" && S=="DAM03") abrir('OR1.php');
	else if (L=="0R3-05" && S=="DFP05") abrir('OR1.php');
	else if (L=="0R3-06" && S=="MAF03") abrir('OR1.php');
	else if (L=="0R3-07" && S=="MLN03") abrir('OR1.php');
	else if (L=="0R3-08" && S=="MOP03") abrir('OR1.php');
	else if (L=="0R3-09" && S=="OSC03") abrir('OR1.php');
	else if (L=="0R3-10" && S=="RFQ03") abrir('OR1.php');
	else if (L=="0R3-11" && S=="RAZ03") abrir('OR1.php');
	else if (L=="0R3-12" && S=="RLL03") abrir('OR1.php');
	else if (L=="0R3-13" && S=="FER03") abrir('OR1.php');
	else if (L=="0R3-14" && S=="CIN03") abrir('OR1.php');
	else if (L=="0R3-15" && S=="0RT15") abrir('OR1.php');
	else if (L=="0R3-16" && S=="0RT16") abrir('OR1.php');
	else if (L=="0R3-17" && S=="0RT17") abrir('OR1.php');
	else if (L=="0R3-18" && S=="0RT18") abrir('OR1.php');
	else if (L=="0R3-19" && S=="0RT19") abrir('OR1.php');
	else if (L=="0R3-20" && S=="0RT20") abrir('OR1.php');
	else if (L=="PROF-OR02" && S=="ACESSO") abrir('ORT2.php');
	else if (L=="TGT-OR02" && S=="ADMIN") abrir('ORT2.php');
	else if (L=="ORT201" && S=="BDZ201") abrir('ORT2.php');
	else if (L=="ORT202" && S=="CRD202") abrir('ORT2.php');
	else if (L=="ORT203" && S=="GRS203") abrir('ORT2.php');
	else if (L=="ORT204" && S=="GPS204") abrir('ORT2.php');
	else if (L=="ORT205" && S=="JBB205") abrir('ORT2.php');
	else if (L=="ORT206" && S=="KDD206") abrir('ORT2.php');
	else if (L=="ORT207" && S=="LLB207") abrir('ORT2.php');
	else if (L=="ORT208" && S=="MCS208") abrir('ORT2.php');
	else if (L=="ORT209" && S=="MCB209") abrir('ORT2.php');
	else if (L=="ORT210" && S=="MFC210") abrir('ORT2.php');
	else if (L=="ORT211" && S=="RFB211") abrir('ORT2.php');
	else if (L=="ORT212" && S=="ROB212") abrir('ORT2.php');
	else if (L=="ORT213" && S=="SSB213") abrir('ORT2.php');
	else if (L=="ORT214" && S=="TSP214") abrir('ORT2.php');
	else if (L=="ORT215" && S=="RMF215") abrir('ORT2.php');
	else if (L=="PROF-ORT3" && S=="ACESSO") abrir('ORT3.php');
	else if (L=="TGT-ORT3" && S=="ADMIN") abrir('ORT3.php');
	else if (L=="ORT301" && S=="MAR301") abrir('ORT3.php');
	else if (L=="ORT302" && S=="ING302") abrir('ORT3.php');
	else if (L=="ORT303" && S=="HER303") abrir('ORT3.php');
	else if (L=="ORT304" && S=="AND304") abrir('ORT3.php');
	else if (L=="ORT305" && S=="VIV305") abrir('ORT3.php');
	else if (L=="ORT306" && S=="CRI306") abrir('ORT3.php');
	else if (L=="ORT307" && S=="CAM307") abrir('ORT3.php');
	else if (L=="ORT308" && S=="SIM308") abrir('ORT3.php');
	else if (L=="ORT309" && S=="MIL309") abrir('ORT3.php');
	else if (L=="ORT310" && S=="MAR310") abrir('ORT3.php');
	else if (L=="ORT311" && S=="AND311") abrir('ORT3.php');
	else if (L=="ORT312" && S=="ANA312") abrir('ORT3.php');
	else if (L=="ORT313" && S=="BAR313") abrir('ORT3.php');
	else if (L=="ORT314" && S=="HUG314") abrir('ORT3.php');
	else if (L=="TGT-ORT4" && S=="ADMIN") abrir('ORT4.php');
	else if (L=="ORT407" && S=="ALUNO") abrir('ORT4.php');
	else if (L=="ORTO7" && S=="ALUNO") abrir('ORT7.php');
	else if (L=="PRO107" && S=="ALUNO") abrir('PROT1.php');


	else alert("DADOS INVÁLIDOS OU INCORRETOS!\n\n\Verifique se seu nome de usuário é "+L+" e se sua senha possui "+S.length+" caracteres.\n\Talvez algum caractere esteja faltado ou sobrando.\n\n\Verifique se a luz do 'Caps Lock' está acesa no teclado.\n\Se estiver, pressione 'Caps Lock' e tente novamente.");
	}
}

function abrir(arquivo) {
	window.open("usuarios/"+arquivo+"","_blank","menubar=no,toolbar=no,location=no,directories=no,scrollbars=yes,status=no,resizable=yes"); escrever();
}

function escrever() {
	Agora = new Date();
	Agora.setTime(Agora.getTime()+(365*24*60*60*1000));
	if (document.membros.lembrar.checked == true) {
	document.cookie=""+document.membros.login.value+"end"+Agora+"; expires="+Agora.toGMTString();+"";
	}
	else {
	document.cookie="end"+Agora+"; expires="+Agora.toGMTString();+"";
	}
}

function clear_field(field){
   
	if (field.value==field.defaultValue)    {    

	field.value=''    }
}

function check_field(field){

    if (field.value=='' ||
    field.value==' ')    {

        field.value=field.defaultValue    }
} 

