/* 此程式為 網頁設計排困解難 DIY (程秉輝 John Hawke 合著) 範例程式,詳細使用說明請見該書 */

var whichOpen='';
var whichContinue='';

// 圖層id, maxh 子選單高度, 選單表格id
function menuChange(obj,maxh,obj2)
{
  if (obj.style.pixelHeight)    // 關閉目前打開的選單
     {menuHide(obj,maxh,obj2);
      whichOpen=''; whichcontinue='';
     }
  else
     {if (whichOpen)
	     {whichContinue=obj2; whichOpen.click();}
	  else
	     {menuShow(obj,maxh,obj2); whichOpen=obj2; whichContinue='';}
	 }
}

// 顯示指定的選單
function menuload(obj,maxh,obj2)
{
	obj.style.pixelHeight=maxh
	obj.filters.alpha.opacity=100;
   obj2.background="images/item_hide.gif";
obj.style.display='block'
whichOpen=obj2; whichContinue=''
}

function menuShow(obj,maxh,obj2)
{
  if (obj.style.pixelHeight < maxh)
  {obj.style.pixelHeight+=maxh/20;
   obj.filters.alpha.opacity+=5;
   obj2.background="images/item_hide.gif";
   if (obj.style.pixelHeight == maxh/10) obj.style.display='block';
   myObj=obj; myMaxh=maxh; myObj2=obj2;
   setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
  }
}

// 關閉指定的選單
function menuHide(obj,maxh,obj2)
{
  if (obj.style.pixelHeight>0)
     {if (obj.style.pixelHeight == maxh/20) obj.style.display='none';
      obj.style.pixelHeight-=maxh/20;
	  obj.filters.alpha.opacity-=5;
	  obj2.background="images/item_show.gif";
	  myObj=obj; myMaxh=maxh; myObj2=obj2;
	  setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
     }
  else
     if (whichContinue) whichContinue.click();
}
