	var num_menus = 10;
	var title = new Array;
	var link = new Array;
	var c1 = new Array;
	var c2 = new Array;
	var menutext = new Array;
	var menubarwidth = 620;

	mt = new Array(10);
	for (i=0; i < 10; i++) {
		mt[i] = new Array;
	}

	ml = new Array(10);
	for (i=0; i < 10; i++) {
		ml[i] = new Array;
	}

	mt[0][0] = 'Sonic HQ';
	ml[0][0] = '/newsite';
	mt[0][1] = 'Mega Man HQ';
	ml[0][1] = '/megaman';
	mt[0][2] = 'Free E-Mail';
	ml[0][2] = '/newsite/features/email.php';
	mt[0][3] = 'Update Board';
	ml[0][3] = '/newsite/features/updateboard';
	mt[0][4] = 'Time Capsule';
	ml[0][4] = '/main/nostalgia';
	mt[0][5] = 'Awards';
	ml[0][5] = '/newsite/features/awards.php';
	mt[0][6] = 'Staff';
	ml[0][6] = '/newsite/features/staff';
	mt[0][7] = 'Site FAQ';
	ml[0][7] = '/newsite/features/faq.php';
	mt[0][8] = 'Humor';
	ml[0][8] = '/newsite/features/humor.php';
	mt[0][9] = 'Store';
	ml[0][9] = '/newsite/features/store.php';

	mt[1][0] = 'News';
	ml[1][0] = '/newsite/news';
	mt[1][1] = 'Front Page News';
	ml[1][1] = '/newsite/news';
	mt[1][2] = 'Report News';
	ml[1][2] = '/newsite/news/publicpost.php';
	mt[1][3] = 'News Archive';
	ml[1][3] = '/newsite/news/archives.php';
	mt[1][4] = 'Interviews';
	ml[1][4] = '/newsite/news/interviews';

	mt[2][0] = 'Info';
	ml[2][0] = '/newsite/general';
	mt[2][1] = 'Sonic Encyclopedia';
	ml[2][1] = '/newsite/general';
	mt[2][2] = 'Q&A';
	ml[2][2] = '/newsite/qa';
	mt[2][3] = 'Sonic FAQ';
	ml[2][3] = '/newsite/qa/faq.php';
	mt[2][4] = 'Legends of a Blue Blur';
	ml[2][4] = '/newsite/general/legends/1990-1994.php';
	mt[2][5] = 'Sonic Net History';
	ml[2][5] = '/newsite/general/history.php';

	mt[3][0] = 'Games';
	ml[3][0] = '/newsite/games';
	mt[3][1] = 'Game Index';
	ml[3][1] = '/newsite/games/index';
	mt[3][2] = 'Replay Zone';
	ml[3][2] = '/games/replay';
	mt[3][3] = 'Gameplay';
	ml[3][3] = '/games/gameplay';
	mt[3][4] = 'Hedgehog That Never Was';
	ml[3][4] = '/games/neverwas';
	mt[3][5] = 'Sonic Heroes';
	ml[3][5] = '/newsite/games/index/sonicheroes/';

	mt[4][0] = 'Comics';
	ml[4][0] = '/newsite/comics';
	mt[4][1] = 'Comics Archive';
	ml[4][1] = '/newsite/comics/issues';
	mt[4][2] = 'Previews';
	ml[4][2] = '/newsite/comics/issues';
	mt[4][3] = 'Reviews';
	ml[4][3] = '/newsite/comics/comments';
	mt[4][4] = 'Comic Scans';
	ml[4][4] = '/newsite/comics/images';

	mt[5][0] = 'Cartoons';
	ml[5][0] = '/newsite/cartoon';
	mt[5][1] = 'Before SatAM';
	ml[5][1] = '/newsite/cartoon/before';
	mt[5][2] = 'Sonic SatAM';
	ml[5][2] = '/newsite/cartoon/SatAM.php3';
	mt[5][3] = 'Adventures Of STH';
	ml[5][3] = '/newsite/cartoon/AoStH.php3';
	mt[5][4] = 'Sonic Anime OVA';
	ml[5][4] = '/newsite/cartoon/anime.php3';
	mt[5][5] = 'Sonic Underground';
	ml[5][5] = '/newsite/cartoon/SU.php3';
	mt[5][6] = 'Sonic X';
	ml[5][6] = '/newsite/cartoon/sonicx';

	mt[6][0] = 'Multimedia';
	ml[6][0] = '/newsite/images';
	mt[6][1] = 'Music';
	ml[6][1] = '/newsite/music';
	mt[6][2] = 'Gallery';
	ml[6][2] = '/newsite/images/gallery';
	mt[6][3] = 'Desktop';
	ml[6][3] = '/newsite/images/downloads/desktop.php';
	mt[6][4] = 'Video';
	ml[6][4] = '/newsite/images/downloads/video.php';

	mt[7][0] = 'Fan Fair';
	ml[7][0] = '/newsite/fanfair';
	mt[7][2] = 'Fan Art';
	ml[7][2] = '/newsite/fanfair/pics/fanart.php';
	mt[7][1] = 'Hoaxes';
	ml[7][1] = '/newsite/fanfair/pics/hoaxes.php';
	mt[7][5] = 'Fan Comics';
	ml[7][5] = '/newsite/fanfair/fancomics';
	mt[7][4] = 'Fan Fiction';
	ml[7][4] = '/newsite/fanfair/fan-fic';
	mt[7][3] = 'Fan Games';
	ml[7][3] = '/newsite/fanfair/fangames';
	mt[7][6] = 'Editorials';
	ml[7][6] = '/newsite/fanfair/editorials';
	mt[7][7] = 'Survey';
	ml[7][7] = '/newsite/fanfair/survey';

	mt[8][0] = 'Forum';
	ml[8][0] = '/newsite/forum';
	mt[8][1] = 'Forum List';
	ml[8][1] = '/newsite/forum';
	mt[8][3] = 'Board Rules';
	ml[8][3] = '/newsite/forum/guide.php';
	mt[8][4] = 'MF Chat';
	ml[8][4] = 'http://www.mobiusforum.net/mfchat/';

	mt[9][0] = 'Directory';
	ml[9][0] = '/newsite/dir';
	mt[9][1] = 'Links';
	ml[9][1] = '/newsite/dir/links.php';
	mt[9][2] = 'Fans';
	ml[9][2] = '/newsite/dir/dir.php?dir=aim&page=a';
	mt[9][3] = 'Webrings';
	ml[9][3] = '/newsite/dir/webrings.php';
	mt[9][4] = 'The HQ Award';
	ml[9][4] = '/newsite/dir/oscar.php';

	for(i=0; i<mt.length; i++) {
		menutext[i] = '<table border=2 cellspacing=0 cellpadding=2 bgcolor=#2F2FC0 bordercolorlight="#C0C0FF" bordercolordark="#606080"><tr><td><font size=2 face="Helvetica" color=white>';
		for(j=1; j<mt[i].length; j++) {
			menutext[i] += '<LI><a href=' + ml[i][j] + '>' + mt[i][j] + '</a><br>';
		}
		menutext[i] += '</td></tr></table>';
	}

function MidiPlayer () {
midiplayer = window.open("", "MidiPlayer", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=286,height=46")
midiplayer.document.open();
midiplayer.document.write('<html><title>Midi Player</title><body LEFTMARGIN=0 TOPMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0><embed src=http://www.sonichq.org/' + midi + ' autostart=true width=286 height=46 loop=true><br><center>' + caption + '</center></html>');
midiplayer.document.close();
}

var theme = "main";
var midis = new Array;
var captions = new Array;

	var i = 1;

	midis[i]="http://www.geocities.com/EnchantedForest/Glade/8862/Gravityman.mid"
	captions[i]="Gravity Man Echo Remix by Maelgrim"
	midis[++i]="music/midis/sonic/1/s1starlightjr.mid"
	captions[i]="Star Light Zone by Jeff Read "
	midis[++i]="music/midis/sonic/1/s1starlightjw.mid"
	captions[i]="Star Light Zone by John Weeks"
	midis[++i]="music/midis/sonic/1/s1starlightr.mid"
	captions[i]="Star Light Zone by Riwo"

	var space=i;

	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/ricecapdb.mid"
	captions[i]="Ice Cap Epic by David Bulmer"
	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/6657/Take_the_Snow_Train.mid"
	captions[i]="Nights Into Dreams: Take the Snow Train!"
	midis[++i]="games/rnf-cold.mid"
	captions[i]="Cold Man's Stage by Maelgrim"
	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/ricecapwa.mid"
	captions[i]="Ice Cap Wild by Wild Alpha"
	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/ESAMetropolistrancezone.mid"
	captions[i]="Metropolis Trance Zone by Edan Koch"
	midis[++i]="music/midis/sonic/3dblast/diamonddust-act2-jw.mid"
	captions[i]="Diamond Dust Zone Act 2 Genesis by John Weeks"

	var ice=i;

	midis[++i]="music/midis/sonic/s1g/gs1bridgejr.mid"
	captions[i]="Bridge Zone (Version 1) by John Weeks"
	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/SE.mid"
	captions[i]="Sonic Electronic by Jeff Read"

	var tails=i;

	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/kcasolatedislandk3.mid"
	captions[i]="Door Into Summer (Isolated Island Zone) (Version 3) by Koryan"
	midis[++i]="music/midis/sonic/chaotix/kcspeedsliderk2.mid"
	captions[i]="Speed of Sound (Speed Slider Zone) (Version 2) by Koryan"

	var espio=i;

	midis[++i]="music/midis/sonic/chaotix/kcbotonicbasek3.mid"
	captions[i]="Midnight Greenhouse (Botanic Base Zone) (Version 3) by Koryan"
	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/s3creditsek3.mid"
	captions[i]="Sonic 3 Credits Mix 3 by Edan Koch"

	var vector=i;

	midis[++i]="http://www.geocities.com/EnchantedForest/Tower/4309/mm8Tengu.mid"
	captions[i]="Tengu Man (Saturn) by Maelgrim"
	midis[++i]="music/midis/mm/x3/GravityBeetle-jj.mid"
	captions[i]="Gravity Beetle's Stage by Jarel Jones"

	var e102=i;

	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/skcskysanctuary.mid"
	captions[i]="Sky Sanctuary Zone by SEGA"
	midis[++i]="music/midis/sonic/segacd/stardustspeedway-present-jj.mid"
	captions[i]="Stardust Speedway Zone Present by Jarel Jones"

	var supersonic=i;

	midis[++i]="music/midis/sonic/3dblast/rustyruin-act2-jw.mid"
	captions[i]="Rusty Ruin Zone Act 2 Genesis by John Weeks"
	midis[++i]="music/midis/sonic/cdpast/stardustspeedway-past-jf.mid"
	captions[i]="Stardust Speedway - Past by Jose E. Felix"

	var juliesu=i;

	midis[++i]="/music/midis/sonic/3k/flyingbattery2-k.mid"
	captions[i]="Flying Battery Act 1 by Koryan"
	midis[++i]="music/midis/sonic/3dcd/panicpuppetjr.mid"
	captions[i]="Panic Puppet Zone Act 1 by Jeff Read"

	var shadow=i;

	midis[++i]="http://www.geocities.com/enchantedforest/dell/7835/skcflyingbattery.mid"
	captions[i]="Flying Battery Act 1 by SEGA"
	midis[++i]="music/midis/sonic/segacd/stardustspeedway-bad-jj.mid"
	captions[i]="Stardust Speedway Zone Bad Future by Jarel Jones"

	var metalsonic=i;

	midis[++i]="http://www.geocities.com/EnchantedForest/Dell/7835/KR.mid"
	captions[i]="King of the Ring (Radio Zone) by Jeff Read"
	midis[++i]="music/midis/south-island.mid"
	captions[i]="South Island"

var nummidis = i;
day = new Date()
seed = day.getTime()
ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*nummidis + 1,10)

var midi = midis[ran];
var caption = captions[ran];

if(ran <= space) theme = "space";
else if(ran <= ice) theme = "ice";
else if(ran <= tails) theme = "tails";
else if(ran <= espio) theme = "espio";
else if(ran <= vector) theme = "vector";
else if(ran <= e102) theme = "e102";
else if(ran <= supersonic) theme = "supersonic";
else if(ran <= juliesu) theme = "juliesu";

/////////////// STYLESHEET ///////////////

function GetCookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function SetCookie(name, value, path, domain, secure) {
	d = new Date();
	//expires.setTime(expires.getTime() + (365 * 24 * 60 * 60 * 1000 * 365));
	// path,domain,secure
	d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000));

	document.cookie = name + "=" +escape(value) +
		( (d) ? ";expires=" + d.toGMTString() : "") +
		( (path) ? ";path=" + path : "") +
		( (domain) ? ";domain=" + domain : "") +
		( (secure) ? ";secure" : "");

	if(String(GetCookie('stylesheet')) != value) alert('Cookie could not be set');
	else alert('Style set to ' + value + (document.getElementById ? '' : '\nThe style will be visible on the next page you view.'));
}

function DeleteCookie(name,path) {
    if (GetCookie(name)) {document.cookie = name + "=" +
        ((path) ? ";path=" + path : "") +
";expires=Thu, 01-Jan-1970 00:00:01 GMT"; alert('cookie');}
        // ((domain) ? ";domain=" + domain : "") +

}

function changeSheet(choice) {
	mySheet = choice.indexOf('.css')<0 ? choice + '.css' : choice;

	if(document.getElementById) {
		s = document.getElementById('stylesheet');
		if(s) s.href = '/newsite/themes/' + mySheet;
	}

/*	if (document.styleSheets)
		document.styleSheets[2].href = '/newsite/themes/' + mySheet; */
}

function StyleSelect() {
	if (document.styleSheets || document.layers) {
		//document.write('<FORM>');
		document.write('<SELECT NAME="style" onChange="changeSheet(this.options[this.selectedIndex].value)">');
		document.write('<OPTION value="');
		document.write(mySheet);
		document.write('">Current<\/OPTION>');
		document.write('<OPTION value="blue/main">Amy<\/OPTION>');
		document.write('<OPTION value="blue/main2">Vector<\/OPTION>');
		document.write('<OPTION value="blue/main3">Sonic<\/OPTION>');		document.write('<OPTION value="blue/main4">Espio<\/OPTION>');		document.write('<OPTION value="blue/main5">Rouge<\/OPTION>');		document.write('<OPTION value="blue/main6">Shadow<\/OPTION>');		document.write('<\/SELECT>');
		document.write('<INPUT TYPE="BUTTON" VALUE="OK" onClick="SetCookie(\'stylesheet\',mySheet,\'/\')">');
		//document.write('<INPUT TYPE="BUTTON" VALUE="Clear" onClick="DeleteCookie(\'stylesheet\',\'/\')">');
		//document.write('<\/FORM>');
	}
}

/**********************************************************************************   
FoldoutMenu 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()



/*** variables you can configure ***/

FoldNumber = 10					//How many toplinks do you have?
var stayFolded = false			//Stay open when you click a new toplink?
foldImg = 1						//Do you want images (if not set to 0 and remove the images from the body)?
mainOffsetY = 0					//Vertical space adjustment between the main items, in pixels.

//This is the default image.
//Remember to change the actual images in the page as well, but remember to keep the name of the image.
var unImg=new Image();
unImg.src='/newsite/foldoutmenu_arrow.gif'

var exImg=new Image();					//Making an image variable...
exImg.src='/newsite/foldoutmenu_arrow_open.gif'	//...this is the source of the image that it changes to when the menu expands.

// NOTE: if you change the position of divCont from absolute to relative, you can put the foldoutmenu in a table.
// HOWEVER it will no longer work in netscape 4. If you wish to support netscape 4, you have to use absolute positioning.

/*** There should be no need to change anything beyond this. ***/

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

if(navigator.userAgent.indexOf('Opera')>-1 && document.getElementById){ //Opera 5 resize fix.
	scrX= innerWidth; scrY= innerHeight;
	document.onmousemove= function(){
		if(scrX<innerWidth-10 || scrY<innerHeight-10 || scrX>innerWidth+10 || scrY>innerHeight+10){
			scrX = innerWidth;
			scrY = innerHeight;
			initFoldout();
		}
	};
}

//object constructor...
function makeMenu(obj,nest){
	nest= (!nest)?"":'document.'+nest+'.';
	this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj);	
   	this.css= bw.ns4?this.el:this.el.style;
	this.ref= bw.ns4?this.el.document:document;		
	this.x= (bw.ns4||bw.opera5)?this.css.left:this.el.offsetLeft;
	this.y= (bw.ns4||bw.opera5)?this.css.top:this.el.offsetTop;
	this.h= (bw.ie||bw.ns6)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.opera5?this.css.pixelHeight:0;
    this.vis= b_vis;
	this.hideIt= b_hideIt;
    this.showIt= b_showIt;
    this.moveIt= b_moveIt;
	return this
}
//object methods...
function b_showIt(){this.css.visibility='visible'}
function b_hideIt(){this.css.visibility='hidden'}
function b_vis(){if(this.css.visibility=='hidden' || this.css.visibility=='HIDDEN' || this.css.visibility=='hide') return true;}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px}

/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/
function menu(num){
	if(bw.bw){
		if (!stayFolded){
			for (var i=0; i<oSub.length; i++){
				if (i!=num){
					oSub[i].hideIt()
					if (foldImg)oTop[i].ref["imgA"+i].src = unImg.src
				}
			}
			for(var i=1; i<oTop.length; i++){
				oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].h)
			}
		}
		if (oSub[num].vis()){
			oSub[num].showIt()
			if (foldImg)oTop[num].ref["imgA"+num].src = exImg.src
		}else{
			oSub[num].hideIt()
			if(foldImg)oTop[num].ref["imgA"+num].src = unImg.src
		}
		for(var i=1; i<oTop.length; i++){ 
			if (!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].h+oSub[i-1].h+mainOffsetY) 
			else oTop[i].moveIt(0,oTop[i-1].y+oTop[i-1].h+mainOffsetY)
		}
	}
}

/*********************************************************************
The init function... there should be no need to change anything here.
*********************************************************************/
function initFoldout(){
	//Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
	bw.opera5 = (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?true:false
	if (bw.opera5) bw.ns6 = 0

	oTop = new Array()
	oSub = new Array()
	//Making the objects and hiding the subs...
	for (var i=0; i<FoldNumber; i++){
		oTop[i] = new makeMenu('divTop'+i,'divCont')
		oSub[i] = new makeMenu('divSub'+i,'divCont.document.divTop'+i)
		oSub[i].hideIt()
	}
	ads = new makeMenu('divTop10','divCont')
	if(ads) oTop[10] = ads;
	
	//Positioning the top objects...
	oTop[0].moveIt(0,0)
	for (var i=1; i<oTop.length; i++){
		oTop[i].moveIt(0, oTop[i-1].y+oTop[i-1].h+mainOffsetY)
	}
	
	//Making the containing menu object and showing it...
	oCont = new makeMenu('divCont')
	oCont.showIt()
}

/* <div id="divTop0" class="clTop"><div class=titlebar><a href="#" onclick="menu(0); return false" onfocus="this.blur()"><img src="/scripts/foldoutmenu_arrow.gif" name="imgA0" width=12 height=12 alt="" border="0"> [choice 0]</a></div>
<div id="divSub0" class="clSub">
	<a href="#">This is a link</a><br>
	<a href="#">This is a link</a><br>
	<a href="#">This is a link</a><br>
	<a href="#">This is a link</a><br>
</div><br>
</div> */

function writemenu() {
	for(i=0;i<mt.length;i++) {
		document.write('<div id="divTop'+i+'" class="clTop"><a href="#" onclick="menu('+i+'); return false" onfocus="this.blur()"><img src="/newsite/foldoutmenu_arrow.gif" name="imgA'+i+'" width=12 height=12 alt="" border="0">'+mt[i][0]+'</a><div id="divSub'+i+'" class="clSub">');
		for(j=1;j<mt[i].length;j++) {
			document.write('<a href="'+ml[i][j]+'">'+mt[i][j]+'</a><br>');
		}
		document.write('</div></div>');
	}
}