// JavaScript Document

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function printPage() { 
	print(document); 
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function abrir_janela_popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function CheckForm () {
	if (document.form1.nome.value==""){
		alert("O NOME é obrigatório");
		return false;
	}
	if (document.form1.email.value==""){
		alert("O E-MAIL é obrigatório");
		return false;
	}
	if (document.form1.telefone.value==""){
		alert("O TELEFONE é obrigatório");
		return false;
	}
	return true
}

PositionX = 10;
PositionY = 10;
defaultWidth = 600;
defaultHeight = 400;
var AutoClose = true;
function popImage(imageURL,imageTitle){
var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
if( !imgWin ) { return true; } //popup blockers should not cause errors
imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
'function resizeWinTo() {\n'+
'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
'var oH = document.images[0].height, oW = document.images[0].width;\n'+
'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
'window.doneAlready = true;\n'+ //for Safari and Opera
'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
'}\n'+
'<\/script>'+
'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;display:table;">'))+
'<img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();">'+
(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
imgWin.document.close();
}






// MONTAGEM DO MENU - INÍCIO DO CÓDIGO

var defaultMenuWidth="250px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

//sec
linkset[0]='<a href="secretarias.asp?pag=2">Assuntos Jurídicos</a>'
linkset[0]+='<a href="secretarias.asp?pag=3">Cadastro e Tributação</a>'
linkset[0]+='<a href="secretarias.asp?pag=4">Administração, Finanças e Orçamento</a>'
linkset[0]+='<a href="secretarias.asp?pag=5">Turismo e Desenvolvimento</a>'
linkset[0]+='<a href="secretarias.asp?pag=6">Educação e Cultura</a>'
linkset[0]+='<a href="secretarias.asp?pag=7">Saúde, Saneamento e Assistência Social</a>'
linkset[0]+='<a href="secretarias.asp?pag=8">Obras e Serviços Municipais</a>'
linkset[0]+='<a href="secretarias.asp?pag=10">Esporte e Lazer</a>'
linkset[0]+='<a href="secretarias.asp?pag=12">Agricultura e Meio Ambiente</a>'
linkset[0]+='<a href="secretarias.asp?pag=13">Administração, Finanças e Orçamento</a>'
linkset[0]+='<a href="secretarias.asp?pag=14">Comissão Municipal de Defesa Civil</a>'


//departamentos
linkset[1]='<a href="#" >Link 1</a>'
linkset[1]+='<a href="#" >Link 2</a>' 
linkset[1]+='<a href="#" >Link 3</a>' 
linkset[1]+='<a href="#" >Link 4</a>' 
linkset[1]+='<a href="#" >Link 5</a>' 
linkset[1]+='<a href="#" >Link 6</a>' 


//Eventos
linkset[2]='<a href="programacao.asp" >Programação</a>'
linkset[2]+='<a href="fotos.asp" >Fotos</a>'  


//História
linkset[3]='<a href="historia.asp" >Link 1</a>'
linkset[3]+='<a href="historia.asp" >Link 2</a>'  
linkset[3]+='<a href="historia.asp" >Link 3</a>'  
linkset[3]+='<a href="historia.asp" >Link 4</a>'  
linkset[3]+='<a href="historia.asp" >Link 5</a>'  
linkset[3]+='<a href="historia.asp" >Link 6</a>'  


//Legislação
linkset[4]='<a href="leis2009.asp" >Leis 2009</a>'
linkset[4]+='<a href="leis2008.asp" >Leis 2008</a>'  
linkset[4]+='<a href="decretos2009.asp" >Decretos 2009</a>'  
linkset[4]+='<a href="decretos2008.asp" >Decretos 2008</a>'   


////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",200)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

// MONTAGEM DO MENU - FIM DO CÓDIGO


function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }
   window.attachEvent("onload", correctPNG);


