// JavaScript Document
//se for 1024x768
	var resolucaoLargura= screen.width;
	var resolucaoAltura= screen.height;
	
	document.cookie = "resolucao="+screen.width+"x"+screen.height;
	//alert(resolucaoLargura);
	//return (screen.width);
// fim

/* função que abre camada display oculta*/
function abreSubmenu( sId ) {
	var sDiv = document.getElementById( sId );
	if( sDiv.style.display == "" ) {
		sDiv.style.display = "none";
	} else {
		sDiv.style.display = "";
	}
}
/* fim*/

/* função que carrega a página como preload*/
function clearPreloadPage(page) { //DOM
	var pg = document.getElementById(page);
	if (document.getElementById){
		document.getElementById('prepage').style.display="none";
		pg.style.display="";
	}else{
		if (document.getElementById){ //NS4
			document.getElementById('prepage').display = "none";
			pg.display = "";
		}
		else { //IE4
		document.getElementById('prepage').style.display = "none";
		pg.style.display = "";
		}
	}
}
/* fim*/

/* função que abre pop-up*/
function PopUp(pagina,nome,w,h,scroll){
var win = null;	
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(pagina,nome,settings);
}
/*
<a href="http://www.codigofonte.com.br" onclick="PopUp(this.href,'nomeJanela','450','450','yes');return false">Nova Janela de Exemplo</a>
*/
/* fim*/

/* função que maximiza atela do browser*/
//function fullscreen(){
//window.moveTo(0,0);
//window.resizeTo(screen.width,screen.height);
//}
/* fim */

/* fullscren*/
function openBrWindow(theURL,winName,features) { //v2.0
 window.open(theURL,winName,features);
}

function fechaJanela(){
window.opener = window
window.close("#")
}

function janelaFULL() {
window.open(document.location, 'Intranet', 'status=yes,toolbar=no,menubar=no,location=no,fullscreen=yes,scrolling=yes,allowtransparency=yes')
}
/* fim*/

var slideInUse = new Array();

function Slide(objId, options) {
	this.obj = document.getElementById(objId);
	this.duration = 1;
	this.height = parseInt(this.obj.style.height);

	if(typeof options != 'undefined') { this.options = options; } else { this.options = {}; }
	if(this.options.duration) { this.duration = this.options.duration; }
		
	this.up = function() {
		this.curHeight = this.height;
		this.newHeight = '1';
		if(slideInUse[objId] != true) {
			var finishTime = this.slide();
			window.setTimeout("Slide('"+objId+"').finishup("+this.height+");",finishTime);
		}
	}
	
	this.down = function() {
		this.newHeight = this.height;
		this.curHeight = '1';
		if(slideInUse[objId] != true) {
			this.obj.style.height = '1px';
			this.obj.style.display = 'block';
			this.slide();
		}
	}
	
	this.slide = function() {
		slideInUse[objId] = true;
		var frames = 30 * duration; // Running at 30 fps

		var tIncrement = (duration*1000) / frames;
		tIncrement = Math.round(tIncrement);
		var sIncrement = (this.curHeight-this.newHeight) / frames;

		var frameSizes = new Array();
		for(var i=0; i < frames; i++) {
			if(i < frames/2) {
				frameSizes[i] = (sIncrement * (i/frames))*4;
			} else {
				frameSizes[i] = (sIncrement * (1-(i/frames)))*4;
			}
		}
		
		for(var i=0; i < frames; i++) {
			this.curHeight = this.curHeight - frameSizes[i];
			window.setTimeout("document.getElementById('"+objId+"').style.height='"+Math.round(this.curHeight)+"px';",tIncrement * i);
		}
		
		window.setTimeout("delete(slideInUse['"+objId+"']);",tIncrement * i);
		
		if(this.options.onComplete) {
			window.setTimeout(this.options.onComplete, tIncrement * (i-2));
		}
		
		return tIncrement * i;
	}
	
	this.finishup = function(height) {
		this.obj.style.display = 'none';
		this.obj.style.height = height + 'px';
	}
	
	return this;
}

// Função que fecha o pop-up ao clicar no link fechar
function fechar(){
document.getElementById('popup').style.display = 'none';
}
// Aqui definimos o tempo para fechar o pop-up
function abrir(){
document.getElementById('popup').style.display = 'block';
}
// Aqui definimos o tempo para fechar o pop-up
function abrirefecha(){
document.getElementById('popup').style.display = 'block';
setTimeout ("fechar()", 3000);
}
function abreTopico( sId ) {
	var sDiv = document.getElementById( sId );
	if( sDiv.style.display == "block" ) {
		sDiv.style.display = "none";
		dragdrop(sId,sId);
		//aumentaDiv(sId);
	} else {
		sDiv.style.display = "block";
		dragdrop(sId,sId);
		//aumentaDiv(sId);
	}
}
function fecharTopico(sId){
	var sDiv = document.getElementById( sId );
		sDiv.style.display = 'none';
}

window.onerror = erros;
function erros(msg, url, line)
{
	window.alert("Erro Encontrado: "+msg+". \nLinha: "+line+".\nURL: "+url);
}
function aumenta(sId){
		sDiv.innerHTML = "<div class='text'></div>";
}

var xmlhttp = null;

function pegaConteudo(pag,div) {
	var pag ;
	var div ;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
        }
    }

    if  (!xmlhttp && typeof  XMLHttpRequest != 'undefined' ) {
        try  {
            xmlhttp = new  XMLHttpRequest();
        } catch  (e) {
            xmlhttp = false ;
        }
    }

    if (xmlhttp) {
        xmlhttp.onreadystatechange = processadorMudancaEstado;
		xmlhttp.open("GET", pag, true);
        xmlhttp.setRequestHeader('Content-Type','text/html');
        //xmlhttp.setRequestHeader('encoding','utf-8');
		xmlhttp.setRequestHeader('charset','utf-8');
        xmlhttp.send(null);
    }
}

function processadorMudancaEstado () {
	//enquanto estiver processando...emite a msg de carregando
	if(xmlhttp.readyState == 1) { document.getElementById('corpo').innerHTML = "Carregando...!"; }
    if ( xmlhttp.readyState == 4) { // Completo
        if ( xmlhttp.status == 200) { // resposta do servidor OK
			document.getElementById('corpo').innerHTML = xmlhttp.responseText;
		} else {
            alert( "A pagina nao existe" );
        }
    }
}