//jq resizetext
		$(function(){
			$('input').click(function(){
			var ourText = $('div.entry');
			var currFontSize = ourText.css('fontSize');
			var finalNum = parseFloat(currFontSize, 10);
			var stringEnding = currFontSize.slice(-2);
			try{
				if(this.id == 'large') {
					if(finalNum <=16) {
					finalNum += 1;
					}
				}
				else if (this.id == 'small'){
					if(finalNum >=11) {
					finalNum -=1;
					}
				}
				else if (this.id == 'normal'){
					finalNum = 13;
				}
				ourText.css('fontSize', finalNum + stringEnding);
			}catch(e){}
		});
	});
// resize menus
function novaaltura(idflash, altura){
	document.getElementById(idflash, altura).style.height = altura+"px";		
}

//open window
function openPop(_url, _window, _params) {
	var newwindow = window.open(_url, _window, _params);
	if(!newwindow){
			 alert("Seu Navegador bloqueou a janela de visualização\n Por favor desbloqueie-o bloqueador de popup para visualizar o conteúdo.")
		}
		newwindow.document.close();
}



//alterna abas
function achaId(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=achaId(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHide() { 
  var i,p,v,obj,args=showHide.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=achaId(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}



//PARA EXIBIR E OCULTAR BLOCOS
function ShowHideBlocks(obj,s){
	if(obj && s) obj.style.display = s;
	else if(!s) obj.style.display = (obj.style.display=='none') ? 'block' : 'none';
}




//ADICIONAS POR GILSON VARGAS 30.03.09 - MÁSCARAS DE LOGIN


function Formata(campo,tammax,teclapres) {
 var tecla=(window.event)?event.keyCode:teclapres.which;
	vr = Limpar(campo.value,"0123456789");
	tam = vr.length;
	//if(tecla == 9){ campo.focus(); return false; }
	if (tam < tammax && tecla != 8) tam = vr.length + 1; 
			if ( tecla == 8 || tecla == 9 || tecla == 39 || tecla == 37 || tecla == 46  || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) || tecla == 0 ){
			}else return false;
}

 function usuario(frm, url, target)
{
	with(frm){
		if (logs.value == "" || logs.value == "RA DO ALUNO") {
			alert("Por Favor \n Informe o Login.");
			logs.value = "";
			logs.focus();
			return false;
		}else if (senha.value == "") {
			alert("Por Favor \n Informe a senha.");
			senha.focus();
			return false;
		}/*else  if (document.form1.senha.value.length  > 10) {
		  alert("Por Favor, \n Informe sua senha com 10 digitos.");
		  senha.focus();
		  return false;
	   } */else {
		    action = url;
			target = "_self";
			submit();
	 }
	}
}

function Limpar(valor, validos) {
// retira caracteres invalidos da string
var result = "";
var aux;
for (var i=0; i < valor.length; i++) {
	aux = validos.indexOf(valor.substring(i, i+1));
	if (aux>=0) {
		result += aux;
	}
}
return result;
}

//LIMPA CAMPO FORMULARIO OU DEIXA O MESMO VALOR
function padrao(campo,valor){
	try{
		if(campo && typeof(campo.value)!="undefined")
		return campo.value = ((campo.value != valor && campo.value.length != 0) ? campo.value : valor);
		}catch(e){	}
} 

function limpapadrao(campo,valor){
	try{
		if(campo && typeof(campo.value)!="undefined")
			campo.value = ((campo.value != valor) ? campo.value : "");
		}catch(e){	}
}



/*
function Lform(){
		f = document.forms["fLog"].logs;
		g = document.forms["fLog"].senha;
		h = document.forms["fLog"];
		addEvent(f, "focus", function( e ) { limpapadrao('fLog','logs','RA DO ALUNO'); })
		addEvent(f, "blur", function( e ) { padrao('fLog','logs','RA DO ALUNO'); })
		addEvent(f, "keydown", function( e ) { return Formata(this,20,event); })
		addEvent(f, "keypress", function( e ) { return Formata(this,20,event); })
		addEvent(g, "focus", function( e ) { limpapadrao('fLog','senha','*******'); })
		addEvent(g, "blur", function( e ) { padrao('fLog','senha','*******'); })
		addEvent(h, "submit", function( e ) { return usuario(document['fLog'], 'login.php', 'target'); })
}
*/

//-----------

 arr=[];
indice=0;
function loadBlock(place,addr){
	if(xmlhttp){
		document.getElementById(place).style['display']= 'block';
		document.getElementById(place).innerHTML = '<span id="carregando" onClick="javascript: this.style[\'display\']=\'none\';" style="position: absolute; display: block; padding-left:40px; padding-right:10px; width: auto; line-height: 40px; border: 1px solid #000; font-weight: bold; background:#FFF url(\''+URL+'img/loading.gif\') no-repeat 5px center;">Carregando...</span>';
		blockUPDATE(place,addr);
	}
}

function blockUPDATE(place,addr){
	if(xmlhttp){
    	//Adiciona à fila
	    arr[arr.length]=[place,addr];
	    if((indice+1)== arr.length) RunExecute();
	}
}

function RunExecute(){
	if(!xmlhttp){
//CRIA UM OBJETO XHR
	try{
		    xmlhttp = new XMLHttpRequest();
		}catch(xmlhttp){
	    	try{
    		    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		    }catch(xmlhttp){
	    	    try{
    		        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        	}catch(xmlhttp){
            		xmlhttp = false;
	    	    }
    		}
		}
	}

	if(xmlhttp){
    	xmlhttp.open("GET",arr[indice][1],true); 
		xmlhttp.setRequestHeader('content-type', 'text/html');
		xmlhttp.setRequestHeader('Content-Type','charset=iso-8859-1');
		xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	    xmlhttp.onreadystatechange=function() {
			//alert(xmlhttp.status+" - "+xmlhttp.readyState);
	        if (xmlhttp.readyState==4){
    	        //EXIBE o HTML recebido
        	    consulta=unescape(xmlhttp.responseText); //.replace(/\+/g," "));
				//alert(consulta);
				if(document.getElementById(arr[indice][0])){
					 document.getElementById(arr[indice][0]).innerHTML=consulta;
				 }
	            //Roda o próximo
    	        indice++;
        	    if(indice<arr.length) setTimeout("RunExecute()",20);
	        }
    	}
	    //Executa
	    xmlhttp.send(null);
	}
}


Ap=[]; inp=0; frm=[];
function postValores(formulario,act,id,url,texto){
//	alert(formulario.name+" - "+act+" - "+id+" - "+url+" - "+texto);
var	valores = "act="+act;
	for (i=0; i < formulario.elements.length; i++){
		if ((formulario.elements[i].value && formulario.elements[i].type != 'button' && formulario.elements[i].type != 'submit' )){
			if(formulario.elements[i].type == 'checkbox' && formulario.elements[i].checked == true){
				valores += "&"+formulario.elements[i].name+"="+formulario.elements[i].value;
			}else if(formulario.elements[i].type == 'select-multiple'){	//PARA SELECTS MULTIPLOS
				var mult = formulario.elements[i];
				for(a=0;a<mult.length;a++){
					if(mult.options[a].selected){
						valores += "&"+formulario.elements[i].name+"="+mult.options[a].value;
					}
				}
			}else if(formulario.elements[i].type == 'radio' && formulario.elements[i].checked == true){ //PARA RADIOBUTTON
					valores += "&"+formulario.elements[i].name+"="+formulario.elements[i].value;
			}else if((formulario.elements[i].type == 'text' || formulario.elements[i].type == 'select-one' || formulario.elements[i].type == 'textarea' || formulario.elements[i].type == 'hidden') && (formulario.elements[i].type != 'checkbox' && formulario.elements[i].type != 'select-multiple')){
					nVal = "";
					nVal = escape(formulario.elements[i].value);
				valores += "&"+formulario.elements[i].name+"="+nVal;
				}
		}
	}
	if(document.getElementById(id)){
		document.getElementById(id).style['display']= 'block';
		document.getElementById(id).innerHTML = (texto) ? '<span id="carregando" align=center> '+texto+'</span>' : '<span id="carregando" align=center> Aguarde, carregando dados...</span>';
	}
	frm[Ap.length]=valores.toString();
    Ap[Ap.length]=[id,url];
//	alert(Ap.length+" - "+inp);
    if((inp+1)==Ap.length) RunPost();
}

function RunPost(){
	if(xmlhttp){
		//Abre a conexão
		xmlhttp.open("POST", Ap[inp][1], true);
		//xmlhttp.setRequestHeader('Content-Type','charset=iso-8859-1');
		//xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded;'); 
		//Função para tratamento do retorno
	    xmlhttp.onreadystatechange=function() {
			//alert(xmlhttp.status+" - "+xmlhttp.readyState);
	        if (xmlhttp.readyState==4){
    	        //Mostra o HTML recebido
	            retorno=unescape(xmlhttp.responseText); //.replace(/\+/g," "));
				//document.getElementById(Ap[inp][0]).scrollIntoView();
				//alert(retorno + " - " + Ap[inp][0]);
				if(document.getElementById(Ap[inp][0])){
					 document.getElementById(Ap[inp][0]).innerHTML=retorno;
					// if(document.getElementById('globalSource')) reDimensiona();
				 }
	            //Roda o próximo
            	inp++;
        	    if(inp<Ap.length) setTimeout("RunPost()",20);
    	    }
	    }
    	//Executa	
	    xmlhttp.send(frm[inp]);
	}
}

//CRIA UM OBJETO XHR
var xmlhttp;
	if(!xmlhttp){
	try{
		    xmlhttp = new XMLHttpRequest();
		}catch(xmlhttp){
	    	try{
    		    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		    }catch(xmlhttp){
	    	    try{
    		        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        	}catch(xmlhttp){
            		xmlhttp = false;
	    	    }
    		}
		}
	}
	


//PEGA VARIAVEL APÓS SUSTENIDO #
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {	
        hash = hashes[i].split('=');
		hash[1] = unescape(hash[1]);
		vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars;
}
 
//var pedaco = getUrlVars();
//alert(pedaco['variavel1']); // Caixa de alerta resultara "Primeira variavel"
//alert(pedaco['variavel2']); // Caixa de alerta resultara "Segunda variavel"

/* innerfade */
$(document).ready(
				function(){
					$('ul#destaques').innerfade({
						//animationtype: 'slide',
						speed: 1000,
						timeout: 5000,
						type: 'sequence',
						containerheight: '250px'
					});
			});
/* fechar overlay */
function closeAd()
{
	var toClose = document.getElementById("overlay");
	toClose.style.display = "none";
}
/* fechar overlay */