
  function setHeight() {
     partnerArticleBoxMaximum = 0;
     $("div[id*=partnerArticleBoxPage_]").each(function(k,v) {
        if ($(this).height()>partnerArticleBoxMaximum) {
           partnerArticleBoxMaximum = $(this).height();
        }
     });
     $("div[id*=partnerArticleBoxPage_]").height(partnerArticleBoxMaximum);
     $("#partnerArticleBox").height((partnerArticleBoxMaximum+31));
  }

  $(document).ready(function() {
     window.onload = setHeight;
  });


function partnerArticleBox(sumHit) {

   this.globalActualPage = 1;


   this.next = function(rotate) {
      if (timeOutLocker == 1) { return; } else { timeOutLocker = 1; }
      lock = 0;
      actualPage = this.globalActualPage;
      if (lock != 1 && ((this.globalActualPage != sumHit && rotate == 0) || (rotate == 1)) ) {
         lock = 1;

         $("div#partnerArticleBoxPage_"+actualPage).fadeOut(100,function() {
            if (actualPage == sumHit && rotate == 1) { actualPage = 0; partnerArticleBox.globalActualPage = 0; }
            $("div#partnerArticleBoxPage_"+(actualPage+1)).fadeIn(100,function() {

               if (rotate == 1 && actualPage == 0) {
                  $("img#partnerArticleBoxPageSquare_"+sumHit).attr('class','squareInActive');
               } else {
                  $("img#partnerArticleBoxPageSquare_"+actualPage).attr('class','squareInActive');
               }
               $("img#partnerArticleBoxPageSquare_"+(actualPage+1)).attr('class','squareActive');

                  partnerArticleBox.globalActualPage++;

               if (this.globalActualPage == sumHit && rotate == 0) {
                  $("input#partnerArticleBoxNextBtn").attr("disabled",true);
                  $("input#partnerArticleBoxPrevBtn").removeAttr("disabled");
               } else {
                  $("input#partnerArticleBoxPrevBtn").removeAttr("disabled");
                  $("input#partnerArticleBoxNextBtn").removeAttr("disabled");
               }
               lock = 0;
               timeOutLocker = 0;
            });
         });
      } else { return; }
   };

   this.prev = function(rotate) {
      lock = 0;

      actualPage = this.globalActualPage;
      if (lock != 1 && ((this.globalActualPage != 1 && rotate == 0) || (rotate == 1)) ) {
         lock = 1;

         $("div#partnerArticleBoxPage_"+actualPage).fadeOut(100,function() {
            if (actualPage == 1 && rotate == 1) { actualPage = sumHit+1; partnerArticleBox.globalActualPage = sumHit+1; }
            $("div#partnerArticleBoxPage_"+(actualPage-1)).fadeIn(100,function() {

               if (rotate == 1 && actualPage == sumHit+1) {
                  $("img#partnerArticleBoxPageSquare_"+1).attr('class','squareInActive');
               } else {
                  $("img#partnerArticleBoxPageSquare_"+actualPage).attr('class','squareInActive');
               }
               $("img#partnerArticleBoxPageSquare_"+(actualPage-1)).attr('class','squareActive');

                  partnerArticleBox.globalActualPage--;

               if (this.globalActualPage == 1 && rotate == 0) {
                  $("input#partnerArticleBoxNextBtn").attr("disabled",true);
                  $("input#partnerArticleBoxPrevBtn").removeAttr("disabled");
               } else {
                  $("input#partnerArticleBoxPrevBtn").removeAttr("disabled");
                  $("input#partnerArticleBoxNextBtn").removeAttr("disabled");
               }
               lock = 0;
            });
         });
      } else { return; }
   };

}

