imageArray = new Array('topnav_lifestyle','topnav_ostbasics','topnav_prodbasics','topnav_news','topnav_community');  

imagePath = "/ostomy/images/"; 
function preloadImages() { 
	for(x=0;x<imageArray.length;x++) { 
		eval(imageArray[x] + 'off = new Image();'); 
		eval(imageArray[x] + 'off.src = "' + imagePath + imageArray[x] + '_on.gif";'); 
		eval(imageArray[x] + 'over = new Image();'); 
		eval(imageArray[x] + 'over.src = "' + imagePath + imageArray[x] + '_off.gif";'); 
	} 
} 
preloadImages(); 

function turnon(i) { 	
	ctl = "_ctl0_" + i;
	document[ctl].src = eval(i + "off.src") 
	
} 
function turnoff(i) {

    //--
    // The drop down is activated for the current section, but we don't want the current section nav item to be un-bolded on a mouse out.
    // So, determine the current section by looking at the URL.
    //--
    if (document.location.href.indexOf("/lifestyle/") != -1)    
        currentSection = "topnav_lifestyle";
    else if (document.location.href.indexOf("/ostomybasics/") != -1)    
        currentSection = "topnav_ostbasics";
    else if (document.location.href.indexOf("/productbasics/") != -1)    
        currentSection = "topnav_prodbasics";        
    else if (document.location.href.indexOf("/news/") != -1)    
        currentSection = "topnav_news";        
    else if (document.location.href.indexOf("/community/") != -1)    
        currentSection = "topnav_community";        
    
	if (i != currentSection) { 
	    ctl = "_ctl0_" + i;
		document[ctl].src = eval(i + "over.src")				
	} 
} 


//DYNAMIC MENUS 
 
topnav_lifestyle = new Array ( 
  ["Overview", "/ostomy/lifestyle/"], 
  ["Healthy Living", "/ostomy/lifestyle/healthy/"],
  ["Family & Relationships", "/ostomy/lifestyle/family/"],
  ["Travel", "/ostomy/lifestyle/travel/"], 
  ["Work/Life", "/ostomy/lifestyle/worklife/"]
) 
 
topnav_ostbasics = new Array ( 
  ["Overview", "/ostomy/ostomybasics/"],
  ["General Information", "/ostomy/ostomybasics/general/"],
  ["What is a Stoma?", "/ostomy/ostomybasics/stoma/"],
  ["Colostomy", "/ostomy/ostomybasics/colostomy/"],
  ["Ileostomy", "/ostomy/ostomybasics/ileostomy/"],
  ["Urostomy", "/ostomy/ostomybasics/urostomy/"],
  ["Temporary or Permanent?", "/ostomy/ostomybasics/tempperm/"],
  ["Parastomal Hernia", "/ostomy/ostomybasics/parastomal/"],
  ["Reversal", "/ostomy/ostomybasics/reversal/"], 
  ["Internal Pouches", "/ostomy/ostomybasics/internal/"],
  ["Ulcerative Colitis", "/ostomy/ostomybasics/uc/"],    
  ["Crohn's Disease", "/ostomy/ostomybasics/crohns/"],
  ["Glossary", "/ostomy/ostomybasics/glossary/"],
  ["Familial Polyposis Coli", "/ostomy/ostomybasics/fpc/"],
  ["Hirschsprung's Disease", "/ostomy/ostomybasics/hd/"],
  ["Loop Stoma/Loop Ostomy", "/ostomy/ostomybasics/loopstoma/"],
  ["Preoperative", "/ostomy/ostomybasics/preoperative/"],
  ["Postoperative", "/ostomy/ostomybasics/postoperative/"]
)

topnav_prodbasics = new Array (
  ["Overview", "/ostomy/productbasics/"],
  ["Types of Products", "/ostomy/productbasics/types.aspx"],
  ["Glossary", "/ostomy/productbasics/glossary.aspx"],
  ["Links to Manufacturers", "/ostomy/productbasics/links.aspx"]
)

topnav_news = new Array ( 
  ["Overview", "/ostomy/news/"],
  ["News", "/ostomy/news/news.aspx"],
  ["Events", "/ostomy/news/events.aspx"]
)

topnav_community = new Array ( 
  ["Overview", "/ostomy/community/"],
  ["Ask the Clinician Panel", "/ostomy/community/ask.aspx"],
  ["Blogs", "/ostomy/community/blogs.aspx"],
  ["Discussion Forum", "/ostomy/community/forum.aspx"],
  ["Hints &amp; Tips", "/ostomy/community/hintsandtips.aspx"],
  ["Photo Gallery", "/ostomy/community/photo.aspx"],
  ["Recipes", "/ostomy/community/recipes.aspx"],
  ["Stories", "/ostomy/community/stories.aspx"],
  ["Video Gallery", "/ostomy/community/video.aspx"]
)

var NS4 = false 
var IE4 = false 
var DOM = false 
var IE = false 
var NS6 = false 

oldIE = ( navigator.appName.indexOf('Microsoft') >= 0 && navigator.appVersion.indexOf('MSIE 4.') >= 0) ? true:false 
if (document.getElementById) { DOM = true; browser="DOM"; } 
if (document.layers && !DOM) { NS4 = true; browser="NS4"; } 
if (document.all && !DOM) IE4 = true 
if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) IE = true 
if (DOM && !IE) NS6 = true

navArrow = '<img src="/ostomy/images/clear.gif" border=0 width=8>'; 
menuWidth = 200
menuHeight = 18 
menuColor = "#aec48a" 
menuHighlight = "#cedbb7" 
menuborderColor = "#FFFFFF" 
borderStyle1 = ' border-top-width: 1px; border-left-width: 1px; border-bottom-width: 0px; border-right-width: 1px; border-color: ' + menuborderColor + '; border-style: solid; ' 
borderStyle2 = ' border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-right-width: 1px; border-color: ' + menuborderColor + '; border-style: solid;  width:' + menuWidth + 'px; height:' + menuHeight + 'px; ' 
 
if ((IE))
	menuVposition = new Array (34,34,34,34,34)
else
	menuVposition = new Array (27,27,27,27,27)
if ((IE))	
menuHposition = new Array (126,242,365,482,615)
else 
menuHposition = new Array (124,240,363,480,613)

menuArray = new Array ('topnav_lifestyle','topnav_ostbasics','topnav_prodbasics','topnav_news','topnav_community');
backColorArray = new Array('#97cc51','#62bab7','#d4ce64','#f8b766','#93a775');
highlightColorArray = new Array('#c3e09d','#a0d8d6','#e5e2a8','#f8dab4','#c3cfb0');

 
URLpath = new String( window.location.pathname ); 
currentSection = "" 
 
function getSection() { 
	for ( var i=0; i < menuArray.length; i++ ) { 
		if( URLpath.indexOf( menuArray[i] ) >= 0 ) { 
			currentSection = menuArray[i]; 
			turnon(menuArray[i]) 
			break; 
		} 
	} 
	if (currentSection == "") { 
		for (i=0;i<appSection.length; i++) { 
			if( URLpath.indexOf( appSection[i][0] ) >= 0 ) { 
				currentSection = appSection[i][1]; 
				turnon(currentSection) 
				break; 
			} 
		}				 
	} 
	if (currentSection == "") { 
		for (i=0;i<cgiSection.length; i++) { 
			if( URLpath.indexOf( cgiSection[i][0] ) >= 0 ) { 
				currentSection = cgiSection[i][1]; 
				turnon(currentSection) 
				break; 
			} 
		}				 
	} 
} 
 
active=false 
menusReady = false 
currentMenu = "" 
currentMenu = ""
 
function initLayers() { 
  
if (IE || DOM) { 
	for (x=0; x<menuArray.length; x++) { 
		layerName = menuArray[x] + 'Layer' 
		useArray = eval(menuArray[x])
		highlightColor = highlightColorArray[x];
		bgColor = backColorArray[x];		
		menu = '<div id="' + layerName + '" style="position: absolute; width: ' + menuWidth + 'px; z-index: 20; background-color: ' + highlightColor + '; visibility: hidden;" onmouseout="unLock(\'' + menuArray[x] + 'Lyr\')" onmouseover="lock(\'' + menuArray[x] + 'Lyr\')">';
		for (v=0;v<useArray.length;v++) { 		    
			menu += '<div id="' + layerName + v + '" style="position: relative; text-align:right; background-color: ' + bgColor + '; z-index: ' + x + 30 + '; height:' + menuHeight + 'px; ' + borderStyle1 
			menu += (NS6) ? 'width:' + (menuWidth - 1) + 'px; ' : 'width:' + menuWidth + 'px; ' 
			menu += (v == useArray.length - 1) ?  " border-bottom-width: 1px;" : " border-bottom-width: 0px;" 
			menu += '" onmouseover="highlight(\'' + menuArray[x] + v + 'Lyr\',\'' + highlightColor + '\')" onmouseout="unhighlight(\'' + menuArray[x] + v + 'Lyr\',\'' + bgColor + '\')" onclick="linkto(\'' + useArray[v][1] + '\')"><table cellspacing=2 style="float:right"><tr><td align="right">' + navArrow + '<span class="dhtmllink"><a href="' + useArray[v][1] + '">' + useArray[v][0] + '<\/a></span><\/td><\/tr><\/table><\/div>'; 			
		} 
		menu += '<\/div>\n'; 
		document.write(menu); 		
	} 
} 
 
if (NS4) { 
	document.write('<style type="text/css">\n') 
	document.write('all.menuItem1 {' + borderStyle1 + ' width:' + menuWidth + 'px; }\n') 
	document.write('all.menuItem2 {' + borderStyle2 + '}\n') 
	document.write('all.dhtmllink { padding-left: 2px; padding-top: 0px;}</style>') 
	for (x=0; x<menuArray.length; x++) { 
		layerName = menuArray[x] + 'Layer' 
		useArray = eval(menuArray[x]) 
		highlightColor = highlightColorArray[x];
		bgColor = backColorArray[x];	
		menu = '<layer id="' + layerName + '" width=' + menuWidth + ' z-index=20 visibility=hide onmouseout="unLock(\'' + menuArray[x] + 'Lyr\')" onmouseover="lock(\'' + menuArray[x] + 'Lyr\')">'; 
		for (v=0;v<useArray.length;v++) { 
			menu += '<ilayer id="' + layerName + v + '" bgcolor=' + bgColor + '><layer class=' 
			menu += (v == useArray.length - 1) ?  'menuItem2' : 'menuItem1' 
			menu += ' z-index=' + (x + 30 - v) + ' onmouseover="highlight(\'' + menuArray[x] + v + 'Lyr\',\'' + highlightColor + '\')"' 
			menu += ' onmouseout="unhighlight(\'' + menuArray[x] + v + 'Lyr\',\'' + bgColor + '\')"><a href="' + useArray[v][1] + '" class=dhtmllink>' + navArrow + useArray[v][0] + '<\/a><\/layer></ilayer><br>'; 
		} 
		menu += '<\/layer>\n'; 
		document.write(menu); 
	} 
} 

for (x=0; x<menuArray.length; x++) { 
	layerName = menuArray[x] + 'Layer' 
	useArray = eval(menuArray[x]) 

	eval(menuArray[x] + 'Lyr = new domObject(\'' + layerName + '\')'); 
	for (v=0;v<useArray.length;v++) { 
		eval(menuArray[x] + v + 'Lyr = new domObject(\'' + layerName + v + '\',\'' + layerName + '\')') 
	} 

	eval(menuArray[x] + 'Lyr.sty.left = ' + String.fromCharCode(39) + menuHposition[x] + 'px' + String.fromCharCode(39)) 
	eval(menuArray[x] + 'Lyr.sty.top = ' + String.fromCharCode(39) + menuVposition[x] + 'px' + String.fromCharCode(39)) 
} 
menusReady = true; 
} 
 
if (!oldIE) initLayers() 
 
function domObject(theName,nestedLayer,frame) { 
	if (DOM || NS4) { 
		if (DOM) { 
			this.sty = document.getElementById(theName).style 
		} 
		 if (NS4) { 
			if (nestedLayer) { 
				this.sty = eval('document.' + nestedLayer + '.document.' + theName) 
			} else { 
				this.sty = document.layers[theName] 
			} 
		} 
	} 
	if (IE4) { 
		this.sty = this.frame.document.all[theName].style 
	} 
	this.theName = theName 
	this.active = false 
	this.locked = false 
} 
 
 
function showMenu(theMenu) { 

	theName = theMenu.replace(/Lyr/, "") 	
	
	if (menusReady && !oldIE) { 
		if (currentMenu != theName && currentMenu != "") { 
			dropit(theMenu); 			
		} 
		currentMenu = theName; 
		argMenu = theMenu 
		eval(theMenu + ".active = true") 
		show = setTimeout("showIt(argMenu)", 100) 
	} 
} 
 
function dropMenu(theMenu) { 

	eval(theMenu + ".active = false") 
	whichMenu = theMenu 
	wait = setTimeout("dropit(whichMenu)", 0) 
	//dropit(theMenu) 
} 
 
function showIt(theMenu) { 
	if (eval(theMenu + ".active") == true) { 
		eval(theMenu + '.sty.visibility = (NS4)? "show" : "visible"') 
		theName = theMenu.replace(/Lyr/, "")			
		turnon(theName)
		// Hide FORM and AD Elements -- Added by JAM 4/03/03
		// Hide FORM and AD Elements -- Added by JAM 4/03/03
//		if (document.getElementById('dropDown') && (theMenu=="topnav_ostbasicsLyr" || theMenu=="topnav_prodbasicsLyr")) { document.getElementById('dropDown').style.visibility='hidden' }
//		if (document.getElementById('advert') && theMenu=="topnav_estoreLyr" ) { document.getElementById('advert').style.visibility='hidden' } 
	} 
} 
 
function dropit(theMenu) { 
	if (!oldIE && eval(theMenu + ".locked") == false) { 
		eval(theMenu + '.sty.visibility = (NS4)? "hide" : "hidden"') 
		currentMenu = "";
		theName = theMenu.replace(/Lyr/, "") 
		turnoff(theName) 
		// Show FORM and AD Elements -- Added by JAM 4/03/03
		// Show FORM and AD Elements -- Added by JAM 4/03/03
//		if (document.getElementById('dropDown') && (theMenu=="topnav_ostbasicsLyr" || theMenu=="topnav_prodbasicsLyr")) { document.getElementById('dropDown').style.visibility='visible' }
//		if (document.getElementById('advert') && theMenu=="topnav_estoreLyr" ) { document.getElementById('advert').style.visibility='visible' }
	} 
} 

function showMenuActive(theMenu) { 

	theName = theMenu.replace(/Lyr/, "") 
	if (menusReady && !oldIE) { 
		if (currentMenu != theName && currentMenu != "") { 
			dropitActive(theMenu); 
		} 
		currentMenu = theName; 
		argMenu = theMenu 
		eval(theMenu + ".active = true") 
		show = setTimeout("showItActive(argMenu)", 100) 
	} 
}
 
function dropMenuActive(theMenu) { 

	eval(theMenu + ".active = false") 
	whichMenu = theMenu 
	wait = setTimeout("dropitActive(whichMenu)", 0) 
	//dropitActive(theMenu) 
} 
 
function showItActive(theMenu) { 
	if (eval(theMenu + ".active") == true) { 
		eval(theMenu + '.sty.visibility = (NS4)? "show" : "visible"') 
		theName = theMenu.replace(/Lyr/, "")		
		// Hide FORM and AD Elements -- Added by JAM 4/03/03
		// Hide FORM and AD Elements -- Added by JAM 4/03/03
//		if (document.getElementById('dropDown') && (theMenu=="topnav_ostbasicsLyr" || theMenu=="topnav_prodbasicsLyr")) { document.getElementById('dropDown').style.visibility='hidden' }
//		if (document.getElementById('advert') && theMenu=="topnav_estoreLyr" ) { document.getElementById('advert').style.visibility='hidden' } 
	} 
} 
 
function dropitActive(theMenu) { 
	if (!oldIE && eval(theMenu + ".locked") == false) { 
		eval(theMenu + '.sty.visibility = (NS4)? "hide" : "hidden"') 
		currentMenu = "" 
		theName = theMenu.replace(/Lyr/, "") 
		//turnoff(theName)
		// Show FORM and AD Elements -- Added by JAM 4/03/03
		// Show FORM and AD Elements -- Added by JAM 4/03/03
//		if (document.getElementById('dropDown') && (theMenu=="topnav_ostbasicsLyr" || theMenu=="topnav_prodbasicsLyr")) { document.getElementById('dropDown').style.visibility='visible' }
//		if (document.getElementById('advert') && theMenu=="topnav_estoreLyr" ) { document.getElementById('advert').style.visibility='visible' }
	} 
} 
 
function highlight(theMenu,theColor) { 
	if (IE || DOM) { 
		eval(theMenu + '.sty.backgroundColor = "' + theColor + '"') 
		eval(theMenu + '.sty.cursor = "hand"') 					
	} 
	if (NS4) { 
		eval(theMenu + '.sty.bgColor = "' + theColor + '"') 
	} 
} 
 
function unhighlight(theMenu,theColor) { 
	if (IE || DOM) { 
		eval(theMenu + '.sty.backgroundColor = "' + theColor + '"') 
		eval(theMenu + '.sty.cursor = "auto"') 		
	} 
	if (NS4) { 
		eval(theMenu + '.sty.bgColor = "' + theColor + '"') 
	} 
} 
 
function lock(theMenu) { 
	eval(theMenu + ".locked = true") 
} 
 
function unLock(theMenu) {
	eval(theMenu + ".locked = false")
	if (theMenu == currentMenu)
		dropMenuActive(theMenu)
	else
		dropMenu(theMenu) 
} 
 
function linkto(link) { 
	location = link 
}
function setActiveMenu(theMenu){
	currentMenu = theMenu
}