
 setCookie("contraste",1, 15);
 
  function mudacontraste(){

      if (getCookie("contraste") == 0){
		troca('Padrao');
		setCookie("contraste",1, 15);
      }
	  else {
		troca('Contraste');
		setCookie("contraste",0, 15);
	    }
 }
    function troca(txt) {
	var i, a, main;
         for(i=0;(a = document.getElementsByTagName("link")[i]);i++) {
		if (a.getAttribute("type") == "text/css") {
			a.disabled = true ;
			a.setAttribute("rel", "alternate stylesheet") ;
		}
        }
	for(i=0;(a = document.getElementsByTagName("link")[i]);i++) {
	        if (a.getAttribute("type") == "text/css" && a.getAttribute("title") == txt) {
			a.disabled = false ;
			a.setAttribute("rel", "stylesheet") ;
		}
        }

}	

// script adicionar aos favoritos

function addFav(){
    var url      = "http://www.al.iffarroupilha.edu.br";
    var title    = "Instituto Federal Farroupilha - Campus Alegrete";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}


var szs = new Array( 'endereco','menu1','menu2','menu3','menu4','menu5','menu6','menu7','menu8','menu9', 'menu10', 'menu11', 'menu12', 'aluno1','aluno2','diversos1','diversos2','diversos3','seçoes1','seçoes2','seçoes3','seçoes4','seçoes5','seçoes6','bem_vindo','cefet','acessibilidade','menu','aluno','diversos','secoes','atualizese','agencia','fotos','tematico','acesse','destaque','licita','horario', 'sistemas', 'sistemas1', 'sistemas2', 'acessos1', 'acessos2', 'acessos3', 'informa1', 'informa2', 'informa3', 'informa4', 'informa5', 'informa6', 'eventos', 'nmedio', 'nsup', 'npos', 'rede', 'reitoria', 'ale', 'jc', 'pan', 'sr', 'sb', 'sa', 'svs', 'irpara', 'vejamais', 'mail');

function sizeFont (elem,acao){
// tamanho inicial da fonte (em px)
var tamInic = 11;
// Tamanho mínimo da [b]fonte (em px)
var tamMin = 10;
// Tamanho máximo da fonte (em px)
var tamMax = 14;
// Pega o tamanho da fonte. Se não foi setada ainda (primeira vez que a função é executada) terá como tamanho padrão 'tamInic'.
if (document.getElementById(elem).style.fontSize == "") {
var tamFonte = tamInic;
}else{
var tamFonte = parseInt(document.getElementById(elem).style.fontSize);
}
switch (acao){
// Aumenta o tamanho, enquanto foi menor que 'tamMax'
case '+':
if (tamFonte < tamMax)
document.getElementById(elem).style.fontSize = (tamFonte + 1) + "px";
break;
// Diminui o tamanho, enquanto for maior que 'tamMin'
case '-':
if (tamFonte > tamMin)
document.getElementById(elem).style.fontSize = (tamFonte - 1) + "px";
break;
case '=':
if (tamFonte = tamInic)
document.getElementById(elem).style.fontSize = (tamFonte = 11) + "px";
break;

}
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function sizeFont1(acao1){
for ( i = 0; i < szs.length; i++ ) {
  sizeFont(szs[ i ],acao1);
  }
}


function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

// relógio 

function moveRelogio(){
    momentoAtual = new Date()
    hora = momentoAtual.getHours()
    minuto = momentoAtual.getMinutes()
    segundo = momentoAtual.getSeconds()

    str_segundo = new String (segundo)
    if (str_segundo.length == 1)
       segundo = "0" + segundo

    str_minuto = new String (minuto)
    if (str_minuto.length == 1)
       minuto = "0" + minuto

    str_hora = new String (hora)
    if (str_hora.length == 1)
       hora = "0" + hora

    horaImprimible = hora + " : " + minuto + " : " + segundo

    document.form_relogio.relogio.value = horaImprimivel

    setTimeout("moveRelogio()",1000)
}

// script usado para se logar no webmail

function squirrelmail_loginpage_onload() {
    document.forms[0].js_autodetect_results.value = '1';
    var textElements = 0;
    for (i = 0; i < document.forms[0].elements.length; i++) {
      if (document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "password") {
        textElements++;
        if (textElements == 1) {
          document.forms[0].elements[i].focus();
          break;
        }
      }
    }
  }
