// JavaScript Document
// Turn off error report
window.onerror = null;

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.mac=(navigator.appVersion.indexOf('Mac') != -1)?1:0	
	this.ie5=(this.ver.indexOf("MSIE")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && !this.ie5 && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	this.roll=(document.all || document.layers || document.getElementById) ? 1:0;
	this.css=document.styleSheets?1:0; 
	return this;
}
var b=new checkBrowser();

navNames = new Array("business", "disease", "product", "country")
divNames = new Array("A", "B", "C", "D");

/**/if (b.roll) {
		// DHTML global nav rollovers
	    navButtons = new Array(navNames.length*2);
		for (var m = 0; m < navNames.length; m++) {
			var folder = "";
			if (m < navNames.length - 4) folder = "home_nav/"; 
			
			navButtons[m] = new Image();
			navButtons[m].src = "/images/common/" + folder + navNames[m] + "0.gif";
			navButtons[m + navNames.length] = new Image();
			navButtons[m + navNames.length].src = "/images/common/" + folder + navNames[m] + "1.gif";		
		}
}
	
// Swap Global Nav
function swapNav(off,on) {
	if (b.roll) 
		if (document.images[navNames[off]]) document.images[navNames[off]].src = navButtons[on].src;  
}

arr0 = new Image();
arr0.src = "/images/common/nav_drop_arrow.gif";
arr1 = new Image();
arr1.src = "/images/common/nav_drop_arrow_on.gif";

function rollOn(itemId) {
	if (b.css && b.dom) {
		document.getElementById("item" + itemId + "a").style.background = document.getElementById("item" + itemId + "b").style.background  = "#DBAE00";
		document.images["arrow" + itemId].src = arr1.src;		
	}	
}

function rollOff(itemId) {
	if (b.css && b.dom) {
		document.getElementById("item" + itemId + "a").style.background = document.getElementById("item" + itemId + "b").style.background  = "#FFFFFF";		
		document.images["arrow" + itemId].src = arr0.src;		
	}	
}

// Code added to prevent javascript error on rollovers before page has loaded - 04/22/03 LC
// Set variable to not loaded
var isLoaded = 0;

// On page load, set variable to loaded
function pageLoaded() {
	isLoaded = 1; 
}

// Check that page is loaded, otherwise do nothing
function activateLayers(div,act) {
	flag = (arguments.length>2)?1:0;
	hideAllLayers(flag);
	showHideLayers(div,act,flag);
}
// End Code added 04/22/03 LC

function setHideTimeout() {
  if (this.hideTimer) { clearTimeout(this.hideTimer); }
  this.hideTimer = setTimeout('hideAllLayers()', 1000);
}

function clearHideTimeout() {
  if (this.hideTimer) clearTimeout(this.hideTimer);
}

function hideAllLayers() {
	// Swap out all Rollovers
	flag = (arguments.length)?arguments[0]:0;
	if(!flag){
	for (var i = 0; i < navNames.length; i++) {
		
		swapNav(i, i);
		
		
		// Show search form fields when DHTML deactivated.
		if (b.dom) {
			if (document.getElementById('searchQuery')) document.getElementById('searchQuery').style.visibility="visible";
		} else if (b.ie4) {
			if (document.all['searchQuery']) document.all['searchQuery'].style.visibility = 'visible';
		} else if (b.ns4) {
			if (document.layers['searchQuery']) document.layers['searchQuery'].visibility = 'show';
		}
	}}
	for (var i = 0; i < divNames.length; i++) {
		if (b.dom) {
			if (document.getElementById('Div' + divNames[i])) document.getElementById('Div' + divNames[i]).style.visibility="hidden";
		} else if (b.ie4) {
			if (document.all['Div' + divNames[i]]) document.all['Div' + divNames[i]].style.visibility = 'hidden';
		} else if (b.ns4) {
			if (document.layers['Div' + divNames[i]]) document.layers['Div' + divNames[i]].visibility = 'hide';
		}
	}
}

function showHideLayers() {
  hideAllLayers(arguments[2]);
  clearHideTimeout()

  	// Hide search form fields when DHTML activated.
	if(!arguments[2]){
  	if (b.dom) {
		if (document.getElementById('searchQuery')) document.getElementById('searchQuery').style.visibility="hidden";
	} else if (b.ie4) {
		if (document.all['searchQuery']) document.all['searchQuery'].style.visibility = 'hidden';
	} else if (b.ns4) {
		if (document.layers['searchQuery']) document.layers['searchQuery'].visibility = 'hidden';
	}}

  var i, visStr, args, theObj;
  args = showHideLayers.arguments;
  //for (i=0; i<(args.length-1); i+=2) {
	// Swap in appropriate rollover
	/*if (args[i] == 'Div1') swapNav(0,12);
	if (args[i] == 'Div2') swapNav(1,13);
	if (args[i] == 'Div3') swapNav(2,14);
	if (args[i] == 'Div4') swapNav(3,15);
	if (args[i] == 'Div5') swapNav(4,16);
	if (args[i] == 'Div6') swapNav(5,17);
	if (args[i] == 'Div7') swapNav(6,18);
	if (args[i] == 'Div8') swapNav(7,19);*/
	if(!args[2]){
	if (args[0] == 'DivA') swapNav(8,20);
	if (args[0] == 'DivB') swapNav(9,21);
	if (args[0] == 'DivC') swapNav(10,22);
	if (args[0] == 'DivD') swapNav(11,23);
	} else {
	if (args[0] == 'DivA');
	if (args[0] == 'DivB');
	if (args[0] == 'DivC');
	if (args[0] == 'DivD');}
    visStr   = args[1];
	if (b.dom) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
 	   document.getElementById(args[0]).style.visibility=visStr;
    } else if (b.ns4) {
       document.layers[args[0]].visibility = visStr;
    } else if (b.ie4) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
       document.all[args[0]].style.visibility = visStr;
  	}
 // }
}
	
function buildScroll(name, width, height, scroll, items) {
	var source = "";
	if (b.dom || b.ie4 ) {
		source += '<div id="Div' + name + '" style="position:absolute; visibility: hidden;z-index:105">';
	} else if (b.ns4) { 
		source += '<layer name="Div' + name + '" left=' + left + ' top=' + top + ' visibility=hidden>';
	}
	if (items.length > 0 && (b.dom || b.ie4)) {
		source += '<table border="0" cellpadding="1" cellspacing="0" bgcolor="#818181"><tr><td><table border="0" cellpadding="0"  cellspacing="0" bgcolor="#FFFFFF"><tr><td><img src="/images/common/spacer.gif" width="' + (width - 2) + '" height="' + (height - 2) + '"  hspace="0" vspace="0" border="0" alt=""></td></tr></table></td></tr></table>';
		source += '<div id="container' + name + '" style="position: absolute; top: 1px; left: 1px; width: ' + (width - 2) + 'px; height: '  + (height - 2) + 'px; clip: rect(0,' + (width - 2) + ',' + (height - 2) + ',0); overflow: hidden;">';
		source += '<div id="content' + name + '" style="position:absolute; top: 0px; left: 0px; width: ' + (width - 2) + 'px; display:  inline; overflow: visible;">';
		source += '<table border=0 cellpadding=0 cellspacing=0 width=' + (width - 2) + ' bgcolor="#FFFFFF"  onMouseOver="clearHideTimeout();" onMouseOut="setHideTimeout();">';
		for (var i = 0; i < items.length; i++) {
			if (items[i].length == 2) {
				if (i > 0) {
					source += '<tr><td height="1" bgcolor="#818181" colspan="2"><img src="/images/common/spacer.gif" width="1"  height="1" hspace="0" vspace="0" border="0" alt=""></td></tr>';
				}
				source += '<tr><td valign=top id="item' + name + i + 'a" width=19 height=18><img  src="/images/common/nav_drop_arrow.gif" name="arrow' + name + i + '" width="19" height="18" hspace="0" vspace="0" border="0"  alt="arrow"></td>\n<td valign=top id="item' + name + i + 'b"><a href="' + items[i][1] + '" class="scroll_link" onmouseover="rollOn(\'' + name + i  + '\');" onmouseout="rollOff(\'' + name + i + '\');">' + items[i][0] + '</a></td></tr>\n';
			}			
		}
		source += '</table></div></div>';
		if (scroll) {
			source += '<div id="scroll' + name + '" style="position: absolute; top: 0px; left: ' + width + 'px; visibility:  inherit;">';
			source += '<table border="0" cellpadding="0" cellspacing="0" onMouseOver="clearHideTimeout();"  onMouseOut="setHideTimeout();"><tr>';
			source += '<td width="1" bgcolor="#FFFFFF"><img src="/images/common/spacer.gif" width="1" height="' + height + '"  hspace="0" vspace="0" border="0" alt=""></td>';
			source += '<td width="1" bgcolor="#818181"><img src="/images/common/spacer.gif" width="1" height="' + height + '"  hspace="0" vspace="0" border="0" alt=""></td>';
			source += '<td width="13" bgcolor="#F6F6ED" valign="top"><table border="0" cellpadding="0" cellspacing="0">';
			source += '<tr><td bgcolor="#818181"><img src="/images/common/spacer.gif" width="13" height="1" hspace="0" vspace="0"  border="0" alt=""></td></tr>';
			source += '<tr><td><a href="javascript:void(0);" onMouseover="scrollUp(\'' + name + '\');"  onMouseout="clearScroll();"><img src="/images/common/scroll_up.gif" width="13" height="11" hspace="0" vspace="0" border="0"  alt=""></a></td></tr>';
			source += '<tr><td bgcolor="#F6F6ED"><img src="/images/common/spacer.gif" width="13" height="' + (height - 24) + '"  hspace="0" vspace="0" border="0" alt=""></td></tr>';
			source += '<tr><td><a href="javascript:void(0);" onMouseover="scrollDown(\'' + name + '\');"  onMouseout="clearScroll();"><img src="/images/common/scroll_down.gif" width="13" height="11" hspace="0" vspace="0" border="0"  alt=""></a></td></tr>';
			source += '<tr><td bgcolor="#818181"><img src="/images/common/spacer.gif" width="13" height="1" hspace="0" vspace="0"  border="0" alt=""></td></tr>';
			source += '</table></td>';
			source += '<td width="1" bgcolor="#818181"><img src="/images/common/spacer.gif" width="1" height="' + height + '"  hspace="0" vspace="0" border="0" alt=""></td>';
			source += '</tr></table></div>';
		}
	} else {
		source += '&nbsp;\n';
	}
	if (b.dom || b.ie4 ) {
		source += '</div>';
	} else if (b.ns4) {
		source += '</layer>';		
	}
	document.write(source);
	if (b.dom || b.ie4) {
		var dx = -1;
		if (b.ns5) { dx = 177; }
		var dy = 0;
		if (b.ie4 || b.ie5) { dy = 21; }
		positionLayer('Div' + name, 'Holder' + name, dx, dy - height);
	}
}

function positionLayer(n, h, dx, dy) {
	var x=0, y=0;
	var l=findLayer(h);
	if (l!=null) { x=getLeft(l); y=getTop(l); }
	l=findLayer(n);
	if (l!=null) { moveTo(l,x+dx,y+dy); }
}

function moveTo(l, x, y) {
	if (b.dom) { 
		l.style.left=x+"px"; l.style.top=y+"px"; 
	} else if (b.ie4) {
		l.style.pixelLeft=x; l.style.pixelTop=y;	
	}
}

function findLayer(n) {
	if (b.dom) {
		return (document.getElementById(n)?document.getElementById(n):null);
	} else if (b.ie4) {
		return document.all[n]?document.all[n]:null;		
	} 
	return null;
}

function getLeft(l) {
	if (b.dom || b.ie4) {
		return l.offsetLeft+(l.offsetParent?getLeft(l.offsetParent):b.mac?parseInt(document.body.leftMargin):0);
	}
	return 0;
}

function getTop(l) {
	if (b.dom || b.ie4) {
		return l.offsetTop+(l.offsetParent?getTop(l.offsetParent):b.mac?parseInt(document.body.topMargin):0);
	}
	return 0;
}

var scrollTimeout;
var scrollStep = 10;
function scrollDown(name) {
	if (b.dom) {
		var content = document.getElementById("content" + name);
		var container = document.getElementById("container" + name);
		var diff = parseInt(content.style.top) + parseInt(content.offsetHeight) - parseInt(container.style.height);
		if (diff > scrollStep) {
			content.style.top = parseInt(content.style.top) - scrollStep;
		} else if (diff > 0) {
			content.style.top = parseInt(content.style.top) - diff;
		}
		scrollTimeout = setTimeout("scrollDown('" + name + "')", 100);		
	}
}

function scrollUp(name) {
	if (b.dom) {
		var content = document.getElementById("content" + name);
		var diff = parseInt(content.style.top);
		if (diff < -scrollStep) {
			content.style.top = parseInt(content.style.top) + scrollStep;
		} else if (diff < 0) {
			content.style.top = parseInt(content.style.top) - diff;
		}
		scrollTimeout = setTimeout("scrollUp('" + name + "')", 100);		
	}
}

function clearScroll() {
	clearTimeout(scrollTimeout);
}

function go(what) {
    for (var i=0;i<2;i++) {
        if (what.col[i].checked) {
            document.forms[what.col[i].value].submit();
        }
    }
}