function postForm(acao) {
    var obj = document.frm;
    if (!acao || acao == '') acao = 'busca';
    obj.acao.value = acao;
    obj.submit();
}

var WinFotos;
function OpenFotos(path, larg, alt) {
   WinFotos = window.open(path,'OpenFotos', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=' + larg + ',height=' + alt);
   return false;
}

function info(acao,cod,cor){
    window.location.href = '?iUnidadesAcao=' + acao + '&iCidade=' + cod + '&cCodCor=' + cor;
    //return false;
} 

var cto = true;
function showDivPopup() { 
    var obj = ODOM_getMyObj('popdivmain'); 
    if(obj && cto) { 
        obj.style.top = 130; obj.style.left = 220; 
    } 
}
function hideDivPopup() { 
    var obj = ODOM_getMyObj('popdivmain'); 
    if(obj && cto){ 
        obj.style.top = -5000; 
        obj.style.left = -5000; 
        cto = false; 
    } 
}
function quit() { 
    var obj = document.getElementById('dPopup'); 
    if (obj) obj.className = 'dPopupOff'; 
}
function go() { 
    window.location.href='news/index.php?news=h&id=43#43'; 
}
function visitor_in() { 
    setTimeout("javascript:quit();",13000); 
}
function fechar(){ 
    obj = document.getElementById('divcopa'); obj.style.display = "none"; 
}
function quit(){ 
    obj = document.getElementById('divcopa'); obj.style.display = "none"; 
}
function quitdiv(){ 
    document.getElementById('sobre').style.display = 'none'; 
}

function mostraFoto(numero, width, height){
    window.open("imagem.php?iNumero=" + numero,'_blank','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=20,width=350,height=350');
    return false;
}

function mostraswf(){
    window.open("/duvidas/swf.php",'_blank','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=100,width=620,height=545');
}


/*
function trocaImg(nome, caminho, img, ant, prox, nome2){
    document.getElementById(nome).src = caminho+"animacao"+img+".gif";
    document.getElementById(nome2+img).src = caminho+"btn_0"+img+".gif";
    //document.getElementById(nome2+ant).src = caminho+"btn_0"+ant+"a.jpg";
    document.getElementById(nome2+prox).src = caminho+"btn_0"+prox+"a.jpg";
   // linka(img);
}
function linka(num){
    switch(num){
        case 1:
            document.getElementById('ref').href = "#";
        break
        case 2:
            document.getElementById('ref').href = "acoessociais/regulamento.php";
        break
        case 3:
            document.getElementById('ref').href = "http://www.feitrans.com.br/";
        break
        default:
            document.getElementById('ref').href = "acoessociais/regulamento.php";
    }
}
*/
var IsIE = navigator.appName.toLowerCase().indexOf('microsoft')!=-1;

// funcao para validar a entrada de dados em um campo de um formulário
onkeypress_only_numeros = function(e) {
   var Field = IsIE ? event.srcElement : e.target;
   var KeyCode = IsIE ? event.keyCode : e.which; // Codigo da Tecla
   //var Char = String.fromCharCode(KeyCode); // descomente se quiser ver o caracater
   if (KeyCode==8 || KeyCode==0 || KeyCode==13) { // Aceita para ENTER, TAB, NULO, PONTO, HIFEN, BARRA
       return true;
   }
   return (KeyCode >= 48 && KeyCode <= 57); // >= 0  &&  <=57
}

function soNumeros(v){
    var anterior;
    var tam = v.length;
    anterior = v.substr( 0, tam - 1) ;
    return v.replace(/\d*[0-9](\,\d[0-9]{3})/,anterior);
}

function openNewWindow(link, w, h,rolagem) {
  if (!w || w == '') w = 200;
  if (!h || h == '') h = 200;
  if (rolagem) rolagem = "yes"; else rolagem = "no";
  var left = (screen.width-w)/3;
  var top = 10;
  if (window.NewWindow) window.NewWindow.close();
  //NewWindow = window.open (link,'NewWindow','channelmode=no,directories=no,fullscreen=no,left=150,top=50,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,width='+w+',height='+h+'');
  window.open (link,'NewWindow','channelmode=no,directories=no,fullscreen=no,left='+left+',top='+top+',location=no,menubar=no,resizable=yes,scrollbars='+rolagem+',status=no,titlebar=no,toolbar=no,width='+w+',height='+h+'');
  return false;
}
function HideShowDivs(obj, imgSrc, Ext) {
   var objImg = "img"+obj;
   var objDiv = "id"+obj;
   setMyObj(getMyObj(objDiv), 'display',  (getMyObjDisplay(getMyObj(objDiv)) == "") ? 'none':'' );
   objImg = document.all[objImg];
   if (objImg) {
	  objImg.src = imgSrc + ((getMyObjDisplay(getMyObj(objDiv)) == "") ? 'Hide':'Show' ) + "." + Ext      
   };
   
   return false;
}
