var currentTNav = '';


window.onload = function() {	

	soopaPopSetup();
	soopaRolloverSetup();
	
	if (currentTNav != '') {
		toggle(currentTNav);
	}
}

function toggle(which) {
	if (! document.getElementById) return true;
	
	var submenu = document.getElementById('sub_' + which);
	var header = document.getElementById('img_' + which);
	var detail = (document.getElementsByTagName('body')[0].className == 'detail');
	
	if (header.src.indexOf('_o') == -1) {
		header.src = header.src.substring(0,header.src.length - 4) + '_o.gif';
		submenu.style.display = 'block';
		
		if (!detail && (which != currentTNav) && (currentTNav != '')) {
			submenu = document.getElementById('sub_' + currentTNav);
			header = document.getElementById('img_' + currentTNav);
			
			header.src = header.src.substring(0,header.src.length - 6) + '.gif';
			submenu.style.display = 'none';
		}
		currentTNav = which;
	} else {
		header.src = header.src.substring(0,header.src.length - 6) + '.gif';
		submenu.style.display = 'none';
		if (!detail) {
			currentTNav = '';
		}
	}
	
	return false;
}

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// easiest rollovers on earth, baby!
// see www.youngpup.net for documentation.
//
// altered by nate cook for xhtml compliance

function soopaRolloverSetup() {
	var img, sh, sn, sd;
	
	for (var i = 0; (img = document.images[i]); i++) {
		if (img.className == "roll") {
			img.n = new Image();
			img.n.src = img.src;

			img.h = new Image();
			img.h.src = img.src.substring(0,img.src.length - 4) + "_o.gif";
			img.onmouseover = soopaSwapOn;
			img.onmouseout  = soopaSwapOff;
		}
	}
}

function soopaSwapOn() {
	this.src = this.h.src;
}

function soopaSwapOff() {
	this.src  = this.n.src;
}

function soopaSwapDown() {
	this.src  = this.d.src;
	this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
	soopaSwapUp.img = this;
	document.onmouseup = soopaSwapUp;
}

function soopaSwapUp() {
	var ths = soopaSwapUp.img;
	ths.src = ths.n.src;
	if (ths.temp) document.onmouseup = ths.temp;
}


// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// from 'soopa-pop.js' at youngpup.net

function soopaPopSetup() {
	var a;
	for (var i = 0; (a = document.links[i]); i++) {
		if (a.target && a.target.indexOf("soopaPop") == 0) {
			a.onclick = soopaPop;
		}
	}
}

function soopaPop() {
	var a = this.target.split(":");
	var sFeatures = a[1];
	window.open(this.href, a.length > 2 ? a[2] : String((new Date()).getTime()), sFeatures);
	return false;
}

function linkPop(url) {
	if(confirm('You are now leaving the Bard Urological Website: Any links or references to other Internet sites (hyperlinks) are provided by Bard merely as a convenience to users of this Internet site.  Any hyperlink to such other Internet site does not imply an endorsement or recommendation by Bard or its Affiliates.  Please see our Terms of Use Section for additional information.  Before acting on any advice or information related to your healthcare that you find at the following or any other website, contact a Healthcare professional.')) window.open(url);
}


// --------------------------------------------------
// right nav drop down for product page
// Built from SCRATCH by Rich Z
// --------------------------------------------------

function do_onload() {
	getElementbyClass("list");
	getCarrotbyClass("carrot");
}

function getElementbyClass(classname){
	arLink=new Array()
	var a=0
	var alltags=document.all? document.all : document.getElementsByTagName("*")
	for (i=0; i<alltags.length; i++){
		if (alltags[i].className==classname)
		arLink[a++]=alltags[i]
	}
}

function getCarrotbyClass(classname){
	arCarrot=new Array()
	var b=0
	var alltags=document.all? document.all : document.getElementsByTagName("*")
	for (i=0; i<alltags.length; i++){
		if (alltags[i].className==classname)
		arCarrot[b++]=alltags[i]
	}
}

function contractlist(list){
	var inc=0
	while (arLink[inc]){
	if (arLink[inc].id!=list)
		arLink[inc].style.display="none"
		arCarrot[inc].style.display="none"	
		inc++
	}
}

function contractcarrot(carrot){
	var inc=0
	while (arCarrot[inc]){
	if (arCarrot[inc].id!=carrot)
		arCarrot[inc].style.display="none"
		inc++
	}
}	 
 
function showHide(list, carrot) {  
	contractlist(list);
	contractcarrot(carrot);
	if (document.getElementById(list).style.display == 'block') 
	{
		document.getElementById(list).style.display = 'none';
		document.getElementById(carrot).style.display = 'none';
	}
	else
	{
		document.getElementById(list).style.display = 'block';
		document.getElementById(carrot).style.display = 'block';
	}
}

if (window.addEventListener)
	window.addEventListener("load", do_onload, false)
	else if (window.attachEvent)
	window.attachEvent("onload", do_onload)
	else if (document.getElementById)
	window.onload=do_onload
