// JavaScript Document
function insertObject(str) {
    document.write(str);
}

// VARIAVEIS DO AJAX
var oReq
var xobjDestino
var xnomePropriedade = new String()
var xfuncaoAposResultado
var xconteudoAnterior
var xobjTmp
var oXmlInformativo
var oxmlDoc
var oxmlDoc2
var xIndexInformativo = new Number(0)
var xintervalInformativo
var xulrInformativo

var sRequestBody = new String()

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

try{window.parent.document.documentElement.scrollTop = '0px'}catch(e){}
try{window.parent.document.body.scrollTop = '0px'}catch(e){}

function lerInformativo(direcao, secretaria) {

	var xdivNoticiaImagem = document.getElementById('divNoticiaImagem')
	if(!(xdivNoticiaImagem ))
	{
		window.clearInterval();
	}
	else
	{
		//CASO EXISTA EXECUTA A FUN O
		var xdivNoticiaTitulo = document.getElementById('divNoticiaTitulo')
		var ximgInformativoPause = document.getElementById('imgInformativoPause')
		if(secretaria) {
			//var url = '/sistemas/informativos/XMLSecretarias.asp?sec=' + secretaria 
			var url = '/sistemas/informativos/informativoXml.aspx?id=' + secretaria 
		} else {
			var url = '/sistemas/informativos/informativoXml.aspx'
		}
		

		if (!oxmlDoc) {
			// Procura por um objeto nativo (Mozilla/Safari) 
			if (window.XMLHttpRequest) { 
				oReq = new XMLHttpRequest(); 
				oReq.onreadystatechange = lerDadosXML_Informativo; 
				oReq.open("GET", url, true); 
				oReq.send(null)
				//window.setTimeout('oReq.send(null)', 500); 
			// Procura por uma verso ActiveX (IE) 
			} else if (window.ActiveXObject) { 
				oReq = new ActiveXObject("Microsoft.XMLHTTP"); 
				if (oReq) { 
					oReq.onreadystatechange = lerDadosXML_Informativo; 
					oReq.open("GET", url, true); 
					//oReq.setRequestHeader("Content-Type", "text/xml");
					/*
					oReq.setRequestHeader("Content-Type", "text/html");
					oReq.setRequestHeader("charset", "iso-8859-1"); 
					*/
					oReq.send()
					//window.setTimeout('oReq.send()', 500); 
				} 
			} 
		} else {
	
			oxmlDoc2 = oxmlDoc.getElementsByTagName('noticia')
			
			if (direcao=='parar') {
				if (xintervalInformativo) {
					window.clearInterval(xintervalInformativo)
					xintervalInformativo=null
					ximgInformativoPause.src = '/comum/images/bt_play.gif'
				} else {
					
					if(secretaria) {
						xintervalInformativo = window.setInterval("lerInformativo('proximo',secretaria)", 10000)
					} else {
						xintervalInformativo = window.setInterval("lerInformativo('proximo')", 10000) 
					}
					
					
					ximgInformativoPause.src = '/comum/images/bt_pause.gif'
				}
				return
			}
	
			if (direcao=='anterior') {
				xIndexInformativo = xIndexInformativo - 2
				if (xIndexInformativo<0) {
					xIndexInformativo = oxmlDoc2.length-1
				}
			}
			
			if (!direcao || direcao=='proximo') {
				if (xIndexInformativo>oxmlDoc2.length-1) {
					xIndexInformativo = 0
				}
			}
	
			xdivNoticiaImagem.innerHTML = '<img src="/sistemas/informativos/img/' + oxmlDoc2[xIndexInformativo].attributes.getNamedItem('foto').value + '" width="100%" onerror="this.src=\'/sistemas/informativos/img/img_InformativoPadrao.jpg\';">'
			xdivNoticiaTitulo.innerHTML = oxmlDoc2[xIndexInformativo].attributes.getNamedItem('titulo').value
			xurlInformativo = '/sistemas/informativos/informativo.asp?id=' + oxmlDoc2[xIndexInformativo].attributes.getNamedItem('id').value
			xIndexInformativo = xIndexInformativo + 1
			
			
		}
				
	//ENCERRA A CONDICIONAL CLEARINTERVAL
	}
}

function lerDadosXML_Informativo() {

	// apenas quando o estado for "completado" 
	if (oReq.readyState == 4) { 
		// apenas se o servidor retornar "OK" 
		if (oReq.status == 200) { 
			// procura pela div id="news" e insere o conteudo  
			// retornado nela, como texto HTML 
			oxmlDoc = oReq.responseXML
			
			lerInformativo('proximo')
			xintervalInformativo = window.setInterval("lerInformativo('proximo')", 10000)
		} else { 
			/*
			alert("Ocorreu um erro ao obter os dados:\n" + oReq.statusText); 
			sendUrl('/erro.htm', 'divConteudo', 'innerHTML', 'retornarResultado()')
			*/
			//openUrl('/erro.htm', 'menuPrincipal.aspx', 'principal')
			//eval("xobjDestino." + xnomePropriedade + "=xconteudoAnterior")
		}
	} 
	
}

function sendUrl(url, nomeObjetoResultado, propriedadeDestino, aposResultadoExecutarFuncao) {

	xobjDestino = document.getElementById(nomeObjetoResultado)
	xnomePropriedade = propriedadeDestino
	xfuncaoAposResultado = aposResultadoExecutarFuncao
	// Estava passando duas vezes em todas as chamada de openUra... comentado dia 12/01/2011
	//eval('xconteudoAnterior = xobjDestino.' + xnomePropriedade)
	
	// Procura por um objeto nativo (Mozilla/Safari) 
	if (window.XMLHttpRequest) { 
		oReq = new XMLHttpRequest(); 
		oReq.onreadystatechange = lerDadosXML; 
		oReq.open("GET", url, true); 
		oReq.send(null)
		//window.setTimeout('oReq.send(null)', 500); 
	// Procura por uma vers o ActiveX (IE) 
	} else if (window.ActiveXObject) { 
		oReq = new ActiveXObject("Microsoft.XMLHTTP"); 
		if (oReq) { 
			oReq.onreadystatechange = lerDadosXML; 
			oReq.open("GET", url, true); 
			//oReq.setRequestHeader("Content-Type", "text/xml");
			/*
			oReq.setRequestHeader("Content-Type", "text/html");
			oReq.setRequestHeader("charset", "iso-8859-1"); 
			*/
			oReq.send()
			//window.setTimeout('oReq.send()', 500); 
		} 
	} 

}
	
function lerDadosXML() {

	// apenas quando o estado for "completado" 
	if (oReq.readyState == 4) { 
		// apenas se o servidor retornar "OK" 
		if (oReq.status == 200) { 

			// procura pela div id="news" e insere o conteudo  
			// retornado nela, como texto HTML 
			if (xobjDestino && xnomePropriedade) {
				eval("xobjDestino." + xnomePropriedade + "=oReq.responseText")
			}
			
			if (xfuncaoAposResultado) {
				eval("try { " + xfuncaoAposResultado + " } catch(e) { if (e.message) { alert(e.name + ' \\n \\n' + ' - ' + e.message) } else {	alert(e) }	}" )
			}
			
		} else { 
			alert("Ocorreu um erro ao obter os dados:\n" + oReq.statusText); 
			sendUrl('/erro.htm', 'divConteudo', 'innerHTML', 'retornarResultado()')
			//openUrl('/erro.htm', 'menuPrincipal.aspx', 'principal')
			//eval("xobjDestino." + xnomePropriedade + "=xconteudoAnterior")
		}
	} 
	
}

function openUrl(url, menu, css, urlTituloArea, afterScript, sys, objDestino) {
	
	var xurl = new String()
	mostrarWait()
	
	xurl = '/getUrl.aspx?'
	xurl = xurl + 'url=' + escape(url)
	
	if (menu) {
		xurl = xurl + '&menu=' + escape(menu)
	}

	if (css) {
		xurl = xurl + '&css=' + escape(css)
	}

	if (urlTituloArea) {
		xurl = xurl + '&urlTituloArea=' + escape(urlTituloArea)
	}

	if (afterScript) {
		xurl = xurl + '&afterScript=' + escape(afterScript)
	}

	if (sys) {
		xurl = xurl + '&sys=' + escape(sys)
	}
	
	if (objDestino) {
		xurl = xurl + '&objDestino=' + escape(objDestino)
	}
	
	
	xobj = document.getElementById('ifrmGetUrl_Id')
	if (xobj) {
	    xobj.src = xurl
	    //window.open(xurl, 'ifrmGetUrl')
	}
}

function abrirInformativo(url) {
	
	xobj = document.getElementById('divAreaTrabalho')
	if (xobj) {
		openUrl(url, 'menuPrincipal.aspx', 'principal', '', '', 'yes' )
	} else {
		window.open(url, '_self')	
	}
}
////////////////////////////////////////////////////////Informativos Incluedes////////////////////////////////////////////////////////////////////////////////////////


					
					function abrirInformativoInclude(url) {
						xobj = document.getElementById('divAreaTrabalho')
						if (xobj) {
							window.parent.openUrl(url, 'menuPrincipal.aspx', 'principal', '', '', 'yes' )
						} else {
							window.parent.openUrl(url, 'menuPrincipal.aspx', 'principal', '', '', 'yes' )
							//window.open(url, '_self')	
						}
					}
					



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function aplicarTituloArea(url, destino) {
	var xtrTituloArea = document.getElementById('trTituloArea')
	var xtdTituloArea = document.getElementById('tdTituloArea')
	xtrTituloArea.style.display = ''
	sendUrl(url, destino, 'innerHTML')
}

function openSistema(url, menu, css, urlTituloArea) {
	
	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	var xhtml = new String('')

	/*
	xhtml = ''
	xhtml = xhtml + '<table width="100%" border="0" cellspacing="0" cellpadding="5">'
	xhtml = xhtml + '  <tr>'
	xhtml = xhtml + '    <td><div id="divTituloArea"></div> </td>'
	xhtml = xhtml + '  </tr>'
	xhtml = xhtml + '  <tr>'
	xhtml = xhtml + '    <td></td>'
	xhtml = xhtml + '  </tr>'
	xhtml = xhtml + '</table>'
	*/
	
	xhtml = '<iframe id="ifrmSistemaId" name="ifrmSistema" width="100%" height="0" frameborder="0" src="' + url + '"></iframe>'
	xdivAreaTrabalho.innerHTML = xhtml

	if (menu) {
		sendUrl(menu, 'divMenuPrincipal', 'innerHTML', 'aplicarTituloArea("' + urlTituloArea + '", "tdTituloArea")' )
	}

	/*
	if (urlTituloArea) {
		sendUrl(urlTituloArea, 'trTituloArea', 'innerHTML')
	}
	*/
	
	if (css) {
		aplicarCss(css)	
	}

}

function resizeIfrmSistema() {
	
	var xobjRelativo
	var xhtml = new String('')
	var xdivBody
    
    var xifrmSistema = document.getElementById('ifrmSistemaId')
    if (xifrmSistema) {
		
		
		try {
			xhtml = '<div id="divBody">' + ifrmSistema.document.body.innerHTML + '</div>'
			ifrmSistema.document.body.innerHTML = xhtml
			xdivBody = ifrmSistema.document.getElementById('divBody')
			xheight = xdivBody.offsetHeight + 50
        	xifrmSistema.height = xheight + 'px'
		} catch(e) {
			x=1	
		}
    }
    
}

function resizeIfrmSistema2() {

    var xifrmSistema = window.parent.document.getElementById('ifrmSistemaId')
	var xdivBody
	var xhtml = new String('')
	
	if (xifrmSistema) {
		xhtml = '<div id="divBody">' + document.body.innerHTML + '</div>'
		document.body.innerHTML = xhtml
		xdivBody = document.getElementById('divBody')
		xheight = xdivBody.offsetHeight + 50
		xifrmSistema.height = xheight + 'px'
	}
	
}

function resizeIfrmSistema3() {

    var xifrmSistema = window.parent.document.getElementById('ifrmSistemaId')
	var xdivBody
	var xhtml = new String('')
	var erro = new Array()
	xheight = "";
	if (xifrmSistema) {
		
		if ( navigator.appName == "Microsoft Internet Explorer" )
		{	
			xheight = xifrmSistema.contentWindow.document.body.clientHeight + 20;
			
		}else{
			xheight = xifrmSistema.contentDocument.body.clientHeight + 50;
			
		}
		//document.getElementById('divAreaTrabalho').style.overflow = 'hidden';
		xifrmSistema.style.height = parseInt(xheight) + "px";
		//console.log(xifrmSistema.style.height + " / " + xifrmSistema.height);
	}
}

function resizeIfrmPrincipal() {

	try {
		
		if(document.all){
			var msg = navigator.appVersion;
			var erro = new Array();			
			var xifrmPrincipal = window.parent.parent.document.ifrmPrincipal;
			var xdivBody
			var xhtml = new String('')
			var xdivProvisorio
			var xifrmRedirect
			//Body margin 0px
			
			xifrmPrincipal.document.body.style.margin = '0px'
			xifrmPrincipal.document.body.style.overflow = 'hidden'
			//xifrmPrincipal.contentDocument.documentElement.style.overflow = 'hidden'
			
			//Redimencionando o iframe principal				
			if (xifrmPrincipal) {

				if ( !document.documentMode < 8 || !document.documentMode == "undefined" ) {
											
					xifrmRedirect = xifrmPrincipal.ifrmRedirect;//ifrmPrincipal.document.getElementById('ifrmRedirect');
					
				}else{
					//xifrmRedirect = xifrmPrincipal.contentDocument.getElementsByTagName('iframe')[0];
					xifrmRedirect = xifrmPrincipal.ifrmRedirect;
				}
				//document.all('ifrmPrincipal').contentDocument.all('ifrmRedirect');
				
				if (xifrmRedirect) {
					
					xheight = xifrmPrincipal.document.ifrmRedirect.document.body.scrollHeight
					
					xheight = xheight + 50
					xifrmRedirect.frameElement.style.height = '1px'
					xifrmRedirect.frameElement.style.height = xheight + 'px'
					if (ifrmPrincipal.ifrmRedirect) {
						ifrmPrincipal.ifrmRedirect.document.body.style.margin = '0px'
						ifrmPrincipal.ifrmRedirect.document.body.style.overflow = 'hidden'
						ifrmPrincipal.ifrmRedirect.document.documentElement.style.overflow = 'hidden'
					}
				}
				
				/*for (i in xifrmPrincipal.frameElement) erro.push(i);
				console.log(erro.join('\n'))*/
				
				xifrmPrincipal.frameElement.style.height = '1px'
				xifrmPrincipal.frameElement.style.height = xheight + 'px'
				
			} 

		} else {
			/*      FIREFOX      */
			var xifrmPrincipal = window.parent.parent.document.getElementById('ifrmPrincipalId')
			var xdivBody
			var xhtml = new String('')
			var xdivProvisorio
				
			//Redimencionando o iframe principal
			if (xifrmPrincipal) {
				xifrmRedirect = xifrmPrincipal.contentDocument.getElementsByTagName('iframe')[0];
				// ANTIGO NÃO FUNCIONAVA = xifrmPrincipal.contentDocument.getElementById('ifrmRedirect')
				
				if (xifrmRedirect) {
					xheight = xifrmRedirect.contentDocument.body.scrollHeight
					xheight = xheight + 20
					xifrmRedirect.style.height = '1px'
					xifrmRedirect.style.height = xheight + 'px'
					if (ifrmPrincipal.ifrmRedirect) {
						ifrmPrincipal.ifrmRedirect.document.documentElement.style.margin = '0px'
						ifrmPrincipal.ifrmRedirect.document.documentElement.style.overflow = 'hidden'
						ifrmPrincipal.ifrmRedirect.document.documentElement.style.overflow = 'hidden'
					}
				} else {
					xifrmLogin = document.getElementById('ifrmLogin');		
					xheight = 510;
				}
				//xheight = xheight + 50
				xifrmPrincipal.style.height = '1px'
				xifrmPrincipal.style.height = xheight + 'px'
	
			} 
			
		}
		
	} catch(e) {
		//return alert(e.description + " - " +msg)
	}
	
}

function guardarHistorico() {
	
	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	var xlinkCss = document.getElementById('linkCss')
	
	xvoltar_conteudo[xvoltar_conteudo.length+1] = xdivAreaTrabalho.innerHTML
	xvoltar_css[xvoltar_css.length+1] = xlinkCss.href

}

function voltar() {

	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	var xlinkCss = document.getElementById('linkCss')
	
	xdivAreaTrabalho.innerHTML = xvoltar_conteudo[xvoltar_conteudo.length-1]
	aplicarCss(xvoltar_css[xvoltar_css.length-1].toString().replace('comum/css/','').replace('.css',''))
	alert(xvoltar_css[xvoltar_css.length-1].toString().replace('comum/css/','').replace('.css',''))

}

function mostrarWait(pRollBack) {

	var xTdAreaTrabalho = document.getElementById('tdAreaTrabalho')
	xTdAreaTrabalho.style.height = 400
	
	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	
	try {
		if (!xdivAreaTrabalho) {
			xdivAreaTrabalho = window.parent.document.getElementById('divAreaTrabalho')
//			xdivAreaTrabalho.style.height = (document.documentElement.clientHeight - 130) - 20
		}
	
		if (!pRollBack) {
			xconteudoAnterior = xdivAreaTrabalho.innerHTML
			xdivAreaTrabalho.innerHTML = '<img src="comum/images/ic_wait.gif" alt="" />'
		} else {
			xdivAreaTrabalho.innerHTML = xconteudoAnterior
		}
	} catch(e) {
		return
	}
	
}

function aplicarCss(tipo) {
	
	var xlinkCss = document.getElementById('linkCss')
	if (!xlinkCss) {
	    xlinkCss = window.parent.document.getElementById('linkCss')
	}
/*	var ximgVoltar = document.getElementById('imgVoltar')
	if (!ximgVoltar) {
	    ximgVoltar = window.parent.document.getElementById('imgVoltar')
	}*/
	
	switch(tipo) {
		
		case 'principal':
		
			xlinkCss.href = 'comum/css/principal.css?'
			//ximgVoltar.src = '/comum/images/bt_voltar.gif'
			break
		
		case 'sasc':
		
			xlinkCss.href = 'comum/css/sasc.css?'
		//	ximgVoltar.src = '/comum/images/bt_voltar.gif'
			break
			
		case 'imprensa':
		
			xlinkCss.href = 'comum/css/imprensa.css?'
		//	ximgVoltar.src = '/comum/images/bt_voltar.gif'
			break
			
		case 'interna':
		
			xlinkCss.href = 'comum/css/interna.css?'
		//	ximgVoltar.src = '/comum/images/bt_voltar.gif'
			break
			
		default:
			
			xlinkCss.href = 'comum/css/principal.css'
		//	ximgVoltar.src = '/comum/images/bt_voltar.gif'
			break
		
	}
	
}

function configurarAreaTrabalho() {
	
	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	var xtablePrincipal = document.getElementById('tablePrincipal')
	
	xHeight = document.documentElement.clientHeight
	xHeight = xHeight - xtablePrincipal.rows[0].offsetHeight
	xHeight = xHeight - xtablePrincipal.rows[1].offsetHeight
	xHeight = xHeight - xtablePrincipal.rows[2].offsetHeight
	xHeight = xHeight - xtablePrincipal.rows[3].offsetHeight
	xHeight = xHeight - xtablePrincipal.rows[5].offsetHeight
	xdivAreaTrabalho.style.height = xHeight + 'px'
	
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function liberarAreaTrabalho() {
	
	var xdivAreaTrabalho = document.getElementById('divAreaTrabalho')
	
	xdivAreaTrabalho.style.height = ''
	
}





function show(variavel){
	if(document.getElementById(variavel).style.display == 'none')
		{
			document.getElementById(variavel).style.display = 'block';
		}else{
			document.getElementById(variavel).style.display = 'none';
			
			}

	
	}

function verificaInicioPublic(objeto, dtIniPublic) {

	var dtAtual = new Date();

	if (dtAtual>=dtIniPublic) {
		return true
	} else {
		return false
	}
	
//popup_validade.setDate(13); // Dia
	//popup_validade.setMonth(01); // Ms [ 01 equivale  02 ]

}

function iniciarPaginaPrincipal(){
	var popup_validade=new Date();
	popup_validade.setDate(11); // Dia
	popup_validade.setMonth(11); // Ms [ 01 equivale  02 ], OU SEJA, UM ARRAY COMEÇA DO ZERO AO .... 

	var hoje=new Date();
    /*
	aplicarCss('principal')
	configurarAreaTrabalho()
	window.setTimeout("sendUrl('home.aspx', 'divAreaTrabalho', 'innerHTML', 'principal', 'liberarAreaTrabalho()')", 1000)
	*/

	openUrl('home-nova.aspx', '', 'principal', '', 'window.parent.lerInformativo();')

	var width2 = 680;
	var left2 = parseInt((screen.width-width2) / 6);
	var width = 380;
	var left = parseInt((screen.width-width)/ 2)
	//if(hoje<popup_validade2) window.open('/comum/popups/luta_contra_aids.aspx','','width=300, height=300, top=100, left=10');
	//if(hoje<popup_validade) window.open('/comum/popups/claudia.aspx','','width=277, height=283, top=160, left=300');
	//if(hoje<popup_validade3) window.open('/comum/popups/daniel.aspx','','width=316, height=300, top=160, left=622');
	//window.open('/comum/popups/torpedosms.aspx','','width=300, height=300, top=200, left='+left);
	//if(hoje<popup_validade) window.open('/comum/popups/pedaladadobem.aspx','','width=387, height=387, top=100, left='+left2);
	//if(hoje<popup_validade) window.open('/comum/popups/natal.aspx','','width=380, height=380, top=100, left='+left);
	//if(hoje<popup_validade2) window.open('/comum/popups/feriado_25.aspx','','width=380, height=380, top=100, left=300');
	//if(hoje<popup_validade) window.open('/comum/popups/dia_sem_carro.aspx','','width=380, height=380, top=100, left='+left);
	//if(hoje<popup_validade) window.open('/comum/popups/feriado_independencia.aspx','','width=380, height=380, top=100, left='+left);
	//if(hoje<popup_validade) window.open('/comum/popups/baile_brega.aspx','','width=380, height=380, top=100, left='+left);
	//window.open('/comum/popups/vacinacao_antirrabica.aspx','','width=380, height=380, top=100, left='+left)
	//window.open('/comum/popups/audiencia2.aspx','','width=600, height=424, top=100, left='+left2+',resizable=no,location=no')
	//if(hoje<popup_validade) window.open('/comum/popups/pastel_bem.aspx','','width=380, height=380, top=100, left='+left);
	//if(hoje<popup_validade) window.open('/comum/popups/aviso_convocacao.aspx','','width=691, height=392, top=10, left=10');
	//window.open('/comum/popups/concurso_homologacao.aspx','','width=300, height=300, top=10, left=10')
	//window.open('/comum/popups/graacc.aspx','','width=300, height=300, top=10, left=10')
	//window.open('/comum/popups/diasemcarro.aspx','','width=470, height=456, top=10, left=10')
	//window.open('/comum/popups/aviso_financas.aspx','','width=570, height=402, top=10, left=10') 
	//window.open('/comum/popups/bombas.aspx','','width=250, height=244, top=10, left=20')
	//window.open('/comum/popups/convite.aspx','','width=450, height=261, top=10, left=20')
	//window.open('/comum/popups/femupo2008.aspx','','width=300, height=250, top=250, left=350')
}

function showMenuInicial(){
		document.getElementById('tableSecsHome').style.display = 'block';
		setTimeout(hideMenuInicial, 12000)
	}
function hideMenuInicial(){
		document.getElementById('tableSecsHome').style.display = 'none';
}

function showMenuPatIntra(){
		document.getElementById('tablePatrimonio').style.display = 'block';
		setTimeout(hideMenuPatIntra, 5000)
	}
function hideMenuPatIntra(){
		document.getElementById('tablePatrimonio').style.display = 'none';
}

	function validaEmail(mail){
		var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
		if(typeof(mail) == "string"){
			if(er.test(mail)){ return true; }
		}else if(typeof(mail) == "object"){
			if(er.test(mail.value)){ 
						return true; 
					}
		}else{
			return false;
			}
		}


function fundo(tipo){
	var obj=document.getElementById('corpo');
	{
		if (tipo == "gray")
			{obj.className='body1';}
		if (tipo == "white")
			{obj.className='body2';}
		if (tipo == "yellow")
			{obj.className='body3';}
		if (tipo == "green")
			{obj.className='body4';}
		if (tipo == "orange")
			{obj.className='body5';}
		if (tipo == "blue")
			{obj.className='body6';}
			
	}
}
function barras(tipo){
	var barras = document.getElementById('barra');
	{
		if (tipo == "gray")
			{barras.className='barra1';}
		if (tipo == "white")
			{barras.className='barra2';}
		if (tipo == "yellow")
			{barras.className='barra3';}
		if (tipo == "green")
			{barras.className='barra4';}
		if (tipo == "orange")
			{barras.className='barra5';}
		if (tipo == "blue")
			{barras.className='barra6';}
			
	}
}


function popGt() {

	//window.open('/sites/gt/materias/popGt.aspx','','width=400, height=581, top=10, left=10')
}

/*
function imgRamdom()
{
  var j;
  var imgMarcao= new Array()
  
  imgMarcao[imgMarcao.length]='/comum/images/bannerRotativos/avisoIssqn03.gif';
  imgMarcao[imgMarcao.length]='/comum/images/bannerRotativos/soudobem.gif';
  j=parseInt(Math.random()*imgMarcao.length);
  j=(isNaN(j))?0:j;
	document.getElementById('tdExibeFoto').innerHTML = "<img src='"+imgMarcao[j]+"' width='495'>";
}
*/


/*Busca Informativos Home*/
	function limpar (objeto, msg) {
		if (objeto.value == msg)objeto.value = '';
	}
	
	function mostrar (objeto, msg) {
		if (objeto.value == '')objeto.value = msg;
	}

/*Busca Informativos Home*/



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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//Includes Menu Obras
function includeMenuAObras() {
	//sendUrl('/comum/includes/menuAobras.aspx', 'divMenuAObras', 'innerHTML', 'retornarResultado()')
	sendUrl('/comum/includes/menuAobras.aspx', 'divMenuAObras', 'innerHTML', 'fixaRetornoDivAreaTrabalho()')
}

function acoplarMenuServicosOnlineHome()
{
	sendUrl('/comum/includes/menuServicosOnline.aspx', 'divMenuServicosOnlineHome', 'innerHTML', 'fixaRetornoDivAreaTrabalho(); ')	
}

function acoplarMenuFinancasOnlineHome()
{
	sendUrl('/comum/includes/menuFinancasOnline.aspx', 'divMenuFinancasOnlineHome', 'innerHTML', 'fixaRetornoDivAreaTrabalho(); ')	
}

function fixaRetornoDivAreaTrabalho(afterScript) {
	
	var xdivAreaTrabalho = window.parent.document.getElementById('divAreaTrabalho')
	var xdivConteudo = document.getElementById('divConteudo')
	
	xdivAreaTrabalho.innerHTML = xdivConteudo.innerHTML
	
	if (afterScript) {
		eval("try { " + afterScript + " } catch(e) { if (e.message) { alert(e.name + ' \\n \\n' + ' - ' + e.message) } else {	alert(e) }	}" )			
	}
	
}

//Menu Sites de Interesse
function toggleVis(elId,aIds) {
	// 
	try {
		
		if (toggleVis.arguments.length > 1) {
			for (i=0; i < aIds.length; i++) {
				var x  = aIds[i];
				el = document.getElementById(x);
				if (x != elId) {
					el.style.display = "none";
				}
			}
			
		}
		
		el = document.getElementById(elId);
			window.parent.document.documentElement.scrollTop = '139'
			if (el.style.display == "none") {
			el.style.display = "block";
		}
		else {
			if (toggleVis.arguments.length == 1) {
				el.style.display = "none";
			}
			if (toggleVis.arguments.length > 1) {
				var x  = aIds[0];
				if (x == "principal") {
					el = document.getElementById(x);
					el.style.display = "block";
				}
			}
		}
		
		window.parent.resizeIframeIntranet()
		
	} catch (e) {
		alert('Erro! - [toggleVis]\n\n' + e.message)	
	}
}

function toggleVisIntra(elId) {
	el = document.getElementById(elId);
	if (el.style.display == "none") el.style.display = "block";
	else el.style.display = "none";

	window.parent.resizeIframeIntranet()
	
}

//**************************************************************************************************************
//**** FUN ES DIVERSAS ****************************************************************************************
//**************************************************************************************************************

/////////////////////////////////////////////////////////////////
	function AtualizaImagem(CodigoText, ImageASP, CaminhoASP) {
		CodigoText.value = '';
		ImageASP.src= CaminhoASP + "FazASPImage.asp?" + Math.random();
	}

/////////////////////////////////////////////////////////////////
	function Upper(TextField) {
		TextField.value = TextField.value.toUpperCase();
	}

/////////////////////////////////////////////////////////////////
function isNum(str) {
	//alert(str);
  if(!str) return false;
  for(var i=0; i<str.length; i++){
    var ch=str.charAt(i);
    if ("0123456789".indexOf(ch) ==-1) return false;
  }
  return true;
} 

/////////////////////////////////////////////////////////////////
function FormataCNPJ(Campo, teclapres, Tipo)
{


		var tecla;// = teclapres.keyCode;

		if(document.all)
		{
			tecla = event.keyCode;
		} 
		else
		{
			tecla = teclapres.which;
		}
		
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");

		tam = vr.length + 1;
		
		if (Tipo == 0) {
			if (tecla != 9 && tecla != 8){
				if (tam > 2 && tam < 4)
					Campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
				if (tam >= 6 && tam <7)
					Campo.value = vr.substr(0, 2) + '.' + vr.substr(2,3) + '.';
				if (tam >= 9 && tam <10)
					Campo.value = vr.substr(0, 2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/';
				if (tam >= 14 && tam <15)
					Campo.value = vr.substr(0, 2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(9,4) + '-';
				}
		}
		else
		{
			if (tecla != 9 && tecla != 8){
				if (tam > 3 && tam < 5)
					Campo.value = vr.substr(0, 3) + '.' + vr.substr(3, tam);
				if (tam >= 7 && tam <8)
					Campo.value = vr.substr(0, 3) + '.' + vr.substr(3,3) + '.' + vr.substr(6, tam);
				if (tam >= 10 && tam <11)
					Campo.value = vr.substr(0, 3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,3) + '-' + vr.substr(9, tam);
				}
		}
	}

/////////////////////////////////////////////////////////////////
function FormataCEP(Campo, teclapres){
		var tecla = teclapres.keyCode;
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");

		tam = vr.length + 1;
		
		if (tecla != 8 && tecla != 9){
			if (tam > 5 && tam < 7)
				Campo.value = vr.substr(0, 5) + '-' + vr.substr(6, tam);
			}
	}

/////////////////////////////////////////////////////////////////
function FormataINSCRICAO_MUNICIPAL(Campo, teclapres){
		var tecla = teclapres.keyCode;
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");

		tam = vr.length + 1;
		
		if (tecla != 9 && tecla != 8){
			if (tam > 1 && tam < 3)
				Campo.value = vr.substr(0, 1) + '.' + vr.substr(2, tam);
			if (tam >= 7 && tam <8)
				Campo.value = vr.substr(0, 1) + '.' + vr.substr(1,5) + '-';
			}
	}

/////////////////////////////////////////////////////////////////
function FormataINSCRICAO(Campo, teclapres){
		var tecla = teclapres.keyCode;
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");

		tam = vr.length + 1;
		
		if (tecla != 9 && tecla != 8){
			if (tam > 5 && tam < 7)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(6, tam);
			if (tam >= 8 && tam <9)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(5,2) + '.';
			if (tam >= 10 && tam <11)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(5,2) + '.' + vr.substr(7,2) + '.';
			if (tam >= 15 && tam <16)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(5,2) + '.' + vr.substr(7,2) + '.' + vr.substr(10,4) + '.';
			if (tam >= 18 && tam <19)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(5,2) + '.' + vr.substr(7,2) + '.' + vr.substr(10,4) + '.' + vr.substr(15,2) + '.';
			if (tam >= 22 && tam <23)
				Campo.value = vr.substr(0, 5) + '.' + vr.substr(5,2) + '.' + vr.substr(7,2) + '.' + vr.substr(10,4) + '.' + vr.substr(15,2) + '.' + vr.substr(18,3) + '.';
			}
	}

/////////////////////////////////////////////////////////////////
function formataDATA(Campo, teclapres){
	
	
		var tecla = teclapres.keyCode;
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");
		vr = vr.replace("/", "");
		while (vr.indexOf('/') > -1 ) {
			vr = vr.replace("/", "");
		}

		tam = vr.length + 1;
		
		if (tecla != 9 && tecla != 8){
			if (tam > 2 && tam < 4)
				Campo.value = vr.substr(0, 2) + '/' + vr.substr(3, tam);
			if (tam > 4 && tam <6)
				Campo.value = vr.substr(0, 2) + '/' + vr.substr(2,2) + '/';
		}
	}
/////////////////////////////////////////////////////////////////

function Verifica_Data(data, obrigatorio, mostraMsg){
//Se o parâmetro obrigatorio for igual à zero, significa que elepode estar vazio, caso contrário, não
//Se o parâmetro mostraMsg for igual à zero, significa que mostra o alert, caso contrario, não

    //var xdata = document.getElementById(data);
 	var strdata = data.value;

 	if((obrigatorio == 1) || (obrigatorio == 0 && strdata != "")){

 		//Verifica a quantidade de digitos informada esta correta.
 		if (strdata.length != 10){
			if(mostraMsg==0)
			{
	 			alert("Formato da data não é válido. Formato correto: - dd/mm/aaaa.");
			}
			
 			return false
 		}

 		//Verifica máscara da data
 		if ("/" != strdata.substr(2,1) || "/" != strdata.substr(5,1)){
 			if(mostraMsg==0)
			{
				alert("Formato da data não é válido. Formato correto: - dd/mm/aaaa.");
			}
 			return false
 		}

 		dia = strdata.substr(0,2)
 		mes = strdata.substr(3,2);
 		ano = strdata.substr(6,4);
 		
 		//Verifica o dia
 		if (isNaN(dia) || dia > 31 || dia < 1){
 			if(mostraMsg==0)
			{
				alert("Formato do dia não é válido.");
			}
 			return false
 		}

 		if (mes == 4 || mes == 6 || mes == 9 || mes == 11){
 			
 			if (dia == "31"){
 				if(mostraMsg==0)
				{
					alert("O mês informado não possui 31 dias.");
				}
 				return false
 			}

 		}
 		if (mes == "02"){

 			bissexto = ano % 4;

 			if (bissexto == 0){

 				if (dia > 29){
 					if(mostraMsg==0)
					{
						alert("O mês informado possui somente 29 dias.");
					}
 					return false
 				}

 			}else{

 				if (dia > 28){
					if(mostraMsg==0)
					{
 					alert("O mês informado possui somente 28 dias.");
					}
 					return false

 				}
 			}
 		}
 	    
 	    //Verifica o mês
 		if (isNaN(mes) || mes > 12 || mes < 1){
			if(mostraMsg==0)
			{
 				alert("Formato do mês não é válido.");
			}
 			return false
 		}
 		
 		//Verifica o ano
 		if (isNaN(ano)){
			if(mostraMsg==0)
			{
	 			alert("Formato do ano não é válido.");
			}
 			return false
 		}
 	}
 	return true
 }
 /////////////////////////////////////////////////////////////////
function formataHORA(Campo, teclapres){
	
		var tecla = teclapres.keyCode;
		
		var vr = new String(Campo.value);
		vr = vr.replace(".", "");
		vr = vr.replace(".", "");
		vr = vr.replace("-", "");
		vr = vr.replace("/", "");
		vr = vr.replace(":", "");
		while (vr.indexOf(':') > -1 ) {
			vr = vr.replace(":", "");
		}

		tam = vr.length + 1;
		
		if (tecla != 9 && tecla != 8){
			if (tam > 2 && tam < 4)
				Campo.value = vr.substr(0, 2) + ':' + vr.substr(3, tam);
		}
	}
/////////////////////////////////////////////////////////////////
	function chkNumero() {

	 if (event.keyCode == '13') 
	 {
		 return true;
	 }
	 else if (event.keyCode < '48' || event.keyCode > '58')
	 {
	  alert('Por favor, digite apenas nmeros!'); 
	  event.keyCode = '127';
	  return false;
	  }
	}

/////////////////////////////////////////////////////////////////

	function soNumeros(objEvent)
	{
		var teclasPermitidas = [13,48,49,50,51,52,53,54,55,56,57,8 ,9,35 ,36,46,37,39,96,97,98,99,100,101,102,103,104,105];
		var bloquear = false;

		if(document.all)
		{
			tecla = event.keyCode;
		} 
		else
		{
			tecla = objEvent.which;
		}
		for (i=0;i<teclasPermitidas.length;i++)
		{
			if(teclasPermitidas[i] == tecla)
			{
				bloquear = true;
				break;
			}
		}
		
		return bloquear;
			
	}



/////////////////////////////////////////////////////////////////

function chkCaracteresEspeciais() {

	if ( (event.keyCode >= '48' && event.keyCode <= '57') || (event.keyCode >= '97' && event.keyCode <= '122')  || (event.keyCode >= '65' && event.keyCode <= '90')) {
		return true
	} else {
		event.keyCode = '127';
	}
}


/////////////////////////////////////////////////////////////////
function chkCaracteresEspeciaisEmail() {

	if ( (event.keyCode >= '48' && event.keyCode <= '57') || (event.keyCode >= '97' && event.keyCode <= '122')  || (event.keyCode >= '65' && event.keyCode <= '90') || (event.keyCode >= '45') || (event.keyCode >= '95') ) {
		return true
	} else {
		if (event.keyCode!='46' && event.keyCode!='64') {
			event.keyCode = '127';
		}
	}
}
/*
/////////////////////////////////////////////////////////////////
function chkCaracteresEspeciaisComEspaco() {

	if ( (event.keyCode >= '48' && event.keyCode <= '57') || (event.keyCode >= '97' && event.keyCode <= '122')  || (event.keyCode >= '65' && event.keyCode <= '90')) {
		return true
	} else {
		if (event.keyCode!='32') {
			event.keyCode = '127';
		}
	}
}
*/
////////////////////////////////////////////////////////////////
	function ValidaDigito(num){
		var n1, n2, n3, n4, n5, n6, dig;
  
		n1 = parseInt(num.substr(0,1)) * 2;
		n2 = parseInt(num.substr(1,1)) * 2;
		n3 = parseInt(num.substr(2,1));
		n4 = parseInt(num.substr(3,1)) * 2;
		n5 = parseInt(num.substr(4,1));
		n6 = parseInt(num.substr(5,1)) * 2;
  
		if(n1 > 9){n1 -= 9};
		if(n2 > 9){n2 -= 9};
		if(n4 > 9){n4 -= 9};
		if(n6 > 9){n6 -= 9};
  
		dig = 10 - ((n1 + n2 + n3 + n4 + n5 + n6) % 10)
  
		if(dig == 10) {
			dig = 0
		}
		
		//alert(dig + '   ' + parseInt(num.substr(6,1)));
		
		if(parseInt(num.substr(6,1)) == dig) {
			return(true)
		}
	
		if(parseInt(num.substr(6,1)) != dig) {
			return(false)
		}
	}	

/*
function CalcularDV(sCampo, iPeso){
	
	var iTamCampo;
	var iPosicao, iDigito;
	var iSoma1 = 0;
	var iSoma2=0;
	var iDV1, iDV2;
		
	iTamCampo = sCampo.length;

	for (iPosicao=1; iPosicao<=iTamCampo; iPosicao++){
		iDigito = sCampo.substr(iPosicao-1, 1);
		iSoma1 = parseInt(iSoma1,10) + parseInt((iDigito * Calcular_Peso(iTamCampo - iPosicao, iPeso)),10);
		iSoma2 = parseInt(iSoma2,10) + parseInt((iDigito * Calcular_Peso(iTamCampo - iPosicao + 1, iPeso)),10);
		}

	iDV1 = 11 - (iSoma1 % 11);
	if (iDV1 > 9)
		iDV1 = 0;

	iSoma2 = iSoma2 + (iDV1 * 2);
	iDV2 = 11 - (iSoma2 % 11);
	if (iDV2 > 9)
		iDV2 = 0;

	Ret = (parseInt(iDV1 * 10,10) + parseInt(iDV2));

	Ret = "0" + Ret;
	Ret = Ret.substr(Ret.length - 2,Ret.length);
		
	return(Ret);
}
*/

////// RECEITA

//////////////////////////////////////////////////////////////////
function CalcularDV(sCampo, iPeso){
	
	var iTamCampo;
	var iPosicao, iDigito;
	var iSoma1 = 0;
	var iSoma2=0;
	var iDV1, iDV2;
		
	iTamCampo = sCampo.length;

	for (iPosicao=1; iPosicao<=iTamCampo; iPosicao++){
		iDigito = sCampo.substr(iPosicao-1, 1);
		iSoma1 = parseInt(iSoma1,10) + parseInt((iDigito * Calcular_Peso(iTamCampo - iPosicao, iPeso)),10);
		iSoma2 = parseInt(iSoma2,10) + parseInt((iDigito * Calcular_Peso(iTamCampo - iPosicao + 1, iPeso)),10);
		}

	iDV1 = 11 - (iSoma1 % 11);
	if (iDV1 > 9)
		iDV1 = 0;

	iSoma2 = iSoma2 + (iDV1 * 2);
	iDV2 = 11 - (iSoma2 % 11);
	if (iDV2 > 9)
		iDV2 = 0;

	Ret = (parseInt(iDV1 * 10,10) + parseInt(iDV2));

	Ret = "0" + Ret;
	Ret = Ret.substr(Ret.length - 2,Ret.length);
		
	return(Ret);
}

//////////////////////////////////////////////////////////////////		
function Calcular_Peso(iPosicao, iPeso){

	//Pesos
	//CPF 11
	//CNPJ 9
	return (iPosicao % (iPeso - 1)) + 2;
	}
	
/////////////////////////////////////////////////////////////////
function LimpaCampo(sValor,iBase){
	var tam = sValor.length
	var saida = new String
	for (i=0;i<tam;i++)
		if (!isNaN(parseInt(sValor.substr(i,1),iBase)))
			saida = saida + String(sValor.substr(i,1));
	return (saida);		
	}
/////////////////////////////////////////////////////////////////
function TestaNI(cNI,iTipo){
	var NI 
	NI = LimpaCampo(cNI.value,10);
	ok  = false
	num1 = NI.toString().substring(0,1)
	for (i=0;i<NI.length;i++) {
		num = NI.toString().substring(i,i+1)
		if (num1!=num) {
			ok = true
			continue
		}
	}
	if (ok==false) {
		cNI.focus()
		return(false)
	}
	switch (iTipo) {
		case 1:
			if (NI.length != 14){
				//alert('O n mero do CNPJ informado est incorreto');
				//cNI.value = "";
				cNI.focus();
				return(false);
				}

			if (NI.substr(12,2) != CalcularDV(NI.substr(0,12), 9)){
				//alert('O n mero do CNPJ informado est incorreto');
				//cNI.value = "";
				cNI.focus();
				return(false);
				}
			break;

		case 2:
			if (NI.length != 11){
				//alert('O n mero do CPF informado est incorreto');
				//cNI.value = "";
				cNI.focus();
				return(false);
				}

			if (NI.substr(9,2) != CalcularDV(NI.substr(0,9), 11)){
				//alert('O n mero do CPF informado est incorreto');
				//cNI.value = "";
				cNI.focus();
				return(false);
				}
			break;

		default:
			return(false);
		}
	
	return (true);	
	}  
	
	function pegaConteudoIframe() {
		
		var xtdResultado 	= document.getElementById('tdResultado')
		var xifrmComp		= document.getElementById('ifrmComp')
		
		xtdResultado.innerHTML = ifrmComp.document.body.innerHTML
		
	}

	function reposicionarNoElemento(elemento) {
		var xelemento = document.getElementById(elemento)
		if (xelemento) {
			xelemento.scrollIntoView()		
		}
	}
	
		function videoteca(destino) {
			openUrl('/comum/multimidia/video/flv/home_video.asp?video='+destino,'menuScs.aspx','interna','/sites/scs/tituloArea.aspx','','yes')
			
			
			//switch (destino) 
			//{
				
			//	case 'video0':
			//		openUrl('comum/multimidia/video/flv/home_video.asp?video=0','menuScs.aspx','interna','/sites/scs/tituloArea.aspx','','yes')
			//		break
	
			//	case 'video1':
			//		openUrl('comum/multimidia/video/flv/home_video.asp?video=1','menuScs.aspx','interna','/sites/scs/tituloArea.aspx','','yes')
			//		break
	
			//	case 'video2':
			//		openUrl('comum/multimidia/video/flv/home_video.asp?video=2','menuScs.aspx','interna','/sites/scs/tituloArea.aspx','','yes')
			//		break
	
			//}
		}
		//Fun o Banners Lateral//////////////////////////////////////////////////////////////////////////////////////////////
		function ActionBanners(destino) {
		switch (destino) 
		{
			
			case 'Inicio':
				window.location.reload()
				break
				
			case 'eiss':
				window.open('http://www.barueri.sp.gov.br/e-iss','_blank')
				break


			case 'cta':
				openUrl('/sites/ssamb/materias/cta.aspx', 'menussamb.aspx', 'interna', '/sites/ssamb/tituloArea.aspx')
				break
				
			case 'balada_adolescente':
				openUrl('/sites/ssamb/materias/balada_adolescente.aspx', 'menussamb.aspx', 'interna', '/sites/ssamb/tituloArea.aspx')
				break
				
			case 'maturidade':
				openUrl('/sistemas/busca/index.asp?OpcBusca=tituloartigo&txtConteudo=maturidade')
				break
				
			case 'bancoPovo':
				openUrl('/sites/sict/materias/banco_povo.aspx', 'menuSict.aspx', 'interna', '/sites/sict/tituloArea.aspx')
				break
				
			case 'agenda':
				openUrl('/comum/materias/60anos.aspx', 'menuPrincipal.aspx', 'principal')
				break

			case 'sms':
				openUrl('/sistemas/sms/','menuPrincipal.aspx','principal','','','yes')
				break
				
			case 'GanhaTempo':
				openUrl('/sites/gt/home.aspx','menuGt.aspx', 'interna','/sites/gt/tituloArea.aspx')
				break
				
			case 'Licitacoes':
				openUrl('/sistemas/licitacoes/selecionarAreaPMB.asp','menusts.aspx','interna','/sites/sts/tituloArea.aspx','','yes')
				break
				
			case 'ISSQN':
				openUrl('/sites/sfn/materias/instrucoes_issqn.aspx', 'menuSfn.aspx', 'interna', '/sites/sfn/tituloArea.aspx')
				break
				
			case 'anistia':
				openUrl('/sites/sfn/materias/anistia_2009.aspx', 'menuSfn.aspx', 'interna', '/sites/sfn/tituloArea.aspx')
				break
				
			case 'prc':
				openUrl('/sistemas/prc/','menuspcu.aspx','interna','/sites/spcu/tituloArea.aspx','','yes')
				break

			case 'cpa':
				openUrl('/sites/spd/materias/cpa.aspx','menuSpd.aspx','interna','/sites/spd/tituloArea.aspx')
				break

			case '8metas':
				openUrl('/sites/sgg/materias/objetivos_milenio.aspx', 'menusgg.aspx', 'principal', '/sites/sgg/tituloArea.aspx','window.parent.lerInformativo()')
				break
				
			case 'tutelar':
				openUrl('/sites/sasc/materias/criancas_adolescentes.aspx', 'menusasc.aspx', 'interna', '/sites/sasc/tituloArea.aspx','')
				break
				
			case 'IPRESB':
				window.open('http://www.barueri.sp.gov.br/ipresb/')
				break

			case 'candidato_IPRESB':
				window.open('http://www.barueri.sp.gov.br/ipresb/candidato2009.asp')
				break

			case 'Pinacoteca':
				window.open('http://www.barueri.sp.gov.br/pinacoteca/')
				break
				
			case 'Comad':
				window.open('http://www.barueri.sp.gov.br/comad')
				break
				
			case 'CartaoVirtual':
				openUrl('/sistemas/cartaoVirtual/', 'MenuPrincipal.aspx', 'principal', '', '', 'yes' )
				break

			case 'finados':
				openUrl('/sistemas/Sepultamentos/', 'menuSsm.aspx', 'principal', '', '', 'yes' )
				break

			case 'opiniao':
				openUrl('/sistemas/suaOpiniao/', 'menuPrincipal.aspx', 'principal', '', '', 'yes' )
				break
//Secretaria de Cultura
			case 'multas':
				window.open('http://www.cobrasin.com.br/barueri', '_blank')
				break

						case '3musica':
							openUrl('/sites/sct/materias/musica_estudantil.aspx', 'menuSct.aspx', 'interna', '/sites/Sct/tituloArea.aspx')
							break
						case 'mostra':
							openUrl('/sites/sct/materias/mostra2009.aspx', 'menuSct.aspx', 'interna', '/sites/Sct/tituloArea.aspx')
							break
						case 'simbolos':
							openUrl('/sites/sct/materias/simbolos.aspx', 'menuSct.aspx', 'interna', '/sites/Sct/tituloArea.aspx')
							break
						case 'literatura':
							openUrl('/sites/sct/materias/VI_premio_literatura.aspx', 'menuSct.aspx', 'interna', '/sites/Sct/tituloArea.aspx')
							break
			
// 
//Secretaria de Meio Ambiente
					case 'fotos':
						openUrl('/sites/Srnma/materias/concurso_fotos_2009.aspx', 'menuSrnma.aspx', 'interna', '/sites/Srnma/tituloArea.aspx')
						break
						
					case 'lixo':
						openUrl('sistemas/informativos/Informativo.asp?ID=8964','menuPrincipal.aspx','principal','','', 'yes')
						break
		
//
//Secretaria de Esportes
					case 'saosilveira':
						openUrl('/sites/Sesp/materias/sao_silveira.aspx', 'menuSesp.aspx', 'interna', '/sites/Sesp/tituloArea.aspx')
						break
						
					case 'corridaKmBarueri':
						openUrl('/sites/Sesp/materias/15kmbarueri.aspx', 'menuSesp.aspx', 'interna', '/sites/Sesp/tituloArea.aspx')
						break

					case 'gpBarueriCiclismo':
						openUrl('/sites/Sesp/materias/gpBarueriCiclismo.aspx', 'menuSesp.aspx', 'interna', '/sites/Sesp/tituloArea.aspx')
						break

//
//Servios Online
					case 'hora':
						openUrl('/comum/materias/hora.aspx', '', 'principal', '/sistemas/servicosOnline/tituloArea.aspx', '', 'yes' )
						break
					case 'emprega':
						openUrl('/comum/materias/emprega.aspx', 'menuPrincipal.aspx', 'principal','')
						break
		
//
//SASC
					case 'obras_andamento':
						openUrl('/sites/spc/materias/obras_andamento.aspx', 'menuSpc.aspx', 'interna', '/sites/spc/tituloArea.aspx')
						break
		
//
//SASC
					case 'uso':
						openUrl('/comum/materias/uso.aspx', 'menuScs.aspx', 'interna', '/sites/scs/tituloArea.aspx')
						break
		
//
//Secretaria de Educacao
					case 'eja':
						openUrl('/sites/Sed/materias/proj_eja_edu_jovens_adultos.aspx', 'menuSed.aspx', 'interna', '')
						break
		
//
//Secretaria de Educacao
					case 'concurso':
						openUrl('/sistemas/ConcursosPublicos/','menuSadm.aspx','interna','','', 'yes')
						break

//
//Secretaria de Segurana
					case 'manualseg':
						openUrl('/sites/sseg/materias/manuais.aspx', 'menuSseg.aspx', 'interna', '/sites/Sseg/tituloArea.aspx')
						break

//
//
			case 'ontem':
				window.open('/ontemhoje/index.asp','','width=780, height=450, top=20, left=20')
				break
			case 'listaVideo':
				window.open('/comum/multimidia/video/listaGeral.asp','','width=430, height=450, top=20, left=20')
				break
		
		    case 'listaJob':
				window.open('/sites/scs/listaJobAnterior.asp','','width=430, height=450, top=20, left=20')
				break

			case 'comad1':
				openUrl('/comum/materias/comad.aspx', 'menuPrincipal.aspx', 'principal', '')
				break

			case 'redecrianca':
				window.open('http://www.redecrianca.barueri.sp.gov.br')
				break

			case 'rh':
				openUrl('/sites/Sadm/materias/rhOnline.aspx', 'menuSadm.aspx', 'interna', '/sites/Sadm/tituloArea.aspx')
				break

			case 'profissional':
				openUrl('/sites/Sadm/materias/carteira_profissional.aspx', 'menuSadm.aspx', 'interna', '/sites/Sadm/tituloArea.aspx')
				break

			case 'junta':
				openUrl('/sites/Sadm/materias/junta_militar.aspx', 'menuSadm.aspx', 'interna', '/sites/Sadm/tituloArea.aspx')
				break

			case 'segurancaTrabalho':
				openUrl('/sites/Sadm/materias/segTrabalho.aspx', 'menuSadm.aspx', 'interna', '/sites/Sadm/tituloArea.aspx')
				break

			case 'souBem':
				window.open('http://www.baruerisoudobem.com.br','_blank')
				break

			case 'souBemSecretaria':
				openUrl('/sites/sasc/home.aspx','menuSasc.aspx', 'sasc','/sites/Sasc/tituloArea.aspx')
				break


			case '8metasRight':
				openUrl('/sites/sasc/home.aspx','menuSasc.aspx', 'sasc','/sites/Sasc/tituloArea.aspx')
				break

			case '59':
				openUrl('/sites/sadm/materias/concurso012008.aspx','menuSadm.aspx', 'interna','/sites/sadm/tituloArea.aspx')
				break

			case 'secretariasIntra':
				openUrl('/comum/materias/secretarias.aspx','menuPrincipal.aspx', 'principal','')
				break

			case 'mais':
				openUrl('/sites/SalaImprensa/materias/mais.aspx', 'MenuSalaImprensa.aspx', 'interna', '/sites/SalaImprensa/tituloArea.aspx')
				break

			case 'flashDestaque':
				openUrl('/sistemas/leis/detalhe_Dec.asp?nlei=6229&TEMPLATE=<%=request("template")%>&LAYOUT=<%=request("LAYOUT")%>', 'menuSnj.aspx', 'interna', '/sites/snj/tituloArea.aspx','', 'yes')
				break

			case 'agasalho':
				openUrl('/sites/sasc/materias/agasalho2008.aspx', 'menuSasc.aspx', 'interna', '/sites/sasc/tituloArea.aspx')
				break

			case 'graac':
				/*openUrl('/sites/sasc/materias/graac.aspx', 'menuSasc.aspx', 'interna', '/sites/sasc/tituloArea.aspx')
				break*/

			case 'natal':
				<!--openUrl('/sites/sasc/materias/brinquedos.aspx', 'menuSasc.aspx', 'interna', '/sites/sasc/tituloArea.aspx')-->
				openUrl('sistemas/informativos/Informativo.asp?ID=12670','menuPrincipal.aspx','principal','','', 'yes')
				break

			case 'constutelar':
				openUrl('/comum/materias/cons_tutelar.aspx', 'menuPrincipal.aspx', 'principal', '')
				break
				
			case 'ldo':
				openUrl('/sistemas/LDO/', 'menuSfn.aspx', 'interna', '/sites/sfn/tituloArea.aspx','', 'yes')
				break

			case 'orcCidadao':
				openUrl('/sites/sfn/materias/orccidadao1.aspx', 'menuSfn.aspx', 'interna', '')
				break

			case 'orcCidadaoSis':
				openUrl('/sistemas/OrcamentoCidadao/', 'menuSfn.aspx', 'interna', '/sites/sfn/tituloArea.aspx', '', 'yes' )
				break

			case 'ppa':
				openUrl('/sites/sfn/materias/ppa.aspx', 'menusfn.aspx', 'interna', '/sites/sfn/tituloArea.aspx')
				break


			case 'concurso012009':
				openUrl('/sistemas/concursosPublicos/', 'menusadm.aspx', 'interna', '/sites/sadm/tituloArea.aspx', '', 'yes')
				break

			case 'concursoHomologacao012009':
				openUrl('/sistemas/concursosPublicos/', 'menusadm.aspx', 'interna', '/sites/sadm/tituloArea.aspx', '', 'yes')
				break
			case 'horadoplaneta':
				//window.location = 'http://www.barueri.sp.gov.br/?pg=informativoLista&ID=11364';
				window.open('http://www.horadoplaneta.org.br/participe.php', '_blank')
				break	

			case 'claudia':
				openUrl('sistemas/informativos/Informativo.asp?ID=13029','menuPrincipal.aspx','principal','','', 'yes')
				break


		}
	}
	
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



	
	// FUN O PARA ABRIA A JANELA DA VIDEOTECA DA COMUNICA O...
	function openBrWindow(theURL,winName,features) { 
	  window.open(theURL,winName,features);
	}

	function abreArquivo(arquivo) {
		window.navigate('index.aspx?arquivo=' + arquivo)
	}

	function menuServicosOnline(nomeMenu, objChamador) {
		
		if(document.all){
			modoDisplay = 'block';
		} else {
			modoDisplay = 'table-row';
		}
		
		xmenus = ['trMinhaEmpresa', 'trMeuImovel','trOutrosServicos','trAcesso'];
		
		for(i=0;i<xmenus.length;i++){
			document.getElementById(xmenus[i]).style.display = 'none';
		}
		
		document.getElementById(nomeMenu).style.display = modoDisplay;
		
		/*
		xobjMenu = document.getElementById(nomeMenu) 
		
		if (xobjTmp) {
			if (xobjMenu!=xobjTmp) {
				xobjTmp.style.display = 'none'
			}
		}

		xobjTmp = document.getElementById(nomeMenu)
		if (xobjTmp)
		{
			if (xobjTmp==xobjMenu) {
				if (xobjMenu.style.display=='none') {
					xobjMenu.style.display=''
				} else {
					xobjMenu.style.display='none'
				}
			} else {
				xobjTmp.style.display = ''
			}
		}
		
		//objChamador.scrollIntoView()
		*/
	}
	function menuFinancasOnline(nomeMenu, objChamador) {
		
		if(document.getElementById){
			modoDisplay = 'block';
		} else {
			modoDisplay = 'table-row';
		}
		
		xmenus = ['trMinhaEmpresa', 'trMeuImovel','trAcesso'];
		
		for(i=0;i<xmenus.length;i++){
			document.getElementById(xmenus[i]).style.display = 'none';
		}
		
		document.getElementById(nomeMenu).style.display = modoDisplay;
		
	}
	
	
	
	
	
	
	function abrirServicosOnlineCombo(pstrTipo, pstrKey) {
		openUrl('/sistemas/servicosOnline/home.aspx', '', 'principal','/sistemas/servicosOnline/tituloArea.aspx', "window.parent.abrirServicosOnline('" + pstrTipo + "', '" + pstrKey + "')" )
	}
	function alertServicosOnlineTaxas() {
		alert('Ateno! Servio indisponvel at clculo do exerccio de 2010.');
	}
	
	function abrirServicosOnline(pstrTipo, pstrKey) {
		
		var url
		var xtdAreaTrabalho = document.getElementById('tdAreaTrabalho')
		var xifrmPrincipal = document.getElementById('ifrmPrincipalId')
		var msg
	
		xtdAreaTrabalho.style.padding = '0px'
	
		if (pstrTipo=='empresa') {

			if (pstrKey=='2via_iss') { 
				//urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=35&TpLogin=1&Pergs=Contribuinte Mobili%c3%a1rio,7;Contribuinte Imobili%c3%a1rio,31'
				
				// ************ Retirar linha apos o calculo 2012 *************
				msg = 'Serviço ainda indisponível para o exercício de 2012!';
				alert(msg);
				//url = '#'
				return
				
				// ************************************************************
				
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IDItemMenu=35&TpLogin=1&IdGrupoTrabalho=1&urlDestino=ISS/wf2via.aspx&idOrigemContribuinte=&idGrupoTrabalhoContador=4&idDomiciliado='
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
				
				
				
			}
			if (pstrKey=='aidf_solicitacao') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IDItemMenu=23&TpLogin=1&IdGrupoTrabalho=1&urlDestino=AIDF/wfaidfsolicitacao.aspx&idOrigemContribuinte=&idGrupoTrabalhoContador=4&idDomiciliado='
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='aidf_autorizacao') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IDItemMenu=24&TpLogin=1&IdGrupoTrabalho=3&urlDestino=AIDF/wfaidflistapendente.aspx&idOrigemContribuinte=&idGrupoTrabalhoContador=4&idDomiciliado='
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='renovar_alvara') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IDItemMenu=8&TpLogin=1&IdGrupoTrabalho=1&urlDestino=Relatorios/wfalvara.aspx&idOrigemContribuinte=1&idGrupoTrabalhoContador=4&idDomiciliado='
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='guia_parcelamento') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=7&TpLogin=1&Pergs=Contribuinte Mobili%c3%a1rio,7;Contribuinte Imobili%c3%a1rio,31'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='extrato_debito') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=5&TpLogin=1&Pergs=Contribuinte Mobili%c3%a1rio,5;Contribuinte Imobili%c3%a1rio,28'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='parcelar_debito') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=6&TpLogin=1&Pergs=Contribuinte Mobili%c3%a1rio,6;Contribuinte Imobili%c3%a1rio,27'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='documento_emitido') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=33&TpLogin=1&Pergs=Contribuinte Mobili%c3%a1rio,33;Contribuinte Imobili%c3%a1rio,34'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='grafica_nao_domiciliada') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IDItemMenu=17&TpLogin=1&IdGrupoTrabalho=3&urlDestino=Grafica/wfgraficanaodomiciliadamanutencao.aspx&idOrigemContribuinte=&idGrupoTrabalhoContador=4&idDomiciliado=2'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
		}
		
		if (pstrTipo=='imovel') {
			if (pstrKey=='documento_emitido') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=34&TpLogin=2&Pergs=Contribuinte Mobili%c3%a1rio,33;Contribuinte Imobili%c3%a1rio,34'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='extrato_debito') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=28&TpLogin=2&Pergs=Contribuinte Mobili%c3%a1rio,5;Contribuinte Imobili%c3%a1rio,28'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='parcelar_debito') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=27&TpLogin=2&Pergs=Contribuinte Mobili%c3%a1rio,6;Contribuinte Imobili%c3%a1rio,27'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='guia_parcelamento') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfGenericQuestion.aspx?IDItemMenu=31&TpLogin=2&Pergs=Contribuinte Mobili%c3%a1rio,7;Contribuinte Imobili%c3%a1rio,31'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
		}
		if (pstrTipo=='acesso') {
			if (pstrKey=='usuario') { 
				urlso = '/PMB/PortalServicos/WF/Comum/wfacessousuariolista.aspx?IdGrupoTrabalho=&urlDestino=Usuario/wfusuariogerenciamento.aspx&idOrigemContribuinte=&idGrupoTrabalhoContador=&idDomiciliado=&IDItemMenu=19&TpLogin=1'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='expiracao') { 
				urlso = '/PMB/PortalServicos/WF/ParametroExpiracao/wfparametroexpiracaoalterar.aspx?IDItemMenu=20&TpLogin=1'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='perfil') { 
				urlso = '/PMB/PortalServicos/WF/PerfilAcesso/wfperfilacessomanutencao.aspx?IDItemMenu=21&TpLogin=1'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
			if (pstrKey=='alterar_senha') { 
				urlso = '/PMB/PortalServicos/WF/Usuario/wfusuariosenhaalterar.aspx?IDItemMenu=25&TpLogin=1'
				urlso = escape(urlso)
				url = '/getServicosOnline.aspx?url=' + urlso
			}
		}

		if (xifrmPrincipal) {
			window.open(url, 'ifrmPrincipal')	
		} else {
			xtdAreaTrabalho.innerHTML = '<iframe name="ifrmPrincipal" id="ifrmPrincipalId" width="100%" height="100%" src="' + url + '" frameborder=0 scrolling="no">ifrmPrincipal</iframe>'
		}
	}
/////////////////Funcao Sala de Imprensa - Composi o mandato a mandato	
function abrirComp(ano) {

	var url

	switch (ano) {
		case 1949:               
			url = '/sites/SalaImprensa/materias/cp_1949.aspx' 
			break
		case 1953:               
			url = '/sites/SalaImprensa/materias/cp_1953.aspx' 
			break
		case 1957:               
			url = '/sites/SalaImprensa/materias/cp_1957.aspx' 
			break
		case 1961:               
			url = '/sites/SalaImprensa/materias/cp_1961.aspx' 
			break
		case 1965:               
			url = '/sites/SalaImprensa/materias/cp_1965.aspx' 
			break
		case 1969:               
			url = '/sites/SalaImprensa/materias/cp_1969.aspx' 
			break
		case 1973:               
			url = '/sites/SalaImprensa/materias/cp_1973.aspx' 
			break
		case 1977:               
			url = '/sites/SalaImprensa/materias/cp_1977.aspx' 
			break
		case 1983:               
			url = '/sites/SalaImprensa/materias/cp_1983.aspx' 
			break
		case 1989:               
			url = '/sites/SalaImprensa/materias/cp_1989.aspx' 
			break
		case 1993:               
			url = '/sites/SalaImprensa/materias/cp_1993.aspx' 
			break
		case 1997:               
			url = '/sites/SalaImprensa/materias/cp_1997.aspx' 
			break
		case 2001:               
			url = '/sites/SalaImprensa/materias/cp_2001.aspx' 
			break
		case 2005:               
			url = '/sites/SalaImprensa/materias/cp_2005.aspx' 
			break
	}
	
	sendUrl(url, 'tdComposicaoPolitica', 'innerHTML', '')
	
}

function showUserName(userName, tpLogin) {
	//window.open('/pmb/portalservicos/wf/wfautenticacaopermanente.aspx', 'ifrmLogin')
	try {
		ifrmLogin.SetUsrLogado(userName, tpLogin);
	} catch(e) {
		return
	}
}

function ocultaDivLancamento(obj) 
{
	document.getElementById(obj).style.display = 'none';
}


function ocultaMenuPrincipal() {
	document.getElementById('menuDivHome').style.display = 'none';
	}
function mostraMenuPrincipal(){
	document.getElementById('menuDivHome').style.display = '';
	}



function resizeIframeIntranet()
{
	try{	
		if(document.all)
		{
			var xbody	=	ifrmPrincipal.document.body;
			var xframe	=	document.all("ifrmPrincipal");
				
			xframe.style.height = xbody.scrollHeight + (xbody.offsetHeight - xbody.clientHeight);
		}
		else
		{
			var xifrmPrincipal = document.getElementById('_ifrmPrincipal');
			if (xifrmPrincipal)
			{
				var xheight = ifrmPrincipal.document.documentElement.offsetHeight;
				xifrmPrincipal.style.height = xheight + 'px';
			}
		}		
	}
	catch(e)
	{
		//window.status =	'Error: ' + e.number + '; ' + e.description;
	}

}


function overInformativo(id)
{
	if(id == "verTodas"){
		document.getElementById("verTodas").style.textDecoration = "underline";		
	} else {
		var idObjTitulo = "tdTitulo" + id.toString();
		var idObjChamada = "tdChamada" + id.toString();
		
		document.getElementById(idObjTitulo).style.textDecoration = "underline";
		document.getElementById(idObjChamada).style.textDecoration = "underline";
	}
}

function outInformativo(id)
{
	if(id == "verTodas"){
		document.getElementById("verTodas").style.textDecoration = "none";		
	} else {
		var idObjTitulo = "tdTitulo" + id.toString();
		var idObjChamada = "tdChamada" + id.toString();
		
		document.getElementById(idObjTitulo).style.textDecoration = "none";
		document.getElementById(idObjChamada).style.textDecoration = "none";
	}
}



//##########SCRIPT FLASH uPDATE##################

if(Browser == undefined){
	var Browser = {
	isIE: function(){
		return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
}
}

	var Flash = function(movie, id, width, height, initParams){
	
	this.html = "";
	this.attributes = this.params = this.variables = null;

	this.variables = new Array();
	this.attributes = {
	"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
	"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0",
	"type": "application/x-shockwave-flash"
}
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
	
	if(movie) {
	this.addAttribute("data", movie);
	this.addParameter("movie", movie);
}
	
	if(id && id != null) this.addAttribute("id", id);
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined){
	for(var i in initParams){
	this.addParameter(i.toString(), initParams[i]);
}
}

}
	Flash.version = "1.2b";
	Flash.getObjectByExceptions = function(obj, excep){
	var tempObj = {};
	for(var i in obj){
	var inclui = true;
	for(var j=0; j<excep.length; j++)
	if(excep[j] == i.toString()) { inclui = false; break; };
	if(inclui) tempObj[i] = obj[i];
}
	return tempObj;
}
	Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
	Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
	Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
	Flash.prototype.getFlashVars = function(){
var tempString = new Array();

for(var i=0; i<this.variables.length; i++)
	tempString.push(this.variables[i].join("="));
	
	return tempString.join("&");
}
	Flash.prototype.toString = function(){
	
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE()){

//IE
	this.html = "<ob" + "ject";
	var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
	for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
	this.html += "> ";
	var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
	for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
	this.html += " </obj" + "ect>";

} else {
	//non-IE
	this.html = "<!--[if !IE]> <--> <obj" + "ect";
	var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
	for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
	this.html += "> ";
	var params = Flash.getObjectByExceptions(this.params, ["extend"]);
	for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
	this.html += " </obj" + "ect> <!--> <![endif]-->";
}

return this.html;

}
	Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
	if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
	if( w != undefined && w ) w.innerHTML = this.toString();
	else document.write( this.toString() );
}


////////////////////////////////////////Autenticidade Home Servicos Online


	function openWindow() {

		// Validaao Chave Autenticidade
		var nr_chave = new String (document.form1.txtcd_autenticidade.value);
		nr_chave = nr_chave.replace(".","")
		nr_chave = nr_chave.replace (" ","")
		
		if (nr_chave == "") {
		alert ("Por favor, preencha o campo Cdigo de Autenticidade");
		return false;
		}

		var nr_inscricao = new String (document.form1.txtnr_inscricao.value);
		nr_inscricao = nr_inscricao.replace(".","")
		nr_inscricao = nr_inscricao.replace (" ","")
		
		if (nr_inscricao == "") {
		alert ("Por favor, preencha o N da Inscrio");
		return false;
		}

		/*
		newWindow = window.open("", "AUTENTICIDADE","top=50,left=70,toolbar=no,location=no,diretories=no,resizable=no,status=no,menubar=no,scrollbars=no,width=700, height=400"); 
		newWindow.focus()
		*/
		
		return true; 
	}

	function formatarInscricao(objTexto) {
		if (objTexto.maxLength==9) {
			FormataINSCRICAO_MUNICIPAL(objTexto, event)
		} else {
			FormataINSCRICAO(objTexto, event)
		}
	
	}
	function habilitarEmpresa(empresa) {
	
		var lblInscricao 	= document.getElementById('lblInscricao')
		var form			= document.getElementById('form1')

		lblInscricao.innerHTML='Inscrio Municipal';
		form.txtnr_inscricao.value='';
		form.txtnr_inscricao.maxLength=9; 
		form.txtnr_inscricao.size=10	
		
	}
	
	function habilitarImovel(imovel) {

		var lblInscricao 	= document.getElementById('lblInscricao')
		var form			= document.getElementById('form1')

		lblInscricao.innerHTML='Inscrio Cadastral:';
		form.txtnr_inscricao.value='';
		form.txtnr_inscricao.maxLength=25; 
		form.txtnr_inscricao.size=35	
		
	}


function subMenu(){
		document.getElementById('dc_submenu').style.display = 'block';
		setTimeout(hideSubMenu, 5000)
	}
function hideSubMenu(){
		document.getElementById('dc_submenu').style.display = 'none';
	}

// FUNES PARA A PGINA DE CONCURSOS PBLICOS 05/03/2010

function toggleConvocacoes(elId) {
	el = document.getElementById(elId);
	if (el.style.display == "none") el.style.display = "";
	else el.style.display = "none";
	try {
		window.parent.resizeIframeConcursosPublicos();
		window.parent.resizeIfrmSistema3()
	}catch(e){
		//alert(e)	
	}
}

function resizeIframeConcursosPublicos(){
	var body2 = document.getElementById('ifrmSistemaId').contentWindow;
	document.getElementById('ifrmSistemaId').style.height = body2.document.body.clientHeight+'px';
}

function pesquisarCPF(obj) {

	var txtCpf = document.getElementById('txtcpf');
	var xtdMensagem = document.getElementById('tdMensagem');
	var xdivMensagem = document.getElementById('divMensagem');
	var xtdIconeMensagem = document.getElementById('tdIconeMensagem');
	var xtrSugestao = document.getElementById('trSugestao');
	var xtableControles = document.getElementById('tableControles');
	
	
	if (txtCpf.value.length==14)
	 {
			tempCPF = txtCpf.value;
			if  (!(validaCPF(tempCPF)))
			{
				xtdMensagem.innerHTML = 'O n&ordm; de CPF [' + tempCPF + ']  inv&aacute;lido!';
				xdivMensagem.style.border = '2px outset';
				xdivMensagem.style.backgroundColor = '#CCCCCC';
				obj.parentNode.appendChild(xdivMensagem);
				obj.parentNode.lastChild.style.display = '';
				xtrSugestao.style.display = 'none';
				xtableControles.style.display = 'none';
				return;
			} 			
			xtrSugestao.style.display = '';
			xtableControles.style.display = '';
			xCPF = txtCpf.value;
			window.open('validarCPF.asp?CPF=' + xCPF,'ifrmCheck');
			return;
	}
	else
	{
		xdivMensagem.style.display = 'none';
		xtrSugestao.style.display = 'none';
		xtableControles.style.display = 'none';
	}

}


function validaCPF(txtCPF)
{
	txtCPF = txtCPF.replace(/\./g, '');
	txtCPF = txtCPF.replace('-', '');
	var c = txtCPF.substr(0,9);
	var dv = txtCPF.substr(9,2);
	var d1 = 0;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(10-i);
	}
	if (d1 == 0){
		return false;
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
 
	if (dv.charAt(0) != d1)
	{
		return false;
	}
 
	d1 *= 2;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(11-i);
	}
	 
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
		if (dv.charAt(1) != d1)
		{
			return false;
		}
	return true;
}

/* JQUERY */

function widget(obj){
	if ( !obj ) return false;
	$('#widget').toggle();
	
};


function ShowServicosOnline () {
	openUrl('/sistemas/servicosOnline/home.aspx', '', 'principal','/sistemas/servicosOnline/tituloArea.aspx', 'acoplarMenuServicosOnlineHome()' )
}

function reloadpage() {
	
	try {		
			var f = document.getElementById('ifrmLogin');
			f.src = f.src;		
		
			ifrmLogin.reloadPage();
			
	} catch(e) {		
		return
	}
}

