
function MM_swapImgRestore() { //v3.0
  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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  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 abre_url(url)
{
	var link_sel = url;
	var verifica_link_externo = /^http/;
	if (verifica_link_externo.test(link_sel))
	{
		window.open(link_sel,"blank");
	}
	else
	{
		parent.location = link_sel;
	}
}


var urlEleicao = "";

function eleicao2006()
{ 
  urlEleicao = "";
  window.open("/eleicoes/2006/index.htm","Eleições_2006","left=0,top=0,width=735,height=450, resizable=no") ;
}


function eleicaoAtual()
{ 
  urlEleicao = "";
  window.open("/eleicoes/2004/index.htm","Eleições_2004","left=0,top=0,width=735,height=450, resizable=yes") ;
}


function referendo()
{ 
  urlEleicao = "";
  window.open("/referendo/inicial.htm","Referendo", "left=0,top=0,width=670,height=500, resizable=no, scrollbars") ;
}



function mesario()
{ 
  urlEleicao = "";
  window.open("http://www2.tre-sp.jus.br/MesVol2005/index.jsp","Referendo", "left=0,top=0,width=600,height=600, resizable=no, scrollbars") ;
}


//como utilizar a função abrePaginas
//chame esta função sempre enviando os parâmetros necessários.
//ex: <a href="abrePaginas('Aqui vem o nome da página', 'aqui vem o caminho para a
//página', 'aqui vem a largura', 'aqui vem a altura', 'aqui vem a posicao em relacao ao
//lado esquerdo', 'aqui vem a posicao em relacao ao topo', 'aqui vc envia yes ou no'"
//Ex: abrePaginas("Eleicoes", "/figuras/teste.htm", "200", "300", "100", "100", "yes")

function abrePaginas(nome, url, tamanhoW, tamanhoH, posicaoy, posicaox, resize) {
 opcoes = "left=" + posicaoy + ", top=" + posicaox +", width=" + tamanhoW + ", height=" + tamanhoH + ", resizable=" + resize;
  obj = window.open(url, nome, opcoes + " scrollbars");
}


function eleicaoAtualComUrl(url)
{
  urlEleicao = url;
  obj = window.open('eleicoes/2004/index.htm','Eleições_2004','left=0,top=0,width=735,height=450, resizable=yes');
}

function eleicao2006ComUrl(url)
{
  urlEleicao = url;
  obj = window.open('eleicoes/2006/index.htm','Eleições_2006','left=0,top=0,width=735,height=450, resizable=yes');
}


function result_elei2004()
{ 
  window.open('eleicoes/result_elei2004/net_xml.html','Resultado','left=50,top=0,width=820,height=600, scrollbars=yes, resizable=yes') 
}

function vai_para_url(selecao)
{
  var sel = selecao.selectedIndex;
  var link_sel;
  var verifica_link_externo = /^http/;
  if (sel > 0)
  {
    link_sel = selecao.options[sel].value;
    if (verifica_link_externo.test(link_sel))
    {
      window.open(link_sel,"blank");
    }
    else
    {
      parent.location = link_sel;
    }
  }
}

var Id ;
var clipWidth = 800;
var clipBottom = 10;

function exibe_msg(){
	
	obj = document.getElementById("MSG");
	obj.style.display = "";
	maxBottom = 300;
	maxWidth = 800;
	clipTop = 0;
	
	obj.style.clip = 'rect('+clipTop+' '+clipWidth+' '+ clipBottom +' 0)';

	if (clipBottom >= maxBottom && clipWidth >= maxWidth){
		window.clearTimeout(Id);Id=0;
	}else{
		Id = window.setTimeout("exibe_msg();",1);
	}
	clipBottom = clipBottom + 15;	
	clipWidth = clipWidth + 15;
}

function fecha_msg(){
	window.clearTimeout(Id);Id=0;
	obj = document.getElementById("MSG");
	obj.style.display = "none";
}



