/***********************************************
// Adicionar aos favoritos
***********************************************/
function addFav(){
    var url  = "http://www.luizhumberto.com.br";
    var title  = "Vereador Luiz Humberto";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}


//Esta função faz com que a função poListener seja adicionada à lista de funções chamadas quando o evento psEvent é disparado para o objeto poElement
function mtlAddEventListener(poElement, psEvent, poListener, pbCapture)
{
	//poElement		//Elemento cujo evento será interceptado
	//psEvent		//Nome do evento a ser interceptado
	//poListener	//Função ou método a ser chamado na ocorrência do evento
	//pbCapture		//Flag que determina se o evento será capturado ou não

	var oException; //Possível exceção a ser lançada caso o evento padrão do DOM não exista (IE)

	if ((typeof(poElement) == "object") && psEvent && poListener && (typeof(pbCapture) == "boolean"))
	{
		if (poElement)
		{
			try	//Navegadores gecko
			{
				poElement.addEventListener(psEvent, poListener, pbCapture);
			}
			catch (oException)	//Navegador IE
			{
				poElement.attachEvent(("on" + psEvent), poListener);
			}
		}
	}
}


//Pop Centralizada
function exibirPop(psFile, pnWidth, pnHeight)
{
	//psFile	//Arquivo a ser aberto dentro da pop-up
	//pnWidth	//Largura da pop-up
	//pnHeight	//Altura da pop-up
	
	var oPop;	//Pop-up
	var nLeft;	//Canto esquerdo da pop-up, em pixels
	var nTop;	//Canto superior da pop-up, em pixels
	
	nLeft = (screen.width / 2) - (pnWidth / 2);
	nTop = (screen.height / 2) - (pnHeight / 2);
	
	oPop = window.open(psFile, "Brokers", new String("width=" + pnWidth + "px,height=" + pnHeight + "px,top=" + nTop + "px,left=" + nLeft + "px") );
}


//Altera o tamanho da letra
var letra ={
	size:12,
	aumenta:function()
	{
		if ( this.size < 16 )
		{
			this.size++;
			createCookie("fs", this.size, 365);
			document.body.style.fontSize = this.size+'px';
		}
	},
	diminui:function()
	{
		if ( this.size > 11 )
		{
			this.size--;
			createCookie("fs", this.size, 365);
			document.body.style.fontSize = this.size+'px';
		}
	}
}

function createCookie(name,value,days)
{
  if (days)
  {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

if ( document.body )
{
  var fs = readCookie("fs");
  if ( !isNaN(parseInt(fs)) )
  {
    document.body.style.fontSize = parseInt(fs)+"px";
    Ac.size = parseInt(fs);
  }
}
