function resizeEsp( numCx ){
/* setTamanhos */
var escalaEsp = new Array();
var escalaCx = new Array();


var tEsp = 0;
var tCx = 0;
var escala = 0;
if(navigator.appName == 'Netscape')
{
	escalaEsp[0] = 39;
	escalaEsp[1] = 29;
	escalaEsp[2] = 19;
	escalaEsp[3] = 9;
	
	escalaCx[0] = 59;
	escalaCx[1] = 69;
	escalaCx[2] = 79;
	escalaCx[3] = 89;
	if ( numCx == 2 )
		escala = 1;
	else
		if ( numCx == 3 )
			escala = 2;
		else
			if ( numCx >= 4 )
				escala = 3;
	tEsp = escalaEsp[escala];
	tCx = escalaCx[escala];
}
else
{
	escalaEsp[0] = 35;
	escalaEsp[1] = 30;
	escalaEsp[2] = 25;
	escalaEsp[3] = 15;
	escalaEsp[4] = 9;
	
	escalaCx[0] = 65;
	escalaCx[1] = 70;
	escalaCx[2] = 75;
	escalaCx[3] = 85;
	escalaCx[4] = 91;
	if ( numCx == 2 )
		escala = 1;
	else
		if ( numCx == 3 )
			escala = 2;
		else
			if ( numCx == 4 || numCx > 5 )
				escala = 3;
			else
				if ( numCx == 5 )
					escala = 4;
	tEsp = escalaEsp[escala];
	tCx = escalaCx[escala];
}
/* end - setTamanhos */

	var elemEsp = null;
	var elemCx = null;

	var valEsp = parseInt(numCx)-1;
	var valCx = parseInt(numCx);
	var sizeEsp = tEsp/valEsp;
	var sizeCx = tCx/valCx;
	
	for( i=1; i <= numCx; i++ ){
		elemEsp = document.getElementById("esp-" + i);
		if (i < numCx){
			elemEsp.style.width = sizeEsp + "%";	
		}
		elemCx = document.getElementById("cx-" + i);
		elemCx.style.width = sizeCx + "%";
		elem = null;
	}
}

function sublinharElem( idBase, nElem, decoration ){
	var maxElem = 3;
	var elem = null;
	var child = null;
	var none = null;
	var totalChildren = 0;
	for (i=0; i<maxElem; i++){
		elem = document.getElementById(idBase + '-' + i);
		if (elem != null){
			 if (elem.className == "bb"){
                                   elem.className="bbLink";
                          }
                          else if (elem.className == "bbLink"){
                                elem.className="bb";
                           }
			elem.style.textDecoration = decoration;
			nodes = elem.childNodes;
			if (nodes != null){
				totalChildren = nodes.length
				for (c=0; c < totalChildren; c++  ){
					child = elem.childNodes[c];
					if ( child != null && child.style != null )
							child.style.textDecoration = decoration;
				}
			}
		}
	}
}

function sublinharElem2( idBase, nElem, decoration,back ){
	var maxElem = 3;
	var elem = null;
	var child = null;
	var none = null;
	var totalChildren = 0;
	for (i=0; i<maxElem; i++){
		elem = document.getElementById(idBase + '-' + i);
		if (elem != null){
			 if (elem.className == "bb"){
                                   elem.className="bbLink";
                          }
                          else if (elem.className == "bbLink"){
                                elem.className="bb";
                           }
			if (back=='1' && i==1){
			   elem.style.background= '#4570a7';
			}
			else if(back=='2' && i==1) { elem.style.background= '#829FC4';}

			elem.style.textDecoration = decoration;
			nodes = elem.childNodes;
			if (nodes != null){
				totalChildren = nodes.length
				for (c=0; c < totalChildren; c++  ){
					child = elem.childNodes[c];
					if ( child != null && child.style != null ){
							child.style.textDecoration = decoration;
							if (back=='1' && i==1){
							   child.style.background= '#4570a7';
							}
							else if(back=='2' && i==1) { child.style.background= '#829FC4';}
					}
				}
			}
		}
	}
}

function changeComentStatus(idElem){

            var elem = document.getElementById(idElem);

            if ( elem.style.visibility == 'visible' )

            {

                        elem.style.display = 'none';

                        elem.style.visibility = 'hidden';

            }

            else

                        if ( elem.style.visibility == 'hidden' )

                        {

                                    elem.style.display = 'block';

                                    elem.style.visibility = 'visible';

                        }

}

function path_barraesq(p_path) {
	var v_url = window.location.href;
	var v_index = v_url.lastIndexOf('/');
	var v_path = v_url.substring(v_index + 1);
	var v_td = '<td';

	v_td += ' style="width:100%;"';
	if (p_path == v_path) {
		v_td += ' class="itemActive">';
		document.write(v_td);
	} else {
		v_td += ' class="item" onMouseOver="javascript: this.className = ';
		v_td += "'itemActive'";
		v_td += '" onMouseOut="javascript: this.className = ';
		v_td += "'item'";
		v_td += '">';
		document.write(v_td);
	}
}

/*BARRA SUBPORTAIS (alteração) mlopes 20060309*/
function preLoadMenuImages(){

	var photos=new Array();
	photos[0]="/imagem_wsd/info-home/subT-cla-cla.jpg";
	photos[1]="/imagem_wsd/imagem/info-home/subT-esc-cla.jpg";
	photos[2]="/imagem_wsd/imagem/info-home/subT-esc-med.jpg";
	photos[3]="/imagem_wsd/imagem/info-home/subT-cla-esc.jpg";
	photos[4]="/imagem_wsd/imagem/info-home/subT-cla-med.jpg";
	photos[5]="/imagem_wsd/imagem/info-home/subT-med-esc.jpg";
	photos[6]="/imagem_wsd/imagem/info-home/subT-med-cla.jpg";
	photos[7]="/imagem_wsd/imagem/info-home/subT-fim-c.jpg";
	photos[8]="/imagem_wsd/imagem/info-home/subT-fim-m.jpg";
	photos[9]="/imagem_wsd/imagem/info-home/subT-fim-e.jpg";
	photos[10]="/imagem_wsd/imagem/info-home/subT-risca-c.jpg";
	photos[11]="/imagem_wsd/imagem/info-home/subT-risca-m.jpg";
	photos[12]="/imagem_wsd/imagem/info-home/subT-risca-e.jpg";
	
	var preloadedimages=new Array();
	for (i=0;i<photos.length;i++){
		preloadedimages[i]=new Image();
		preloadedimages[i].src=photos[i];
	}
}

function putMouseHover(obj,numMenu){
	var objId = (obj.id).split('-')
	var id = objId[2];
	id --;
	var idPrv = id;
	id = objId[2];
	id ++;
	var idNxt = id;
	id = objId[2];
	var elemPrev = document.getElementById('subS-T-' + idPrv);
	var elemNext = document.getElementById('subS-T-' + id);
	var par = document.getElementById('subS-' + id);
	par.className = "hover";

	if (elemPrev != null){
		if (idPrv == numMenu){
			elemPrev.className = 'transicao-act-hover';
		} else {
			elemPrev.className = 'transicao-normal-hover';
		}
	}
	if (elemNext != null){
		if (idNxt == numMenu){
			elemNext.className = 'transicao-hover-act';
		} else {
			elemNext.className = 'transicao-hover-normal';
		}
	} else {
		var elemFinal = document.getElementById('subS-T-F');
		var elemLinhaFinal = document.getElementById('subS-T-LF');

		if (elemFinal != null){
			elemFinal.className = 'transicaoFinalHover';
		}
		if (elemLinhaFinal != null){
			elemLinhaFinal.className = 'linhaFinalHover';
		}
	}
	
}

function putMouseOut(obj,numMenu){
	var objId = (obj.id).split('-')
	var id = objId[2];
	id --;
	var idPrv = id;
	id = objId[2];
	id ++;
	var idNxt = id;
	id = objId[2];
	var par = document.getElementById('subS-' + id);
	par.className = "hover";

	
	if ( id == numMenu ){
		par.className = "active";
	} else {
		par.className = "normal";
	}

	var elemPrev = document.getElementById('subS-T-' + idPrv);
	var elemNext = document.getElementById('subS-T-' + id);

	if (elemPrev != null){
		if (idPrv == numMenu){
			elemPrev.className = 'transicao-act-normal';
		} else {
			if (id == numMenu) {
				elemPrev.className = 'transicao-normal-act';
			} else {
				elemPrev.className = 'transicao';
			}
		}
	}
	
	if (elemNext != null){
		if (idNxt == numMenu){
			elemNext.className = 'transicao-normal-act';
		} else {
			if (id == numMenu){
				elemNext.className = 'transicao-act-normal';
			} else {
				elemNext.className = 'transicao';
			}
		}
	} else {
		var elemFinal = document.getElementById('subS-T-F');
		var elemLinhaFinal = document.getElementById('subS-T-LF');
		if (elemFinal != null){
			if (id == numMenu){
				elemFinal.className = 'transicaoFinalActive';
			} else {
				elemFinal.className = 'transicaoFinalNormal';
			}
		}
		if (elemLinhaFinal != null){
			if (id == numMenu){
				elemLinhaFinal.className = 'linhaFinalActive';
			} else {
				elemLinhaFinal.className = 'linhaFinalNormal';
			}
		}
	}
	
	
}

function initSubSitesBar(numMenu) {
	var active = document.getElementById('subS-' + numMenu);
	if (active != null) {
		active.className='active';
		var elemPrev = document.getElementById('subS-T-' + (numMenu-1));
		var elemNext = document.getElementById('subS-T-' + numMenu);
		if (elemPrev != null)
			elemPrev.className = 'transicao-normal-act';

		if (elemNext != null) {
			elemNext.className = 'transicao-act-normal';
		} else {
			var elemFinal = document.getElementById('subS-T-F');
			var elemLinhaFinal = document.getElementById('subS-T-LF');
			if (elemFinal != null){
				elemFinal.className = 'transicaoFinalActive';
			}
			if (elemLinhaFinal != null){
				elemLinhaFinal.className = 'linhaFinalActive';
			}
		}
	}
}
/*BARRA SUBPORTAIS (alteração) mlopes 20060309*/

var ultimoMenu = '';
function showHideStar( id, action )
{
	var  elem = document.getElementById(id);
	elem.style.visibility=action;
}

function showHidden( id ){
	var elem = document.getElementById(id);
	if ( elem.style.visibility == 'visible' )
	{
		elem.style.display = 'none';
		elem.style.visibility = 'hidden';
	}
	else
		if ( elem.style.visibility == 'hidden' )
		{
			elem.style.display = 'block';
			elem.style.visibility = 'visible';
		}
}

function showHideTitleSubContent( subId )
{
	var str = subId.split('-');
	idOpened = str[0] + "-opened-" + str[1];
	idClosed = str[0] + "-closed-" + str[1];
	
	showHidden( idOpened );
	showHidden( idClosed );
}

function hiddeOthers( subId )
{
	var str = subId.split('-');
	actual = str[0] + '-' + str[1];

	var elem = document.getElementById(str[0] + "-01");
	i = 1;
	while ( elem != null )
	{
		if ( elem != null && elem.id != ultimoMenu)
		{
			elem.style.display = 'none';
			elem.style.visibility = 'hidden';
			changeBkGdImgToHidden( elem.id )
		}
		if (i < 10 )
			valor = '0' + i;
		else
			valor = '' + i;
		elem = document.getElementById(str[0]+ "-" + valor);
		i++;
	}

}

function showHideTitle(subId){
	var str = subId.split('-');
	idOpened = str[0] + "-opened-" + str[1];
	idClosed = str[0] + "-closed-" + str[1];
	idImgOn =  str[0] + "-imgOn-" + str[1];
	idImgOff = str[0] + "-imgOff-" + str[1];
	idImgCutOn = str[0] + "-bxOn-" + str[1];
	idImgCutOff = str[0] + "-bxOff-" + str[1];
	ultimoMenu = subId;
//	hiddeOthers( subId );

	showHidden( idOpened );
	showHidden( idClosed );
	showHidden( idImgOn );
	showHidden( idImgOff );
	showHidden( idImgCutOn );
	showHidden( idImgCutOff );
}

function changeBkGdImgToHidden( subId )
{
	var str = subId.split('-');
	
	idImgOnAux =  str[0] + "-imgOn-" + str[1];
	idImgOffAux = str[0] + "-imgOff-" + str[1];

	var elemVisible = document.getElementById(idImgOnAux);
	if ( elemVisible.style.visibility == 'visible' )
	{
		showHidden( idImgOnAux );
		showHidden( idImgOffAux );
	}
}

function toggleLNK(elem,chrFirst,chrSecond)
{
	if ( elem.innerHTML == chrFirst )
	{
		elem.innerHTML = chrSecond;
	}
	else
		if ( elem.innerHTML == chrSecond )
		{
			elem.innerHTML = chrFirst;
		}
}

function setCheckBox(strElemento, totalElemntos, setCheck)
{
	var elem;
	for ( i=1; i < totalElemntos + 1; i++ )
	{
		elem = document.getElementById(strElemento + i);
		elem.checked = setCheck;
	}
}

function pointerOver( obj )
{
	obj.style.cursor='pointer';
}

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) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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 setClassNameMapaSite(obj){
   if ( obj != null ){
      if (obj.className == 'supTituloEscuro' ){
         obj.className = 'supTituloEscuroHover'; 
      } else {
         obj.className = 'supTituloEscuro';         
      }
   }
}

/*
var max=1.6;
  var min=1;
  var normal=1;
 

  function mudaFonte( val ) {
              var tamanho = parseFloat(document.body.style.fontSize) ;
              var elemDim = document.getElementById("p_diminuir");
              var elemAum = document.getElementById("p_aumentar");

              tamanho += val;
              tamanho = roundNumber(tamanho);
              if ( tamanho >= max )
              {
                          tamanho = max;
                          elemAum.style.cursor="default";
                          elemDim.style.cursor="pointer";
              }
              else
                          if(tamanho <= min )
                          {
                                      tamanho=min;
                                      elemAum.style.cursor="pointer";
                                      elemDim.style.cursor="default";
                          }
                          else{
                                      elemAum.style.cursor="pointer";
                                      elemDim.style.cursor="pointer";
                          }
              document.body.style.fontSize = tamanho + "em";
              document.letratamanho.elements["p_tamanho"].value = tamanho;
              var url = window.location.href;
	      var index = url.lastIndexOf('/');
	      var path = url.substring(index + 1);
	      while (path.indexOf('&') > -1) {
	      	path = path.replace('&', '%26');
	      }
	      document.letratamanho.elements["p_url"].value = path;
              document.letratamanho.submit();
  }
*/

 

  function roundNumber( value ) {
            var rnum = value;
            var rlength = 2; // The number of decimal places to round to
            if (rnum > 8191 && rnum < 10485) {
                        rnum = rnum-5000;
                        var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
                        //newnumber = newnumber+5000;
            } else {
                        var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
            }
            return newnumber;
}
/*
function menuSep(){
            var c = 0;
            var tam;
            var child = null;
            var totalChildren = document.getElementById('totalSeparadores').value; 

            for (c=1; c <= totalChildren; c++  ){
                        child = document.getElementById('sep-' + c);
                        tam = child.offsetWidth;
                        if (tam < 85 ){
                                    child.style.width = '85px';
                        }
            }
}
*/
/*Pop-up de AJUDA*/
var helpWindow = null;

function openHelpWindow( url, titulo ){
   helpWindow = window.open (url,titulo,'toolbar=0, status=0, menubar=0, resizable=1,scrollbars=1, width=450');
   helpWindow.focus();
}
