// JavaScript Document
//Função para carregar qualquer outra função no metodo onload

//Variáveis padroes

var tempo = 15;

function _onload(funcao){
	// função para carregar outras funçoes no onload
}

function redirect()
{
	if (tempo <= 0)
	{
 		window.location.href = 'default.asp';
	}else{
  		tempo = tempo - 1;
	}
	document.all('tempo').innerHTML = tempo;
	setTimeout('javascript:redirect();', 1000);
}

<!--
/**
 * Abre um pop_up
 * @author Thiago Vieira de Castro <thiago_castro@nacionelnet.com.br>
 * @param value Endereço
 * @param win Nome da janela
 * @param tool Apresenta barra de ferramentas 'yes' ou 'no'
 * @param status Apresenta barra de status 'yes' ou 'no'
 * @param menubar Apresenta barra de menu 'yes' ou 'no'
 * @param scrol Apresenta barra de rolagens 'yes' ou 'no'
 * @param resizable Permitir alterar tamanho do pop_up 'yes' ou 'no'
 * @param width Largura do pop_up
 * @param height Altura do pop_up
 */
function pop_up(URL,NameWindow,BarrFerr,BarrStatus,BarrMenu,Rolagem,Redimensiona,Largura,Altura,Topo,Esquerda){
	popup = window.open(URL,NameWindow,'toolbar='+BarrFerr+',location=no,directories=no,status='+BarrStatus+',menubar='+BarrMenu+',scrollbars='+Rolagem+',resizable='+Redimensiona+',width='+Largura+',height='+Altura+',left=' + Esquerda + ',top=' + Topo)
}

function ApresentaItem(Objeto){
	alert(Objeto.style.display)
}

var param1, param2
var CorVelha;
var ObjetoVelho;

function ColorirPassarMouse (Objeto,FundoCor,FundoCorSelecionado) {
	
	if (Objeto.style.backgroundColor != FundoCorSelecionado) {
		CorVelha = Objeto.style.backgroundColor;
		Objeto.style.backgroundColor = FundoCor;
	}
	
}

function VoltaCorSairMouse (Objeto,FundoCorSelecionado) {
	
	if (Objeto.style.backgroundColor != FundoCorSelecionado) {
		Objeto.style.backgroundColor = CorVelha;
	}
}

function ColorirAoClicar (Objeto,FundoCor) {
	
	var i;
	
	Objeto.style.backgroundColor = FundoCor;
	
	for (i=0; i < Objeto.cells.length; i++) {
		Objeto.cells(i).style.color = '#FFFFFF';
	}
	
	if (ObjetoVelho != undefined && ObjetoVelho != Objeto) {
		ObjetoVelho.style.backgroundColor = CorVelha;
		
		for (i=0; i < Objeto.cells.length; i++) {
			ObjetoVelho.cells(i).style.color = '#000000';
		}
	
	}
	
	ObjetoVelho = Objeto;
	
}

function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

/**
 * Retira caracteres que não estejam de [a_z][A_Z][0_9] do início e
 * fim da string
 * @author Thiago Vieira de Castro <thiago_castro@nacionalnet.com.br>
 * @version 01.00.00 2003/06/23 Thiago Vieira de Castro <thiago_castro@nacionalnet.com.br>
 */
function Trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	
	if(document.all) { // Internet Explorer
		nTecla = evtKeyPress.keyCode; 
	}
	else if(document.layers) { // Nestcape
		nTecla = evtKeyPress.which;
	}
	
	sValue = objForm[strField].value;
	// Limpa todos os caracteres de formatação que
	// já estiverem no campo.
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( ":", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;

	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;
	
	while (i <= mskLen) {
		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ":") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

		if (bolMask) {
			sCod += sMask.charAt(i);
			mskLen++; 
		}
		else {
		sCod += sValue.charAt(nCount);
		nCount++;
		}
		
		i++;
	}

	objForm[strField].value = sCod;
	if (nTecla != 8) { // backspace
		if (sMask.charAt(i-1) == "9") { // apenas números...
			return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
		else { // qualquer caracter...
			return true;
		}
	} else {
		return true;
	}
	
}

/**
 * Permite que apenas caractes de 0-9 sejam digitados no campo 
 * @author Thiago Vieira de Castro <thiago@landix.com.br>
 */
function DigInt () {
  
	if (event.keyCode < 48 || event.keyCode > 57)
    	event.returnValue = false;
}

/**
 * Função para trabalhar com campo SELECT - Apaga todos options
 * @author Desconhecido
 * @version Desconhecido
 */
function deleteAllOption(theSel){	
	var selLength = theSel.length;
	var theIndex = selLength;
	
	
	for (i=0; i<selLength; i++)
	{
		theIndex = theIndex - 1;
			
		theSel.options[theIndex] = null;
		
	}
	
}

/**
 * Função para trabalhar com campo SELECT - Adiciona um option
 * @author Desconhecido
 * @version Desconhecido
 */
function addOption(theSel, theText, theValue){
	var newOpt = new Option(theText, theValue);
	var selLength = theSel.length;
	
	theSel.options[selLength] = newOpt;
}

/**
 * Função para trabalhar com campo SELECT - Apaga um option
 * @author Desconhecido
 * @version Desconhecido
 */
function deleteOption(theSel, theIndex){	
	var selLength = theSel.length;
		
	if(selLength>0)	{
		theSel.options[theIndex] = null;
	}
}

/**
 * Função para trabalhar com campo SELECT - Move options
 * @author Desconhecido
 * @version Desconhecido
 */
function moveOptions(theSelFrom, theSelTo) {
	
	var selLength = theSelFrom.length;
	var selectedText = new Array();
	var selectedValues = new Array();
	var selectedCount = 0;
	
	var i;
	
	// Find the selected Options in reverse order
	// and delete them from the 'from' Select.
	for(i=selLength-1; i>=0; i--)
	{
		if(theSelFrom.options[i].selected)
		{
			selectedText[selectedCount] = theSelFrom.options[i].text;
			selectedValues[selectedCount] = theSelFrom.options[i].value;
			deleteOption(theSelFrom, i);
			selectedCount++;
		}
	}
	
	// Add the selected text/values in reverse order.
	// This will add the Options to the 'to' Select
	// in the same order as they were in the 'from' Select.
	for(i=selectedCount-1; i>=0; i--)
	{
		addOption(theSelTo, selectedText[i], selectedValues[i]);
	}
	
	// Faz ordenação alfabetica ASCENDENTE no theSelTo 
	// pelo text do option
	var theSelTolength = theSelTo.options.length;
	var theSelToText = new Array();
	var theSelToValue = new Array();
	var selArray = new Array();
	var ct = 0;
	
	for(i=0; i<theSelTolength; i++)
	{
		selArray[ct] = new Array();
		selArray[ct][0] = theSelTo.options[i].text;
		selArray[ct][1] = theSelTo.options[i].value;      
		ct++;
	}
	
	theSelTo.options.length = 0
	selArray.sort();
	
	for(i=0; i<selArray.length; i++){
		theSelTo.options[theSelTo.options.length] = new Option(selArray[i][0], selArray[i][1]);
	}
}

/**
 * Função para trabalhar com campo SELECT - Seleciona todos options
 * @author Desconhecido
 * @version Desconhecido
 * @param Object theSel SELECT que terá todos options selecionados
 */
function selecionarOptions(theSel){	
	for (i=0; i<theSel.options.length; i++) {
		
		theSel.options[i].selected = true;
		
	}
	
}

function mouseX(evt) {
	if (evt.pageX) 
		return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	else 
		return null;
}
function mouseY(evt) {
	if (evt.pageY) 
		return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	else 
		return null;
}


<!--
var FechaMenuGerConItem = true;
var ParamGerConItem = new Array();
var ApresItemMenu = new Array();

/**
 * Abre menu para opções do gerenciador de conteúdo
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function MenuGerConItem(evt) { 
	
	var posX;
	var posY;
	var i;
	
	var DivMenu;
	
    if(window.event) 
	{
		//captura posicao no IE 
        posX = evt.clientX; 
		posY = evt.clientY; 
    }
    else if(evt.which) 
	{
		//captura posicao no FF e similares 
        posX = evt.pageX; 
		posY = evt.pageY; 
    } 
	
	for(i=0; i < ApresItemMenu.length; i++)
	{
		
		DivMenu = 'MenuGerConItem_' + i;
		
		if (ApresItemMenu[i])
			document.getElementById(DivMenu).style.display = 'block';
		else
			document.getElementById(DivMenu).style.display = 'none';
		
	}
	
	document.getElementById("MenuGerConItem").style.display = 'block';
	document.getElementById("MenuGerConItem").style.left = mouseX(evt);
	document.getElementById("MenuGerConItem").style.top = mouseY(evt);
	
} 

/**
 * Fecha menu do gerenciador de conteúdo
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function FechaMenuGerContItem(FechaMenuGerConItem)
{
	if (FechaMenuGerConItem) 
		document.getElementById('MenuGerConItem').style.display = 'none';
}

/**
 * Abre tela adicionar um novo conteúdo
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function AddItem()
{
	
	FechaMenuGerContItem(true);
	
	pop_up('adm/default.asp?cod_system=2&cod_funcao=9&param1=0&param2=' + ParamGerConItem[1] + '&param3=0&rand_url=' + Math.random(),'GerConteudo','no','yes','no','no','no',750,400,100,100);
	
}

/**
 * Abre tela editar um conteúdo
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function EditItem()
{
	
	FechaMenuGerContItem(true);
	
	pop_up('adm/default.asp?cod_system=2&cod_funcao=9&param1=' + ParamGerConItem[0] + '&param2=' + ParamGerConItem[1] + '&param3=' + ParamGerConItem[2] + '&rand_url=' + Math.random(),'GerConteudo','no','yes','no','no','no',750,400,100,100);
	
}

/**
 * Abre tela excluir um conteúdo
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function DelItem()
{
	
	FechaMenuGerContItem(true);
	
	pop_up('adm/default.asp?cod_system=2&cod_funcao=18&param1=' + ParamGerConItem[0] + '&param2=' + ParamGerConItem[1] + '&param3=' + ParamGerConItem[2] + '&rand_url=' + Math.random(),'GerConteudo','no','yes','no','no','no',500,200,100,100);
	
}

/**
 * Abre tela adicionar um novo conteúdo com item filho
 * @author Thiago Vieira de Castro
 * @version 01.00.00
 */
function AddItemFilho()
{
	
	FechaMenuGerContItem(true);
	
	pop_up('adm/default.asp?cod_system=2&cod_funcao=9&param1=0&param2=' + ParamGerConItem[1] + '&param3=' + ParamGerConItem[0] + '&rand_url=' + Math.random(),'GerConteudo','no','yes','no','no','no',750,400,100,100);
	
}

function TrocaEmbedLogo()
{
	var i, j;
	var ObjEmbed
	var NewElement
	var WidthElement
	var HeightElement
	
	for(i=0; i< document.getElementsByTagName("embed").length; i++)
	{
		ObjEmbed = document.getElementsByTagName("embed").item(i);
		
		if (ObjEmbed.attributes.getNamedItem("type").value == 'application/x-shockwave-flash')
		{
			ObjEmbed.style.display = 'none';
			
			WidthElement	= ObjEmbed.attributes.getNamedItem("width").value;
			HeightElement	= ObjEmbed.attributes.getNamedItem("height").value;
			
			NewElement = document.createElement("div");
			
			NewElement.innerHTML = '&nbsp;';
			NewElement.style.backgroundImage = 'url(img/flashlogo.gif)';
			NewElement.style.backgroundRepeat = 'no-repeat';
			NewElement.style.backgroundPosition = 'center center';
			NewElement.style.border = 'darkgray 1px solid';
			NewElement.style.width = WidthElement;
			NewElement.style.height = HeightElement;
			
			ObjEmbed.parentNode.insertBefore(NewElement,ObjEmbed);
			
		}
	}
	
}


//-->