// JavaScript Document
	
	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Update log:
	
		March, 15th: Fixed problem with sliding in MSIE
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	
var expandFirstItemAutomatically = false;	// Expand first menu item automatically ?
var initMenuIdToExpand = false;	// Id of menu item that should be initially expanded. the id is defined in the <li> tag.
var expandMenuItemByUrl = true;	// Menu will automatically expand by url - i.e. if the href of the menu item is in the current location, it will expand


var initialMenuItemAlwaysExpanded = true;	// NOT IMPLEMENTED YET

var dhtmlgoodies_slmenuObj;
var divToScroll = false;
var ulToScroll = false;	
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()
{
	dhtmlgoodies_slmenuObj = document.getElementById('dhtmlgoodies_slidedown_menu');
	dhtmlgoodies_slmenuObj.style.visibility='visible';
	var mainUl = dhtmlgoodies_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 = dhtmlgoodies_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!='dhtmlgoodies_slidedown_menu'){
					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!='dhtmlgoodies_slidedown_menu'){
			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 toggleDisplay(divId) {
  var div = document.getElementById(divId);
  div.style.display = (div.style.display=="block" ? "none" : "block");
}

/// shows side menu
document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../images/sub-menu-bg.gif" height="245">');
document.write('<tr>');
document.write('<td valign="top"><img src="../images/shows-hd.gif" /><BR />');
document.write('<div id="leftMenu">');
document.write('<div id="dhtmlgoodies_slidedown_menu">');
document.write('<ul>');
document.write('<li><a href="#">Top Takeaways</a>');
document.write('<ul>');
document.write('<li><a href="../shows/index_celebrity_apprentice.asp">Celebrity Apprentice</a></li>');
document.write('<li><a href="../shows/index_brothers_sisters.asp">Brothers and Sisters</a></li>');
document.write('<li><a href="../shows/index_gary_unmarried.asp">Gary Unmarried</a></li>');
document.write('<li><a href="../shows/index_shoot_me.asp">Just Shoot Me</a></li>');
document.write('<li><a href="../shows/index_idrmj.asp">I dream of Jeannie</a></li>');
document.write('<li><a href="../shows/index_90210.asp">Beverly Hills 90210</a></li>');
document.write('<li><a href="../shows/index_jamie_at_home.asp">Jamie at home</a></li>');
document.write('<li><a href="../shows/index_afv.asp">Americas Funniest Videos</a></li>');
document.write('<li><a href="../jay-leno/index.asp">The Tonight Show with Jay Leno</a></li>');
document.write('<li><a href="index_friend.asp">Friends</a></li>');
/*
document.write('<li><a href="americas_next_top_model.asp">America&#8217;s Next Top Model 10</a></li>');
document.write('<li><a href="/shows/index_survivor_gabon.asp">Survivor: Tocantins</a></li>');
document.write('<li><a href="../big-bang-theory/index.asp">The Big Bang Theory</a></li>');
document.write('<li><a href="../gossipgirl/index.asp">Gossip Girl</a></li>');
document.write('<li><a href="../sarah-connor/index.asp">Terminator: Sarah Connor Chronicles</a></li>');


document.write('<li><a href="../shows/index_crosswords.asp">Crosswords</a></li>');

document.write('<li><a href="../shows/index_gilmore_girls.asp">Gilmore Girls</a></li>');*/



document.write('</ul>');
document.write('</li>');
/*document.write('<li><a href="#">Coming Soon</a>');
document.write('<ul>');
document.write('<li><a href="../shows/index_brit_awards.asp">Brit Awards 2008</a></li>');
document.write('<li><a href="../shows/index_kitchen_confidential.asp">Kitchen Confidential</a></li>');
document.write('<li><a href="../shows/index_90210.asp">Beverly Hills 90210</a></li>');
document.write('<li><a href="../shows/index_gilmore_girls.asp">Gilmore Girls</a></li>');
document.write('</ul>');
document.write('</li>');*/

document.write('<li><a href="#">Cafe Essentials </a>');
document.write('<ul>');
document.write('<li><a href="../shows/index_hot_guys.asp">Hot Guys Who Cook</a></li>');
document.write('<li><a href="../shows/index_baby_ballroom.asp">Baby Ballroom</a></li>');
document.write('<li><a href="../shows/index_planet_rock.asp">Planet Rock Profiles</a></li>');
document.write('<li><a href="../shows/index_fullon.asp">Full On</a></li>');
document.write('<li><a href="../shows/index_after_hrs.asp">After Hrs</a></li>');
document.write('<li><a href="../shows/index_gig.asp">The Gig </a></li>');
document.write('<li><a href="../shows/index_friends.asp">The Best of Friends</a></li>');
document.write('</ul>');
document.write('</li>');

document.write('<li><a href="#">Cafe Xtreme</a>');
document.write('<ul>');
document.write('<li><a href="../shows/index_streetracers.asp">Street Racers  </a></li>');
document.write('<li><a href="../shows/index_urbanstunts.asp">Urban Stunts Bikers </a></li>');
document.write('<li><a href="../shows/index_guinness_world_records.asp">Guinness World Records: Primetime</a></li>');
document.write('<li><a href="../shows/index_wildbikes.asp">Wild Bikes </a></li>');
document.write('<li><a href="../shows/index_riots.asp">Riots: Mobs out of Control </a></li>');
document.write('<li><a href="../criss-angel/index.asp">Criss Angel: Mindfreak</a></li>');
document.write('<li><a href="../shows/index_worlds_scariest_police.asp">World&#8217;s Scariest Police Shootouts </a></li>');
/*document.write('<li><a href="../shows/index_virtual_magician.asp">Virtual Magician</a></li>');*/
/*document.write('<li><a href="../shows/index_alpine_chronicles.asp">The Alpine Chronicles </a></li>');*/
document.write('</ul>');
document.write('</li>');


document.write('<li><a href="#">Old Skool</a>');
document.write('<ul>');
document.write('<li><a href="../shows/index_wonder_years.asp">The Wonder Years</a></li>');
document.write('<li><a href="../shows/index_ally_mcbeal.asp">Ally McBeal</a></li>');
document.write('<li><a href="../shows/index_boss.asp">Who&#8217;s the Boss?</a></li>');
document.write('<li><a href="../shows/index_language.asp">Mind Your Language</a></li>');
document.write('<li><a href="../shows/index_x_files.asp">The X-Files</a></li>');
document.write('</ul>');
document.write('</li>');

document.write('<li><a href="#">Hall of Fame </a>');
document.write('<ul>');
/document.write('<li><a href="mic-testing/default.htm>Mic Testing</a></li>');
document.write('<li><a href="gossipgirl/index.asp>Gossip Girl</a></li>');
document.write('<li><a href="big-bang-theory/index.asp>The Big Bang Theory</a></li>');
document.write('<li><a href="index_x_files.asp>The X-Files</a></li>');
document.write('<li><a href="index_dawson_creek.asp>Dawsons Creek</a></li>');
document.write('<li><a href="index_planet_rock.asp>Planet Rock Profiles</a></li>');
document.write('<li><a href="index_wonder_years.asp>The Wonder Years</a></li>');
document.write('<li><a href="index_crosswords.asp>Crosswords</a></li>');
document.write('<li><a href="index_wanna_be_soapstar.asp>I Wanna be a  Soapstar IV</a></li>');
document.write('<li><a href="index_top_10_countdown.asp>Top 10 Countdown</a></li>');
document.write('<li><a href="aliens-in-america/index.asp>Aliens In America</a></li>');
document.write('<li><a href="the-oc4/index.asp>The OC4</a></li>');
document.write('<li><a href="index_battlestar_galactica.asp>Battlestar Galactica - Season IV</a></li>');
document.write('<li><a href="comedy-inc/index.asp>Comedy Inc</a></li>');
document.write('<li><a href="army-wives/index.asp>Army Wives - Season 2</a></li>');
document.write('<li><a href="pushing-daisies/index.asp>Pushing Daisies Season2</a></li>');
document.write('<li><a href="index_survivor.asp>Survivor</a></li>');
document.write('<li><a href="sarah-connor/index.asp>Terminator: Sarah Connor Chronicles</a></li>');
document.write('<li><a href="index_sutasi.asp>Sutasi</a></li>');
document.write('<li><a href="americas_next_top_model.asp>Americas Next Top Model 10</a></li>');
document.write('<li><a href="index_amerciasmost.asp>Amercias Most Smartest Models </a></li>');
document.write('<li><a href="index_kitchen_confidential.asp>Kitchen Confidential</a></li>');
document.write('<li><a href="index_e_news.asp>E! News</a></li>');
document.write('<li><a href="index_gilmore_girls.asp>Gilmore Girls</a></li>');
document.write('<li><a href="../shows/index_greysanatomy.asp">Greys Anatomy</a></li>');
document.write('<li><a href="../shows/index_everybody_hates_chris.asp">Everybody Hates Chris</a></li>');
document.write('<li><a href="../shows/index_private_practice.asp">Private Practice II</a></li>');
document.write('<li><a href="../shows/index_til_death.asp">Til Death</a></li>');
document.write('</ul>');
document.write('</li>');

document.write('</ul>');
document.write('<ul>');
document.write('</div>');
document.write('</div></td>');
document.write('</tr>');
document.write('</table>');