function appBehavior(){
   this.idTopMenu = 0;
   this.idInnerMenu = 0;
   this.posActual = 0;
   this.ultimo = 0;
   this.sentido = 0;
   this.delta = -450;
   
   this.topMenu = function(idTop)
   {
      this.idTopMenu = idTop;
      document.getElementById("spnInnerMenu").innerHTML = document.getElementById("im" + idTop).innerHTML;
      document.getElementById("spnFrame").style.backgroundImage = "url(art/images/leaves" + this.idTopMenu + ".jpg)"
      
      oIfz.selectItem(document.getElementById(idTop), null, 'topMenuSelect')     
   }

   this.increment = function(){
      while (this.posActual != this.ultimo){
         this.posActual = this.posActual + (this.sentido * 50);

         marginLeft = document.getElementById("spnContents").childNodes[0].style.marginLeft;

         document.getElementById("spnContents").childNodes[0].style.marginLeft = this.posActual;

      }

      oSlide = document.getElementById("spnContents").childNodes[0];

      oSlide.style.marginLeft = this.posActual;
      
   }
      
   this.innerMenu = function(idInner){
      var sentido = 0;

      this.idInnerMenu = idInner.substr(idInner.length-1);
      leftInner = idInner.substr(0, idInner.length-1);

      newSlide = document.getElementById('div' + leftInner).innerHTML;

      expReg = new RegExp(String.fromCharCode(13) + String.fromCharCode(10), "g");
      newSlide = newSlide.replace(expReg, "");

      document.getElementById("spnContents").innerHTML = newSlide;

      for (cont=0; cont<document.getElementById("spnContents").childNodes.length; cont++){
         nodoTmp = document.getElementById("spnContents").childNodes[cont];
         if (nodoTmp.nodeType == 3){
            document.getElementById("spnContents").removeChild(nodoTmp);
         }
      }

      oIfz.selectItem(document.getElementById(idInner), null, 'innerMenuSelect');

      if (this.posActual > (this.idInnerMenu - 1) * this.delta){
         this.sentido = -1;
      }
      else{
         this.sentido = 1;
      }
      
      this.ultimo = (this.idInnerMenu - 1) * this.delta;

      this.increment();
      this.posActual = this.ultimo;
   }
}
