var estagioCorpo = 1;
var tamanhoFonte = '';

var DOM= document.getElementById;

var obb;

var obb10 = new Array;

var obb11 = new Array;

var botaoaumentadiminui1,botaoaumentadiminui2,textoaumentadiminui1,textoaumentadiminui2;



function iniciaObjetosTamanhoLetra()
{

  obb = document.getElementById("corpo");
  //obb.innerHTML = document.getElementById('corpo').innerHTML.replace(/<font.*>/g, '');
  /*botaoaumentadiminui1 = document.getElementById("botaoaumentadiminui1");

  botaoaumentadiminui2 = document.getElementById("botaoaumentadiminui2");

  textoaumentadiminui1 = document.getElementById("textoaumentadiminui1");

  textoaumentadiminui2 = document.getElementById("textoaumentadiminui2");*/

}





function achaCookie(nome)

{

 var i=0;

 var achou=false;

 var COOKIES = document.cookie.split("; ")

 for (i=0;i<COOKIES.length;i++)

 {

   if (COOKIES[i].split("=")[0]==nome)

   {

     	return COOKIES[i].split("=")[1]

   }

 }

 return ""

}



function setaCorpo()

{

  expirateDate = new Date;

  expirateDate.setMonth(expirateDate.getMonth()+6)

  document.cookie="estagioCorpo="+estagioCorpo;expires=expirateDate    

} 



        

function iniciaCorpo()

{

estagioCorpo=achaCookie("estagioCorpo")

if (estagioCorpo==2)

{

   estagioCorpo2();

}

 else

{

    if (estagioCorpo==3)

    {

      estagioCorpo3();

    }

    else

    {

      if (estagioCorpo==4)

      {

        estagioCorpo4();

      }

      else

      {

    	estagioCorpo1();

      }	

    } 

} 

}



function estagioCorpo1()

{

	if (obb){ 
	   obb.style.fontSize="70%";
	   obb.style.lineHeight="160%";
	   
	   ojbFont = obb.getElementsByTagName('font');
	   for(i=0; i<ojbFont.length; i++){
	     ojbFont[i].size="2";	
	   }
	}

		

	estagioCorpo=1;

} 		



function estagioCorpo2()

{

   	if (obb){
	   obb.style.fontSize="80%";
	   obb.style.lineHeight="165%";
	   ojbFont = obb.getElementsByTagName('font');
	   for(i=0; i<ojbFont.length; i++){
	     ojbFont[i].style.size="3";	
	   }
	 }


    estagioCorpo=2;

}



function estagioCorpo3()

{

   	if (obb) {
	  obb.style.fontSize="90%";
	   ojbFont = obb.getElementsByTagName('font');
	   for(i=0; i<ojbFont.length; i++){
	     ojbFont[i].size="4";	
	   }
	}

	

	estagioCorpo=3;

}



function estagioCorpo4()

{

	if (obb) {
		
		obb.style.fontSize="100%";
		obb.style.lineHeight="160%";
        ojbFont = obb.getElementsByTagName('font');
	      for(i=0; i<ojbFont.length; i++){
	        ojbFont[i].size="5";
		   }
     }

	

	estagioCorpo=4;

}



		

function aumentaCorpo()

{

  if (estagioCorpo==1) 
  { 

    estagioCorpo2();

  }	
  else if (estagioCorpo==2) 
  {
	 estagioCorpo3();
  }		
  else if (estagioCorpo==3) 
  {

    estagioCorpo4();
  }

  setaCorpo();	

}



function diminuiCorpo()

{

  if (estagioCorpo==4) 

  {

    estagioCorpo3();

  }	

  else

  {

  	if (estagioCorpo==3) 

  	{

	  estagioCorpo2();

  	}	

  	else

  	{

  		if (estagioCorpo==2) 

  		{		

		 estagioCorpo1();

  		}	

  	}	

  }	

  setaCorpo();

}



function mostraAumentaDiminui()

{

     // botaoaumentadiminui1.style.visibility="visible";

     // botaoaumentadiminui2.style.visibility="visible";

      //textoaumentadiminui1.style.visibility="visible";

      //textoaumentadiminui2.style.visibility="visible";

}



function iniciaTamanhoLetra()

{

  if (DOM)

  {	

       iniciaObjetosTamanhoLetra();

       iniciaCorpo();

       mostraAumentaDiminui();

  }	  	

}

function attachEventFonte(){
	
	if(document.getElementById('aumenta')){
		
	   addEvent(document.getElementById('aumenta'), 'click', aumentaCorpo);
	}	 
	if(document.getElementById('diminui')){	
	   addEvent(document.getElementById('diminui'), 'click', diminuiCorpo);
	}

	iniciaTamanhoLetra();
}
