function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function display(nod,num){
	var tmp = nod.parentNode.parentNode.parentNode.childNodes[num];
	if (tmp.style.display=='none'){
		tmp.style.display='block'
	}else{
		tmp.style.display='none'
	}
}
function play(num,aid){
	var winPaly = window.open('../base/play.asp?NO='+num+'&AID='+aid,'play','top=30,left=140,width=430,height=545,scrollbars=yes,resizable=yes,menubar=yes')
	winPaly.window.focus();
}

var timerID = null
var timerRunning = false
var charNo = 0
var charMax = 0
var lineNo = 0
var lineMax = 3
var lineArr = new Array(lineMax)
var urlArr = new Array(lineMax)
lineArr[1] = "本店更多資訊"
urlArr[1] = "index.asp?module=intro"
lineArr[2] = "本店更多資訊"
urlArr[2] = "index.asp?module=intro"
lineArr[3] = "本店更多資訊"
urlArr[3] = "index.asp?module=intro"
lineArr[4] = "本店更多資訊"
urlArr[4] = "index.asp?module=intro"

var lineText = lineArr[1];
function StartShow() {
	StopShow()
	ShowLine()
	timerRunning = true
}
function StopShow() {
	if (timerRunning) {
		clearTimeout(timerID)
		timerRunning = false
	}
}
function ShowLine() {
	if (charNo == 0) { // Next line
		if (lineNo < lineMax) 	{
			lineNo++
		}
		else {
			lineNo = 1
		}
		lineText = lineArr[lineNo]
		charMax = lineText.length
	}
	if (charNo <= charMax) { // Next char
		document.formDisplay.buttonFace.value = lineText.substring(0, charNo)
		charNo++
		timerID = setTimeout("ShowLine()", 100)
	}
	else {
		charNo = 0
		timerID = setTimeout("ShowLine()", 3000)
	}
}
function GotoUrl(url)
{
	location.href = url
}
//---------------------------------------------
//開始計時的時間
var mmStart;
//等待隱藏時間的長短
var timeout=500;
//等待隱藏的物件
var mmInTimerobj;
//目前在計時的程序
var mmHideMenuTimer=null;
//不能隱藏Div名稱
var NotHiddenDivs = new Array(); 
//---------------------------------------------
//取得絕對位置程式
function getPos(el,sProp)  
{
	var iPos = 0;
	while (el!=null)  
　　 {
		iPos+=el["offset" + sProp];
		el = el.offsetParent;
	 } 
    return iPos;
}  

//---------------------------------------------
//清除計時的程序
function MM_clearTimeout() {
	if (mmHideMenuTimer){
		clearTimeout(mmHideMenuTimer);	
		mmHideMenuTimer = null;
	}
}

//---------------------------------------------
//開始一個計時程序每500毫秒一次
function MM_startTimeout() {
	NotHiddenDivs=null;
	mmStart = new Date();
	mmHideMenuTimer = setTimeout("mmDoHide()", 500);
}

//---------------------------------------------
//判斷隱藏的程式
function mmDoHide() {
	var elapsed = new Date() - mmStart;
	if (elapsed < timeout) {
		mmHideMenuTimer = setTimeout("mmDoHide()", timeout+100-elapsed);
		return;
	}
	ToHiddenAllDiv();
	mmHideMenuTimer=null;
}
//---------------------------------------------
//發現物件
function FIND(item) {
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

//---------------------------------------------
//設定不能隱藏DIV 及顯示DIV
function ShowMenu(el,NotHiddenDivStr,actMenu,isRoot){
	var ActiveMenu;
	MM_clearTimeout();	
	if (!NotHiddenDivs){
		NotHiddenDivs = NotHiddenDivStr.split(",");	
		ToHiddenAllDiv();
	}
	if (FIND(actMenu)){
		ActiveMenu=FIND(actMenu);
		if (ActiveMenu) {
			if (isRoot=='root'){
				ActiveMenu.style.pixelLeft=getPos(el.offsetParent,"Left"); 
				ActiveMenu.style.pixelTop=getPos(el.offsetParent,"Top") + el.offsetParent.offsetHeight-5;
			}else{
				ActiveMenu.style.pixelLeft=getPos(el.offsetParent,"Left")+el.offsetWidth-5;
				ActiveMenu.style.pixelTop=getPos(el.offsetParent,"Top")+5;
			}
			ActiveMenu.style.position='absolute'; 
			ActiveMenu.style.display='block'; 
		}
	}
}
//---------------------------------------------
//隱藏所有可隱藏的DIV
function ToHiddenAllDiv(){
	var Divstr,hiddenFlg;
	for (var i=0; i<50; i++) {
		Divstr="menuDiv_"+i;
		hiddenFlg=true;
		if (NotHiddenDivs){
			for (var j=0;j<NotHiddenDivs.length;j++){	
				if (NotHiddenDivs[j]==Divstr){
					hiddenFlg=false;
				}			
			}
		}
		if (hiddenFlg){
			if (FIND("menuDiv_"+i)){
				var toHiddenDiv = FIND("menuDiv_"+i);
				toHiddenDiv.style.display='none';
			}
		}
	}
}
//---------------------------------------------
//不做任何事件時
function NoEven(){
	return;
}