var expandFirstItemAutomatically = false;
var initMenuIdToExpand = false;	
var expandMenuItemByUrl = false;


var initialMenuItemAlwaysExpanded = false;

var slmenuObj;
var divToScroll = true;
var ulToScroll = true;	
var divCounter = 1;
var otherDivsToScroll = new Array();
var divToHide = false;
var parentDivToHide = new Array();
var ulToHide = false;
var offsetOpera = 0;
if(navigator.userAgent.indexOf('Opera')>=0)offsetOpera=1;	
var slideMenuHeightOfCurrentBox = 0;
var objectsToExpand = new Array();
var initExpandIndex = 0;
var alwaysExpanedItems = new Array();
	
function popMenusToShow()
{
	var obj = divToScroll;
	var endArray = new Array();
	while(obj && obj.tagName!='BODY'){
		if(obj.tagName=='DIV' && obj.id.indexOf('slideDiv')>=0){
			var objFound = -1;
			for(var no=0;no<otherDivsToScroll.length;no++){
				if(otherDivsToScroll[no]==obj){
					objFound = no;		
				}					
			}	
			if(objFound>=0){
				otherDivsToScroll.splice(objFound,1);	
			}		
		}	
		obj = obj.parentNode;
	}	
}

function showSubMenu(e,inputObj)
{

	if(this && this.tagName)inputObj = this.parentNode;
	if(inputObj && inputObj.tagName=='LI'){
		divToScroll = inputObj.getElementsByTagName('DIV')[0];
		for(var no=0;no<otherDivsToScroll.length;no++){
			if(otherDivsToScroll[no]==divToScroll)return;
		}			
	}
	hidingInProcess = false;
	if(otherDivsToScroll.length>0){
		if(divToScroll){				
			if(otherDivsToScroll.length>0){
				popMenusToShow();
			}
			if(otherDivsToScroll.length>0){	
				autoHideMenus();
				hidingInProcess = true;
			}
		}	
	}		
	if(divToScroll && !hidingInProcess){
		divToScroll.style.display='';
		otherDivsToScroll.length = 0;
		otherDivToScroll = divToScroll.parentNode;
		otherDivsToScroll.push(divToScroll);	
		while(otherDivToScroll && otherDivToScroll.tagName!='BODY'){
			if(otherDivToScroll.tagName=='DIV' && otherDivToScroll.id.indexOf('slideDiv')>=0){
				otherDivsToScroll.push(otherDivToScroll);
									
			}
			otherDivToScroll = otherDivToScroll.parentNode;
		}			
		ulToScroll = divToScroll.getElementsByTagName('UL')[0];
		if(divToScroll.style.height.replace('px','')/1<=1)scrollDownSub();
	}	
	

}



function autoHideMenus()
{
	if(otherDivsToScroll.length>0){
		divToHide = otherDivsToScroll[otherDivsToScroll.length-1];
		parentDivToHide.length=0;
		var obj = divToHide.parentNode.parentNode.parentNode;
		while(obj && obj.tagName=='DIV'){			
			if(obj.id.indexOf('slideDiv')>=0)parentDivToHide.push(obj);
			obj = obj.parentNode.parentNode.parentNode;
		}
		var tmpHeight = (divToHide.style.height.replace('px','')/1 - slideMenuHeightOfCurrentBox);
		if(tmpHeight<0)tmpHeight=0;
		if(slideMenuHeightOfCurrentBox)divToHide.style.height = tmpHeight  + 'px';
		ulToHide = divToHide.getElementsByTagName('UL')[0];
		slideMenuHeightOfCurrentBox = ulToHide.offsetHeight;
		scrollUpMenu();		
	}else{
		slideMenuHeightOfCurrentBox = 0;
		showSubMenu();			
	}
}


function scrollUpMenu()
{

	var height = divToHide.offsetHeight;
	height-=15;
	if(height<0)height=0;
	divToHide.style.height = height + 'px';

	for(var no=0;no<parentDivToHide.length;no++){	
		parentDivToHide[no].style.height = parentDivToHide[no].getElementsByTagName('UL')[0].offsetHeight + 'px';
	}
	if(height>0){
		setTimeout('scrollUpMenu()',5);
	}else{
		divToHide.style.display='none';
		otherDivsToScroll.length = otherDivsToScroll.length-1;
		autoHideMenus();			
	}
}	

function scrollDownSub()
{
	if(divToScroll){			
		var height = divToScroll.offsetHeight/1;
		var offsetMove =Math.min(15,(ulToScroll.offsetHeight - height));
		height = height +offsetMove ;
		divToScroll.style.height = height + 'px';
		
		for(var no=1;no<otherDivsToScroll.length;no++){
			var tmpHeight = otherDivsToScroll[no].offsetHeight/1 + offsetMove;
			otherDivsToScroll[no].style.height = tmpHeight + 'px';
		}			
		if(height<ulToScroll.offsetHeight)setTimeout('scrollDownSub()',5); else {
			divToScroll = false;
			ulToScroll = false;
			if(objectsToExpand.length>0 && initExpandIndex<(objectsToExpand.length-1)){
				initExpandIndex++;
				
				showSubMenu(false,objectsToExpand[initExpandIndex]);
			}
		}
	}
}
	
function initSubItems(inputObj,currentDepth)
{		
	divCounter++;		
	var div = document.createElement('DIV');	// Creating new div		
	div.style.overflow = 'hidden';	
	div.style.position = 'relative';
	div.style.display='none';
	div.style.height = '1px';
	div.id = 'slideDiv' + divCounter;
	div.className = 'slideMenuDiv' + currentDepth;		
	inputObj.parentNode.appendChild(div);	// Appending DIV as child element of <LI> that is parent of input <UL>		
	div.appendChild(inputObj);	// Appending <UL> to the div
	var menuItem = inputObj.getElementsByTagName('LI')[0];
	while(menuItem){
		if(menuItem.tagName=='LI'){
			var aTag = menuItem.getElementsByTagName('A')[0];
			aTag.className='slMenuItem_depth'+currentDepth;	
			var subUl = menuItem.getElementsByTagName('UL');
			if(subUl.length>0){
				initSubItems(subUl[0],currentDepth+1);					
			}
			aTag.onclick = showSubMenu;				
		}			
		menuItem = menuItem.nextSibling;						
	}		
}

function initSlideDownMenu()
{
	slmenuObj = document.getElementById('nav');
	slmenuObj.style.visibility='visible';
	var mainUl = slmenuObj.getElementsByTagName('UL')[0];		
	var mainMenuItem = mainUl.getElementsByTagName('LI')[0];
	mainItemCounter = 1;
	while(mainMenuItem){			
		if(mainMenuItem.tagName=='LI'){
			var aTag = mainMenuItem.getElementsByTagName('A')[0];
			aTag.className='slMenuItem_depth1';	
			var subUl = mainMenuItem.getElementsByTagName('UL');
			if(subUl.length>0){
				mainMenuItem.id = 'mainMenuItem' + mainItemCounter;
				initSubItems(subUl[0],2);
				aTag.onclick = showSubMenu;
				mainItemCounter++;
			}				
		}			
		mainMenuItem = mainMenuItem.nextSibling;	
	}		
	
	if(location.search.indexOf('mainMenuItemToSlide')>=0){
		var items = location.search.split('&');
		for(var no=0;no<items.length;no++){
			if(items[no].indexOf('mainMenuItemToSlide')>=0){
				values = items[no].split('=');
				showSubMenu(false,document.getElementById('mainMenuItem' + values[1]));	
				initMenuIdToExpand = false;				
			}
		}			
	}else if(expandFirstItemAutomatically>0){
		if(document.getElementById('mainMenuItem' + expandFirstItemAutomatically)){
			showSubMenu(false,document.getElementById('mainMenuItem' + expandFirstItemAutomatically));
			initMenuIdToExpand = false;
		}
	}

	if(expandMenuItemByUrl)
	{
		var aTags = slmenuObj.getElementsByTagName('A');
		for(var no=0;no<aTags.length;no++){
			var hrefToCheckOn = aTags[no].href;				
			if(location.href.indexOf(hrefToCheckOn)>=0 && hrefToCheckOn.indexOf('#')<hrefToCheckOn.length-1){
				initMenuIdToExpand = false;
				var obj = aTags[no].parentNode;
				while(obj && obj.id!='nav'){
					if(obj.tagName=='LI'){							
						var subUl = obj.getElementsByTagName('UL');
						if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
						if(subUl.length>0){								
							objectsToExpand.unshift(obj);
						}
					}
					obj = obj.parentNode;	
				}
				showSubMenu(false,objectsToExpand[0]);
				break;					
			}			
		}
	}
			
	if(initMenuIdToExpand)
	{
		objectsToExpand = new Array();
		var obj = document.getElementById(initMenuIdToExpand)
		while(obj && obj.id!='nav'){
			if(obj.tagName=='LI'){
				var subUl = obj.getElementsByTagName('UL');
				if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
				if(subUl.length>0){						
					objectsToExpand.unshift(obj);
				}
			}
			obj = obj.parentNode;	
		}
		
		showSubMenu(false,objectsToExpand[0]);

	}
	

		
}
window.onload = initSlideDownMenu;


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function meta(directory){
	document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><meta http-equiv="Content-Style-Type" content="text/css2" /><meta http-equiv="Content-Language" content="en" /><meta http-equiv="Audience" content="General" /><meta name="keywords" content="Absolute Championship Wrestling, ACW, Videos, Results, Wrestling" /><meta name="description" content="Since 1997, Absolute Championship Wrestling has been providing superior and unique wrestling." /><meta name="classification" content="Wrestling" /><meta name="area" content="Wrestling" /><meta name="robots" content="index,follow" /><meta name="copyright" content="Copyright © 2006" /><link rel="shortcut icon" href="' + directory  + 'favicon.ico" /><link rel="stylesheet" type="text/css" href="' + directory  + 'navigation/css.css" />');
}

function bodytop(directory){

document.write('<table style="width: 1000px;">');
document.write('	<tr style="height: 105px;"><td colspan="3"><img src="' + directory  + 'navigation/top.jpg" width="1000" height="105" alt="Absolute Championship Wrestling" /></td></tr>');
document.write('	<tr style="width: 1000px; vertical-align: top;"><td style="height 100%; background-image: url(' + directory  + 'navigation/bgleft.jpg); background-color: #000; width: 140px;"><div style="background-image: url(' + directory  + 'navigation/tbgleft.jpg); background-repeat: no-repeat; padding-top: 5px;">');
document.write('		<div id="nav" class="nav">');
document.write('			<ul>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'Main\',\'\',\'' + directory  + 'navigation/navbg1.jpg\',1)" onmouseover="MM_swapImage(\'Main\',\'\',\'' + directory  + 'navigation/navbg1a.jpg\',1)"><img src="' + directory  + 'navigation/navbg1.jpg" alt="Main" width="126" height="35" id="Main" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'index.htm">Updates</a></li>');
document.write('						<li><a href="' + directory  + 'main/guestbook/index.php">Guestbook</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'News\',\'\',\'' + directory  + 'navigation/navbg2.jpg\',1)" onmouseover="MM_swapImage(\'News\',\'\',\'' + directory  + 'navigation/navbg2a.jpg\',1)"><img src="' + directory  + 'navigation/navbg2.jpg" alt="News" width="126" height="35" id="News" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'news/general/index.htm">General News</a></li>');
document.write('						<li><a href="' + directory  + 'news/smithsays/index.htm">Smith Says</a></li>');
document.write('						<li><a href="' + directory  + 'news/quick5/index.htm">Quick 5</a></li>');
document.write('						<li><a href="' + directory  + 'news/wdr/index.htm">Dirt & Rumors</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'Events\',\'\',\'' + directory  + 'navigation/navbg3.jpg\',1)" onmouseover="MM_swapImage(\'Events\',\'\',\'' + directory  + 'navigation/navbg3a.jpg\',1)"><img src="' + directory  + 'navigation/navbg3.jpg" alt="Events" width="126" height="35" id="Events" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'events/weekly/index.htm">Weekly</a></li>');
document.write('						<li><a href="' + directory  + 'events/yearly/index.htm">Yearly</a></li>');
document.write('						<li><a href="' + directory  + 'events/wawards/index.htm">Wrestlor Awards</a></li>');
document.write('						<li><a href="' + directory  + 'events/special/index.htm">Special</a></li>');
document.write('						<li><a href="' + directory  + 'events/former/index.htm">Former</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'Media\',\'\',\'' + directory  + 'navigation/navbg4.jpg\',1)" onmouseover="MM_swapImage(\'Media\',\'\',\'' + directory  + 'navigation/navbg4a.jpg\',1)"><img src="' + directory  + 'navigation/navbg4.jpg" alt="Media" width="126" height="35" id="Media" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'media/videos/index.htm">Videos</a></li>');
document.write('						<li><a href="' + directory  + 'media/audio/index.htm">Audio</a></li>');
document.write('						<li><a href="' + directory  + 'media/dbackgrounds/index.htm">Backgrounds</a></li>');
document.write('						<li><a href="' + directory  + 'media/banners/index.htm">Banners</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'Roster\',\'\',\'' + directory  + 'navigation/navbg5.jpg\',1)" onmouseover="MM_swapImage(\'Roster\',\'\',\'' + directory  + 'navigation/navbg5a.jpg\',1)"><img src="' + directory  + 'navigation/navbg5.jpg" alt="Roster" width="126" height="35" id="Roster" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'roster/america.htm">America</a></li>');
document.write('						<li><a href="' + directory  + 'roster/spain.htm">Spain</a></li>');
document.write('						<li><a href="' + directory  + 'roster/training.htm">ACW Training</a></li>');
document.write('						<li><a href="' + directory  + 'roster/halloffame.htm">Hall of Fame</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'About\',\'\',\'' + directory  + 'navigation/navbg6.jpg\',1)" onmouseover="MM_swapImage(\'About\',\'\',\'' + directory  + 'navigation/navbg6a.jpg\',1)"><img src="' + directory  + 'navigation/navbg6.jpg" alt="About" width="126" height="35" id="About" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'about/history.htm">History</a></li>');
document.write('						<li><a href="' + directory  + 'about/membership/index.htm">Membership</a></li>');
document.write('						<li><a href="' + directory  + 'about/championships/index.htm">Championships</a></li>');
document.write('						<li><a href="' + directory  + 'about/donations/index.htm">Donations</a></li>');
document.write('						<li><a href="' + directory  + 'about/contact/index.htm">Contact</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="#" onmouseout="MM_swapImage(\'Extras\',\'\',\'' + directory  + 'navigation/navbg7.jpg\',1)" onmouseover="MM_swapImage(\'Extras\',\'\',\'' + directory  + 'navigation/navbg7a.jpg\',1)"><img src="' + directory  + 'navigation/navbg7.jpg" alt="Extras" width="126" height="35" id="Extras" /></a>');
document.write('					<ul>');
document.write('						<li><a href="' + directory  + 'extras/rh.htm">Record Holders</a></li>');
document.write('						<li><a href="' + directory  + 'extras/top/30/index.htm">Top 30</a></li>');
document.write('						<li><a href="' + directory  + 'extras/top/title/index.htm">Title Contenders</a></li>');
document.write('						<li><a href="' + directory  + 'extras/trivia/index.htm">Trivia</a></li>');
document.write('					</ul>');
document.write('				</li>');
document.write('				<li><a href="' + directory  + 'links/index.htm" onmouseout="MM_swapImage(\'Links\',\'\',\'' + directory  + 'navigation/navbg8.jpg\',1)" onmouseover="MM_swapImage(\'Links\',\'\',\'' + directory  + 'navigation/navbg8a.jpg\',1)"><img src="' + directory  + 'navigation/navbg8.jpg" alt="Links" width="126" height="35" id="Links" /></a>');
document.write('				</li>');
document.write('			</ul>');
document.write('		</div>');
document.write('	</div></td>');
document.write('	<td style="background-color: #FFF; background-image: url(' + directory  + 'navigation/mainbg.jpg); background-repeat: no-repeat; width: 700px; text-align: center;  padding-left: 10px; padding-right: 10px;">');
}

function bba(directory) {
document.write('	</td>');
document.write('	<td style="background-color: #000; background-image: url(' + directory  + 'navigation/bgright.jpg); width: 140px;"><div style="background-image: url(' + directory  + 'navigation/tbgright.jpg); background-repeat: no-repeat;">');
document.write('		<div style="padding-left: 10px; padding-top: 5px; padding-bottom: 5px; height: 600;">');
			<!--
			google_ad_client = "pub-1450048408211159";
			/* Main */
			google_ad_slot = "2242157614";
			google_ad_width = 120;
			google_ad_height = 600;
			//-->
document.write('		<scr' + 'ipt type="text\/javascript" src="http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js"><\/script>');
}

function bbb(directory) {
document.write('	</div></div></td></tr>');
document.write('	<tr style="height: 34px;"><td colspan="3">');
document.write('<img src="' + directory  + 'navigation/bottombr.jpg" width="1000" height="34" alt="Copyright 2006 Absolute Championship Wrestling" />');
document.write('</td></tr></table>');
}

meta(x);

if (document.images)
{

  pic1= new Image(126,35);
  pic1.src= x + "navigation/navbg1a.jpg"; 

  pic2= new Image(126,35);
  pic2.src= x + "navigation/navbg2a.jpg"; 

  pic3= new Image(126,35);
  pic3.src= x + "navigation/navbg3a.jpg"; 

  pic4= new Image(126,35);
  pic4.src= x + "navigation/navbg4a.jpg"; 

  pic5= new Image(126,35);
  pic5.src= x + "navigation/navbg5a.jpg"; 

  pic6= new Image(126,35);
  pic6.src= x + "navigation/navbg6a.jpg"; 

  pic7= new Image(126,35);
  pic7.src= x + "navigation/navbg7a.jpg"; 

  pic8= new Image(126,35);
  pic8.src= x + "navigation/navbg8a.jpg"; 

}
