function s_menu()
{
	this.id="";
	this.pic="";
	this.activepic="";
	this.activebg="";
	this.path="";
	this.ap=0;
	this.movetype="";
	this.rocktype=0;
	this.width=0;
}

var currentobj=null;
var isrock=0;
var mainmenu =new Array()
var tempmenuitem;

tempmenuitem=new s_menu();
tempmenuitem.id="index"; // 關於
tempmenuitem.pic="menu_2.png";
tempmenuitem.activepic="menu_2a.png";
//tempmenuitem.activebg="menu_activebg2.gif";
tempmenuitem.path="index.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="spbar";
tempmenuitem.pic="menubar_bg3.png";
tempmenuitem.width=15;
mainmenu.push(tempmenuitem);


tempmenuitem=new s_menu();
tempmenuitem.id="menu";       // 中壢店
tempmenuitem.pic="menu_3.png";
tempmenuitem.activepic="menu_3a.png";
//tempmenuitem.activebg="menu_activebg.gif";
tempmenuitem.activebg="";
tempmenuitem.path="menu.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="spbar";     
tempmenuitem.pic="menubar_bg3.png";
tempmenuitem.width=15;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="news";     // 龍潭店
tempmenuitem.pic="menu_1.png";
tempmenuitem.activepic="menu_1a.png";
//tempmenuitem.activebg="menu_activebg.gif";
tempmenuitem.path="news.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="spbar";
tempmenuitem.pic="menubar_bg3.png";
tempmenuitem.width=15;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="pissa";   // pizza 介紹
tempmenuitem.pic="menu_4.png";
tempmenuitem.activepic="menu_4a.png";
//tempmenuitem.activebg="menu_activebg2.gif";
tempmenuitem.path="pissa.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="spbar";
tempmenuitem.pic="menubar_bg3.png";
tempmenuitem.width=15;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="map";    // 地圖
tempmenuitem.pic="menu_5.png";
tempmenuitem.activepic="menu_5a.png";
//tempmenuitem.activebg="menu_activebg2.gif";
tempmenuitem.path="map.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="spbar";
tempmenuitem.pic="menubar_bg3.png";
tempmenuitem.width=15;
mainmenu.push(tempmenuitem);

tempmenuitem=new s_menu();
tempmenuitem.id="contact";    //聯絡
tempmenuitem.pic="menu_6.png";
tempmenuitem.activepic="menu_6a.png";
//tempmenuitem.activebg="menu_activebg2.gif";
tempmenuitem.path="contact.html";
tempmenuitem.ap=43;
tempmenuitem.movetype="none";
tempmenuitem.rocktype=0;
tempmenuitem.width=100;
mainmenu.push(tempmenuitem);


function initmenu(mainmenu_id)
{
	var str="";
	
	str+="<div style='position:absolute;left:24;top:0;height:37;'>";
	
	for(t in mainmenu)
	{
		if (mainmenu[t].id=="spbar")
		{
			str+="<span style='position:relative;z-index:1;width:"+mainmenu[t].width+";height:38;background-image:url(images/"+mainmenu[t].pic+");'>";
			str+="<div style='position:absolute;left:-2;height:41;width:81;overflow:hidden'></div>";
			
			str+="</span>";
			
			
			//str+="<span style='position:relative;z-index:1;width:100;height:38;background-image:url(images/"+mainmenu[t].pic+");'>";
			//str+="</span>";
			//str+="<div style='position:absolute;left:-2;height:41;width:81;overflow:hidden'></div>";
			
		}
		else if (mainmenu[t].id==mainmenu_id)
		{
			str+="<span id=menu_"+mainmenu[t].id+"_body style='position:relative;width:"+mainmenu[t].width+";height:37;background-image:url(images/"+mainmenu[t].pic+");'>";

				
				str+="<div style='position:absolute;left:-2;height:43;width:"+(mainmenu[t].width+4)+";overflow:hidden'>";

					str+="<span id=menubg_"+mainmenu[t].id+" style='position:absolute;left:0;top:0;z-index:0;width:"+(mainmenu[t].width+4)+";height:43;background-image:url(images/"+mainmenu[t].activebg+");'></span>";

				str+="</div>";
				
				str+="<img id=menuactivetxt_"+mainmenu[t].id+" style='position:absolute;left:0;top:0;z-index:100;width:"+mainmenu[t].width+";height:37;' src='images/"+mainmenu[t].activepic+"'>";
			
			str+="</span>";
		}
		else
		{
			str+="<span id=menu_"+mainmenu[t].id+"_body style='position:relative;width:"+mainmenu[t].width+";height:37;background-image:url(images/"+mainmenu[t].pic+");cursor:pointer;'>";

				str+="<img style='position:absolute;left:0;top:0;z-index:200;width:"+mainmenu[t].width+";height:37;' src='images/empty.gif' onmouseover='activemenu(\""+mainmenu[t].id+"\")' onmouseout='hidemenu(\""+mainmenu[t].id+"\")' onclick='menugoto(\""+mainmenu[t].id+"\")'>";
				
				str+="<div style='position:absolute;left:-2;height:43;width:"+(mainmenu[t].width+4)+";overflow:hidden'>";

					str+="<span id=menubg_"+mainmenu[t].id+" style='position:absolute;left:0;top:"+mainmenu[t].ap+";z-index:0;width:"+(mainmenu[t].width+4)+";height:43;background-image:url(images/"+mainmenu[t].activebg+");filter:Alpha(Opacity=0);'></span>";

					
				
				str+="</div>";
				
				str+="<img id=menuactivetxt_"+mainmenu[t].id+" style='position:absolute;left:0;top:0;z-index:100;width:"+mainmenu[t].width+";height:37;filter:Alpha(Opacity=0);' src='images/"+mainmenu[t].activepic+"'>";

			str+="</span>";
		}
	}

	str+="</div>";

	document.write(str);
}

function get_obj(id)
{
	var tempmenu=null;
	for (t in mainmenu)
	{
		if (mainmenu[t].id==id)
		{
			tempmenu=mainmenu[t];
		}
	}
	if (!tempmenu) return(null);
	return(tempmenu);
}


function menugoto(mainmenu_id)
{
	var tempmenu=get_obj(mainmenu_id);
	if (!tempmenu) return;

	location.assign(tempmenu.path);
}

function activemenu(mainmenu_id)
{
	var tempmenu=get_obj(mainmenu_id);
	if (!tempmenu) return;

	if (tempmenu.ap!=43) return;

	if (tempmenu.movetype!="show")
	{
		tempmenu.movetype="show";
		currentobj=tempmenu.id;
		menuitem_show(tempmenu.id);
		if (isrock==0)
		{
			isrock=1;
			rocktxt();
		}
	}
	
}

function menuitem_show(id)
{	
	var tempmenu=get_obj(id);
	if (!tempmenu) return;

	if (tempmenu.movetype!="show") return;

	if (tempmenu.ap>0)
	{
		//tempmenu.ap=tempmenu.ap/1.5;
		//document.all["menubg_"+tempmenu.id].style.top=tempmenu.ap;
		//document.all["menubg_"+tempmenu.id].filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		//document.all["menuactivetxt_"+tempmenu.id].filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		//setTimeout("menuitem_show(\""+tempmenu.id+"\")",25);
		
		tempmenu.ap=tempmenu.ap/1.5;
		
		var temElement = document.getElementById("menubg_"+tempmenu.id);
		
		temElement.style.top=tempmenu.ap;
		temElement.filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		temElement.filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		setTimeout("menuitem_show(\""+tempmenu.id+"\")",25);
	}
	else
	{
		tempmenu.ap=0;
		document.all["menubg_"+tempmenu.id].style.top=0;
		document.all["menubg_"+tempmenu.id].filters.alpha.opacity=100;
		document.all["menuactivetxt_"+tempmenu.id].filters.alpha.opacity=100;
		tempmenu.movetype="none";
	}
}

function hidemenu(mainmenu_id)
{
	return; // add 2011/12/18, fix menu changed when mouse out
	var tempmenu=get_obj(mainmenu_id);
	if (!tempmenu) return;

	if (tempmenu.movetype!="hide")
	{
		tempmenu.movetype="hide";
		setTimeout("menuitem_hide(\""+tempmenu.id+"\")",0);
	}
}

function menuitem_hide(id)
{
	var tempmenu=get_obj(id);
	if (!tempmenu) return;

	if (tempmenu.movetype!="hide") return;

	if (tempmenu.ap<43)
	{
		tempmenu.ap=tempmenu.ap+5;
		document.all["menubg_"+tempmenu.id].style.top=tempmenu.ap;
		document.all["menubg_"+tempmenu.id].filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		document.all["menuactivetxt_"+tempmenu.id].filters.alpha.opacity=((43-tempmenu.ap)/43 *100);
		setTimeout("menuitem_hide(\""+tempmenu.id+"\")",25);
	}
	else
	{
		tempmenu.ap=43;
		document.all["menubg_"+tempmenu.id].filters.alpha.opacity=0;
		document.all["menuactivetxt_"+tempmenu.id].filters.alpha.opacity=0;
		document.all["menubg_"+tempmenu.id].style.top=43;
		tempmenu.movetype="none";
	}
}

function rocktxt()
{
	if (currentobj==null) return;

	var tempmenu=get_obj(currentobj);
	if (!tempmenu) return;

	var PI=3.14159;

	if (tempmenu.rocktype>PI*2)
	{
		tempmenu.rocktype=0;
	}
	tempmenu.rocktype+=0.45;
	
	var tnum=Math.cos(tempmenu.rocktype);
	document.all["menuactivetxt_"+tempmenu.id].style.top=0-tnum*6*37/100;

	setTimeout("rocktxt(\""+tempmenu.id+"\")",25);
}



function inittopbar()
{
	var str="";
	
	//str+="<div id=logobar style= \"position:absolute;left:7;top:96;filter:progid:DXImageTransform.Microsoft.Wipe(GradientSize=1.0, wipeStyle=0, //motion='reverse');width:786px;height:162px;z-index:3\" >";
	
	str+="<div id=logobar style= \"position:absolute;left:7;top:96;width:786px;height:162px;z-index:3\" >";
	
	str+="<img id=logobar_1 border=0 src=images/adpic_01.jpg style='position: absolute; top: -16; left:4; width: 778px; height: 154px; z-index: 100;visibility:visible;'>";
	str+="<img id=logobar_2 border=0 src=images/adpic_02.jpg style='position: absolute; top: -16; left:4; width: 778px; height: 154px; z-index: 99;visibility:visible;'>";
	str+="<img id=logobar_3 border=0 src=images/adpic_03.jpg style='position: absolute; top: -16; left:4; width: 778px; height: 154px; z-index: 98;visibility:visible;'>";
	str+="<img id=logobar_bg border=0 src=images/adpic_bg.png style='position: absolute; top: -20; left:0; width: 786px; height: 162px; z-index: 0;visibility:visible;'>";
	str+="</div>"
	setTimeout("changelogobar()",1000);
	document.write(str);
}


var lastlogobar=1;
var currentlogobar=1;

function changelogobar()
{
	document.all["logobar_"+lastlogobar].style.zIndex=98;
	document.all["logobar_"+lastlogobar].style.visibility="hidden";
	
	lastlogobar=currentlogobar;
	currentlogobar++;
	if (currentlogobar>3) currentlogobar=1;
	
	document.all["logobar_"+lastlogobar].style.zIndex=99;
	document.all["logobar_"+lastlogobar].style.visibility="visible";
	document.all["logobar_"+currentlogobar].style.zIndex=100;
	document.all["logobar_"+currentlogobar].style.visibility="hidden";
	
	
	//document.all["logobar"].filters[0].Apply();
	document.all["logobar_"+currentlogobar].style.visibility="visible";
	//document.all["logobar"].filters[0].play(duation=2);
	
	
	setTimeout("changelogobar()",5000);
}

