﻿    //Adjust imgBox in albumpic
    function AdjustImg(theImg)
    {
      var imgBox = theImg.parentElement;
      if (imgBox.className != "imgBox") imgBox = imgBox.parentElement;
      if (imgBox.className != "imgBox") imgBox = imgBox.parentElement; //最多3層
      if (imgBox.className != "imgBox") return;
      
      //albumpic is 90 width height
      var theTop = (90-imgBox.offsetHeight)/2;
      var theLeft = (90-imgBox.offsetWidth)/2;
      
      if (theTop > 30 && theLeft > 30)
      {
        //window.setTimeout("AdjustImg(theImg);", 200);
        imgBox.style.top = "0px";
        imgBox.style.left = "0px";        
      }
      else
      {
        imgBox.style.top = theTop + "px"; 
        imgBox.style.left = theLeft + "px";      
      }
      
    }
    
    //Adjust imgBox in albumpic
    function AdjustImg100(theImg)
    {
      var imgBox = theImg.parentElement;
      if (imgBox.className != "imgBox") imgBox = imgBox.parentElement;
      if (imgBox.className != "imgBox") imgBox = imgBox.parentElement; //最多3層
      if (imgBox.className != "imgBox") return;
      
      //albumpic is 100 width height
      var theTop = (100-imgBox.offsetHeight)/2;
      var theLeft = (100-imgBox.offsetWidth)/2;
      
      if (theTop > 30 && theLeft > 30)
      {
        //window.setTimeout("AdjustImg(theImg);", 200);
        imgBox.style.top = "0px";
        imgBox.style.left = "0px";        
      }
      else
      {
        imgBox.style.top = theTop + "px"; 
        imgBox.style.left = theLeft + "px";      
      }
      
    }    

