

//Contents for menu 1, and so on
var menu_icms=new Array();
menu_icms[0]='<ul><li><a href="exhibitor.php?category=participation">參展辦法</a></li>';
menu_icms[1]='<li><a href="exhibitor.php?category=list">參展商名單</a></li>';
menu_icms[2]='<li><a href="exhibitor.php?category=manual">參展商手冊</a></li>';
menu_icms[3]='<li><a href="exhibitor.php?category=advertisement">宣傳廣告攻略</a></li></ul>';

var menu_dips=new Array();
menu_dips[0]="<ul><li><a href='news_coverage.php'>新聞報導</a></li>";
menu_dips[1]='<li><a href="hotnew.php">資訊快遞</a></li></ul>';

var menu_exhi_intro=new Array();
menu_exhi_intro[0]='<ul><li><a href="visitor.php?category=theme">展覽會介紹</a></li>';
menu_exhi_intro[2]='<li><a href="visitor.php?category=stage">大會舞台時間表</a></li>';
menu_exhi_intro[3]='<li><a href="visitor.php?category=miss">亞洲遊戲展小姐選舉</a></li>';
menu_exhi_intro[4]='<li><a href="visitor.php?category=cosplay">角色扮演狂熱</a></li></ul>';

var menu_contact=new Array();
menu_contact[0]='<ul><li><a href="contactus.php">聯絡我們</a></li></ul>';
menu_contact[1]='<ul><li><a href="faq.php">FAQ</a></li></ul>';

var menuwidth='285px' //default menu width
var menubgcolor='#ffffff'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

var classObj;
/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents,overName, menuwidth){
if(classObj!=null)classObj.className='';
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
obj.className=overName;
classObj=obj;
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)


dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
if(classObj!=null)classObj.className='';
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

// Function to animate the page back to top
function goTop()
{
	$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
}



var curLanguage = 'tc';         // Modify to fit your needs



function changeLanguage (lang) {

           if (lang != curLanguage) {

                     // Modify to fit how many lanuages you have

                     if (lang != 'en' && lang != 'tc')

                                lang = curLanguage;



                     var replacefrom = '/'+curLanguage+'/';

                     var replaceto = '/'+lang+'/';



                     var hrefto = location.href.replace(replacefrom, replaceto);

                     window.location = hrefto;

           }

}


function goUrl(lang){
    var url = document.location.href;
    var query = window.location.search.substring(1);
    var urls = url.split("?");
    var vars = query.split("&");
    var query = "";
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] != "lang" && pair[0] != "") {
            query = query + pair[0] + "=" + pair[1] + "&";
        }
    }
    query = query + "lang=" + lang;
    location.href = urls[0]+"?"+query;
}


