/***********************************************************************
*	UNITEDHEALTHCARE LOCAL SITE NAVIGATION DHTML APPLICATION
*	Copyright (c) 2003 digital@jwt. All rights reserved.
*	Authored by: Spencer H. Bennett
***********************************************************************/

//-- USER AGENT OBJECT

function clsUa(){
	this.ua=navigator.userAgent.toLowerCase();
	this.mac=(this.ua.indexOf("mac")!=-1);
	this.ns4=(document.layers);
	this.w3c=(document.getElementById)?1:0;
	this.ieX=(document.all)?1:0;
	this.ie5=(this.ieX && this.w3c)?1:0;
	this.objGsn = null;
	this.arrLsn = new Array();
	this.objLsn = null;
	this.arrLsnState = new Array();
	this.intImgId = 0;
	}

var aLsn0 = new Array(), aLsn1 = new Array(), aLsn2 = new Array(), aLsn3 = new Array(), aLsn4 = new Array(), aLsn5 = new Array(), aLsn6 = new Array();

//-- VIEW OUR PLANS

aLsn0[0] = new Array ('nowhere.html','Medical',new Array());
aLsn0[1] = new Array ('nowhere.html','Life');
aLsn0[2] = new Array ('nowhere.html','Vision');
aLsn0[3] = new Array ('nowhere.html','Dental');

aLsn0[0][2][0] = new Array ('nowhere.html','Medicare',new Array());
aLsn0[0][2][1] = new Array ('nowhere.html','Individuals');
aLsn0[0][2][2] = new Array ('nowhere.html','Groups',new Array());
aLsn0[0][2][3] = new Array ('nowhere.html','Plans by State');

aLsn0[0][2][0][2][0] = new Array ('nowhere.html','Medicare Complete',new Array());
aLsn0[0][2][0][2][1] = new Array ('nowhere.html','Medicare Complete Choice',new Array());
aLsn0[0][2][0][2][2] = new Array ('nowhere.html','Medicare Complete Medipath');

aLsn0[0][2][2][2][0] = new Array ('nowhere.html','2 - 50 Employees');
aLsn0[0][2][2][2][1] = new Array ('nowhere.html','51 - 5000 Employees');
aLsn0[0][2][2][2][2] = new Array ('nowhere.html','5000+ Employees');
aLsn0[0][2][2][2][3] = new Array ('nowhere.html','Funding Options');

aLsn0[0][2][0][2][0][2][0] = new Array ('nowhere.html','Deluxe Rider');
aLsn0[0][2][0][2][0][2][1] = new Array ('nowhere.html','Point of Service');
aLsn0[0][2][0][2][0][2][2] = new Array ('nowhere.html','Premium');

aLsn0[0][2][0][2][1][2][0] = new Array ('nowhere.html','Deluxe Rider');

//-- PROGRAMS AND WELLNESS

aLsn1[0] = new Array ('nowhere.html','Care Coordination',new Array());
aLsn1[1] = new Array ('nowhere.html','Disease Management');
aLsn1[2] = new Array ('nowhere.html','Specialized Care');

aLsn1[0][2][0] = new Array ('nowhere.html','Health Education');
aLsn1[0][2][1] = new Array ('nowhere.html','Admission Counseling');
aLsn1[0][2][2] = new Array ('nowhere.html','Patient Advocacy');
aLsn1[0][2][3] = new Array ('nowhere.html','Recent Hospital Discharge');
aLsn1[0][2][4] = new Array ('nowhere.html','Chronic and Complex Illness');

//-- ONLINE SELF SERVICE & SUPPORT

aLsn2[0] = new Array ('nowhere.html','Consumers');
aLsn2[1] = new Array ('nowhere.html','Brokers and Agents');
aLsn2[2] = new Array ('nowhere.html','Employers');
aLsn2[3] = new Array ('nowhere.html','Physician Offices');

//-- HEALTH CARE TRENDS

aLsn3[0] = new Array ('nowhere.html','Costs');
aLsn3[1] = new Array ('nowhere.html','Privacy');
aLsn3[2] = new Array ('nowhere.html','Wellness');
aLsn3[3] = new Array ('nowhere.html','Patient Safety');
aLsn3[4] = new Array ('nowhere.html','Plan Options');
aLsn3[5] = new Array ('nowhere.html','Legislation');

//-- RESOURCES & TOOLS

aLsn4[0] = new Array ('nowhere.html','Brochures');
aLsn4[1] = new Array ('nowhere.html','Enewsletters');
aLsn4[2] = new Array ('nowhere.html','Related Links');
aLsn4[3] = new Array ('nowhere.html','Multi-Media');

//-- ABOUT US

aLsn5[0] = new Array ('nowhere.html','Careers');
aLsn5[1] = new Array ('nowhere.html','History');
aLsn5[2] = new Array ('nowhere.html','UnitedHealthGroup',new Array());
aLsn5[3] = new Array ('nowhere.html','Corporate Overview');

aLsn5[2][2][0] = new Array ('nowhere.html','UnitedHealthGroup Companies');

//-- NEWS ROOM

aLsn6[0] = new Array ('nowhere.html','News Archive');
aLsn6[1] = new Array ('nowhere.html','Press Contacts');
aLsn6[2] = new Array ('nowhere.html','Media Assets',new Array());
aLsn6[3] = new Array ('nowhere.html','Press Kit');
aLsn6[4] = new Array ('nowhere.html',"FAQ's");

aLsn6[2][2][0] = new Array ('nowhere.html','Image Library');

//-- LOCAL SITE NAVIGATION EVENT HANDLING

function lsnReset(x){
	for (var i = 0; i < x.length; i++){
		x[i].oChl.style.display = 'none';
		x[i].oImg.src = x[i].oImgA;
		if (x[i].aCrn.length) lsnReset(x[i].aCrn);
		}
	}

function lsnClick(x){
	var oImg = document.getElementById(x), oLsn = oImg.oLsn;
	oLsn.bDsp = (oLsn.oChl.style.display == 'block') ? 0 : 1;
	oLsn.oChl.style.display = (oLsn.bDsp) ? 'block' : 'none';
	oImg.src = (oLsn.bDsp) ? oLsn.oImgB : oLsn.oImgA;
	if (oLsn.bEnd){
		oGlb.oCap.style.visibility = (oLsn.bDsp) ? 'visible' : 'hidden';
		oGlb.oEnd.style.borderBottomColor = (oLsn.bDsp) ? '#F6F2E8' : '#E4E0D5';
		}
	if (!oLsn.bDsp && oLsn.aCrn.length) lsnReset(oLsn.aCrn);
	}

//-- LOCAL SITE NAVIGATION CONSTRUCTION

function lsnSpawn(x){
	for (var i = 0; i < x.aChl.length; i++){
		var	oLsn = new Object();
		oLsn.sRef = String((x.sRef) ? x.sRef + '_' + i : i);
		oLsn.iLvl = (oLsn.sRef.length < 2) ? 1 : (oLsn.sRef.length < 4) ? 2 : (oLsn.sRef.length < 7) ? 3 : 4;
		oLsn.sSty = 'lsnLvl_' + oLsn.iLvl;
		oLsn.sAst = (oLsn.iLvl > 1) ? 'lsnLvl_2' : 'lsnLvl_1';
		oLsn.sCls = (oLsn.iLvl == 2 && i == 0) ? 'lsnLvl_' + oLsn.iLvl + '_0' : 'lsnLvl_' + oLsn.iLvl;
		oLsn.aChl = x.aChl[i][2];
		oLsn.bChl = (oLsn.aChl) ? 1 : 0;
		oLsn.aCrn = new Array();
		var sLnk = '<a id="lsnLnk' + oLsn.sRef + '" class="' + oLsn.sAst + '" href="' + x.aChl[i][0] + '">' + x.aChl[i][1] + '</a>',
			sDiv = 'lsnDiv' + oLsn.sRef, sImg = 'lsnImg' + oLsn.sRef, sClk = "'" + sImg + "'", iVsp = (oLsn.iLvl < 3) ? 0 : 1,
			sSpn = 'lsnSpn' + oLsn.sRef, sSrc = '<img id="' + sImg + '" src="/uhc/cda/images/update/pxClr.gif" border="0" hspace="3" vspace="' + iVsp + '" />',
			sIcn = (oLsn.bChl && oLsn.iLvl != 1) ? '<a href="javascript:lsnClick(' + sClk + ');">' + sSrc + '</a>' : (oLsn.iLvl < 2) ? '<a href="' + x.aChl[i][0] + '">' + sSrc + '</a>' : sSrc,
			sPad = (oLsn.iLvl < 2) ? 'style="padding-right:1px;"' : '',
			sMouseOverOut = (oLsn.iLvl < 2) ? ' onMouseOver="menuToggle(\'' + oLsn.sRef + '\',1);" onMouseOut="menuToggle(\'' + oLsn.sRef + '\',0);"' : '',
			sHtm = '<div id="' + sDiv + '" class="' + oLsn.sCls + '"' + sMouseOverOut + '><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td ' + sPad + '>' + sIcn + '</td><td>' + sLnk + '</td></tr></table></div>';
		if (oLsn.bChl) sHtm += '<span id="' + sSpn + '" style="display:none;background-color:#F6F2E8;"></span>';
		if (oLsn.iLvl == 2) sHtm += '<img src="/uhc/cda/images/update/ruleH_125.gif" hspace="9" vspace="3" />';
		oLsn.oWrp = document.getElementById('oWrp' + oLsn.sRef);
		oLsn.oWrp.innerHTML = sHtm;
		oLsn.oChl = document.getElementById(sSpn);
		oLsn.oImgA = (oLsn.iLvl > 1) ? (oLsn.bChl) ? '/uhc/cda/images/update/iconA.gif' : '/uhc/cda/images/update/iconC.gif' : '/uhc/cda/images/update/iconX.gif';
		oLsn.oImgB = (oLsn.iLvl > 1) ? '/uhc/cda/images/update/iconB.gif' : '/uhc/cda/images/update/iconX.gif';
		oLsn.oImg = document.getElementById(sImg);
		oLsn.oImg.src = oLsn.oImgA;
		oLsn.oImg.oLsn = oLsn;
		if (oLsn.iLvl > 1 && oLsn.bChl) x.aCrn[x.aCrn.length] = oLsn;
		if (oLsn.iLvl == 1 && i == x.aChl.length - 1){
			oLsn.bEnd = 1;
			oGlb.oEnd = document.getElementById(sDiv);
			oGlb.oEnd.style.borderBottomColor = '#E4E0D5';
			}
		if (oLsn.bChl){
			sHtm = '';
			for (var ii = 0; ii < oLsn.aChl.length; ii++) sHtm += '<div id="oWrp' + oLsn.sRef + '_' + ii + '"></div>\n';
			oLsn.oChl.innerHTML = sHtm;
			//alert(sHtm);
			lsnSpawn(oLsn);
			}
		if (oGlb.iLvl >= oLsn.iLvl && oGlb.aCrr[oLsn.iLvl] == i && oLsn.bChl)lsnClick(sImg);
		}
	oGlb.oDiv.style.visibility = 'visible';
	}

//-- LOCAL SITE NAVIGATION INITIALIZATION

function lsnInit(){
	oGlb = new Object();
	oGlb.aCrr = sCrr.split('-');
	oGlb.iLvl = oGlb.aCrr.length - 1;
	oGlb.oDiv = document.getElementById('divLsn');
	oGlb.aChl = eval('aLsn' + oGlb.aCrr[0]);
	var sHtm = '';
	for (var i = 0; i < oGlb.aChl.length; i++) sHtm += '<div id="oWrp' + i + '"></div>';
	sHtm += '<div id="lsnCap"><img src="/uhc/cda/images/update/pxClr.gif" width="1" height="1" /></div>';
	oGlb.oDiv.innerHTML = sHtm;
	oGlb.oCap = document.getElementById('lsnCap');
	lsnSpawn(oGlb);
	turnOn();
	}

function turnOn() {
	var aTemp = sCrr.split('-');
	var onImg = document.getElementById("lsnImg" + aTemp[1]);
	var onLnk = document.getElementById("lsnLnk" + aTemp[1]);
	if (onImg != null) {
		if (aTemp.length > 2 || document.getElementById("lsnLnk" + aTemp[1] + "_0") != null) {
			onImg.src="/uhc/cda/images/update/iconBrownDown.gif";
		} else {
			onImg.src="/uhc/cda/images/update/iconBrown.gif";
		}
	
		onLnk.style.textDecoration = "none";
		onLnk.style.fontWeight = "bold";

		var temp = sCrr;
		temp = temp.substring(2);
		temp = temp.replace(/-/g,"_");
		temp = temp.replace(/ /g,"");

		var onLnk2 = document.getElementById("lsnLnk" + temp);
	
		if(onLnk != onLnk2) {
			onLnk2.style.color = "#433D2D";
			onLnk2.style.textDecoration = "none";
		}
	}
}

function menuToggle(objName,on) {
	var aTemp = sCrr.split('-');
	if(sCrr.length < 3 || aTemp[1] != objName) {
		var objImg = null;
		var objLink = null;
		var onImg = new Image();
		var offImg = new Image();
		onImg.src = "/uhc/cda/images/update/iconBrown.gif";
		offImg.src = "/uhc/cda/images/update/iconX.gif";
		
		if(document.all) {
			objImg = eval("document.all.lsnImg"+objName);
			objLink = eval("document.all.lsnLnk"+objName);
		} else {
			objImg = document.getElementById("lsnImg" + objName);
			objLink = document.getElementById("lsnLnk" + objName);
		}
		
		if(objImg != null && objLink != null && on){
			objImg.src = onImg.src;
			objLink.style.textDecoration = "underline";
		} else if(objImg != null && objLink != null && !on) {
			objImg.src = offImg.src;
			objLink.style.textDecoration = "none";
		}
	}
}

//-- HUB PAGE NAVIGATION EVENT HANDLING

function hubOver(x){
	if (oUa.ie5 && !oUa.mac) return;
	var oTrg = document.getElementById(x);
	oTrg.style.backgroundColor = '#424A7E';
	}

function hubOut(x){
	if (oUa.ie5 && !oUa.mac) return;
	var oTrg = document.getElementById(x);
	oTrg.style.backgroundColor = '#535D9E';
	}

//-- HOMEPAGE ROLLOVER CODE

numdivs=4; //The number of div on the homepage that have rollovers

//This function is called when you rollover a div
//	which = the div to show (from 0 to numdivs-1)
function showDiv( which ) {
	for(i=0;i<numdivs;i++) {
		if(document.all) {
			eval("document.all.div"+i+".style.display='none'");
			document.all.initial.style.display='none';
		} else {
			eval("document.getElementById('div"+i+"').style.display='none'");
			document.getElementById('initial').style.display='none';
		}
	}
	if(document.all) eval("document.all.div"+which+".style.display='block'");
	else eval("document.getElementById('div"+which+"').style.display='block'");
}


