/***********************************************
* 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
***********************************************/

//All commented-out links are going to be updated, so please hold.

//Contents for menu 1
var menu1=new Array()
menu1[1]='<a href="/index.php">Home</a>'
//menu1[2]='<a href="/news.php">News</a>'
//menu1[3]='<a href="/aboutus.php"> About Us </a>'
//menu1[4]='<a href="/awards.php"> Awards </a>'
//menu1[5]='<a href="/contactforms.php"> Contact Forms </a>'
menu1[6]='<a href="/credits.php"> Credits </a>'
//menu1[7]='<a href="/disappearing.php"> Disappearing Acts </a>'
menu1[8]='<a href="/linktous.php"> Link to Us </a>'
menu1[9]='<a href="/tos.php"> Terms and Conditions </a>'

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="http://www.animalpalace.org/graphics.php">Graphics</a>'

//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="http://www.animalpalace.org/Neopets/guides/listing.php">Guide Listing</a>'
menu3[1]='<a href="/adventc.php">Advent Calendar Archive</a>'

//Contents for menu 4
var menu4=new Array()
menu4[0]='Coming Soon'//menu4[1]='<a href="/Services/premium.php">Animal Palace Premium</a>'
//menu4[2]='<a href="/Services/buttons.php">Buttons</a>'
//menu4[3]='<a href="/graphicrequest.php">Custom Graphics</a>'
//menu4[4]='<a href="http://plugboards.animalpalace.org/">Plug Board</a>'
//menu4[5]='<a href="/Services/sitelayouts.php">Site Layouts</a>'
//menu4[6]='<a href="/Services/certification.php">Site Certification</a>'
//menu4[7]='<a href="/shopdirectory.php/main.php">Shop Directory</a>'
//menu4[8]='<a href="/guilddirectory/main.php"> Guild Directory</a>'
//Contents for menu 5
var menu5=new Array()
menu5[0]='Hahah...  you thought we were FUN!?'
//menu5[1]='<a href="/Fun/gamesroom.php">Games Room</a>'
//menu5[2]='<a href="http://forums.animalpalace.org/">Forum</a>'
//menu5[3]='<a href="/Fun/quizzes.php">Quizzes</a>'
//menu5[4]='<a href="/Fun/screenies.php">Screenies</a>'

//Contents for menu 6
var menu6=new Array()
//menu6[0]='<a href="/Other/polls.php">Polls and Surveys</a>'
//menu6[1]='<a href="/Other/other.php">Other</a>'
menu6[2]='<a href="/code_post.php">Neoboard HTML Poster</a>'
menu6[3]='<a href="/dropdown/index.php">Viewers</a>'
menu6[4]='<a href="/last_caption.php">Latest Uploaded Caption</a>'
menu6[5]='<a href="/adinterview.php">Adam/Donna Interview</a>'
menu6[6]='<a href="/Adoption_agency/ap_adoptions.php"> Animal Palace Adoption Agency </a>'

//Contents for menu 7
var menu7=new Array()
menu7[0]='<a href="http://animalpalace.org/staff/meetthestaff.php">Meet the Staff</a>'
//menu7[1]='<a href="/Staff/blogs.php">Staff Blogs</a>'


		
/////No further editing 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, menuwidth){
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){
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)
}

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


/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
document.cookie =
  obj + '=block; expires=Mon, 28 June 2010 20:47:11 UTC; path=/'
			el.style.display = "block";
		}else{
document.cookie =
  obj + '=none; expires=Mon, 28 June 2010 20:47:11 UTC; path=/'
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
