//########################//########################
// Função para iniciarmos o Ajax no browser do cliente.
function openAjax() {
	var ajax;
	try{
		ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers decentes, como: Firefox, Safari, dentre outros.
	}catch(ee){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
			}catch(E){
				ajax = false;
			}
		}
	}
	return ajax;
}
// Função para trocar titulo quando uzar ajax
function trocatitulo(titulo,id){
	var exibe = document.getElementById(id);
	exibe.innerHTML = titulo;
}

// Função Para utilizar ajax geral
function ajaxinteligente(arquivo,querystring,id,cor,idiomab) {
	if(document.getElementById) { // Para os browsers complacentes com o DOM W3C.
		var exibeResultado = document.getElementById(id); // div que exibirá o resultado da busca.
		if(arquivo != "" && arquivo != null) { // Verifica se o campo não está vazio
			var ajax = openAjax(); // Inicia o Ajax.
			ajax.open("GET", arquivo + querystring, true); // Envia o termo da busca como uma querystring, nos possibilitando o filtro na busca.
			ajax.onreadystatechange = function() {
				if(ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando...
					exibeResultado.innerHTML = "Carregando...";
				}
				if(ajax.readyState == 4) { // Quando estiver tudo pronto.
					if(ajax.status == 200) {
						var resultado = ajax.responseText; // Coloca o resultado (da busca) retornado pelo Ajax nessa variável (var resultado).
						resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
						resultado = unescape(resultado); // Resolve o problema dos acentos
						
						exibeResultado.style.background = cor;
					
						exibeResultado.innerHTML = resultado;
					} else {
						exibeResultado.innerHTML = "Erro: Por favor, informe ao Administrador (www.expertu.com.br).";
					}
				}
			}
			ajax.send(null); // submete
		} 
	}
}


function verificacep(t) {
	
	if(isEmpty(document.formcadastro.cep.value) || !checkField(document.formcadastro.cep.value))
	{
		warnInvalid(document.formcadastro.cep,'O CEP está vazio ou é inválido!');
		
	}else{
	
				if(document.getElementById) { // Para os browsers complacentes com o DOM W3C.
					var cep = document.getElementById('cep').value; // Pega o termo digitado no campo de texto.
					//alert(termo);
					var exibeResultado = document.getElementById('exibeendereco'); // div que exibirá o resultado da busca.
					if(cep != "" && cep != null && cep.length >= 3) { // Verifica se o campo não está vazio, ou se foi digitado no mínimo três caracteres.
						var ajax = openAjax(); // Inicia o Ajax.
						ajax.open("GET", "ajax-cep.asp?t=" + t +"&c=" + cep, true); // Envia o termo da busca como uma querystring, nos possibilitando o filtro na busca.
						ajax.onreadystatechange = function() {
							if(ajax.readyState == 1) { // Quando estiver carregando, exibe: carregando...
								exibeResultado.innerHTML = "<br /><div  style=\"background:#ffffff; width:125px;  border:solid 1px #666666; padding:2px; margin:2px; font: 11px; bold Arial, Helvetica, sans-serif; color:#666666;\">Verificando CEP...</div>";
			
							}
							if(ajax.readyState == 4) { // Quando estiver tudo pronto.
								if(ajax.status == 200) {
									var resultado = ajax.responseText; // Coloca o resultado (da busca) retornado pelo Ajax nessa variável (var resultado).
									resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4)
									resultado = unescape(resultado); // Resolve o problema dos acentos
									
									exibeResultado.innerHTML = resultado;
									
										if ((document.getElementById('btfinalizar').style.display == "none") && (resultado != '')) {
											document.getElementById('btfinalizar').style.display = "block";
										}else {
											document.getElementById('btfinalizar').style.display = "none";
										}	
									
								} else {
									exibeResultado.innerHTML = "Erro: consulte o suporte da expertu.com.br";
									document.getElementById('btfinalizar').style.display = "none";
								}
							}
							
						}
						ajax.send(null); // submete
					} 
				}
	}
}
//FIM AJAX
//########################//########################

//#################################################
//FUNÇÕES PRÉ-VISUALIZAÇÃO
//#################################################
function getElt(id) {
  return document.getElementById ? document.getElementById(id) :
           (document.all ? document.all[id] : 0);
}

function toggle(id, show) {
  var elt = getElt(id);
  if (! elt) return;
  if (show > 0 || (! show && elt.style.display == 'none')) {
    elt.style.display = '';
    toggled = displayed = id;
  } else {
    elt.style.display = 'none';
    toggled = displayed = 0;
  }
}

function olhadinha(id, show, post) {
  var lk = getElt('po-' + id);
  var fr = getElt('pf-' + id);
  if (! lk || ! fr) return false;
  toggle('pf-' + id, show);
  toggle('po-' + id, - show);
  toggle('pc-' + id, show);
  if (! show) return;
  if (fr.src) ;
  else if (post) postlink(lk, 'pf-'+id);
  else fr.src = lk.href;
  return false;
}


var wForm = "";
function popWform(value){
	wForm = value;
}
//FIM FUNÇÕES PRÉ-VISUALIZAÇÃO
//#################################################

//conta caracteres no campo textarea
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
	else 
	countfield.value = maxlimit - field.value.length;
}


// Mascara para Data
// Instrução de chamada no <input>:
// onkeypress="FormataData(this,event)"
function FormataData(Campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = Campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;
	if( tecla != 9 && tecla != 8 ) 	{
		if( tam > 2 && tam < 5 )
			Campo.value = vr.substr( 0, tam - 2 ) + '/' + vr.substr( tam - 2, tam );
		if( tam >= 5 && tam <= 10 )
			Campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 );
	}
}




function mostradivoculta(div) {
	if (document.getElementById(div).style.display == "none") {
		document.getElementById(div).style.display = "block";
	}else{
		document.getElementById(div).style.display = "none";
	}
}
function menu(sID) {
	var atual = sID;
	//Obtém os links do menu
	var menu=document.getElementById("menu")
	var links=menu.getElementsByTagName("a")
	//Limpa as classes do menu
	for(var i=0;i<links.length;i++)
	{
		if(i == 2) {
			links[i].className="linkanuncios";
		}else{
			links[i].className="linkmenu";
		}
	}
	if ((atual > 0) || (atual < links.length))
	{
		 links[atual].className="selecionado"+sID;	
	}
}

function mostramenu(id,tamanho) {
	var tag = document.getElementById(id);
	tag.className="menuselecionado";
	tag.style.width=tamanho+"px";
}
function escondemenu(id,classe) {
	var tag = document.getElementById(id);
	tag.className=classe;
}






//########################//########################
//Texto na barra de status
function wiper()
{
        if (stcnt > -1) str = wmsg[stcnt]; else str = wmsg[0];
        if (stcnt-- < -40) stcnt=31;
        status = str;
        clearTimeout(timeID);
        timeID = setTimeout("wiper()",100);
}

msg = "ANGELUS";
timeID = 10;
stcnt = 16;
wmsg = new Array(33);
wmsg[0]=msg;
blnk = "                                                               ";
for (i=1; i<32; i++)
	{
		b = blnk.substring(0,i);
		wmsg[i]="";
		for (j=0; j<msg.length; j++) wmsg[i]=wmsg[i]+msg.charAt(j)+b;
	}
//wiper()
//########################//########################			






//########################
//Função para o menu
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
//########################

//##########################################################################
//FUNÇÃO PARA REDIMENSIONAR A JANELA NO TAMANHO DA IMAGEM QUE ESTÁ ABRINDO
function reSizeImage() {
	//Pego o tamanho da tela Horizontal e Vertical
	var valorW = screen.width;
	var valorH = screen.height;
	//Pego o tamanho da imagem Horizontal e Vertical
	var width = document.getElementById('imagem').width;
	var height = document.getElementById('imagem').height;
	//Variavel que identifica se a imagem eh maior que a tela
	var estouro = false;
	//Se o tamanho Horizontal da imagem for maior que o tamanho da tela
	if ( width > valorW ) {
		//Calculo o tamanho vertical da imagem proporcional ao tamanho da tela
		height = retornaProporcional( width, height, valorW );
		width = valorW;
		//Redimensiono a imagem para o tamanho da tela
		//Diminuo um pouco a imagem para que ela seja exibida completa
		//Windows XP deixa uma barra maior na parte inferior do popup
		document.getElementById('imagem').width = width - 12;
		document.getElementById('imagem').height = height - 60;
		estouro = true;
	}
	//Se o tamanho Vertical da imagem for maior que o tamanho da tela
	if ( height > valorH ) {
		//Calculo o tamanho horizontal da imagem proporcional ao tamanho da tela
		width = retornaProporcional( height, width, valorH );
		height = valorH;
		//Redimensiono a imagem para o tamanho da tela
		//Diminuo um pouco a imagem para que ela seja exibida completa
		//Windows XP deixa uma barra maior na parte inferior do popup
		document.getElementById('imagem').width = width - 12;
		document.getElementById('imagem').height = height - 60;
		estouro = true;
	}
	if ( !estouro ) {
		width += 12;
		height += 60;
	}
	window.resizeTo(width+20,height+20);
	self.focus();
};

function doTitle(title) {
	//Altero o Titulo da janela
	document.title = title;
}

function retornaProporcional( x, y, valor ) {
	var retorno;
	//Calculo um valor proporcional para y de acordo com x e valor
	retorno = new Number( y / ( x / valor ) );
	return retorno.toFixed(0);
}

function openWindow(theURL,winName,winWidth,winHeight,features) {
  features = features+',width='+winWidth+',height='+winHeight+',top=0,left=0';
  window.open(theURL,winName,features);
}
//FIM REDIMENSIONA
//##########################################################################


// JavaScript
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function IrAoCorreio()
{
  open('http://www.correios.com.br/servicos/cep/cep_default.cfm','IrAoCorreio','location=no,resize=no, width=730,height=400,left=18,top=18,maximized=0,scrollbars=1');
}

/************************************************
* function verificaDataform
* Verifica se um campo data é válido.
* Input: Campo do formulário que contém a data
* Esta função pega o campo diretamente, pois assim
* pode dar uma resposta melhor ao usuário.
*************************************************/

function verificaDataform(data){
	var Date = new String(data);
	Day = "";
	Month = "";
	Year = "";
	i =  0;
	for (i=0;(i<Date.length) && (Date.charAt(i) != '/');i++)
		Day = Day + Date.charAt(i);
	i++;
	for (;(i<Date.length) && (Date.charAt(i) != '/');i++)
		Month = Month + Date.charAt(i);
	i++;
	for (;(i<Date.length);i++)
		Year = Year + Date.charAt(i);
	for(i=0;i<Date.length;i++){
		NroAsc = asc(Date.substring(i,i+1))
		if (!(NroAsc>=48 && NroAsc<=57) || !(NroAsc = 47) )  {
			return false;
		}
	}
	if(!isNumeric(Month)) {
		return false;
	}
	if (eval(Month) > 12){
		return false;
	}
	if(!isNumeric(Day)) {
		return false;
	}
	if (eval(Day) > 31){
		return false;
	}
	if(!isNumeric(Year)) {
		return false;
	}
	if(eval(Year) < 1900) {
		return false;
	}
	return true;
}


/************************************************
* function verificaCPF
* Verifica se um CPF é válido
* Input: cpf a ser verificado
************************************************/

function verificaCPF(cpf)
{
	var dac = "", inicio = 2, fim = 10, soma, digito, i, j
	for (j=1;j<=2;j++) {
		soma = 0
		for (i=inicio;i<=fim;i++) {
			soma += parseInt(cpf.substring(i-j-1,i-j))*(fim+1+j-i)
		}
		if (j == 2) { soma += 2*digito }
		digito = (10*soma) % 11
		if (digito == 10) { digito = 0 }
		dac += digito
		inicio = 3
		fim = 11
	}
	return (dac == cpf.substring(cpf.length-2,cpf.length))
}

/************************************************
* function verificaCGC
* Verifica se um CGC é válido
* Input: cgc a ser verificado
************************************************/

function verificaCGC(scgc) {
	cgc = trimtodigits(scgc);
	if ((cgc.indexOf("-") != -1) || (cgc.indexOf(".") != -1) || (cgc.indexOf("/") != -1)){
		return( false )
	}
	var df, resto, dac = ""
	df = 5*cgc.charAt(0)+4*cgc.charAt(1)+3*cgc.charAt(2)+2*cgc.charAt(3)+9*cgc.charAt(4)+8*cgc.charAt(5)+7*cgc.charAt(6)+6*cgc.charAt(7)+5*cgc.charAt(8)+4*cgc.charAt(9)+3*cgc.charAt(10)+2*cgc.charAt(11)
	resto = df % 11
	dac += ( (resto <= 1) ? 0 : (11-resto) )
	df = 6*cgc.charAt(0)+5*cgc.charAt(1)+4*cgc.charAt(2)+3*cgc.charAt(3)+2*cgc.charAt(4)+9*cgc.charAt(5)+8*cgc.charAt(6)+7*cgc.charAt(7)+6*cgc.charAt(8)+5*cgc.charAt(9)+4*cgc.charAt(10)+3*cgc.charAt(11)+2*parseInt(dac)
	resto = df % 11
	dac += ( (resto <= 1) ? 0 : (11-resto) )
	return (dac == cgc.substring(cgc.length-2,cgc.length))
}

/************************************************
* function verificaEmail
* Verifica se um email é válido
* Input: email a ser verificado
************************************************/

function verificaEmail(email) {
	var s = new String(email);
	// { } ( ) < > [ ] | \ /
	if ((s.indexOf("{")>=0) || (s.indexOf("}")>=0) || (s.indexOf("(")>=0) || (s.indexOf(")")>=0) || (s.indexOf("<")>=0) || (s.indexOf(">")>=0) || (s.indexOf("[")>=0) || (s.indexOf("]")>=0) || (s.indexOf("|")>=0) || (s.indexOf("\"")>=0) || (s.indexOf("/")>=0) )
		return false;
	if (vogalAcentuada(email))
		return false;
	// & * $ % ? ! ^ ~ ` ' "
	if ((s.indexOf("&")>=0) || (s.indexOf("*")>=0) || (s.indexOf("$")>=0) || (s.indexOf("%")>=0) || (s.indexOf("?")>=0) || (s.indexOf("!")>=0) || (s.indexOf("^")>=0) || (s.indexOf("~")>=0) || (s.indexOf("`")>=0) || (s.indexOf("'")>=0) )
		return false;
	// , ; : = #
	if ((s.indexOf(",")>=0) || (s.indexOf(";")>=0) || (s.indexOf(":")>=0) || (s.indexOf("=")>=0) || (s.indexOf("#")>=0) )
		return false;
	// procura se existe apenas um @
	if ( (s.indexOf("@") < 0) || (s.indexOf("@") != s.lastIndexOf("@")) )
		return false;
	// verifica se tem pelo menos um ponto após o @
	if (s.lastIndexOf(".") < s.indexOf("@"))
		return false;
	return true;
}

/************************************************
* function verificaCEP
* Verifica se o CEP está no formato correto
* Input: CEP a ser verificado
************************************************/

function verificaCEP (cep) {
	s = new String(cep);
	if ((s.length > 9) || (s.length < 5))
		return false;
	if (!isInteger(cep))
		return false;
	return true;
}

/************************************************
* function isInteger
* Verifica se um campo é inteiro, inclui dígitos de 0 a 9, vírgula, ponto, espaços e -
* Input: campo a ser verificado
************************************************/

function isInteger(s){
	var i;
	if (isEmpty(s)) 
		return false;
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (!isNumber(c)) return false;
	}
	return true;
}

/************************************************
* function isNumeric
* Verifica se um campo é numérico. Se contém apenas dígitos de 0 a 9
* Input: campo a ser verificado
************************************************/

function isNumeric(s){
	var i;
	if (isEmpty(s)) 
		return false;
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (!isDigit(c)) return false;
	}
	return true;
}

/************************************************
* function warnInvalid
* Gera um alert para o usuário e volta o foco para
* o campo que está com problema
* Input: theField - campo do formulário com problema
*        warnText - texto a ser mostrado no alert
************************************************/

function warnInvalid (theField, warnText)
{   theField.focus()
	theField.select()
	alert(warnText)
	return false
}

// Verifica se o caracter é um dígito de 0 a 9
function isDigit (c)
{ return ((c >= "0") && (c <= "9")) }

// Verifica se uma string tem vogais acentuadas
function vogalAcentuada(s) {
	ls = s.toLowerCase();
	if ((ls.indexOf("á")>=0) || (ls.indexOf("à")>=0) || (ls.indexOf("ã")>=0) || (ls.indexOf("â")>=0) || (ls.indexOf("é")>=0) || (ls.indexOf("í")>=0) || (ls.indexOf("ó")>=0) || (ls.indexOf("õ")>=0) || (ls.indexOf("ô")>=0) || (ls.indexOf("ú")>=0) || (ls.indexOf("ü")>=0))
		return true;
}

// Gera uma string com os caracteres básicos na sequência de códigos ASC
function makeCharsetString(){
	var astr
	astr = ' !"#$%&\'()*+,-./0123456789:;<=>?@'
	astr+= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	astr+= '[\]^_`abcdefghijklmnopqrstuvwxyz'
	astr+= '{|}~'
	return astr
}

// Retorna o código ASC do caracter passada por parâmetro
function asc(achar){
	var n=0;
	var ascstr = makeCharsetString()
	for(i=0;i<ascstr.length;i++){
		if(achar==ascstr.substring(i,i+1)){
			n=i;
			break;
		}
	}
	return n+32
}

//Remove todos os caracteres excetos 0-9
function trimtodigits(tstring){
  s=""; 
  ts=new String(tstring);
  for (x=0;x<ts.length;x++){
   ch=ts.charAt(x);
	if (asc(ch)>=48 && asc(ch)<=57){
	  s=s+ch;
	}
  }
  return s;
}
/*inicio */


// Retorna o código ASC do caracter passada por parâmetro
function asc(achar){
	var n=0;
	var ascstr = makeCharsetString()
	for(i=0;i<ascstr.length;i++){
		if(achar==ascstr.substring(i,i+1)){
			n=i;
			break;
		}
	}
	return n+32
}
// Gera uma string com os caracteres básicos na sequência de códigos ASC
function makeCharsetString(){
	var astr
	astr = ' !"#$%&\'()*+,-./0123456789:;<=>?@'
	astr+= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	astr+= '[\]^_`abcdefghijklmnopqrstuvwxyz'
	astr+= '{|}~'
	return astr
}

// Verifica se uma string tem vogais acentuadas
function vogalAcentuada(s) {
	ls = s.toLowerCase();
	if ((ls.indexOf("á")>=0) || (ls.indexOf("à")>=0) || (ls.indexOf("ã")>=0) || (ls.indexOf("â")>=0) || (ls.indexOf("é")>=0) || (ls.indexOf("í")>=0) || (ls.indexOf("ó")>=0) || (ls.indexOf("õ")>=0) || (ls.indexOf("ô")>=0) || (ls.indexOf("ú")>=0) || (ls.indexOf("ü")>=0))
	return true;
}

// Verifica se o caracter pode fazer parte de um número: 0-9 , . ( ) - e espaço
function isNumber (c) { 
	return ((c >= "0") && (c <= "9") || (c=="-") || (c=="(") || (c==")") || (c==" ") || (c==".") || (c==",")) 
}

// Verifica se o caracter é um dígito de 0 a 9
function isDigit (c) { 
	return ((c >= "0") && (c <= "9")) 
}

/************************************************
* function checkField
* Verificação básica de um campo de formulário por "coisas bobas": & < > | \ /
* Input: campo a ser verificado
************************************************/

function checkField(s) {
	if ((s.indexOf("&")>=0) || (s.indexOf("<")>=0) || (s.indexOf(">")>=0) || (s.indexOf("|")>=0) || (s.indexOf("\"")>=0) || (s.indexOf("/")>=0) )
		return false;
	return true;
}

/************************************************
* function isEmpty
* Verifica se um campo está vazio
* Input: campo a ser verificado
************************************************/

function isEmpty(s) {
	return ((s == null) || (s.length == 0));
}


/************************************************
* function warnInvalid
* Gera um alert para o usuário e volta o foco para
* o campo que está com problema
* Input: theField - campo do formulário com problema
*        warnText - texto a ser mostrado no alert
************************************************/

function warnInvalid (theField, warnText)
{   theField.focus()
	theField.select()
	alert(warnText)
	return false
}

/************************************************
* function warnInvalid_SelectBox
* Gera um alert para o usuário e volta o foco para
* o campo que está com problema
* Esta função é específica para ser usada com campos Select, para outros campos, usar a warnInvalid
* Input: theField - campo do formulário com problema
*        warnText - texto a ser mostrado no alert
************************************************/
function warnInvalid_SelectBox (theField, s)
{
	theField.focus();
	alert(s);
	return false;
}

function openCentered(theURL,winName,winWidth,winHeight,features) {
  var w = (screen.width - winWidth)/2;
  var h = (screen.height - winHeight)/2 - 60;
  features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
  window.open(theURL,winName,features);
}


		
function toggleDisplay(sID){

		//PRELOAD
	transimg = new Image; 
	transimg.src = 'imgsite/menu_seta_abaixo.gif';
	transimg2 = new Image; 
	transimg2.src = 'imgsite/menu_seta_direita.gif';
	if (document.getElementById)
	{
		if (document.getElementById(sID).style.display == "none") {
			document.getElementById("img"+sID).src = transimg.src;
			document.getElementById(sID).style.display = "block";
			//alert("if");
			//document.getElementById("img"+sID).src = "imgsite/menu_setacima.gif";
			setCookie(sID, "1");
		}
		else {
			//alert("else");
			document.getElementById("img"+sID).src = transimg2.src;
			document.getElementById(sID).style.display = "none";
			//document.getElementById("img"+sID).src = "imgsite/menu_setabaixo.gif";
			deleteCookie(sID);
		}
	}
	else
	{
		alert('Your browser does not allow for dynamic javascript and is not standards-compliant.\nPlease update your browser to use our site and have it function correctly.');
	};

}

function toggleDisplayGeral(sID){

	//PRELOAD
	if (document.getElementById)
	{
		if (document.getElementById(sID).style.display == "none") {
			document.getElementById(sID).style.display = "block";
			//alert("if");
			//document.getElementById("img"+sID).src = "imgsite/menu_setacima.gif";
			setCookie(sID, "1");
		}
		else {
			//alert("else");
			document.getElementById(sID).style.display = "none";
			//document.getElementById("img"+sID).src = "imgsite/menu_setabaixo.gif";
			deleteCookie(sID);
		}
	}
	else
	{
		alert('Your browser does not allow for dynamic javascript and is not standards-compliant.\nPlease update your browser to use our site and have it function correctly.');
	};

}

function setCookie(name, value, expires, path, domain, secure) {
		  var curCookie = name + "=" + escape(value) +
		  ((expires) ? "; expires=" + expires.toGMTString() : "") +
		  ((path) ? "; path=" + path : "") +
		  ((domain) ? "; domain=" + domain : "") +
		  ((secure) ? "; secure" : "");
		  document.cookie = curCookie;
 }
 function getCookie(name) {
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);
		if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
		} else
		begin += 2;
		var end = document.cookie.indexOf(";", begin);
		if (end == -1)
		end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
 }
 function deleteCookie(name, path, domain) {
		if (getCookie(name)) {
			   document.cookie = name + "=" + 
			   ((path) ? "; path=" + path : "") +
			   ((domain) ? "; domain=" + domain : "") +
			   "; expires=Thu, 01-Jan-70 00:00:01 GMT";
			   //history.go(0);
		}
 }
 function fixDate(date) {
		var base = new Date(0);
		var skew = base.getTime();
		if (skew > 0) date.setTime(date.getTime() - skew);
 } 
