/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

// Status of pic
var imgStatus = new Array()
// Contents for normal pics (optional)
var imgNormal = new Array()
// Contents for rollover pics
var imgRollover = new Array()
imgRollover[0] = "" // not used
imgRollover[1] = "/cms/templates/final_fantasy_future2/buttons/xii2.jpg"
imgRollover[2] = "/cms/templates/final_fantasy_future2/buttons/dissidia2.jpg"
imgRollover[3] = "/cms/templates/final_fantasy_future2/buttons/xiii2.jpg"
imgRollover[4] = "/cms/templates/final_fantasy_future2/buttons/versusxiii2.jpg"
imgRollover[5] = "/cms/templates/final_fantasy_future2/buttons/features2.jpg"
imgRollover[6] = "/cms/templates/final_fantasy_future2/buttons/community2.jpg"

//Contents for Final Fantasy XII
var menu1=new Array()
menu1[0]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii-revenant-wings/content/erste-infos-und-screenshots.html">Revenant Wings</a>'
menu1[1]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/rund-um-ivalice/inhalt.html">Rund um Ivalice</a>' // <-- BraveEdit
menu1[2]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/gameplay-und-system/inhalt.html">Gameplay & System</a>'
menu1[3]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/guides-und-hilfen/inhalt.html">Guides & Hilfen</a>'
menu1[4]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/walkthrough/komplettloesung.html">Komplettl&ouml;sung</a>'
menu1[5]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/berichte-und-interviews/inhalt.html">Berichte & Interviews</a>'
menu1[6]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/media/inhalt.html">Media</a>'
menu1[7]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/soundtrack/inhalt.html">Soundtrack</a>'
menu1[8]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/specials/inhalt.html">Specials</a>'
menu1[9]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/specials/die-entwickler.html">Entwicklerteam</a>'
menu1[10]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xii/specials/review-der-deutschen-pal-version-von-final-fantasy-xii.html">Review PAL-Version</a>'

//Contents for Final Fantasy XIII
var menu2=new Array()
menu2[0]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/charaktere.html">Charaktere</a>'
menu2[1]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/kampfsystem.html">Kampfsystem</a>'
menu2[2]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/summons.html">Beschw&ouml;rungen</a>'
menu2[3]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/welt-und-setting.html">Welt & Setting</a>'
menu2[4]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/screenshots.html">Screenshots</a>'
menu2[5]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/crystarium-system.html">Crystarium System</a>'
menu2[6]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/reform-system.html">Reform System</a>'
menu2[7]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/mission-system.html">Missions System</a>'
menu2[8]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/interessant-und-kurios.html">Kurioses</a>'
menu2[9]='<a href="http://final-fantasy-future.de/cms/final-fantasy-xiii/content/entwicklerteam.html">Entwicklerteam</a>'

//Contents for Features
var menu3=new Array()
menu3[0]='<a href="http://final-fantasy-future.de/cms/square-enix/start/reviews-und-previews.html">Reviews und Previews</a>'
menu3[1]='<a href="http://final-fantasy-future.de/cms/square-enix/start/messe-specials.html">Specials zu Messen</a>'
menu3[2]='<a href="http://final-fantasy-future.de/cms/square-enix/entwickler/entwickler.html">Entwicklerdatenbank</a>'

//Contents for Versus
var menu4=new Array()
menu4[0]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/preview.html">Preview</a>'
menu4[1]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/charaktere.html">Charaktere</a>'
menu4[2]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/story.html">Story</a>'
menu4[3]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/welt-und-setting.html">Welt & Setting</a>'
menu4[4]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/screenshots.html">Screenshots</a>'
menu4[5]='<a href="http://final-fantasy-future.de/cms/ffxiii-versus/content/entwicklerteam.html">Entwicklerteam</a>'

//Contents for Community
var menu5=new Array()
menu5[0]='<a href="http://final-fantasy-future.de/forum/">Hauptseite Forum</a>'
menu5[1]='<a href="http://final-fantasy-future.de/forum/index.php?page=Register">Registrieren</a>'
menu5[2]='<a href="http://final-fantasy-future.de/forum/index.php?form=Search&action=unread">Neue Beiträge</a>'
menu5[3]='<a href="http://final-fantasy-future.de/cms/intern/content/5-geburtstag-gewinnspiel.html">Gewinnspiel</a>'
menu5[4]='<a href="http://final-fantasy-future.de/cms/intern/content/final-fantasy-future-shop.html">FF Future Shop</a>'


//Contents for Intern
var menu6=new Array()
menu6[0]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-uberblick.html">Überblick</a>'
menu6[1]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-wahl-der-charaktere.html">Wahl der Charaktere</a>'
menu6[2]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-charaktere.html">Cosmos Charaktere</a>'
menu6[3]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-charaktere-2.html">Chaos Charaktere</a>'
menu6[4]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-kampfarenen.html">Kampfarenen</a>'
menu6[5]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-soundtrack.html">Soundtrack</a>'
menu6[6]='<a href="http://final-fantasy-future.de/cms/square-enix/dissidia-final-fantasy/dissidia-final-fantasy-trailer.html">Trailer & Videos</a>'

var curOrder=0
var menuwidth='149px' //default menu width
var menubgimage='rollover.png' //menu bgcolor // <-- BraveEdit
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu? // <-- BraveEdit

/////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-image:url(\''+menubgimage+'\'" 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 setPicToNormal(order) {
	if(order == 0)
		return false;
	if(!imgStatus[order] || imgStatus[order] == 0)
		return false;
	
	imgObj.src=imgNormal[order];
	imgStatus[order] = 0;
}

function dropdownmenu(obj, e, menucontents, menuwidth, order){
	// reset old pic
	setPicToNormal(curOrder);
	
	// change pic
	imgObj = document.getElementById('imgmenu' + order);
	curOrder = order // needed for rechange
	if(!imgNormal[order])
		imgNormal[order] = imgObj.src
	if(imgRollover[order] != "") {
		imgObj.src=imgRollover[order];
		imgStatus[order] = 1;
	}
	
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()
    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
    populatemenu(menucontents)

    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){
	// change pic
	setPicToNormal(curOrder);
	
    if (typeof dropmenuobj!="undefined"){
        if (ie4||ns6)
        dropmenuobj.style.visibility="hidden"
    }
}

function delayhidemenu(){
    if (ie4||ns6)
            delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
    if (typeof delayhide!="undefined")
    clearTimeout(delayhide)
}

function preloadImages() {
	var divObj=document.getElementById? document.getElementById("preloadImagesDiv") : preloadImagesDiv;
	divObj.innerHTML = '<img src="' + imgRollover.join(' "/><img src="') + '" />';
}

if (hidemenu_onclick=="yes")
	document.onclick=hidemenu
	
preloadImages()