

/*
by badanha
- > 01/2002
*/


var ehNS4, ehIE, ehNS6, ehIE6
var compl    = ""
var finalObj = ""
var theObj2;
var temp = 0;
var timerId

if(parseInt(navigator.appVersion) >=4){
           if(navigator.appName == "Netscape"){
			       if(document.layers){
                ehNS4   = true
					 }else if(document.getElementById){
					       ehNS6 = true
					 }
           }else if(document.all && document.getElementById){
                  ehIE6     = true
                  compl    = "all."
                  finalObj = ".style"
           }else if(document.all){
			         ehIE     = true
                  compl    = "all."
                  finalObj = ".style"
           }
}




//Encontrar e definir o objeto.
function getObject(obj){
   var theObj	
   if(typeof obj == "string"){
		if(ehNS4){
                       numLayers = document.layers.length;
                       for(i=0; i<numLayers; i++){
                          if(document.layers[i].name == obj){
                             theObj = eval("document."+ compl + obj + finalObj)
                             return theObj;
                          }
                          numLayersInterno = document.layers[i].document.layers.length;
                             for(k=0; k<numLayersInterno; k++){
                               if(document.layers[i].document.layers[k].name == obj){
                                  theObj = eval("document.layers[i].document."+ compl+ obj + finalObj)
                                  return theObj;
                               }
                               numLayersInterno2 = document.layers[i].document.layers[k].document.layers.length;
                                  for(j=0; j<numLayersInterno2; j++){
                                      if(document.layers[i].document.layers[k].document.layers[j].name == obj){
                                         theObj = eval("document.layers[i].document.layers[k].document."+ compl+ obj + finalObj)
                                         return theObj;
                                      }
                                      
                                  }
                             }
                       }
                }
                if(ehIE){
                       theObj = eval("document."+ compl + obj + finalObj)
                       theObj2 = eval("document."+ compl + obj)					   
                       return theObj;
                       return theObj2;					   
                }
                if(ehIE6){
                       theObj = eval("document.getElementById('"+ obj +"')"+finalObj)
                       return theObj;
                }
                if(ehNS6){
                       theObj = eval("document.getElementById('"+ obj +"')")
                       return theObj;
                }

					 
   }else{
             theObj = obj
             return theObj;
   }

}


//Tornar visivel algum objeto.
function mostra(obj){
   var theObj = getObject(obj)
   theObj.visibility = "visible"
}

//Tornar invisivel algum objeto.
function some(obj){
   var theObj = getObject(obj)
   theObj.visibility = "hidden"
}


//Passa o estado atual de visibilidade de um objeto, para o seu oposto.
function inverteVis(qual){
if(timerId){
 paraTimer()
}
  var theObj = getObject(qual)
  var estadoAtual =  theObj.visibility;

  if(estadoAtual == 'hidden' || estadoAtual == 'hide'){
     mostra(qual)
  }else if(estadoAtual == 'show' || estadoAtual == 'visible'){
     some(qual)
  }
}

function disparaTimer(comando,tempo){
  timerId = setTimeout(comando,tempo)
}

function paraTimer(){
  clearTimeout(timerId)
}


function Bpop(url, nome, larguraJ, alturaJ){
  window.open(url,nome,'status=no,scrollbars=no,left=210,top=165,menubar=no,width=' + larguraJ + ',height=' + alturaJ)
}

function shiftTo(obj, x, y) {
        var theObj = getObject(obj)
        if (ehNS4) {
                theObj.moveTo(x,y)
        } else {
                theObj.pixelLeft = x
                theObj.pixelTop = y
        }
}

function Bswap(qual,pqual,asterisco,qnd,caminho,astimg){
  if(qnd == 1)
	  document.images[asterisco].src = caminho+astimg;
     document.images[qual].src = caminho+pqual;


  if(qnd == 0)
     document.images[qual].src = caminho+pqual;
	  document.images[asterisco].src = caminho+astimg;
}



