//GLOBAL VARS********************************************************************

//general globals
var isLoggedIn = false;

var thisURL = document.location.href;
if (thisURL.indexOf('?') != -1) {
	thisURL = thisURL.substring(0, thisURL.indexOf('?'));
}
if (thisURL.indexOf('#') != -1) {
	thisURL = thisURL.substring(0, thisURL.indexOf('#'));
}

var isLandingPage = false;

if (thisURL.indexOf('/landing/') != -1) {
	isLandingPage = true;
}

var thisSecureURL = replace(thisURL, 'http:', 'https:');

var isSecure = false;
if (thisURL.toLowerCase().indexOf('https:') != -1) {
	isSecure = true;
}

var isSafari = navigator.userAgent.toLowerCase().indexOf('safari') != -1;
var isNetscape = navigator.userAgent.toLowerCase().indexOf('netscape') != -1;
var isIE = navigator.userAgent.toLowerCase().indexOf('msie') != -1;

var whichSubSection = (thisURL.indexOf('/professionals/') != -1 ? 'professionals' : (thisURL.indexOf('patients') != -1 ? 'patients' : ''));
var isHome = (countCharTokens(thisURL, '/') == 3 ? true : false);

//isHome = (((thisURL.indexOf('http://genesanddrugs.dnadirect.com') == 0 && thisURL.length == 35) || (thisURL.indexOf('http://stage.genesanddrugs.com/') == 0 && thisURL.length == 31 || (thisURL.indexOf('http://genesanddrugs.com/') == 0 && thisURL.length == 25) || (thisURL.indexOf('http://www.genesanddrugs.com/') == 0 && thisURL.length == 29) || (thisURL.indexOf('http://pgx.dna01.atomz.com') == 0 && thisURL.length == 27) || (thisURL.indexOf('http://pgx.dna02.atomz.com') == 0 && thisURL.length == 27) || (thisURL.indexOf('http://pgx.dna03.atomz.com') == 0 && thisURL.length == 27) || (thisURL.indexOf('http://genesanddrugs.dna01.atomz.com') == 0 && thisURL.length == 37) || (thisURL.indexOf('http://genesanddrugs.dna02.atomz.com') == 0 && thisURL.length == 37) || (thisURL.indexOf('http://genesanddrugs.dna03.atomz.com') == 0 && thisURL.length == 37) || (thisURL.indexOf('http://dev.genesanddrugs.com/') == 0 && thisURL.length == 29)) || (thisURL.indexOf('genesanddrugs.com/index.jsp') != -1) || (thisURL.indexOf('genesanddrugs.dnadirect.com/index.jsp') != -1) )?true:false)

if (isHome) {

	if ((thisURL.lastIndexOf('/') != thisURL.length - 1) && (thisURL.lastIndexOf('index.jsp') != thisURL.length - 9)) {
		isHome = false;
	}

	//added for Andrew Clark alternate index pages
	if (thisURL.indexOf('.com/index_AC') != -1) {
		isHome = true;
	}

	//end AClark additions


	whichSubSection = 'patients';
} else if (thisURL.indexOf('.com/jsp/') != -1 && thisURL.indexOf('editPage/cms_rootDoppleganger/') == -1) {
	whichSubSection = 'account';
}

//menu vars

var cmsMenuItems = null;

var bizDevMenuItems = null;

var accountMenuItems = new Array();

//accountMenuItems[accountMenuItems.length] = 'report|Sample Report|/jsp/reports/sample_guide.jsp|nav__report_preview';

var accountMenuItems_loggedIn = new Array();

//accountMenuItems_loggedIn[accountMenuItems_loggedIn.length] = 'report|Report Preview|/jsp/reports/report_preview.jsp|nav__report_preview';
accountMenuItems_loggedIn[accountMenuItems_loggedIn.length] = 'report|My Results|/jsp/account/secure/testsubject_form.jsp|nav__display_my_reports';
accountMenuItems_loggedIn[accountMenuItems_loggedIn.length] = 'profile|My Profile|/jsp/account/secure/welcome.jsp|nav__display_profile';
//accountMenuItems_loggedIn[accountMenuItems_loggedIn.length] = 'report|Report Mockup|/jsp/reports/report_mockup.jsp|nav__display_report_mockup';

//we do not want any options if this person is on a test ordering path
//to prevent confusion
if (thisURL.indexOf('questionnaire_testsubject_check.jsp') != -1 || thisURL.indexOf('/store/index.jsp') != -1) {
	accountMenuItems_loggedIn = new Array();
}


var report_subMenu_account = new Array();
var profile_subMenu_account = new Array();

//and create menu hide/show vars
var thisMainMenu = null;
var menuLefts = new Array();

if (whichSubSection != '') {
	thisMainMenu = eval(whichSubSection + 'MenuItems');

	for (var i = 0; i < thisMainMenu.length; i++) {
		var thisItemName = thisMainMenu[i].split('|')[0];
		eval('var hideMenu_' + whichSubSection + '_' + thisItemName + '= false;');

		var subMenuItems = eval(thisItemName + '_subMenu_' + whichSubSection);
		for (var j = 0; j < subMenuItems.length; j++) {
			if (subMenuItems[j].split('|')[0].indexOf('*') != -1) {
				eval('var hideMenu_' + whichSubSection + '_' + thisItemName + '_' + subMenuItems[j].split('|')[1] + '= false;');
				//alert('var hideMenu_' + whichSubSection + '_' + thisItemName + '_' + subMenuItems[j].split('|')[1]);
			}
		}
	}

}


//global menu vars
var thisChannelMenu = null;
var thisChannel = '';
var thisSubChannel = '';
var thisSubSubChannel = '';

if (thisURL.indexOf('/' + whichSubSection) != -1 && whichSubSection != '') {

	var trimmedURL = thisURL.substring(thisURL.indexOf('://') + 3, thisURL.lastIndexOf('/'));

	var thisChannel = trimmedURL.substring(trimmedURL.indexOf(whichSubSection + '/') + 1, trimmedURL.length);
	thisChannel = thisChannel.substring(thisChannel.indexOf('/') + 1, thisChannel.length);

	var subChannelBit = thisChannel;

	while (thisChannel.indexOf('/') != -1) {
		thisChannel = thisChannel.substring(0, thisChannel.lastIndexOf('/'));
	}

	//alert(mainSection + ' ' + thisChannel);

	if (thisChannel != 'jsp' && thisChannel != 'secure' && thisChannel != 'landing') {

		var thisChannelMenu = eval(thisChannel + '_subMenu_' + whichSubSection);

		if (subChannelBit.indexOf('/') != -1) {
			//alert(subChannelBit);
			thisSubChannel = subChannelBit.substring(subChannelBit.indexOf('/') + 1, subChannelBit.length);
			if (thisSubChannel.indexOf('/') != -1) {
				thisSubSubChannel = thisSubChannel.substring(thisSubChannel.indexOf('/') + 1);
				thisSubChannel = thisSubChannel.substring(0, thisSubChannel.indexOf('/'));
			}
		}

	}

}


var interpsArray = new Array();
interpsArray[interpsArray.length] = 'tamoxifen';
interpsArray[interpsArray.length] = 'codeine';


var genesToDrugsMap = {CYP2D6: "tamoxifen|codeine"};

var drugsToGenesMap = {tamoxifen: "CYP2D6",codeine: "CYP2D6"};


//global product vars
var focusedProductIndex = -1;


//END GLOBAL VARS



//META FUNCTIONS*************************************************************************
//that are called from the site templates

var loadLog = '';

function doHeaderInit() {
	//this function should contain any calls that need to execute before the
	//the body of the page begins to be parsed

	loadLog += '   doHeaderInit...';
	focusedProductIndex = getProductContext();

}


function doOnLoadStuff() {
	//this function should contain any calls that should be executed
	//once the page has finished loading

	loadLog += '   doOnLoadStuff...';

}


function doFooterInit() {
	//this function should contain any calls that need to execute
	//at he end of page parsing (just before the close </body> tag)
	//and *before* the page has loaded (the onload event).

	loadLog += '   doFooterInit...';

	fixMenuWidths();
	writeInlinePromos();
	showReturn2TopButton();
	selectMainMenuTab();
}


var beaconImg = new Image();

function trackClick(clickParm) {

	//window.status = clickParm;
	//alert(clickParm);

	var dmy = false;

	if (clickParm.indexOf('=') != -1) {
		clickParm = clickParm.split('=')[1];
	}

	//beaconImg.src = 'http://www.dnadirect.com/img/blank.gif?utm_source=beacons&utm_medium=site&utm_content=' + clickParm;

	if (thisURL.indexOf('mainapp.dna03') == -1) {

		try
		{
			urchinTracker('site_tracking__' + clickParm);
		}
		catch (err)
		{
			var thisErr = true;
		}

	}


	/*
	 try {
	 var dmy2 = ntptEventTag;
	 }
	 catch(err) {
	 dmy=true;
	 }

	 if (dmy == false) {
	 ntptEventTag(clickParm);
	 }
	 */

}

function getNavColor(which) {
	var theColor = 'gold';

	if (which == 'patients') {
		theColor = 'gold';
	} else if (which == 'account') {
		theColor = 'darkBlue';
	} else if (which == 'professionals') {
		theColor = 'lightBlue';
	} else if (which == 'emphasis_patients') {
		theColor = 'emphasisBlue';
	}

	return(theColor);

}

function getNavBGColor(which) {
	var theColor = '#FFAE27';

	if (which == 'patients') {
		theColor = '#FFAE27';
	} else if (which == 'account') {
		theColor = '#2C6DAF';
	} else if (which == 'professionals') {
		theColor = '#78AABF';
	}

	return(theColor);

}


function getBGColor(which) {
	var theColor = '#FFE073';

	if (which == 'patients') {
		theColor = '#FFE073';
	} else if (which == 'account') {
		theColor = '#48778B';
	} else if (which == 'professionals') {
		theColor = '#CADFF0';
	}

	return(theColor);

}

//END META FUNCTIONS





//HEADER FUNCTIONS*****************************************************************

function writeTopTabs() {

	var tabsML = '';

	if (isLandingPage) {
		return('');
	}


	if (whichSubSection == 'account') {

		tabsML = '<div style="float:right;width:130px;" id="other_TopTab_patients">' + writeOtherTab('patients') + '</div>' +
		         '<div style="float:right;width:130px;margin-right:5px;" id="other_TopTab_professionals">' + writeOtherTab('professionals') + '</div>';

	} else if (isHome) {

		tabsML = '<div style="float:right;width:' + (isLoggedIn ? '290' : '200') + 'px;margin-left:5px;" id="account_TopTab">' + writeAccountTab() + '</div>';
	} else {

		tabsML = '<div style="float:right;width:' + (isLoggedIn ? '290' : '200') + 'px;margin-left:5px;" id="account_TopTab">' + writeAccountTab() + '</div>' +
		         '<div style="float:right;width:' + (whichSubSection == 'professionals' ? '105' : '133') + 'px;" id="other_TopTab">' + writeOtherTab() + '</div>';
	}

	if (!isHome) {
		tabsML += '<div style="width:100px;position:relative;float:right;padding-top:3px;text-align:right;font-weight:bold;line-height:16px;"><a href="/" style="color:#8E8E8E;"><span style="font-size:18px;">&#171;</span><span style="font-size:8px;">&nbsp;</span>Home</a>&nbsp;&nbsp;&nbsp;&nbsp;</div>';
	} else {
		tabsML += '<div style="float:right;width:133px;" id="other_TopTab">' + writeOtherTab('patients') + '</div>';
	}

	tabsML = '<div id="topTabsDiv">' + tabsML + '</div>';

	return(tabsML);

}

function writeTagLine() {
	var tL = new Array();

	//tL[tL.length] = 'A Genetic Testing Center of Excellence';
	//tL[tL.length] = 'Your Genes. Your Health. Your Choices.';
	tL[tL.length] = 'Genetic Information and Testing Services';

	/*
	 if (isHome) {
	 tL = 'A Genetic Testing Center of Excellence';
	 } else {

	 tL = 'Tests For Drug Response';
	 }
	 */
	return(tL[rand(tL.length) - 1]);
}

function writePageHeader() {

	var headerML = '';


	headerML += '<div style="float:right;width:170px;" id="searchDiv">' +
	            '<div style="position:relative;float:right;width:43px;font-size:12px;padding-left:3px;">' + getOrangeButtonML('Go!', 'doSearch(document.srchForm.searWords.value, document.srchForm);') + '</div><div style="position:relative;float:right;width:110px;padding-top:1px;"><form name="srchForm" onSubmit="doSearch(document.srchForm.searWords.value, document.srchForm);return(false);" action="/patients/about/search.jsp" style="padding:0px;position:relative;margin:0px;display:inline;"><input onClick="clearDef(document.srchForm.searWords.value, document.srchForm);" type="text" name="searWords" value="' + searchDef + '" style="width:110px;height:20px;top:2px;color:#666666;"></form></div>'
	'</div>';


	if (whichSubSection != 'account') {
		headerML = writeThreeJumpTabs() + headerML;
	}

	headerML = '<div style="position:absolute;width:800px;top:92px;">' +
	           headerML +
	           '</div>';

	if (isLandingPage) {
		headerML += '<div style="position:absolute;width:800px;top:25px;left:0px;">' +
		            '<div class="box_goldHgrad_top" style="cursor:hand;cursor:pointer;">' +
		            '<div class="rightCorner"><img src="/img/box/goldHgrad_curverCorner_RT.gif"></div>' +
		            '<span class="navTabHeader">&nbsp;WELCOME TO DNA DIRECT</span>' +
		            '</div>' +
		            '</div>';

	} else {

		if (whichSubSection == 'account') {
			headerML += '<div style="position:absolute;width:800px;left:0px;">' +
			            '<div id="navDiv">' + writeMainNav(whichSubSection, isHome) + '</div>' +
			            '<div id="breadCrumb_pageTop" style="top:30px;">' +
			            writeBreadCrumb() +
			            '<div id="printEmailDiv"><a class="emailA" href="javascript:emailArticle();" id="header_emailLink">email</a>&nbsp;&nbsp;&nbsp;<a class="printA" href="javascript:printArticle();" id="header_printLink">print</a></div>' +
			            '</div>' +
			            '</div>';

		} else if (!isHome) {

			headerML += '<div id="navDiv">' + writeMainNav(whichSubSection, isHome) + '</div>';
			headerML += '<div id="breadCrumb_pageTop">' +
			            writeBreadCrumb() +
			            '<div id="printEmailDiv"><a class="emailA" href="javascript:emailArticle();" id="header_emailLink">email</a>&nbsp;&nbsp;&nbsp;<a class="printA" href="javascript:printArticle();" id="header_printLink">print</a></div>' +
			            '</div>';
		}
	}

	return(headerML);
}

function writeThreeJumpTabs() {
	var tabsML = '';


	tabsML += '<div style="width:200px;float:left;" onClick="document.location.href=\'/patients/testing_services/order_services.jsp\'">' +
	          '<div class="tab_darkBlue" style="cursor:hand;cursor:pointer;text-align:center;">' +
	          '<div class="leftCorner"><img src="/img/box/darkBlue_tabEnd_L.gif"></div>' +
	          '<div class="rightCorner"><img src="/img/box/darkBlue_tabEnd_R.gif"></div>' +
	          '<span class="navTabHeader">TESTING SERVICES</span>' +
	          '</div>' +
	          '</div>' +
		/*
		 '<div style="width:181px;float:left;margin-left:5px;"  onClick="document.location.href=\'/patients/testing_services/free_advice.jsp\'">' +
		 '<div class="tab_medBlue" style="cursor:hand;cursor:pointer;text-align:center;">' +
		 '<div class="leftCorner"><img src="/img/box/medBlue_tabEnd_L.gif"></div>' +
		 '<div class="rightCorner"><img src="/img/box/medBlue_tabEnd_R.gif"></div>' +
		 '<span class="navTabHeader">FREE TESTING ADVICE</span>' +
		 '</div>' +
		 '</div>' +
		 */
		        '<div style="width:212px;float:left;margin-left:5px;">' +
	          '<div class="tab_lightBlue" style="cursor:hand;cursor:pointer;text-align:center;"  onClick="document.location.href=\'/patients/tests/counseling_services.jsp\'">' +
	          '<div class="leftCorner"><img src="/img/box/lightBlue_tabEnd_L.gif"></div>' +
	          '<div class="rightCorner"><img src="/img/box/lightBlue_tabEnd_R.gif"></div>' +
	          '<span class="navTabHeader">CONSULTING SERVICES</span>' +
	          '</div>' +
	          '</div>';

	if (whichSubSection == 'professionals') {

		tabsML = '';

		tabsML += '<div style="width:181px;float:left;"  onClick="document.location.href=\'/professionals/referring/instructions_prof.jsp\'">' +
		          '<div class="tab_medBlue" style="cursor:hand;cursor:pointer;text-align:center;">' +
		          '<div class="leftCorner"><img src="/img/box/medBlue_tabEnd_L.gif"></div>' +
		          '<div class="rightCorner"><img src="/img/box/medBlue_tabEnd_R.gif"></div>' +
		          '<span class="navTabHeader">REFER YOUR PATIENT</span>' +
		          '</div>' +
		          '</div>' +
		          '</div>';

	}

	tabsML = '<div id="jumpTabsDiv">' + tabsML + '</div>';

	return(tabsML);
}

function writeAccountTab() {
	var tabML = ''

	if (isLoggedIn) {

		tabML = '<div class="darkBlueHgradBG">' +
		        '<div class="darkBlueHgrad_content_grad" style="padding-top:5px;">' +
		        '<span class="tabHeader">' +
		        '<a href="/jsp/account/secure/testsubject_form.jsp" onClick="trackClick(\'link_source=header__accounts\');" class="topTabA">My Results</a>' +
		        '<a href="/jsp/account/secure/welcome.jsp" onClick="trackClick(\'link_source=header__profile\');" class="topTabA" style="margin-left:10px;">My Profile</a>' +
		        '<a href="/jsp/store/cart.jsp" onClick="trackClick(\'link_source=header__cart\');" class="topTabA" style="margin-left:10px;">My Cart</a>' +
		        '<a onClick="return(confirm(\'Are you sure you want to logout of DNA Direct?\'));trackClick(\'link_source=header__logout\');" href="/jsp/account/login.jsp?action=logout" class="topTabA" style="margin-left:10px;">Logout</a>' +
		        '</span>' +
		        '</div>' +
		        '<div class="darkBlueHgrad_bot_grad">' +
		        '<div class="leftCorner"><img src="/img/box/darkBlueHgrad_curverCorner_LB.gif"></div>' +
		        '<div class="rightCorner"><img src="/img/box/darkBlueHgrad_curverCorner_RB.gif"></div>' +
		        '</div>' +
		        '</div>';

	} else {

		tabML = '<div class="darkBlueHgradBG">' +
		        '<div class="darkBlueHgrad_content_grad" style="padding-top:5px;">' +
		        '<span class="tabHeader">' +
		        '<a href="/jsp/account/register.jsp" onClick="trackClick(\'link_source=header__register\');" class="topTabA" style="margin-left:20px;">Register</a>' +
		        '<a href="/jsp/account/login.jsp" onClick="trackClick(\'link_source=header__login\');" class="topTabA" style="margin-left:10px;">Login</a>' +
		        '</span>' +
		        '</div>' +
		        '<div class="darkBlueHgrad_bot_grad">' +
		        '<div class="leftCorner"><img src="/img/box/darkBlueHgrad_curverCorner_LB.gif"></div>' +
		        '<div class="rightCorner"><img src="/img/box/darkBlueHgrad_curverCorner_RB.gif"></div>' +
		        '</div>' +
		        '</div>';
	}

	return(tabML);
}


function writeOtherTab(forceWhich) {
	var tabML = ''

	if (thisURL.indexOf('/patients/') != -1 || forceWhich == 'patients') {
		tabML = '<div class="lightBlueHgradBG" style="cursor:hand;cursor:pointer;" onClick="switchSection(\'professionals\')">' +
		        '<div class="lightBlueHgrad_content_grad" style="padding-top:0px;position:relative;padding-bottom:1px;">' +
		        '<span class="tabHeader" style="position:relative;display:block;top:4px;">' +
		        '<img src="/img/btn/white_tabArrow_lightBlueBG.gif" style="position:relative;top:-3px;margin-right:3px;">PROFESSIONALS' +
		        '</span>' +
		        '</div>' +
		        '<div class="lightBlueHgrad_bot_grad">' +
		        '<div class="leftCorner"><img src="/img/box/lightBlueHgrad_curverCorner_LB.gif"></div>' +
		        '<div class="rightCorner"><img src="/img/box/lightBlueHgrad_curverCorner_RB.gif"></div>' +
		        '</div>' +
		        '</div>';
	} else if (thisURL.indexOf('/professionals/') != -1 || forceWhich == 'professionals') {
		tabML = '<div class="goldHgradBG"  style="cursor:hand;cursor:pointer;" onClick="switchSection(\'patients\')">' +
		        '<div class="goldHgrad_content_grad" style="padding-top:0px;position:relative;padding-bottom:1px;">' +
		        '<span class="tabHeader" style="position:relative;display:block;top:4px;">' +
		        '<img src="/img/btn/white_tabArrow_goldBG.gif" style="position:relative;top:-3px;margin-right:3px;">PATIENTS' +
		        '</span>' +
		        '</div>' +
		        '<div class="goldHgrad_bot_grad">' +
		        '<div class="leftCorner"><img src="/img/box/goldHgrad_curverCorner_LB.gif"></div>' +
		        '<div class="rightCorner"><img src="/img/box/goldHgrad_curverCorner_RB.gif"></div>' +
		        '</div>' +
		        '</div>';
	}


	return(tabML);
}

function writeBreadCrumb() {
	var bcML = '';
	bcML = '<span id="breadCrumbSpan">> ' +
	       getSubSectionBreadCrumbName(whichSubSection) +
	       ' > <a href="/' + whichSubSection + '/' + thisChannel + '/index.jsp"  onClick="trackClick(\'link_source=breadcrumb__\' + this.href);">' +
	       getChannelBreadCrumbName(thisChannel) + '</a>' +
	       (thisSubChannel != '' ? ' > <a href="/' + whichSubSection + '/' + thisChannel + '/' + thisSubChannel + '/index.jsp" onClick="trackClick(\'link_source=breadcrumb__\' + this.href);">' + replace(thisSubChannel, '_', ' ') + '</a>' : '') +
	       (thisSubSubChannel != '' ? ' > <a href="/' + whichSubSection + '/' + thisChannel + '/' + thisSubChannel + '/' + thisSubSubChannel + '/index.jsp" onClick="trackClick(\'link_source=breadcrumb__\' + this.href);">' + replace(thisSubSubChannel, '_', ' ') + '</a>' : '') +
	       '</span>';

	return(bcML);

}

function getSubSectionBreadCrumbName(sSection) {
	if (sSection != 'account') {
		return(sSection);
	} else {
		return('account');
	}

}

function getChannelBreadCrumbName(channel) {
	var rName = '';

	var thisChannelList = eval(whichSubSection + 'MenuItems');

	for (var i = 0; i < thisChannelList.length; i++) {
		if (thisChannelList[i].split('|')[0] == channel) {
			rName = thisChannelList[i].split('|')[1].toLowerCase();
			break;
		}
	}

	//add kluge for report mockup
	if (thisURL.indexOf('report_mockup.jsp') != -1 || thisURL.indexOf('dummy_guideArt.jsp') != -1) {
		rName = '2D6 Tamoxifen Report'
	}

	return(rName);
}

function appendBreadCrumb(withWhat, overwrite) {

	if (document.getElementById('breadCrumbSpan')) {

		var bc = '';
		if (!exists(overwrite) || !overwrite) {
			bc = document.getElementById('breadCrumbSpan').innerHTML;
		}
		bc += withWhat;
		document.getElementById('breadCrumbSpan').innerHTML = bc;

	}
}


function switchSection(toWhich) {

	var whichMenu = eval(toWhich + 'MenuItems');
	document.location.href = '/' + toWhich + '/' + whichMenu[0].split('|')[0] + '/index.jsp';
}

//END HEADER FUNCTIONS



//MENU FUNCTIONS*****************************************************************

function writeMainNav(which, isHome) {

	var menuItems = eval(which + 'MenuItems');

	if (isLoggedIn && which == 'account') {
		menuItems = eval(which + 'MenuItems_loggedIn');
	}

	if (thisURL.indexOf('jsp/admin/') != -1) {
		if (thisURL.indexOf('jsp/admin/secure/editPage/materializeMenu.jsp') == -1) {
			menuItems = cmsMenuItems;
		}
	} else if (thisURL.indexOf('jsp/bizDev/') != -1) {
		menuItems = bizDevMenuItems;
	}

	//if (isHome) {
	//	menuItems = eval('hybridMenuItems');
	//}


	var navColor = getNavColor(which);

	var navML = '<div class="box_' + navColor + 'Hgrad_top" style="overflow:hidden">';

	if (isHome) {
		//navML += '<div class="rightCorner"><img src="/img/box/' + navColor + 'Hgrad_curverCorner_RT.gif"></div>';
	} else {

		navML += '<div class="rightCorner"><img src="/img/box/' + navColor + 'Hgrad_curverCorner_RT.gif"></div>';

		/*navML += '<div class="leftCorner"><img src="/img/box/' + navColor + 'Hgrad_curverCorner_LT.gif"></div>' +
		 '<div class="rightCorner"><img src="/img/box/' + navColor + 'Hgrad_curverCorner_RT.gif"></div>';*/

		if (which == 'patients') {
			//navML += '<div class="navName_' + navColor + '" id="nav_name_div">PATIENTS<img src="/img/btn/white_right_tabArrow_' + navColor + 'BG.gif" WIDTH="5" HEIGHT="7"></div>';
		} else if (which == 'account') {
			if (menuItems == cmsMenuItems || menuItems == bizDevMenuItems) {
				if (menuItems == bizDevMenuItems) {
					navML += '<div class="navName_' + navColor + '" id="nav_name_div">DEMO FILES<img src="/img/btn/white_right_tabArrow_' + navColor + 'BG.gif" WIDTH="5" HEIGHT="7"></div>';
				} else {
					navML += '<div class="navName_' + navColor + '" id="nav_name_div">CONTENT CMS<img src="/img/btn/white_right_tabArrow_' + navColor + 'BG.gif" WIDTH="5" HEIGHT="7"></div>';
				}

			} else {
				navML += '<div class="navName_' + navColor + '" id="nav_name_div">MY ACCOUNT<img src="/img/btn/white_right_tabArrow_' + navColor + 'BG.gif" WIDTH="5" HEIGHT="7"></div>';
			}
		} else if (which == 'professionals') {
			navML += '<div class="navName_' + navColor + '" id="nav_name_div">PROFESSIONALS<img src="/img/btn/white_right_tabArrow_' + navColor + 'BG.gif" WIDTH="5" HEIGHT="7"></div>';
		}
	}

	for (var i = 0; i < menuItems.length; i++) {
		var thisItemName = menuItems[i].split('|')[0];
		var navClass = 'navA_' + navColor;
		if (thisChannel == thisItemName) {
			navClass += '_on';
		} else if (which == 'account') {
			var thisPageUrl = menuItems[i].split('|')[2];
			if (thisURL.indexOf(thisPageUrl) != -1) {
				navClass += '_on';
			}

			if (thisURL.indexOf('reports/view_report.jsp') != -1 && menuItems[i].split('|')[1] == 'My Reports') {
				navClass += '_on';
			}
		}
		navML += '<a class="' + navClass + '" href="' + menuItems[i].split('|')[2] + '" onClick="trackClick(\'link_source=main_nav__\' + this.href);" onMouseOver="hideMenu_' + which + '_' + thisItemName + '=false;showMenu(\'' + which + '_' + thisItemName + '\')" onMouseOut="hideMenu_' + which + '_' + menuItems[i].split('|')[0] + '=true;callHideMenu(\'' + which + '_' + thisItemName + '\')" id="' + thisItemName + '_mainMenu">' + menuItems[i].split('|')[1] + '</a>';
	}

	if (which == 'account' && (menuItems != cmsMenuItems) && (menuItems != bizDevMenuItems)) {
		if (isLoggedIn) {
			navML += '<div style="position:relative;float:right;padding-top:5px;"><a href="/jsp/store/cart.jsp" class="topTabA">My Cart</a>&nbsp;&nbsp;<a onClick="return(confirm(\'Are you sure you want to logout of DNA Direct?\'));" href="/jsp/account/login.jsp?action=logout" class="topTabA">Logout</a></div>';
		} else {
			if (thisURL.indexOf('jsp/admin/editPage/') == -1) {
				navML += '<div style="position:relative;float:right;padding-top:5px;" id="navTabRegLoginDiv">' +
				         '<a href="/jsp/account/register.jsp" class="topTabA">Register</a>' +
				         '<a href="/jsp/account/login.jsp" class="topTabA" style="margin-left:10px;">Login</a></div>';
			}
		}

	} else if (!isHome) {

		navML += '<div style="position:relative;float:right;width:43px;font-size:12px;padding-top:4px;padding-left:3px;line-height:10px;">' + getOrangeButtonML('Go!', 'doSearch(document.srchForm.searWords.value, document.srchForm);') + '</div><div style="position:relative;float:right;width:110px;padding-top:5px;"><form name="srchForm" onSubmit="doSearch(document.srchForm.searWords.value, document.srchForm);return(false);" action="/' + which + '/about/search.jsp" style="padding:0px;position:relative;margin:0px;display:inline;"><input onClick="clearDef(document.srchForm.searWords.value, document.srchForm);" type="text" name="searWords" value="' + searchDef + '" style="width:110px;height:20px;top:2px;color:#666666;"></form></div>'

		/*
		 if (which == 'patients') {
		 navML += '<div style="float:right;padding-top:5px;color:#fff;font-size:12px;">a service of <a href="http://www.dnadirect.com/index.jsp" target="top"><img src="/img/logos/gd_logo_footer.gif" style="position:relative;top:2px;"></a></div>';
		 } else {
		 navML += '<div style="float:right;padding-top:5px;color:#fff;font-size:12px;">a service of <a href="http://www.dnadirect.com/index.jsp" target="top"><img src="/img/logos/dnadirect_logo_serviceOf.gif" style="position:relative;top:3px;"></a></div>';
		 }
		 */
	}

	navML += '</div>';

	return(navML);
}

function writeSubNav() {

	if (document.getElementById('subNavDiv')) {
		document.getElementById('subNavDiv').innerHTML = generateSubNav(whichSubSection, isHome);
	}

}


function refreshSubNav_IE() {
	document.getElementById('subNavDiv').innerHTML = document.getElementById('subNavDiv').innerHTML;
}

function generateSubNav(which, isHome) {

	if (isLandingPage) {
		return('');
	}

	var navML = '';

	var thisMainMenu = eval(which + 'MenuItems');

	var leftOffset = 0;
	if (document.getElementById('nav_name_div')) {
		leftOffset = document.getElementById('nav_name_div').offsetWidth - 0 + 5;
	}

	var topOffset = '';
	var leftOffsetAdjust = 0;

	if (isHome) {
		topOffset = 'top:30px;';
		leftOffsetAdjust = 0;
		//thisMainMenu = eval('hybridMenuItems');
	}

	var navColor = getNavColor(which);

	for (var i = 0; i < thisMainMenu.length; i++) {

		var menuName = thisMainMenu[i].split('|')[0];

		var thisSubMenuData = eval(menuName + '_subMenu_' + which);

		navColor = getNavColor(which);

		if (thisSubMenuData.length > 0) {

			navML += '\n<div class="subNav_' + navColor + '" style="' + topOffset + ';left:' + (leftOffset - (i == 0 ? leftOffsetAdjust : 1)) + 'px;" id="' + which + '_' + menuName + '_subMenu" onMouseOver="hideMenu_' + which + '_' + menuName + '= false;" onMouseOut="hideMenu_' + which + '_' + menuName + '= true;callHideMenu(\'' + which + '_' + menuName + '\')">';

			var subSubML = '';

			for (var j = 0; j < thisSubMenuData.length; j++) {

				var thisItemName = thisSubMenuData[j].split('|')[0];

				//we want to make the non-subdirectory items in the tests a different color
				if (which == 'patients') {
					if ((menuName == 'tests') && (thisItemName.indexOf('*') == -1)) {
						navColor = getNavColor('emphasis_' + which);
					} else {
						navColor = getNavColor(which);
					}
				}

				var thisLinkClass = 'subNavA_' + navColor;
				var rightSpacer = '';
				var showHideLink = '';
				var thisHREF = '/' + which + '/' + thisSubMenuData[j].split('|')[1] + '/' + thisSubMenuData[j].split('|')[2];

				if (thisItemName.indexOf('*') != -1) {
					thisItemName = replace(thisSubMenuData[j].split('|')[0], '*', '');
					subSubML += '\n' + writeSubSubNav(j, thisSubMenuData[j].split('|')[1], menuName, navColor, null, which);
					thisLinkClass = 'subNav_withSubA_' + navColor;
					rightSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					showHideLink = 'onMouseOver="hideMenu_' + which + '_' + menuName + '_' + thisSubMenuData[j].split('|')[1] + '= false;lagShowSubMenu(\'' + which + '_' + menuName + '_' + thisSubMenuData[j].split('|')[1] + '\');"' +
					               ' onMouseOut="hideMenu_' + which + '_' + menuName + '_' + thisSubMenuData[j].split('|')[1] + '= true;callHideMenu(\'' + which + '_' + menuName + '_' + thisSubMenuData[j].split('|')[1] + '\')"';

					thisHREF = '/' + which + '/' + menuName + '/' + thisSubMenuData[j].split('|')[1] + '/' + thisSubMenuData[j].split('|')[2];
				}

				if (thisSubMenuData[j].split('|')[2].indexOf('javascript:') != -1) {
					thisHREF = thisSubMenuData[j].split('|')[2];
				}

				navML += '\n<a ' + showHideLink + ' class="' + thisLinkClass + '" href="' + thisHREF + '" onClick="trackClick(\'link_source=sub_nav__\' + this.href);" id="' + menuName + '_' + j + '">&nbsp;' + fixBreakingChars(thisItemName) + rightSpacer + '&nbsp;</a>';
			}

			navML += subSubML;

			navML += '</div>';

		}
		menuLefts[i] = leftOffset;
		leftOffset += (document.getElementById(menuName + '_mainMenu').offsetWidth - 0);
	}

	return(navML);
}

function writeSubSubNav(parentIndex, parentName, parentMenuName, navColor, subSubParent, which) {

	var subML = '\n<div class="subSubNav_' + navColor + '" style="top:' + ((parentIndex * 26) - 1) + 'px;" onMouseOver="hideMenu_' + which + '_' + parentMenuName + '_' + parentName + '= false;showMenu(\'' + which + '_' + parentMenuName + '_' + parentName + '\');" onMouseOut="hideMenu_' + which + '_' + parentMenuName + '_' + parentName + '= true;callHideMenu(\'' + which + '_' + parentMenuName + '_' + parentName + '\');" id="' + which + '_' + parentMenuName + '_' + parentName + '_' + 'subMenu">';
	var ssMenuItems = eval(which + '_' + parentMenuName + '_' + parentName + '_subMenu');

	var subSubML = '';

	for (var h = 0; h < ssMenuItems.length; h++) {
		var thisSubItemName = ssMenuItems[h].split('|')[0];

		var thisHREF = '/' + which + '/' + parentMenuName + '/' + (exists(subSubParent) ? subSubParent + '/' : '') + ssMenuItems[h].split('|')[1] + '/' + ssMenuItems[h].split('|')[2];

		var thisLinkClass = 'subSubNavA_' + navColor;
		var rightSpacer = '';
		var showHideLink = '';


		if (thisSubItemName.indexOf('*') != -1) {
			//window.status =  ssMenuItems[h];			
			var menuName = parentName + '_' + ssMenuItems[h].split('|')[1];
			//alert(menuName);

			thisSubItemName = replace(ssMenuItems[h].split('|')[0], '*', '');
			subSubML += '\n' + writeSubSubNav(h, menuName, parentMenuName, navColor, parentName, which);
			//alert(subSubML);
			thisLinkClass = 'subSubNav_withSubA_' + navColor;
			rightSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
			showHideLink = 'onMouseOver="hideMenu_' + which + '_' + parentMenuName + '_' + menuName + '= false;lagShowSubMenu(\'' + which + '_' + parentMenuName + '_' + menuName + '\');"' +
			               ' onMouseOut="hideMenu_' + which + '_' + parentMenuName + '_' + menuName + '= true;callHideMenu(\'' + which + '_' + parentMenuName + '_' + menuName + '\')"';

			//showHideLink = 'onMouseOver="alert(\'hideMenu_' + which + '_' + parentMenuName + '_' + menuName + '\')"';			
			thisHREF = '/' + which + '/' + parentMenuName + '/' + parentName + '/' + ssMenuItems[h].split('|')[1] + '/' + ssMenuItems[h].split('|')[2];
		}

		if (ssMenuItems[h].split('|')[2].indexOf('javascript:') != -1) {
			thisHREF = ssMenuItems[h].split('|')[2];
		}

		subML += '\n<a ' + showHideLink + 'class="' + thisLinkClass + '" href="' + thisHREF + '" onClick="trackClick(\'link_source=subsub_nav__\' + this.href);" id="' + which + '_' + parentMenuName + '_' + parentName + '_menuLink' + '_' + h + '">&nbsp;' + fixBreakingChars(thisSubItemName) + rightSpacer + '&nbsp;</a>';
	}
	subML += subSubML;
	subML += '</div>';
	return(subML);
}


function showMenu(which) {

	if (document.getElementById(which + '_subMenu')) {
		document.getElementById(which + '_subMenu').style.visibility = 'visible';
	}
}

function lagShowSubMenu(which) {

	if (document.getElementById(which + '_subMenu')) {
		setTimeout('showSubMenu(\'' + which + '\')', 300);
	}
}

function showSubMenu(which) {

	if (!eval('hideMenu_' + which)) {
		document.getElementById(which + '_subMenu').style.visibility = 'visible';
	}
}

function callHideMenu(which) {
	setTimeout('hideMenu(\'' + which + '\');', 75);
}

function hideMenu(which, forceHide) {

	if (eval('hideMenu_' + which) || forceHide) {
		if (document.getElementById(which + '_subMenu')) {
			document.getElementById(which + '_subMenu').style.visibility = 'hidden';
			//eval('hideMenu_' + which + ' = false;');
		}
	}
}

function fixMenuWidths() {

	//INSRTED FOR TEMP HYBRID MENU'
	//if (isHome) {
	//	thisMainMenu = eval('hybridMenuItems');
	//}

	if (document.getElementById('navDiv') || document.getElementById('navDivHome')) {


		for (var i = 0; i < thisMainMenu.length; i++) {
			var thisItemName = thisMainMenu[i].split('|')[0];

			var thisMenuOffset = 0;
			if (document.getElementById(whichSubSection + '_' + thisItemName + '_subMenu')) {

				thisMenuOffset = document.getElementById(whichSubSection + '_' + thisItemName + '_subMenu').offsetWidth;


				var subMenuItems = eval(thisItemName + '_subMenu_' + whichSubSection);
				fixSubMenuWidths(subMenuItems, thisItemName, thisMenuOffset)

			}

		}

		//netscape sucks, so we need to kluge the menu width and other menu position vars
		if (isNetscape) {

			for (var i = 0; i < thisMainMenu.length; i++) {
				var thisItemName = thisMainMenu[i].split('|')[0];

				var menuWidth = 0;
				if (document.getElementById(whichSubSection + '_' + thisItemName + '_subMenu')) {

					var subMenuItems = eval(thisItemName + '_subMenu_' + whichSubSection);


					for (var j = 0; j < subMenuItems.length; j++) {
						if (replace(subMenuItems[j].split('|')[0], '*', '').length > menuWidth) {
							menuWidth = replace(subMenuItems[j].split('|')[0], '*', '').length;
						}
					}

					document.getElementById(whichSubSection + '_' + thisItemName + '_subMenu').style.width = (menuWidth * 5) + 50 + 'px';

					for (var j = 0; j < subMenuItems.length; j++) {
						if (subMenuItems[j].split('|')[0].indexOf('*') != -1) {

							var subItemName = '';
							//and add a kluge for the capitalization of Tamoxifen
							if (document.getElementById(whichSubSection + '_' + thisItemName + '_' + replace(subMenuItems[j].split('|')[0], '*', '') + '_subMenu')) {
								subItemName = replace(subMenuItems[j].split('|')[0], '*', '');

							} else if (document.getElementById(whichSubSection + '_' + thisItemName + '_' + replace(subMenuItems[j].split('|')[0], '*', '').toLowerCase() + '_subMenu')) {
								subItemName = replace(subMenuItems[j].split('|')[0], '*', '').toLowerCase();
							}

							document.getElementById(whichSubSection + '_' + thisItemName + '_' + subItemName + '_subMenu').style.left = (menuWidth * 5) + 50 + 'px';

							var subSubMenuItems = eval(whichSubSection + '_' + thisItemName + '_' + subItemName + '_subMenu');

							var subMenuWidth = 0;

							for (var k = 0; k < subSubMenuItems.length; k++) {
								if (replace(subSubMenuItems[k].split('|')[0], '*', '').length > subMenuWidth) {
									subMenuWidth = replace(subSubMenuItems[k].split('|')[0], '*', '').length;
								}
							}

							document.getElementById(whichSubSection + '_' + thisItemName + '_' + subItemName + '_subMenu').style.width = (subMenuWidth * 5) + 35 + 'px';

						}
					}

				}

			}

		}

	}

}


function fixSubMenuWidths(menuItems, thisItemName, thisMenuOffset) {
	if ((menuItems + '').indexOf('*') != -1) {
		for (var j = 0; j < menuItems.length; j++) {
			if (menuItems[j].split('|')[0].indexOf('*') != -1) {
				document.getElementById(whichSubSection + '_' + thisItemName + '_' + menuItems[j].split('|')[1] + '_subMenu').style.left = (thisMenuOffset - 1) + 'px';
				//alert(menuItems[j]);
			}

			//okay, the subSubMenu code below assumes that a given item will
			//have a subsub menu. That is not necessarily the case
			//so we'll gate this code section by checking to see if a page
			//element for this subsubmenu exists or not

			if (document.getElementById(whichSubSection + '_' + thisItemName + '_' + menuItems[j].split('|')[1] + '_subMenu')) {
				var subSubMenuItems = eval(whichSubSection + '_' + thisItemName + '_' + menuItems[j].split('|')[1] + '_subMenu');
				var thisSubMenuOffset = document.getElementById(whichSubSection + '_' + thisItemName + '_' + menuItems[j].split('|')[1] + '_subMenu').offsetWidth;
				for (var h = 0; h < subSubMenuItems.length; h++) {
					if (subSubMenuItems[h].split('|')[0].indexOf('*') != -1) {
						document.getElementById(whichSubSection + '_' + thisItemName + '_' + menuItems[j].split('|')[1] + '_' + subSubMenuItems[h].split('|')[1] + '_subMenu').style.left = (thisSubMenuOffset - 0) + 'px';
					}
				}

			}

		}
	}
}

function selectMainMenuTab() {

	if (!isHome && whichSubSection == 'patients' || whichSubSection == 'professionals') {
		if (document.getElementById(thisChannel + '_mainMenu')) {
			document.getElementById(thisChannel + '_mainMenu').className = 'navA_' + getNavColor(whichSubSection) + '_on';
		}
	}

}


//END MENU FUNCTIONS



//CONTENT WRITING FUNCTIONS*****************************************************************

function writeRightContent() {
	var colML = ''

	var theColor = getNavColor(whichSubSection);
	var navBGColor = getBGColor(whichSubSection);

	var focusTestName = '';
	var focusGeneName = '';
	var focusTestPrice = '';
	var focusTestKit = '';
	var focusTestChannel = '';

	if (isLandingPage) {
		/*
		 colML +='<div style="position:relative;width:230px;left:10px;margin-top:10px;">' +
		 '	<div class="box_blueVgrad_trans_top">' +
		 '		<div class="leftCorner"><img src="/img/box/blueVgrad_curverCorner_LT.gif"></div>' +
		 '		<div class="rightCorner"><img src="/img/box/blueVgrad_curverCorner_RT.gif"></div>' +
		 '		<span>Quick Poll</span>' +
		 '	</div>' +
		 '	<div class="box_greyline_content" style="color:#000;" id="quickPollContentDiv">' +
		 '		<form name="qP">' +
		 '			<div>1. Do you have Type 2 diabetes? <br> <input type="radio" name="q1" value="Yes" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q1_yes\');"> Yes &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="q1" value="No" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q1_no\');"> No</div>' +
		 '			<div style="margin-top:10px;">2. Does anyone in your family have Type 2 diabetes? <br> <input type="radio" name="q2" value="Yes" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q2_yes\');"> Yes &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="q2" value="No" style="border:0px;height:18px;"  onClick="trackClick(\'link_source=DT2poll__q2_no\');"> No</div>' +
		 '			<div style="margin-top:10px;">3. Are you concerned about your risk for Type 2 diabetes? <br> <input type="radio" name="q3" value="Yes" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q3_yes\');"> Yes &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="q3" value="No" style="border:0px;height:18px;"  onClick="trackClick(\'link_source=DT2poll__q3_no\');"> No</div>' +
		 '			<div style="margin-top:10px;">4. Would you take a genetic test for Type 2 diabetes risk? <br> <input type="radio" name="q4" value="Yes" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q4_yes\');"> Yes &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="q4" value="No" style="border:0px;height:18px;"  onClick="trackClick(\'link_source=DT2poll__q4_no\');"> No</div>' +
		 '			<div style="margin-top:10px;">5. How would you order this test? <br> <input type="radio" name="q5" value="doctor" style="border:0px;height:18px;" onClick="trackClick(\'link_source=DT2poll__q5_dr\');">Through my doctor <input type="radio" name="q5" value="online" style="border:0px;height:18px;"  onClick="trackClick(\'link_source=DT2poll__q5_online\');">Online</div>' +
		 '		</form>' +
		 '		<div style="position:relative;height:24px;padding-left:60px;margin-top:10px;">' + getOrangeButtonML('Submit Poll', 'document.getElementById(\'quickPollContentDiv\').innerHTML = \'<span class=h2Class>Thank You!</span><br>Your responses will help us to improve our service for everyone.\';', 'l') + '</div>' +
		 '	</div>';

		 colML +='	<div class="box_greyline_bot">' +
		 '		<div class="leftCorner" ><img src="/img/box/greyLine_curveCorner_LB.gif"></div>' +
		 '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif"></div>' +
		 '	</div>' +
		 '</div>';
		 */

	} else if (whichSubSection != 'account') {

		colML += '<div class="rightPatientCol_' + theColor + '">';

		/*
		 colML = '<div style="background-color:#fff;">' +
		 '<a href="/' + whichSubSection + '/what_is_pgx/how.jsp" class="greyBottomLine_A" onClick="trackClick(\'link_source=right_col__how_testing_works\');">How Testing Works</a>' +
		 '<a href="/' + whichSubSection + '/about/test_selection.jsp" class="greyBottomLine_A" onClick="trackClick(\'link_source=right_col__test_selection\');">Our Test Selection Process</a>' +
		 '<a href="/' + whichSubSection + '/about/standards.jsp" class="greyBottomLine_A" onClick="trackClick(\'link_source=right_col__standards_guidelines\');">Our Standards & Guidelines</a>';

		 if (whichSubSection  == 'patients') {

		 colML += '<a href="/patients/what_is_pgx/pros_cons.jsp" class="greyBottomLine_A" onClick="trackClick(\'link_source=right_col__pros_cons\');">Pros & Cons of Testing</a>' +
		 '<a href="/patients/about/comments.jsp" class="greyBottomLine_A" onClick="trackClick(\'link_source=right_col__customer_comments\');">Customer Comments</a>';

		 if (thisURL.indexOf('/drugs/tamoxifen/') != -1) {
		 colML += '<div style="clear:both;text-align:left;padding-left:20px;">' + getOrangeButtonML('Order Testing Now','orderTest(\'tamoxifen\');') + '</div>';
		 if (!isLoggedIn) {
		 colML += '<div style="padding-left:20px;font-size:10px;margin-bottom:10px;">you will be required to register</div>';
		 }
		 }

		 }
		 colML += '</div>';
		 */


		if (focusedProductIndex != -1) {

			focusTestName = getTestName(focusedProductIndex);
			focusGeneName = '';
			focusTestPrice = getTestPrice(focusedProductIndex);
			focusTestKit = getTestKitType(focusedProductIndex);
			focusTestChannel = getChannelName(focusedProductIndex);


			if (whichSubSection == 'patients') {

				if (thisURL.indexOf('/tests/genealogy_testing/') != -1) {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_orangeVgrad_trans_top">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
					         '		<span>ORDER TESTING NOW</span>' +
					         '	</div>' +
					         '	<div class="box_orangeline_trans_content" style="color:#000;padding-top:3px;line-height:auto;" id="genealogyPanelToutBox">' +
					         '<p style="margin-top:0px;margin-bottom:5px;">Ancestry testing is available through our <a href="/patients/tests/genealogy_testing/selecting_our_preferred_providers.jsp">Preferred Providers</a>.</p>' +
					         '<table border=0 width="210" cellspacing="0" cellpadding="0">' +
					         '<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#mito">Maternal Lineage</a><br><strong>Price: $189</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'AC_ML\')', 'r') + '</td></tr>' +
					         '<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#yDNA">Paternal Lineage</a><br><strong>Price: $149-$199</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'AC_yDNA\')', 'r') + '</td></tr>' +
					         '<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#yDNA">Combined Lineage</a><br><strong>Price: $328-$378</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'AC_COMB\')', 'r') + '</td></tr>' +
					         '<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#mito">AncestryByDNA 2.5</a><br><strong>Price: $240</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'ABDNA_ABDNA25\')', 'r') + '</td></tr>' +
					         '<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#yDNA">EurasianDNA 1.0</a><br><strong>Price: $430</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'ABDNA_EDNA10\')', 'r') + '</td></tr>' +
						//'<tr><td style="font-weight:bold;padding-bottom:8px;" width="112"><a href="/patients/tests/genealogy_testing/what_are_the_tests.jsp#yDNA">EuropeanDNA 2.0</a><br><strong>Price: $650</strong></td><td VALIGN="TOP" style="text-align:right;font-weight:bold;">' + getOrangeButtonML('Order Now', 'orderAncestryTestingNow(\'ABDNA_EDNA20\')', 'r') + '</td></tr>' +
						       '</table>';

					/*
					 colML += '<div style="position:relative;display:none;" id="gen_updatesSignup">';
					 colML += 'Enter your email below to be updated when DNA Direct launches ethnic and regional population matching testing.';
					 colML += '<form name="notifyForm" action="/jsp/catchForms/catchNotifyTesting.jsp" style="padding-top:5px;padding-bottom:5px;" target="notifySubmitFrame">your email: <input type="text" name="email" size="23">';

					 colML += '<div style="padding-left:55px;padding-top:3px;">' + getOrangeButtonML('Submit Email', 'if (validateEmail(document.notifyForm.email.value, \'Your\', \'notifyForm.email\')) {document.notifyForm.submit();}') + '</div>';

					 colML += '<input type="hidden" name="testInterest" value="genealogy">';
					 colML += '<input type="hidden" name="thanksObjName" value="genealogyPanelToutBox">';

					 colML += '</form>';

					 colML += '<iframe name="notifySubmitFrame" src="/blank.html" style="position:absolute;left:-2000px;"></iframe>';

					 colML += '</div>';
					 */

					colML += '<div style="padding-top:10px;">Until further notice, DNA Direct cannot accept orders from Maryland residents.</div>';

					colML += '	</div>' +
					         '	<div class="box_orangeVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';


				} else if (thisURL.indexOf('/tests/paternity/') != -1) {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
					         '	</div>' +
					         '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
					         '		<strong>Home Paternity Testing</strong> is easy and completely confidential.' +
					         '		<div style="text-align:center;margin-top:3px;"><strong style="color:#14384C;">Price: ' + focusTestPrice + '</strong></div>';

					colML += '		<div style="position:relative;left:40px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Testing Now', 'orderTestingNow();') + '</div>';

					colML += '<div style="padding-top:8px;"><strong><a href="/patients/tests/paternity/choosing_a_test.jsp">Legal Paternity Testing</a></strong> is <strong>$475</strong>. To order, call our lab partner DNA Diagnostics Center directly at 1-800-281-2916.</div>';

					colML += '<div style="padding-top:10px;">Until further notice, DNA Direct cannot accept orders from Maryland residents.</div>';

					colML += '	</div>' +
					         '	<div class="box_blueVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';


				} else if (thisURL.indexOf('/tests/dna_archive_storage/') != -1) {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
					         '	</div>' +
					         '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
					         '		<strong>DNA Archive&#153;</strong> Home DNA storage lets you preserve genetic history for the future.<div style="text-align:center;"><strong>Price: $225</strong></div>';

					colML += '		<div style="position:relative;left:70px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Now', 'orderTestingNow();') + '</div>';

					colML += '	</div>' +
					         '	<div class="box_blueVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';


				} else if (thisURL.indexOf('/tests/breast_cancer/') != -1) {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
					         '	</div>' +
					         '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
					         '		<strong>Breast & Ovarian Cancer Risk Testing</strong> includes pre- and post-test counseling. <strong>$620-$3456</strong>';

					colML += '		<div style="position:relative;left:40px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Testing Now', 'orderTestingNow();') + '</div>';

					colML += '<div style="padding-top:8px;"><strong>Pre-Test Consultation:</strong> Our counselors can help you determine if testing is right for you. <strong>$150</strong></div>' +
					         '<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Schedule a Consultation', 'document.location.href=\'/patients/testing_services/consultation.jsp\';') + '</div>' +
					         '<div style="padding-top:8px;"><strong>Support After Testing:</strong> In-depth report on your test results, plus genetic counseling. <strong>$150</strong></div>' +
					         '<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Post-Test Support', 'orderTestingNow(\'BRCA\', \'brca_report_only\');') + '</div>';

					colML += '<div style="padding-top:10px;">Until further notice, DNA Direct cannot accept orders from Maryland residents.</div>';

					colML += '	</div>' +
					         '	<div class="box_blueVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';


				} else {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
					         '	</div>' +
					         '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
					         '		<strong>' + focusTestName + '</strong> ' + (focusTestChannel != 'colon_cancer' ? 'testing ' : '') + 'is ' + (focusTestKit == 'SWAB' ? 'painless, easy' : (focusTestKit == 'BLOOD' ? 'easy, accurate' : (focusTestKit == 'STOOL' ? 'accurate, non-invasive' : 'safe, easy'))) + ' and includes a <a href="javascript:getSampleReport();">personalized report</a> of your results.' +
					         '		<div style="text-align:center;margin-top:3px;"><strong style="color:#14384C;">Price: ' + focusTestPrice + '</strong>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' + getLearnMoreLink() + '" style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;">Learn More</a></div>';
					if (focusTestChannel == 'infertility' || focusTestChannel == 'pregnancy_losses') {
						colML += '		<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Men\'s Testing', 'orderTestingNow(\'INF_M\');') + '</div>' +
						         '		<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Women\'s Testing', 'orderTestingNow(\'INF_F\');') + '</div>';
					} else if (focusTestChannel == 'blood_clotting') {
						colML += '		<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Men\'s Testing', 'orderTestingNow(\'FVL_M\');') + '</div>' +
						         '		<div style="position:relative;left:30px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Women\'s Testing', 'orderTestingNow(\'FVL_F\');') + '</div>';
						colML += '<div style="padding-top:5px;font-size:10px;">Note: Men and women receive the same test but pre-test questionaires are gender-specific.</div>';
					} else {
						colML += '		<div style="position:relative;left:40px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Testing Now', 'orderTestingNow();') + '</div>';
					}

					colML += '<div style="padding-top:10px;">Until further notice, DNA Direct cannot accept orders from Maryland residents.</div>';

					if (focusTestChannel == '2D6') {
						colML += '<div style="padding-top:8px;"><strong>Tamoxifen 2D6</strong>, which includes<br>2D6 testing, is also available for <b>$300</b>.&nbsp;&nbsp;<a style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;" href="/' + whichSubSection + '/tests/tamoxifen/what_tell.jsp">Learn More</a></div>';
					} else if (focusTestChannel == 'decode_diabetes') {
						colML += '<div style="padding-top:8px;">' + getQuestionnaireWarnings() + '</div>';
					} else if (focusTestChannel == 'tamoxifen') {
						colML += '<div style="padding-top:10px;">Tamoxifen testing can be included in the <strong>Drug Response Panel</strong>, which also tests 2C9 and 2C19. <a style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;" href="/' + whichSubSection + '/tests/drug_response/how.jsp#addTW">Learn More</a></div>';
					} else if (focusTestChannel == 'warfarin') {
						colML += '<div style="padding-top:10px;">Warfarin testing can be included in the <strong>Drug Response Panel</strong>, which also tests 2D6 and 2C19. <a style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;" href="/' + whichSubSection + '/tests/drug_response/how.jsp#addTW">Learn More</a></div>';
					} else if (focusTestChannel == 'colon_cancer') {
						colML += '<div style="padding-top:10px;">ColoSure&trade; is not available to residents of New York and California as assay approval is still pending in these states. Please email <a href=mailto:colosure@dnadirect.com>colosure@dnadirect.com</a> to be notified when ColoSure&trade; is available in your state.</div>';
					}

					if (focusTestChannel == 'drug_response' || focusTestChannel == 'tamoxifen' || focusTestChannel == 'warfarin') {
						colML += '<div style="padding-top:8px;"><strong>Note to Residents of New York State</strong>: Please call 1-877-646-0222 for information and pricing on drug response tests for your state. Prices for these tests are different than those listed here.</div>';
					}

					colML += '	</div>' +
					         '	<div class="box_blueVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';

				}
			} else if (whichSubSection == 'professionals') {

				colML += '<div style="position:relative;width:230px;left:5px;">' +
				         '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
				         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
				         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
				         '	</div>' +
				         '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
				         '		<strong>' + focusTestName + '</strong> ' + (focusTestChannel != 'colon_cancer' ? 'testing ' : '') + 'is ' + (focusTestKit == 'SWAB' ? 'painless, easy' : (focusTestKit == 'BLOOD' ? 'easy, accurate' : (focusTestKit == 'STOOL' ? 'accurate, non-invasive' : 'safe, easy'))) + ' and includes a <a href="javascript:getSampleReport();">personalized report</a> for your patient and a <a href="javascript:getSampleMDLetter();">physician report</a> for you.' +
				         '		<div style="text-align:center;margin-top:3px;"><strong style="color:#14384C;">Price: ' + focusTestPrice + '</strong>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' + getLearnMoreLink() + '" style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;">Learn More</a></div>' +
				         '		<div style="position:relative;left:40px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Testing Now', 'getHowToOrderPage()') + '</div>';
				if (focusTestChannel == '2D6') {
					colML += '<div style="padding-top:8px;"><strong>Tamoxifen 2D6</strong>, which includes<br>2D6 testing, is also available for <b>$300</b>.&nbsp;&nbsp;<a style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;" href="/' + whichSubSection + '/drugs/tamoxifen/what_tell.jsp">Learn More</a></div>';
				}

				colML += '	</div>' +
				         '	<div class="box_blueVgrad_trans_bot">' +
				         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
				         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
				         '	</div>' +
				         '</div>';

			}

		} else {

			if (whichSubSection == 'professionals') {

				colML += '<div style="position:relative;width:230px;left:5px;">' +
				         '	<div class="box_orangeVgrad_trans_top">' +
				         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
				         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
				         '		<span>Guidelines for Testing</span>' +
				         '	</div>' +
				         '	<div class="box_orangeline_trans_content" style="color:#000;padding-top:3px;line-height:auto;">' +
				         '		DNA Direct has compiled a comprehensive list of testing guidelines and literature references.';

				colML += '<form name="tsForm" style="padding-top:5px;padding-bottom:5px;"><select onChange="if (this.selectedIndex != 0) {getTestingGuidelines(this.selectedIndex);}" style="width:205px;">' + writeTestSelect() + '</select></form>';

				colML += '	</div>' +
				         '	<div class="box_orangeVgrad_trans_bot">' +
				         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
				         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
				         '	</div>' +
				         '</div>';

			} else {


				if (thisURL.indexOf('tests/index.jsp') != -1) {

					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_orangeVgrad_trans_top">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
					         '		<span>Try the Test Finder</span>' +
					         '	</div>' +
					         '	<div class="box_orangeline_trans_content" style="color:#000;padding-top:3px;line-height:auto;">' +
					         '		Find out if there is a genetic test that can help you or your family.';

					colML += '<div style="padding-left:60px;">' + getOrangeButtonML('Get Started', 'document.location.href=\'/patients/tools/test_finder/index.jsp\';') + '</div>';

					colML += '	</div>' +
					         '	<div class="box_orangeVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';


				} else {

					//and force the CYP2D6 box if we're in the drug interaction Checker


					/*
					 if (thisURL.indexOf('/tests/drug_response/') != -1) {

					 colML +='<div style="position:relative;width:230px;left:5px;">' +
					 '	<div class="box_orangeVgrad_trans_top">' +
					 '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
					 '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
					 '		<span>ORDER TESTING NOW</span>' +
					 '	</div>' +
					 '	<div class="box_orangeline_trans_content" style="color:#000;padding-top:3px;line-height:auto;" id="dmePanelToutBox">' +
					 '		To be notified when testing is available for purchase, submit your email below. It will not be used for any other purpose.';

					 colML += '<form name="notifyForm" action="/jsp/catchForms/catchNotifyTesting.jsp" style="padding-top:5px;padding-bottom:5px;" target="notifySubmitFrame">your email: <input type="text" name="email" size="23">';

					 colML += '<div style="padding-left:55px;padding-top:3px;">' + getOrangeButtonML('Submit Email', 'if (validateEmail(document.notifyForm.email.value, \'Your\', \'notifyForm.email\')) {document.notifyForm.submit();}') + '</div>';

					 colML += '<input type="hidden" name="testInterest" value="Drug Response Panel">';

					 colML += '</form>';

					 colML += '<iframe name="notifySubmitFrame" src="/blank.html" style="position:absolute;left:-2000px;"></iframe>';

					 colML +='	</div>' +
					 '	<div class="box_orangeVgrad_trans_bot">' +
					 '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					 '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					 '	</div>' +
					 '</div>';


					 } else if (thisURL.indexOf('drug_checker.jsp') != -1) {

					 focusTestName = getTestName(3);
					 focusGeneName = '';
					 focusTestPrice = getTestPrice(3);
					 focusTestKit = getTestKitType(3);
					 focusTestChannel = getChannelName(3);


					 colML +='<div style="position:relative;width:230px;left:5px;">' +
					 '	<div class="box_blueVgrad_trans_top" style="height:15px;overflow:hidden;">' +
					 '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_LT_trans.gif"></div>' +
					 '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/blueVgrad_curverCorner_RT_trans.gif"></div>' +
					 '	</div>' +
					 '	<div class="box_blueline_trans_content" style="color:#000;padding-top:0px;line-height:auto;">' +
					 '		<strong>' + focusTestName + '</strong> ' + (focusTestChannel!='colon_cancer'?'testing ':'') + 'is ' + (focusTestKit== 'SWAB'?'painless, easy':(focusTestKit== 'BLOOD'?'easy, accurate':(focusTestKit== 'STOOL'?'accurate, non-invasive':'safe, easy'))) + ' and includes a <a href="javascript:getSampleReport(\'2D6\');">personalized report</a> of your results.' +
					 '		<div style="text-align:center;margin-top:3px;"><strong style="color:#14384C;">Price: ' + focusTestPrice + '</strong>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/patients/tests/2D6/index.jsp" style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;">Learn More</a></div>';
					 colML +=	'		<div style="position:relative;left:40px;width:190px;margin-top:3px;">' + getOrangeButtonML('Order Testing Now', 'orderTestingNow(\'2D6\');') + '</div>';
					 colML += '<div style="padding-top:8px;"><strong>Tamoxifen 2D6</strong>, which includes<br>2D6 testing, is also available for <b>$300</b>.&nbsp;&nbsp;<a style="padding-right:10px;background-image:url(\'/img/btn/blue_double_linkArrow.gif\');background-repeat:no-repeat;background-position:right center;" href="/patients/tests/tamoxifen/what_tell.jsp">Learn More</a></div>';

					 colML +='</div>' +
					 '	<div class="box_blueVgrad_trans_bot">' +
					 '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					 '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					 '	</div>' +
					 '</div>';

					 }

					 } else {
					 */
					colML += '<div style="position:relative;width:230px;left:5px;">' +
					         '	<div class="box_orangeVgrad_trans_top">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
					         '		<span>Tests We Offer</span>' +
					         '	</div>' +
					         '	<div class="box_orangeline_trans_content" style="color:#000;padding-top:3px;line-height:auto;">' +
					         '		DNA Direct provides convenient and accurate genetic tests and expert interpretation of your test results.';

					colML += '<form name="tsForm" style="padding-top:5px;padding-bottom:5px;"><select onChange="if (this.selectedIndex != 0) {learnMoreAboutTesting(this.selectedIndex - 1);}">' + writeTestSelect() + '</select></form>';

					colML += '	</div>' +
					         '	<div class="box_orangeVgrad_trans_bot">' +
					         '		<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>' +
					         '		<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
					         '	</div>' +
					         '</div>';
					//}
				}

			}

		}

		colML += '<div style="position:relative;display:block;clear:both;">' +
		         '<div style="position:relative;padding-left:75px;cursor:hand;cursor:pointer;height:29px;margin-top:7px;" onClick="trackClick(\'link_source=right__need_help\');getHelp();">' +
		         '<div style="position:relative;float:left;width:11px;"><img src="/img/btn/orange_manBtn_leftCap.gif"></div>' +
		         '<div style="position:relative;float:left;color:#ffffff;font-size:16px;font-weight:bold;background-image:url(\'/img/btn/orange_manBtn_BG.gif\');line-height:29px;padding-left:3px;padding-right:3px;text-decoration:none;">Get Help</div>' +
		         '<div style="position:relative;float:left;width:3px;"><img src="/img/btn/orange_manBtn_rightCap.gif"></div>' +
		         '</div>' +
		         '</div>';

		colML += '	<div style="position:relative;left:5px;width:230px;margin-top:5px;">' +
		         writeSideLinks() +
		         '	</div>';

		if (whichSubSection == 'patients') {

			/*
			 if (thisURL.indexOf('/decode_diabetes/') != -1 && thisURL.indexOf('/decode_diabetes/index') == -1 && thisURL.indexOf('/decode_diabetes/decode_t2') == -1) {
			 colML +='	<div style="position:relative;left:5px;width:230px;margin-top:8px;">' +
			 '		<div class="box_orangeVgrad_trans_top" style="">' +
			 '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
			 '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
			 '			<span style="color:#0060CC;">$25 Diabetes Survey</span>' +
			 '		</div>';

			 colML += '		<div class="box_orangeline_trans_content" style="color:#000000;">' +
			 '		Help us better serve our customers. Please take a 5-minute survey, and receive $25.' +
			 '<div style="position:relative;padding-left:60px;">' + getOrangeButtonML('Start Survey', 'window.open(\'http://www.surveymonkey.com/s.asp?u=171903806479\');') + '</div>' +
			 '		</div>';

			 colML += '		<div class="box_orangeVgrad_trans_bot">' +
			 '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>	' +
			 '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
			 '		</div>' +
			 '	</div>';

			 } else {
			 */

			colML += getDidYouKnow(navBGColor);
			//}


			/*
			 colML += '		<div class="box_orangeline_trans_content">' +
			 '			Check out the most recent blog post:' +
			 '			<div id="blogFeed" style="margin-top:5px;"></div>' +
			 '		</div>';
			 //and call the ajax data loaders for elements in this content
			 ajx_getElementContent('blogFeed', 'retrieving feed', 'patients');
			 */


		} else if (whichSubSection == 'professionals') {

			colML += getDidYouKnow(navBGColor);

			/*
			 colML +='	<div style="position:relative;left:5px;width:230px;margin-top:10px;">' +
			 '		<div class="box_orangeVgrad_trans_top">' +
			 '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
			 '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
			 '			<span>PHYSICIAN COMMENTS</span>' +
			 '		</div>';

			 colML += '		<div class="box_orangeline_trans_content" style="color:#000000;text-align:left;">' +
			 '			"DNA Direct\'s genetic services can enhance doctor-patient relationships. Physicians save time and can get access to information they may not have in their community while patients can take a more active role in their treatment and remain under a physician\'s care. It\'s great teamwork."' +
			 '			<div style="text-align:right;">&mdash; <strong>Dr. Allan T. Bombard</strong>, Chief Medical Officer at Sharp Mary Birch Hospital for Women</div>' +
			 '			<a href="/patients/about/comments.jsp" class="rightArrow_A">Read Patient Comments</a>' +
			 '		</div>';

			 colML += '		<div class="box_orangeVgrad_trans_bot">' +
			 '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>	' +
			 '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
			 '		</div>' +
			 '	</div>';
			 */

		}


		colML += '</div>';

	} else {
		if (isLoggedIn && (document.getElementById('pageHeadline').innerHTML == 'Profile' || document.getElementById('pageHeadline').innerHTML == 'My Reports')) {
			/*
			 colML = '<div class="box_blueVgrad_top" style="margin-top:10px;">' +
			 '	<div class="leftCorner"><img src="/img/box/blueVgrad_curverCorner_LT.gif"></div>' +
			 '	<div class="rightCorner"><img src="/img/box/blueVgrad_curverCorner_RT.gif"></div>' +
			 '	<span style="font-size:14px;">Access Your DNA Direct Account</span>' +
			 '</div>' +
			 '<div class="box_greyline_content">' +
			 'Click below to securely access questionnaires and reports you have saved at DNA Direct.' +
			 '<div style="position:relative;left:50px;">' + getOrangeButtonML('Login to DNA Direct', 'document.loginToOther.submit();trackClick(\'link_source=right_col__login_to_DNADirect\');') + '</div>' +
			 '</div>' +
			 '<div class="box_greyline_bot">' +
			 '	<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LB.gif"></div>' +
			 '	<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif"></div>' +
			 '</div>';
			 */

		}

	}

	return(colML);
}


function getQuestionnaireWarnings() {

	var warningML = '';

	var focusTestID = getTestIDFromQTitle();

	if (focusTestID == '') {
		focusTestID = getConditionID(focusedProductIndex);
	}

	warningML = '<strong>Until further notice, DNA Direct cannot accept orders from Maryland residents.</strong>';

	if (focusTestID == 'DT2') {
		warningML = "<strong>Please Note:</strong> At this time we cannot accept orders for deCODE\'s T2 test from residents of California, New York, Pennsylvania, or Maryland. Although deCODE\'s genetic laboratory has CLIA certification, state licensure enabling deCODE to process tests for residents of these 4 states is still pending.";
	} else if (focusTestID == 'DME' || focusTestID == 'TAM' || focusTestID == 'WARF') {
		warningML = "<strong>Note to Residents of New York State:</strong> Please call 1-877-646-0222 for information and pricing on drug response tests for your state. Prices for these tests are different than those listed here.";
	} else if (focusTestID == 'CS') {
		//warningML = "<strong>Please Note:</strong> ColoSure&trade; is not available to residents of New York and California as assay approval is still pending in these states. Please email <a href=mailto:colosure@dnadirect.com>colosure@dnadirect.com</a> to be notified when ColoSure&trade; is available in your state.";
	}

	return(warningML);

}


function displayCustomeQuestionnaireIntro() {

	var theseParms = window.location.search.substring(1);
	theseParms = theseParms.split('&');

	var strongIntroSentenceML = '';
	var introSentencesML = '';
	var forOthersSentenceML = '';

	var isCustom = false;

	for (var i = 0; i < theseParms.length; i++) {
		if (theseParms[i].split('=')[0] == 'qContext') {
			contextValue = theseParms[i].split('=')[1];
			if (contextValue != '' && contextValue != null) {
				isCustom = true;
			}

			var testID = getTestIDFromQTitle();

			if (contextValue == 'nextStep') {
				if (testID != 'CS') {
					strongIntroSentenceML = 'Answer the questions below to learn more about testing for ' + getTestName(getIndexFromID(testID)) + '.';
				} else {
					strongIntroSentenceML = 'Answer the questions below to learn more about ' + getTestName(getIndexFromID(testID)) + '.';
				}
			} else if (contextValue == 'brca_report_only') {
				strongIntroSentenceML = 'Please answer the questions below to begin your order for post-test counseling and an in-depth report on test results.';
				forOthersSentenceML = 'If you are ordering post-test support for someone else who was tested, answer these questions with that person\'s information.';
			}


		}
	}

	if (isCustom) {
		if (strongIntroSentenceML != '') {
			document.getElementById('strongIntroSentence').innerHTML = strongIntroSentenceML;
		}

		if (introSentencesML != '') {
			document.getElementById('introSentences').innerHTML = introSentencesML;
		}

		if (forOthersSentenceML != '') {
			document.getElementById('forOthersSentence').innerHTML = forOthersSentenceML;
		}
	}
}


var dyk = new Array();

dyk[dyk.length] = 'Unlike many medical practices, <b>DNA Direct does not mark-up the cost of laboratory analysis</b>. We negotiate the lowest costs with the lab and pass those savings on to you.';
dyk[dyk.length] = '<strong>DNA Direct can work with your doctor.</strong> We provide a <a href="javascript:;" onclick="getSampleMDLetter();">Physician Letter</a> you can take to your doctor, with clinical details about your test results.';
dyk[dyk.length] = 'DNA Direct uses only <a href="http://www.fda.gov/cdrh/clia/" target="top">CLIA-ceritifed</a> labs to guarantee quality control - the same labs used by medical centers and hospitals.';
dyk[dyk.length] = 'DNA Direct only offers tests that are scientically and medically valid, utilizing medical guidelines when available.';
dyk[dyk.length] = 'Testing with DNA Direct includes phone and email support from <a href="http://www.nsgc.org/" target="top">board-certified</a> Genetic Counselors.';
dyk[dyk.length] = 'DNA Direct offers <a href="/patients/testing_services/consultation.jsp">pre- and post-test genetic counseling services</a> even if you don\'t test with us.';
dyk[dyk.length] = 'DNA Direct protects your privacy and anonymity and does not sell, rent or otherwise share your personal or contact information with any outside parties.';
dyk[dyk.length] = 'DNA Direct informs you of the pros <em>and</em> the cons of genetic testing and won\'t hesitate to tell you if genetic testing is not appropriate for you.';

function getDidYouKnow(navBGColor) {

	var dykML = '';

	var focusTestID = getConditionID(focusedProductIndex);

	if (focusTestID != 'PAT' && focusTestID != 'GEN') {

		dykML += '	<div style="position:relative;left:5px;width:230px;margin-top:8px;">' +
		         '		<div class="box_orangeVgrad_trans_top">' +
		         '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_LT_trans.gif"></div>' +
		         '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/orangeVgrad_curverCorner_RT_trans.gif"></div>' +
		         '			<span>Did You Know</span>' +
		         '		</div>';

		dykML += '		<div class="box_orangeline_trans_content" style="color:#000000;margin-top:0px;padding-top:0px;">' +
		         dyk[rand(dyk.length) - 1] +
		         '		</div>';

		dykML += '		<div class="box_orangeVgrad_trans_bot">' +
		         '			<div class="leftCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_LB_trans.gif"></div>	' +
		         '			<div class="rightCorner" style="background-color:' + navBGColor + ';"><img src="/img/box/white_curveCorner_RB_trans.gif"></div>' +
		         '		</div>' +
		         '	</div>';

	}

	return(dykML);

}

function getAncestryOrderNowFooterBox() {

	var boxML = '';

	boxML += '<div style="position: relative; width: 80%; left: 55px;margin-top:10px;padding-bottom:5px;">' +
	         '<div style="overflow: hidden; position: relative; height: 20px; background-image: url(\'/img/box/orangeVgrad_top_BG.gif\'); background-repeat: repeat-x; line-height: 20px">' +
	         '	<div style="position: relative; float: left"><img src="/img/box/orangeVgrad_curverCorner_LT.gif" /></div>' +
	         '	<div style="position: relative; float: right"><img src="/img/box/orangeVgrad_curverCorner_RT.gif" /></div>' +
	         '</div>' +

	         '<div class="box_orangeline_content" style="position: relative; height: 80px">' +
	         '	<div style="position: absolute; left: 10px; top: -3px; width: 185px">' +
	         '		<strong>Home Paternity Testing</strong> is easy, and confidential. <strong>Price: $235</strong></div>' +
	         '		<div id="orderTestingBottomBtnDiv" style="position: absolute; left: 10px; top: 37px">' +
	         getOrangeButtonML('Order Testing Now', 'orderTestingNow(null, \'nextStep\');') +
	         '		</div>' +
	         '		<div style="position: absolute; left: 235px; top: -3px; width: 195px"><strong>Legal Paternity Testing</strong> can be used in court. Available from DNA Diagnostics Center. <strong>Price: $475</strong></div>' +
	         '		<div id="orderLegalTestingBottomBtnDiv" style="position: absolute; left: 235px; top: 57px">' +
	         getOrangeButtonML('Call 1-800-281-2916', 'void(0);') +
	         '		</div>' +
	         '	</div>' +

	         '<div class="box_orangeVgrad_bot" style="position: relative">' +
	         '	<div class="leftCorner"><img src="/img/box/orangeLine_curveCorner_LB.gif" /></div>' +
	         '	<div class="rightCorner"><img src="/img/box/orangeLine_curveCorner_RB.gif" /></div>' +
	         '</div>' +

	         '</div>';

	return(boxML);

}

function getDnaArchiveOrderNowFooterBox() {

	var boxML = '';

	boxML += '<div style="position: relative; width: 80%; left: 55px;margin-top:10px;padding-bottom:5px;">' +
	         '<div style="overflow: hidden; position: relative; height: 20px; background-image: url(\'/img/box/orangeVgrad_top_BG.gif\'); background-repeat: repeat-x; line-height: 20px">' +
	         '	<div style="position: relative; float: left"><img src="/img/box/orangeVgrad_curverCorner_LT.gif" /></div>' +
	         '	<div style="position: relative; float: right"><img src="/img/box/orangeVgrad_curverCorner_RT.gif" /></div>' +
	         '</div>' +

	         '<div class="box_orangeline_content" style="position: relative; height: 75px;overflow:visible;padding-top:0px;padding-bottom:0px;margin:0px;">' +
	         '	<a href="javascript:popPic(\'/img/content_images/common/kit_dna_archive.jpg\');"><img style="position:absolute;left:5px;top:-15px;" src="/img/content_images/common/kit_dna_archive_T.jpg"></a>' +
	         '	<div style="position: absolute; left: 160px; top: -8px;width:250px;">' +
	         '		<strong>DNA Archive&#153;</strong> Home DNA storage helps you preserve your genetic history for the future. <strong>Price: $225</strong></div>' +
	         '		<div id="orderTestingBottomBtnDiv" style="position: absolute; left: 230px; top: 50px">' +
	         getOrangeButtonML('Order Now', 'orderTestingNow();') +
	         '		</div>' +
	         '	</div>' +

	         '<div class="box_orangeVgrad_bot" style="position: relative;background-color:transparent;">' +
	         '	<div class="leftCorner"><img src="/img/box/orangeLine_curveCorner_LB.gif" /></div>' +
	         '	<div class="rightCorner"><img src="/img/box/orangeLine_curveCorner_RB.gif" /></div>' +
	         '</div>' +

	         '</div>';

	return(boxML);

}


function getHelp(forceWhich) {

	var whichSection = whichSubSection;

	if (exists(forceWhich)) {
		whichSection = forceWhich;
	}

	if (whichSection == 'patients') {
		document.location.href = '/patients/testing_services/index.jsp';
	} else if (whichSection == 'professionals') {
		document.location.href = '/professionals/referring/instructions_prof.jsp';
	}

}

function getLearnMoreLink(focusTestIndex) {

	var theTestIndex = '';

	if (!exists(focusTestIndex)) {
		theTestIndex = getChannelName(focusedProductIndex);
	} else {
		theTestIndex = focusTestIndex;
	}

	var link = '/' + whichSubSection + '/tests/' + theTestIndex + '/index.jsp';
	;
	return(link);

}

function getInterpretation(whichDrug) {

	closeAllInterpButtons();
	document.getElementById('interpDiv_' + whichDrug).innerHTML = writeFocusedInterpBox(whichDrug);
	window.status = 'insert content switch code';
}

function closeAllInterpButtons() {

	for (var i = 0; i < interpsArray.length; i++) {
		document.getElementById('interpDiv_' + interpsArray[i]).innerHTML = writeInterpButtons(interpsArray[i]);
	}

}

function writeSideLinks() {

	if (isLandingPage) {
		return('');
	}

	var sideLinksArray_patients = new Array();

	if (focusedProductIndex != -1 && getConditionID(focusedProductIndex) != 'PAT' && getConditionID(focusedProductIndex) != 'ARC') {
		sideLinksArray_patients[sideLinksArray_patients.length] = 'How To Order a Test|javascript:getHowToOrderPage();|how_to_order';
	}

	if (getConditionID(focusedProductIndex) == 'PAT') {
		sideLinksArray_patients[sideLinksArray_patients.length] = 'See Sample Test Results|javascript:if(window.open(\'/pdf/tests/paternity/paternity_sample.pdf\')){void(0);};|paternity_test_results';
	}
	if (getConditionID(focusedProductIndex) == 'ARC') {
		sideLinksArray_patients[sideLinksArray_patients.length] = 'See the DNA Archive&#153; Kit|javascript:if(popPic(\'/img/content_images/common/kit_dna_archive.jpg\')){void(0);};|see_dna_archive_kit';
	} else if (getConditionID(focusedProductIndex) != 'GEN') {
		sideLinksArray_patients[sideLinksArray_patients.length] = 'See a Personalized Report|javascript:getSampleReport();|our_personalized';
	}

	if (getConditionID(focusedProductIndex) != 'PAT' && getConditionID(focusedProductIndex) != 'GEN' && getConditionID(focusedProductIndex) != 'ARC') {
		sideLinksArray_patients[sideLinksArray_patients.length] = 'Testing Includes Expert Support|about/experts.jsp|test_experts';
	}

	sideLinksArray_patients[sideLinksArray_patients.length] = 'Customer Comments|about/comments.jsp|customer_comments';

	var sideLinksArray_professionals = new Array();

	if (focusedProductIndex == -1) {
		sideLinksArray_professionals[sideLinksArray_professionals.length] = 'Ordering a Test for Your Patient|referring/patient_referral_form.jsp|how_to_order';
	}

	sideLinksArray_professionals[sideLinksArray_professionals.length] = 'Sample Physician Report|javascript:getSampleMDLetter()|sample_dr_report';
	//sideLinksArray_professionals[sideLinksArray_professionals.length] = 'Our Test Selection Process|about/test_selection.jsp|test_selection';
	sideLinksArray_professionals[sideLinksArray_professionals.length] = 'Our Standards & Guidelines|about/standards.jsp|standards';
	sideLinksArray_professionals[sideLinksArray_professionals.length] = 'Genetic Counselor Referral Network|javascript:document.location.href=\'/landing/signup_GC.jsp\'|signup';

	var theseLinks = null;
	var color = '';

	if (whichSubSection == 'patients') {
		theseLinks = sideLinksArray_patients;
		color = 'goldBG';
	} else if (whichSubSection == 'professionals') {
		theseLinks = sideLinksArray_professionals;
		color = 'blueBG';
	}

	var btnML = ''

	for (var i = 0; i < theseLinks.length; i++) {

		if (theseLinks[i].split('|')[1].indexOf('javascript:') != -1) {
			btnML += '<a href="' + theseLinks[i].split('|')[1] + '" onClick="trackClick(\'link_source=sidelinks__' + theseLinks[i].split('|')[2] + '\')" class="interp_button" style="height:18px;clear:both;">';
		} else {
			btnML += '<a href="/' + whichSubSection + '/' + theseLinks[i].split('|')[1] + '" onClick="trackClick(\'link_source=sidelinks__' + theseLinks[i].split('|')[2] + '\')" class="interp_button" style="height:18px;clear:both;">';
		}

		btnML += '			<div style="position:relative;float:left;width:8px;">' +
		         '				<div style="height:13px;overflow:hidden;"><img src="/img/box/orangeLine_' + color + '_curveCorner_LT.gif"></div>' +
		         '				<div style="height:13px;overflow:hidden;"><img src="/img/box/orangeLine_' + color + '_curveCorner_LB.gif"></div>' +
		         '			</div>' +
		         '			<div style="border-top:1px solid #FF9B1E;border-bottom:1px solid #FF9B1E;float:left;">' +
		         '				<div id="btn_text" style="width:211px;">' + theseLinks[i].split('|')[0] + '</div>' +
		         '			</div>' +
		         '			<div style="position:relative;float:left;width:8px;">' +
		         '				<div style="height:13px;overflow:hidden;"><img src="/img/box/orangeLine_' + color + '_curveCorner_RT.gif"></div>' +
		         '				<div style="height:13px;overflow:hidden;"><img src="/img/box/orangeLine_' + color + '_curveCorner_RB.gif"></div>' +
		         '			</div>' +
		         '		</a>';
	}

	return(btnML);

}


function writeInterpButtons(whichDrug) {

	var btnML = ''

	btnML = '		<a href="javascript:getInterpretation(\'' + whichDrug + '\');" class="interp_button">' +
	        '			<div style="position:relative;float:left;width:8px;">' +
	        '				<div style="height:13px;overflow:hidden;"><img src="/img/box/greyLine_curveCorner_LT.gif"></div>' +
	        '				<div style="height:13px;overflow:hidden;"><img src="/img/box/greyLine_curveCorner_LB.gif"></div>' +
	        '			</div>' +
	        '			<div style="border-top:1px solid #C5C5C5;border-bottom:1px solid #C5C5C5;float:left;">' +
	        '				<div id="btn_text">' + whichDrug.substring(0, 1).toUpperCase() + whichDrug.substring(1, whichDrug.length).toLowerCase() + ' Interpretation</div>' +
	        '			</div>' +
	        '			<div style="position:relative;float:left;width:8px;">' +
	        '				<div style="height:13px;overflow:hidden;"><img src="/img/box/greyLine_curveCorner_RT.gif"></div>' +
	        '				<div style="height:13px;overflow:hidden;"><img src="/img/box/greyLine_curveCorner_RB.gif"></div>' +
	        '			</div>' +
	        '		</a>';

	return(btnML);

}


function writeFocusedInterpBox(whichDrug) {

	var btnML = ''

	btnML = '<div class="box_orangeVgrad_top" style="position:relative;display:block;clear:both;height:auto;">' +
	        '	<div class="leftCorner"><img src="/img/box/orangeVgrad_curverCorner_LT.gif"></div>' +
	        '	<div class="rightCorner"><img src="/img/box/orangeVgrad_curverCorner_RT.gif"></div>' +
	        '	<span style="font-size:14px;">' + whichDrug.substring(0, 1).toUpperCase() + whichDrug.substring(1, whichDrug.length).toLowerCase() + ' Interpretation</span>' +
	        '</div>' +
	        '<div class="box_orangeline_content" style="padding-top:10px;">' +
	        '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">Your Test Results & ' + whichDrug.substring(0, 1).toUpperCase() + whichDrug.substring(1, whichDrug.length).toLowerCase() + '</a><br>' +
	        '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">What Is ' + whichDrug.substring(0, 1).toUpperCase() + whichDrug.substring(1, whichDrug.length).toLowerCase() + '</a><br>';
	if (whichDrug == 'tamoxifen') {
		btnML += '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">What Is an Aromatase Inhibitor?</a><br>' +
		         '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">Options for Adjuvent Therapy</a><br>' +
		         '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">Tamoxifen and Antidepressants</a><br>';

	}
	btnML += '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">Resources</a><br>' +
	         '<a class="redSolidArrow_channelLinks" style="line-height:20px;font-weight:bold;font-size:11px;" href="">Literature References</a><br>' +
	         '</div>' +
	         '<div class="box_orangeVgrad_bot">' +
	         '	<div class="leftCorner"><img src="/img/box/orangeLine_curveCorner_LB.gif"></div>' +
	         '	<div class="rightCorner"><img src="/img/box/orangeLine_curveCorner_RB.gif"></div>' +
	         '</div>';

	return(btnML);

}


function writeFooter() {
	var footerML = '<div class="grey_content_footer">' +
	               '	<div style="position:relative;float:left;padding-top:10px;">' +
	               '		&#169;2006 <a href="http://www.dnadirect.com/index.jsp?refLink=PGx_footer" target="top"><img src="/img/logos/gd_logo_footer.gif" style="position:relative;top:2px;"></a> | <a href="/' + whichSubSection + '/about/privacy.jsp" onClick="trackClick(\'link_source=footer__privacy\');">Privacy</a> | <a href="/' + whichSubSection + '/about/contact_us.jsp"  onClick="trackClick(\'link_source=footer__contact_us\');">Contact Us</a>' +
	               '	</div>' +
	               '	<form name="searchF" onSubmit="alert(\'More information coming soon!\');return(false);">' +
	               '		<div style="position:relative;float:right;padding-top:6px;">' +
		//'			<a href="javascript:alert(\'More information coming soon!\');">Site Map</a> | <a href="javascript:alert(\'More information coming soon!\');">Glossary</a> | <input type="text" style="width:100px;"> <a href="javascript:alert(\'Search coming soon!\');">Search</a>' +
		             '		</div>' +
	               '	</form>' +
	               '</div>' +
	               '<div class="grey_bot">' +
	               '	<div class="leftCorner"><img src="/img/box/greySolid_curveCorner_LB.gif"></div>' +
	               '	<div class="rightCorner"><img src="/img/box/greySolid_curveCorner_RB.gif"></div>' +
	               '</div>';

	return(footerML);
}


var otherArticlesList = new Array();

function writeNextLink() {

	var nextLinkML = '';

	if (isLandingPage) {
		return('');
	}

	var thisMenu = thisChannelMenu;

	var thisSubDir = '/' + whichSubSection + '/' + thisChannel;
	var thisLastBit = thisURL.substring(thisURL.indexOf(thisSubDir) + thisSubDir.length + 1, thisURL.length);

	if (thisLastBit.indexOf('/') != -1) {
		thisLastBit = thisLastBit.substring(0, thisLastBit.indexOf('/'));
		thisMenu = eval(whichSubSection + '_' + thisChannel + '_' + thisSubChannel + (thisSubSubChannel != '' ? '_' + thisSubSubChannel : '') + '_subMenu');
	}

	var longestTitleSize = 0;

	if (thisMenu.length != 0) {


		if (thisURL.lastIndexOf('/') == (thisURL.length - 1) || thisURL.indexOf('/index.jsp') != -1) {
			if (thisMenu[0].split('|')[0].indexOf('*') == -1) {
				nextLinkML = '<a class="redLineArrow_nextA" href="' + thisMenu[0].split('|')[2] + '"  onClick="trackClick(\'link_source=next_link__\' + this.href);">Next: ' + thisMenu[0].split('|')[0] + '</a>';
			}
		} else {

			var thisFileName = thisURL.substring(thisURL.lastIndexOf('/') + 1, thisURL.lastIndexOf('.'));

			var otherArtsML = '';

			for (var i = 0; i < thisMenu.length; i++) {

				var thisMenuFile = thisMenu[i].split('|')[2].substring(0, thisMenu[i].split('|')[2].lastIndexOf('.'));


				if (thisFileName == thisMenuFile) {
					if ((i + 1) < thisMenu.length) {

						if (thisMenu[i + 1].split('|')[0].indexOf('*') != -1) {
							nextLinkML = '<a onMouseOver="hideOtherArt = false;callShowOtherArt()" onMouseOut="hideOtherArt = true;callHideOtherArt()" class="redLineArrow_nextA" href="' + thisMenu[i + 1].split('|')[1] + '/' + thisMenu[i + 1].split('|')[2] + '" onClick="trackClick(\'link_source=next_link__\' + this.href);">Next: ' + replace(thisMenu[i + 1].split('|')[0], '*', '') + '</a>';
						} else {
							nextLinkML = '<a onMouseOver="hideOtherArt = false;callShowOtherArt()" onMouseOut="hideOtherArt = true;callHideOtherArt()" class="redLineArrow_nextA" href="' + thisMenu[i + 1].split('|')[2] + '" onClick="trackClick(\'link_source=next_link__\' + this.href);">Next: ' + thisMenu[i + 1].split('|')[0] + '</a>';
						}

					} else {
						nextLinkML = '<a onMouseOver="hideOtherArt = false;callShowOtherArt()" onMouseOut="hideOtherArt = true;callHideOtherArt()" class="redLineArrow_nextA" href="index.jsp" onClick="trackClick(\'link_source=next_link__\' + this.href);">View Articles in This Section</a>';
					}
				}

				var thisTitle = thisMenu[i].split('|')[0];

				if (thisTitle.length > longestTitleSize) {
					longestTitleSize = thisTitle.length;
				}

				if (thisTitle.indexOf('*') != -1) {
					otherArtsML += '<a ' + (thisFileName != thisMenuFile ? 'href="' + thisMenu[i].split('|')[1] + '/' + thisMenu[i].split('|')[2] + '"' : '') + ' style="display:block;height:17px;' + (thisFileName == thisMenuFile ? 'color:#656565;' : '') + '">' + replace(thisTitle, '*', '') + '</a>';
				} else {
					otherArtsML += '<a ' + (thisFileName != thisMenuFile ? 'href="' + thisMenu[i].split('|')[2] + '"' : '') + ' style="display:block;height:17px;' + (thisFileName == thisMenuFile ? 'color:#656565;' : '') + '">' + thisTitle + '</a>';
				}


			}

		}
	}

	if (otherArtsML != '') {

		//and we need to add the index page of the section:
		if (thisSubSubChannel != '') {
			otherArtsML = '<a href="index.jsp" style="display:block;height:17px;">' + toSentenceCase(replace(thisSubSubChannel, '_', ' ')) + ' Index</a>' + otherArtsML;
		} else if (thisSubChannel != '') {
			otherArtsML = '<a href="index.jsp" style="display:block;height:17px;">' + toSentenceCase(replace(thisSubChannel, '_', ' ')) + ' Index</a>' + otherArtsML;
		}

		oaWidth = Math.round(longestTitleSize * 6.5);

		otherArtsML = '<div id="otherArtsDiv" onMouseOver="hideOtherArt = false;callShowOtherArt()" onMouseOut="hideOtherArt = true;callHideOtherArt()" style="background-color:#fff;position:relative;margin-bottom:-500px;border:1px dashed #0060CC;padding:3px;float:right;left:-20px;display:none;text-align:right;z-index:12000;top:-' + ((thisMenu.length < 10 ? 17 : 17.5) * (thisMenu.length + 1) + 60) + 'px;width:' + oaWidth + 'px;"><div style="height:25px;font-weight:bold;text-align:right;color:#444;font-size:12px;">Articles in this section:</div>' + otherArtsML + '</div>';
	}

	nextLinkML += otherArtsML;
	return(nextLinkML);
}

var hideOtherArt = false;

function doShowOtherArt() {

	if (document.getElementById('otherArtsDiv') && !hideOtherArt) {
		document.getElementById('otherArtsDiv').style.display = 'block';
	}
}

function callShowOtherArt() {
	setTimeout('doShowOtherArt();', 50);
}

function callHideOtherArt() {
	setTimeout('doHideOtherArt();', 75);
}

function doHideOtherArt(forceHide) {

	if (hideOtherArt || forceHide) {
		if (document.getElementById('otherArtsDiv')) {
			document.getElementById('otherArtsDiv').style.display = 'none';
			hideOtherArt = false;
		}
	}
}


function writeCurrSectionsLinks() {
	var linksML = ''

	if (isLandingPage) {
		return('');
	}

	var theseMenuItems = eval(thisChannel + '_subMenu_' + whichSubSection);
	if (thisSubChannel != '') {
		theseMenuItems = eval(whichSubSection + '_' + thisChannel + '_' + thisSubChannel + (thisSubSubChannel != '' ? '_' + thisSubSubChannel : '') + '_subMenu');
	}

	var thisPathPart = thisURL.substring(thisURL.indexOf(whichSubSection + '/') + whichSubSection.length + 1, thisURL.lastIndexOf('/'));

	//alert(thisPathPart);

	for (var i = 0; i < theseMenuItems.length; i++) {
		if (theseMenuItems[i].split('|')[0].indexOf('*') != -1) {
			linksML += '<a href="/' + whichSubSection + '/' + thisPathPart + '/' + theseMenuItems[i].split('|')[1] + '/' + theseMenuItems[i].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=section_links__\' + this.href);" style="display:inline;">' + replace(theseMenuItems[i].split('|')[0], '*', '') + '</a><br>';
		} else if (thisSubChannel != '') {
			//alert(thisChannel + ' ][ ' + thisPathPart + ' [] ' + thisSubSubChannel);
			linksML += '<a href="/' + whichSubSection + '/' + thisPathPart + '/' + theseMenuItems[i].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=section_links__\' + this.href);" style="display:inline;">' + replace(theseMenuItems[i].split('|')[0], '*', '') + '</a><br>';
		} else {
			if (theseMenuItems[i].split('|')[2].indexOf('javascript:') != -1) {
				linksML += '<a href="' + theseMenuItems[i].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=section_links__\' + this.href);" style="display:inline;">' + replace(theseMenuItems[i].split('|')[0], '*', '') + '</a><br>';
			} else {
				linksML += '<a href="/' + whichSubSection + '/' + thisChannel + '/' + theseMenuItems[i].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=section_links__\' + this.href);" style="display:inline;">' + replace(theseMenuItems[i].split('|')[0], '*', '') + '</a><br>';
			}
		}
	}

	if (linksML != '') {
		linksML = '<h2 style="margin-bottom: 5px;">Read More:</h2>' + linksML;
	}

	return(linksML);
}


function writeComingSoon(whatDrug) {
	csML = '';

	if (whichSubSection == 'professionals') {

		csML = '<p style="margin-bottom:5px;">We will be releasing new PGx tests and Patient Drug Reports' + (whatDrug != null && whatDrug != '' ? ' for ' + whatDrug : '') + '. If you would like to be notified of our new products, sign up below: </p>' +
		       writeUpdateSignup() +
		       '<p style="clear:both;margin:0px; padding-top:5px;margin-bottom:10px;">Your email will not be used by any third parties or for any other purposes.</p>';

	} else {

		csML = '<p>We will soon be offering personalized CYP2D6 testing services' + (whatDrug != null && whatDrug != '' ? ' for ' + whatDrug : '') + '. In addition to test results, we will provide easy-to-read information on what your results mean to you. When you order testing, you will also receive a Physician Report with clinical information for your doctor, so your doctor can determine the best drugs, at the right dosages, for you. </p>' +
		       '<p style="margin-bottom:5px;">If you would like to be notified when testing services are available, sign up below:</p>' +
		       writeUpdateSignup() +
		       '<p style="clear:both;margin:0px; padding-top:5px;margin-bottom:10px;">Your email will not be used by any third parties or for any other purposes.</p>';

	}

	return(csML);
}

function writeUpdateSignup() {
	usML = '<form name="updateForm" target="top" style="margin:0px;padding:0px;" onSubmit="return(false)">' +
	       '<input style="position:relative;top:1px;float:left;margin-right:3px;" type="text" name="email" value="Enter email address" onClick="this.value==\'Enter email address\'?this.value=\'\':\'\';" onBlur="Trim(this.value)==\'\'?this.value=\'Enter email address\':\'\';">' +
	       '</form>' +
	       getOrangeButtonML('Submit', 'if (validateEmail(document.updateForm.email.value, \'Your\', \'updateForm.email\')) {window.open(\'/cgi-bin/joinUpdateList.pl?email=\' + document.updateForm.email.value, \'formWin\', \'resizable=1,scrollbars=0,width=390,height=240\');}', 'l');
	return(usML);
}


function writeSiteMap() {

	var smML = '';

	smML += '<a id="pat"></a><div style="font-size:16px;color:#FFAD03;padding-top:15px;font-weight:bold;margin-bottom:0px;">PATIENTS</div>';

	var thisSMenu = null;
	var thisSSMenu = null;

	var thisMMenu = patientsMenuItems;
	var thisSection = 'patients';

	for (var i = 0; i < thisMMenu.length; i++) {

		smML += '<h2><a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/index.jsp"  onClick="trackClick(\'link_source=site_map__\' + this.href);">' + thisMMenu[i].split('|')[1] + '</a></h2>';
		thisSMenu = eval(thisMMenu[i].split('|')[0] + '_subMenu_' + thisSection);

		if (thisSMenu && thisSMenu.length > 0) {

			smML += '<div style="padding-left: 15px;">';

			for (var j = 0; j < thisSMenu.length; j++) {

				if (thisSMenu[j].split('|')[0].indexOf('*') != -1) {

					smML += '<a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/' + thisSMenu[j].split('|')[1] + '/index.jsp" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';

					var thisSSMenu = eval(thisSection + '_' + thisMMenu[i].split('|')[0] + '_' + thisSMenu[j].split('|')[1] + '_subMenu');

					if (thisSSMenu && thisSSMenu.length > 0) {

						smML += '<div style="padding-left: 15px;">';

						for (var h = 0; h < thisSSMenu.length; h++) {
							smML += '<a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/' + thisSSMenu[h].split('|')[1] + '/' + thisSSMenu[h].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + thisSSMenu[h].split('|')[0] + '</a><br>';
						}

						smML += '</div>';
					}
				} else {
					if (thisSMenu[j].split('|')[2].indexOf('javascript:') != -1) {
						smML += '<a href="' + thisSMenu[j].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';
					} else {
						smML += '<a href="/' + thisSection + '/' + thisSMenu[j].split('|')[1] + '/' + thisSMenu[j].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';
					}
				}

			}

			smML += '</div>';

		}

	}

	smML += '<a id="pro"></a><div style="font-size:16px;color:#3E7EBA;padding-top:40px;font-weight:bold;margin-bottom:0px;">PROFESSIONALS</div>';

	thisMMenu = professionalsMenuItems;
	thisSection = 'professionals';

	for (var i = 0; i < thisMMenu.length; i++) {

		smML += '<h2><a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/index.jsp" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + thisMMenu[i].split('|')[1] + '</a></h2>';
		thisSMenu = eval(thisMMenu[i].split('|')[0] + '_subMenu_' + thisSection);

		if (thisSMenu && thisSMenu.length > 0) {

			smML += '<div style="padding-left: 15px;">';

			for (var j = 0; j < thisSMenu.length; j++) {

				if (thisSMenu[j].split('|')[0].indexOf('*') != -1) {

					smML += '<a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/' + thisSMenu[j].split('|')[1] + '/index.jsp" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';

					var thisSSMenu = eval(thisSection + '_' + thisMMenu[i].split('|')[0] + '_' + thisSMenu[j].split('|')[1] + '_subMenu');

					if (thisSSMenu && thisSSMenu.length > 0) {

						smML += '<div style="padding-left: 15px;">';

						for (var h = 0; h < thisSSMenu.length; h++) {
							smML += '<a href="/' + thisSection + '/' + thisMMenu[i].split('|')[0] + '/' + thisSSMenu[h].split('|')[1] + '/' + thisSSMenu[h].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + thisSSMenu[h].split('|')[0] + '</a><br>';
						}

						smML += '</div>';
					}
				} else {
					if (thisSMenu[j].split('|')[2].indexOf('javascript:') != -1) {
						smML += '<a href="' + thisSMenu[j].split('|')[2] + '" class="redSolidArrow_channelLinks">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';
					} else {
						smML += '<a href="/' + thisSection + '/' + thisSMenu[j].split('|')[1] + '/' + thisSMenu[j].split('|')[2] + '" class="redSolidArrow_channelLinks" onClick="trackClick(\'link_source=site_map__\' + this.href);">' + replace(thisSMenu[j].split('|')[0], '*', '') + '</a><br>';
					}
				}

			}

			smML += '</div>';

		}

	}


	return(smML);
}

//END CONTENT WRITING FUNCTIONS



//PAGE GRAPHICS FUNCTIONS*****************************************************************


//Buttons*******************

function getOrangeButtonML(btnText, theOnClick, flote, width, btnTxtID) {

	var buttonML = '<div style="position:relative;' + (exists(flote) ? (flote == 'l' ? 'float:left;' : 'float:right;') : '') + 'height:18px;padding-top:3px;padding-right:0px;margin-right:0px;">' +
	               '<a href="#null" onClick="' + theOnClick + '" style="cursor:pointer;cursor:hand;" class="btn_orange"><div style="position:relative;float:left;width:11px;"><img src="/img/btn/orange_leftCap.gif"></div>' +
	               '<div style="position:relative;float:left;background-image:url(\'/img/btn/orange_BG.gif\');background-color:transparent;width:' + (exists(width) ? width + 'px' : 'auto') + ';height:18px;">' +
	               '<span style="position:relative;padding:3px;" class="btn_orange" id="' + (exists(btnTxtID) ? btnTxtID : '') + '">' + btnText +
	               '</span></div><div style="position:relative;float:left;width:3px;"><img src="/img/btn/orange_rightCap.gif"></div></a></div>';

	return(buttonML);
}

function getBigOrangeButtonML(btnText, theOnClick, flote, width, btnTxtID) {

	var buttonML = '<div style="position:relative;' + (exists(flote) ? (flote == 'l' ? 'float:left;' : 'float:right;') : '') + 'height:38px;padding-top:3px;padding-right:0px;margin-right:0px;">' +
	               '<a href="#null" onClick="' + theOnClick + '" style="cursor:pointer;cursor:hand;" class="btn_orange_big"><div style="position:relative;float:left;width:21px;"><img src="/img/btn/orange_leftCap_big.gif"></div>' +
	               '<div style="position:relative;float:left;background-image:url(\'/img/btn/orange_BG_big.gif\');background-color:transparent;width:' + (exists(width) ? width + 'px' : 'auto') + ';height:38px;line-height:38px;padding-left:3px;padding-right:5px;">' +
	               '<span style="position:relative;font-size:20px;font-weight:bold;" class="btn_orange_big" id="' + (exists(btnTxtID) ? btnTxtID : '') + '">' + btnText +
	               '</span></div><div style="position:relative;float:left;width:7px;"><img src="/img/btn/orange_rightCap_big.gif"></div></a></div>';

	return(buttonML);
}


function getBlueButtonML(btnText, theOnClick, flote, width, btnTxtID) {

	var buttonML = '<div style="position:relative;' + (exists(flote) ? (flote == 'l' ? 'float:left;' : 'float:right;') : '') + 'height:18px;padding-top:3px;padding-right:0px;margin-right:0px;">' +
	               '<a href="#null" onClick="' + theOnClick + '" style="cursor:pointer;cursor:hand;" class="btn_blue"><div style="position:relative;float:left;width:11px;"><img src="/img/btn/blue_leftCap.gif"></div>' +
	               '<div style="position:relative;float:left;background-image:url(\'/img/btn/blue_BG.gif\');background-color:transparent;width:' + (exists(width) ? width + 'px' : 'auto') + ';height:18px;">' +
	               '<span style="position:relative;padding:3px;" class="btn_blue" id="' + (exists(btnTxtID) ? btnTxtID : '') + '">' + btnText +
	               '</span></div><div style="position:relative;float:left;width:3px;"><img src="/img/btn/blue_rightCap.gif"></div></a></div>';

	return(buttonML);
}

function writeInlinePromos() {

	var promoML = '';
	var whichBox = '';

	if (document.location.href.indexOf('partnerPromo=REV') != -1) {
		whichBox = 'contentTop';
		promoML = '<div style="width:205px;padding-bottom:5px;">' +
		          '	<div style="margin-top: 10px; overflow: hidden; height: 8px" class="box_greyLine_top">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LT.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RT.gif" /></div>' +
		          '	</div>' +
		          '	<div style="margin-top: 0px; padding-top: 0px;height:42px;" class="box_greyLine_content">' +
		          '		<p style="margin-top:0px;margin-bottom:0px;"><img src="/img/logos/revolution_logo.gif" style="position:relative;float:left;margin-right:3px;"><span style="color:#14384C;"><strong style="font-size:14px;font-weight:bold;">WELCOME!</strong><br>Revolution Health Visitor</span></p>' +
		          '	</div>' +
		          '	<div class="box_greyline_bot">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LB.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif" /></div>' +
		          '	</div>' +
		          '</div>';

	} else if (document.location.href.indexOf('partnerPromo=HEALTHL') != -1) {
		whichBox = 'contentTop';
		promoML = '<div style="width:165px;padding-bottom:5px;">' +
		          '	<div style="margin-top: 10px; overflow: hidden; height: 8px" class="box_greyLine_top">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LT.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RT.gif" /></div>' +
		          '	</div>' +
		          '	<div style="margin-top: 0px; padding-top: 0px;height:42px;" class="box_greyLine_content">' +
		          '		<p style="margin-top:0px;margin-bottom:0px;"><img src="/img/logos/healthline_logo.gif" style="position:relative;float:left;margin-right:3px;"><span style="color:#14384C;"><strong style="font-size:14px;font-weight:bold;">WELCOME!</strong><br>Healthline Visitor</span></p>' +
		          '	</div>' +
		          '	<div class="box_greyline_bot">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LB.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif" /></div>' +
		          '	</div>' +
		          '</div>';

	} else if (document.location.href.indexOf('partnerPromo=BRIT') != -1) {
		whichBox = 'contentTop';
		promoML = '<div style="width:165px;padding-bottom:5px;">' +
		          '	<div style="margin-top: 10px; overflow: hidden; height: 8px" class="box_greyLine_top">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LT.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RT.gif" /></div>' +
		          '	</div>' +
		          '	<div style="margin-top: 0px; padding-top: 0px;height:42px;" class="box_greyLine_content">' +
		          '		<p style="margin-top:0px;margin-bottom:0px;"><img src="/img/logos/britannica_logo.gif" style="position:relative;float:left;margin-right:3px;"><span style="color:#14384C;"><strong style="font-size:13px;font-weight:bold;">WELCOME!</strong><br>Britannica Visitor</span></p>' +
		          '	</div>' +
		          '	<div class="box_greyline_bot">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LB.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif" /></div>' +
		          '	</div>' +
		          '</div>';

	} else if (document.location.href.indexOf('partnerPromo=KSA') != -1) {
		whichBox = 'contentTop';
		promoML = '<div style="width:165px;padding-bottom:5px;">' +
		          '	<div style="margin-top: 10px; overflow: hidden; height: 8px" class="box_greyLine_top">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LT.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RT.gif" /></div>' +
		          '	</div>' +
		          '	<div style="margin-top: 0px; padding-top: 0px;height:42px;" class="box_greyLine_content">' +
		          '		<p style="margin-top:0px;margin-bottom:0px;"><img src="/img/logos/klinefelter_logo.gif" style="position:relative;float:left;margin-right:3px;"><span style="color:#14384C;"><strong style="font-size:13px;font-weight:bold;">WELCOME!</strong><br>KS&A Visitor</span></p>' +
		          '	</div>' +
		          '	<div class="box_greyline_bot">' +
		          '		<div class="leftCorner"><img src="/img/box/greyLine_curveCorner_LB.gif" /></div>' +
		          '		<div class="rightCorner"><img src="/img/box/greyLine_curveCorner_RB.gif" /></div>' +
		          '	</div>' +
		          '</div>';

	}

	if (document.getElementById('promoBox_contentTop')) {
		document.getElementById('promoBox_contentTop').innerHTML = promoML;
	}

}


//END PAGE GRAPHICS FUNCTIONS



//EXE FUNCTIONS*************************************************************************

/*this variable is likely unused*/
var focusedTestIndex = '-1';
var focusedBRCASubIndex = 0;

var conditionsArray = new Array();
//this data format:
//f0 = codename
//f1 = channel name
//f2 = test name for copy purposes
//f3 = comma delimited test price(s)
//f4 = test type
//f5 = if exists, other possible names for condition (may not be used)

conditionsArray[conditionsArray.length] = 'A1|alpha_1|Alpha-1 Antitrypsin Deficiency|330|SWAB';
conditionsArray[conditionsArray.length] = 'AKJ|ashkenazi|Ashkenazi Jewish Carrier Screening|262.50-1219|PANEL';
conditionsArray[conditionsArray.length] = 'FVL|blood_clotting|Blood Clotting Disorders|380|SWAB';
conditionsArray[conditionsArray.length] = 'BRCA|breast_cancer|Breast & Ovarian Cancer|620-3456|BLOOD';
conditionsArray[conditionsArray.length] = '2D6|2D6|2D6 Drug Metabolism|250|SWAB';
conditionsArray[conditionsArray.length] = 'CS|colon_cancer|ColoSure&trade; Colon Cancer Screening|399|STOOL';
conditionsArray[conditionsArray.length] = 'CF|cystic_fibrosis|Cystic Fibrosis|260|SWAB';
conditionsArray[conditionsArray.length] = 'DME|drug_response|Drug Response Panel|250-630|SWAB';
conditionsArray[conditionsArray.length] = 'DT2|decode_diabetes|deCODE Diabetes T2&#153;|370|SWAB';
conditionsArray[conditionsArray.length] = 'HFE|hemochromatosis|Hemochromatosis|199|SWAB';
conditionsArray[conditionsArray.length] = 'INF|infertility|Infertility|350-995|PANEL';
conditionsArray[conditionsArray.length] = 'RPL|pregnancy_losses|Pregnancy Losses|350-995|PANEL';
conditionsArray[conditionsArray.length] = 'TAM|tamoxifen|Tamoxifen 2D6|300|SWAB';
conditionsArray[conditionsArray.length] = 'GEN|genealogy_testing|Genealogy|300|SWAB';
conditionsArray[conditionsArray.length] = 'PAT|paternity|Paternity|235|SWAB';
conditionsArray[conditionsArray.length] = 'ARC|dna_archive_storage|DNA Archive|225|SWAB';
conditionsArray[conditionsArray.length] = 'WARF|warfarin|Warfarin Response Testing|175|SWAB';

//and add a names map for

var prof_conditionNamesArray = new Array();
prof_conditionNamesArray[prof_conditionNamesArray.length] = "A1|Alpha-1 Antitrypsin Deficiency";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "BRCA|Breast & Ovarian Cancer";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "CS|ColoSure&trade; Colon Cancer Screening";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "2D6|CYP2D6 (General)";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "TAM|CYP2D6 (Tamoxifen)";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "CF|Cystic Fibrosis";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "DT2|deCODE Diabetes T2&#153;";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "HFE|Hemochromatosis";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "INF|Infertility";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "RPL|Recurrent Pregnancy Loss";
prof_conditionNamesArray[prof_conditionNamesArray.length] = "FVL|Thrombophilia";

function getProfConditionName(whichChannel) {

	var profName = 'NONE';

	for (var i = 0; i < prof_conditionNamesArray.length; i++) {
		if (whichChannel == prof_conditionNamesArray[i].split('|')[0]) {
			profName = prof_conditionNamesArray[i].split('|')[1];
			break;
		}
	}


	return(profName);
}

var focusedProductIndex = -1;

function getProductContext() {

	//we only have test-specific contexts if we have tests/
	//in the URL (or if we're in a questionnaire)

	var contextVal = -1;

	if (thisURL.indexOf('/tests/') != -1) {

		var thisURLPiece = thisURL.substring(thisURL.indexOf('/tests/') + 7);

		if (thisURLPiece.indexOf('/') != -1) {

			var thisChannel = thisURLPiece.substring(0, thisURLPiece.indexOf('/'));

			contextVal = getIndexFromChannel(thisChannel);

		}

	}

	return(contextVal);

}


function getTestIDFromQTitle() {
	var whichTest = ''

	if (document.getElementById('pageHeadline')) {

		var hl = document.getElementById('pageHeadline').innerHTML;

		if (hl.toLowerCase().indexOf('alpha') != -1) {
			whichTest = 'A1';
		} else if (hl.toLowerCase().indexOf('cystic') != -1) {
			whichTest = 'CF';
		} else if (hl.toLowerCase().indexOf('breast') != -1) {
			whichTest = 'BRCA';
		} else if (hl.toLowerCase().indexOf('colon') != -1 || hl.toLowerCase().indexOf('colosure') != -1) {
			whichTest = 'CS';
		} else if (hl.toLowerCase().indexOf('fertility') != -1) {
			whichTest = 'INF';
			if (hl.toLowerCase().indexOf('female') != -1) {
				whichTest = 'FINF'
			} else if (hl.toLowerCase().indexOf('male') != -1) {
				whichTest = 'MINF'
			} else {
				alert('need more');
			}
		} else if (hl.toLowerCase().indexOf('hemo') != -1) {
			whichTest = 'HFE';
		} else if (hl.toLowerCase().indexOf('blood') != -1) {
			whichTest = 'FVL';
		} else if (hl.toLowerCase().indexOf('diabetes') != -1) {
			whichTest = 'DT2';
		} else if (hl.toLowerCase().indexOf('ashkenazi') != -1) {
			whichTest = 'AKJ';
		} else if (hl.toLowerCase().indexOf('drug response') != -1 || hl.toLowerCase().indexOf('drug metabolism') != -1) {
			whichTest = 'DME';
		} else if (hl.toLowerCase().indexOf('archive') != -1) {
			whichTest = 'ARC';
		} else if (hl.toLowerCase().indexOf('warfarin') != -1) {
			whichTest = 'WARF';
		}
	}

	return(whichTest);

}


function writeTestSelect() {

	var optionsML = '<option style="font-size:12px;" value="">select a test to learn more...</option>';

	for (var i = 0; i < conditionsArray.length; i++) {

		var thisName = getTestName(i);

		if (whichSubSection == 'professionals') {
			thisName = getProfConditionName(conditionsArray[i].split('|')[0]);
		}

		if (conditionsArray[i].split('|')[0] == 'CS') {
			thisName = 'Stool DNA Testing ColoSure&trade;';
		}

		optionsML += '<option style="font-size:12px;" value="' + conditionsArray[i].split('|')[1].split(',')[0] + '">' + thisName + '</option>';
	}

	return(optionsML);

}

function learnMoreAboutTesting(which) {

	trackClick('link_source=learn_about_testing_select');

	if (which != -1) {
		document.location.href = '/patients/tests/' + conditionsArray[which].split('|')[1] + '/index.jsp';
	} else {
		document.location.href = '/patients/tests/index.jsp';
	}

}


function getInsurancePage(which) {

	trackClick('link_source=insurance_info_select');

	if (which == getIndexFromID('TAM') || which == getIndexFromID('2D6') || which == getIndexFromID('DME')) {
		alert('Insurance coverage and reimbursement information for drug metabolism testing is coming soon.');
	} else if (which == getIndexFromID('DT2')) {
		alert('Insurance coverage and reimbursement information for deCODE T2&#153; is coming soon.');
	} else {
		document.location.href = '/patients/tests/' + conditionsArray[which].split('|')[1] + '/insurance.jsp';
	}

}


function getTestingGuidelines(which) {

	var thisChannel = getChannelName(which - 1);
	if (thisChannel != 'NONE') {
		if (thisChannel == getChannelName(getIndexFromID('TAM'))) {
			document.location.href = '/professionals/tests/tamoxifen/references.jsp';
		} else if (thisChannel == getChannelName(getIndexFromID('2D6'))) {
			document.location.href = '/professionals/tests/2D6/resources.jsp';
		} else if (thisChannel == getChannelName(getIndexFromID('DT2'))) {
			document.location.href = '/professionals/tests/decode_diabetes/who.jsp';
		} else {
			document.location.href = '/professionals/tests/' + thisChannel + '.jsp';
		}
	}

}

function getTestName(thisIndex, generic) {

	var testName = conditionsArray[thisIndex].split('|')[2];
	var thisTestName = testName.split(',')[0];

	if (focusedBRCASubIndex != 0 && getConditionID(thisIndex) == 'BRCA') {
		if (!exists(generic)) {
			thisTestName = testName.split(',')[focusedBRCASubIndex - 1] + ' ' + testName.split(',')[0];
		}
	} else if (getConditionID(thisIndex) == 'INF' || getConditionID(thisIndex) == 'RPL') {
		if (document.location.href.indexOf('frameworkQuestionnaire.jsp') != -1) {
			thisTestName = testName.split(',')[2];
		}
	} else if (getConditionID(thisIndex) == 'FVL') {
		if (document.location.href.indexOf('frameworkQuestionnaire.jsp') != -1) {
			thisTestName = testName.split(',')[1];
		}
	}

	return(thisTestName);

}

function getChannelName(conditionIndex) {

	if (conditionIndex == -1) {
		return('NONE');
	} else {
		return(conditionsArray[conditionIndex].split('|')[1]);
	}
}


function getTestPrice(conditionIndex) {

	if (conditionIndex == -1) {
		return('NONE');
	} else {
		return('$' + replace(conditionsArray[conditionIndex].split('|')[3], '-', '-$'));
	}
}


function getTestKitType(conditionIndex) {

	if (conditionIndex == -1) {
		return('NONE');
	} else {
		return(conditionsArray[conditionIndex].split('|')[4]);
	}
}

function getTestKitImage(conditionID) {

	var thisImage = '/img/content_images/common/';

	if (conditionID == null || conditionID == '') {
		//do code here
		conditionID = getConditionID(focusedProductIndex);
		if (conditionID == 'NONE') {
			conditionID = getTestIDFromQTitle();
		}

		if (conditionID != '') {
			return(getTestKitImage(conditionID));
		} else {
			thisImage = '/img/blank.gif';
		}

	} else if (conditionID == 'swab') {
		thisImage += 'kit_swab.jpg';
	} else if (conditionID == 'blood_myriad') {
		thisImage += 'kit_brca.jpg';
	} else if (conditionID == 'blood_labcorp') {
		thisImage += 'kit_blood.jpg';
	} else if (conditionID == 'swab_decode') {
		thisImage += 'kit_swab_decode.jpg';
	} else if (conditionID == 'stool') {
		thisImage += 'kit_colosure.jpg';
	} else {

		if (conditionID == 'BRCA') {
			thisImage += 'kit_brca.jpg';
		} else if (conditionID == 'CS') {
			thisImage += 'kit_colosure.jpg';
		} else if (conditionID == 'DT2') {
			thisImage += 'kit_swab_decode.jpg';
		} else if (conditionID == 'INF' || conditionID == 'RPL' || conditionID == 'AKJ') {
			thisImage += 'kit_blood.jpg';
		} else {
			thisImage += 'kit_swab.jpg';
		}

	}

	return(thisImage);
}

function getIndexFromID(theID) {
	var returnIndex = -1;

	for (var j = 0; j < conditionsArray.length; j++) {
		if (getConditionID(j) == theID) {
			returnIndex = j;
		}
	}

	return(returnIndex);
}

function getIndexFromChannel(theChannel) {
	var returnIndex = -1;

	for (var j = 0; j < conditionsArray.length; j++) {
		if (conditionsArray[j].split('|')[1] == theChannel) {
			returnIndex = j;
		}
	}

	return(returnIndex);
}

function getSampleMDLetter(condID) {

	var currConditionID = getConditionID(focusedProductIndex);

	if (exists(condID)) {
		currConditionID = condID;
	}

	var letterURL = '';

	if (currConditionID == 'TAM' || currConditionID == '2D6') {
		letterURL = '/pdf/physicianLetters/sample_doctor_report.pdf'
	} else if (currConditionID == 'DT2') {
		letterURL = '/pdf/physicianLetters/sampleMDLetter_decode.pdf'
	} else {
		letterURL = '/pdf/physicianLetters/sampleMDLetter.pdf'
	}

	window.open(letterURL, 'MD_Letter');

}

var reportWindow = null;

function getSampleReport(which) {
	// TODO this mapping will be moved into the database as part of legacy refactoring. All Panel's will be aware
	// of their sample report
	var currConditionID = null;

	if (!exists(which)) {
		currConditionID = getConditionID(focusedProductIndex);
	} else {
		currConditionID = which;
	}

	if (currConditionID == 'TAM' || currConditionID == '2D6' || currConditionID == 'DME' || currConditionID == 'WARF') {
		//pgx report
		document.location.href = '/jsp/reports/sample_guide.jsp';
	} else {

		var thisURL = 'http://www.dnadirect.com/tests/sample_reports/';

		if (currConditionID != 'NONE' && currConditionID != 'AKJ' && currConditionID != 'GEN') {
			thisURL += currConditionID + '.html';
		} else {
			thisURL += 'CF.html';
		}

		popReport(thisURL);

	}
}

function popReport(reportURL) {

	var theParms = 'resizable=1,scrollbars=1,width=740';

	if (screen.height && (screen.height > 0)) {
		theParms += ',height=' + (screen.height - 75);
	}

	reportWindow = window.open(reportURL, 'repWin', theParms);

}


function orderTestingNow(which, qContext) {

	var qURI = '/jsp/offering/questionnaire/displayQuestionnaire.jsp?action=display';
	var whatTest = '';
	var panelId = '';

	/*if (exists(qContext)) {
	 document.qForm.qContext.value = qContext + '';
	 } else {
	 document.qForm.qContext.value = '';
	 }
	 */
	if (!exists(which)) {
		whatTest = getConditionID(focusedProductIndex);
	} else {
		whatTest = which;
	}

	if (whatTest == 'TAM') {
		panelId = '14';
	} else if (whatTest == '2D6') {
		panelId = '13';
	} else {
		//then it's a DNA Direct condition test and we need to change the form


		//and get which test this is:
		var thisCond = whatTest;
		var thisWrap = '';

		if (thisCond == 'A1') {
			panelId = '1';
		} else if (thisCond == 'FVL_M') {
			panelId = '15';
		} else if (thisCond == 'FVL_F') {
			panelId = '16';
		} else if (thisCond == 'BRCA') {
			panelId = '6';
		} else if (thisCond == 'CS') {
			panelId = '8';

			//alert('Due to a transition at the testing lab, Pregen testing is temporarily unavailable. Please email pregen@dnadirect.com to be notified when Pregen is again available.');
			//return(false);


		} else if (thisCond == 'CF') {
			panelId = '7';
		} else if (thisCond == 'HFE') {
			panelId = '10';
		} else if (thisCond == 'INF_M') {
			panelId = '9';
		} else if (thisCond == 'INF_F') {
			panelId = '11';
		} else if (whatTest == 'DT2') {
			panelId = '12';
		} else if (whatTest == 'AKJ') {
			panelId = '28';
		} else if (whatTest == 'DME') {
			panelId = '29';
		} else if (whatTest == 'PAT') {
			panelId = '41';
		} else if (whatTest == 'ARC') {
			panelId = '40';
		} else if (whatTest == 'WARF') {
			panelId = '43';
		}

	}
	qURI += '&Panel_PanelId=' + panelId;

	if (exists(qContext)) {
		qURI += '&qContext=' + qContext;
	}

	document.qForm.Panel_PanelId.value = panelId;
	// document.qForm.action.value = 'display';
	document.qForm.action = qURI;
	document.qForm.submit();
}

function orderAncestryTestingNow(which) {

	trackClick('ancestry_referral_' + which);

	if (which == 'ABDNA_EDNA20') {
		alert('Due to problem at the testing Lab, European DNA 2.0 is temporarily unavailable. You can email us (expert@dnadirect.com) to request to be notified when this test is available again.');
		return(false);
	} else if (which.indexOf('ABDNA_') == 0) {
		var qURI = '/jsp/offering/questionnaire/displayQuestionnaire.jsp?action=display';
		document.qForm.target = '';
		qURI += '&Panel_PanelId=' + '42';
		document.qForm.Panel_PanelId.value = '42';
		document.qForm.action = qURI;

	} else if (which.indexOf('AC_') == 0) {
		document.qForm.target = 'top';
		document.qForm.action = 'http://www.tkqlhce.com/click-2567685-10508559';
	}

	document.qForm.submit();
}


function getHowToOrderPage() {

	var currChannel = getChannelName(focusedProductIndex);
	if (currChannel != 'NONE') {
		var testID = conditionsArray[getIndexFromChannel(currChannel)].split('|')[0];
		if (whichSubSection == 'patients') {
			if (testID == 'DT2') {
				document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/how_testing_works.jsp';
			} else if (testID == 'GEN') {
				document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/what_does_testing_involve.jsp';
			} else if (testID == 'AKJ') {
				document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/how_ashkenazi.jsp';
			} else if (testID == 'WARF') {
				document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/how_to_order_testing.jsp';
			} else {
				document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/how.jsp';
			}

		} else {
			document.location.href = '/' + whichSubSection + '/tests/' + conditionsArray[getIndexFromChannel(currChannel)].split('|')[1] + '/order.jsp';
		}

	}

}


function getConditionID(whatIndex) {

	if (whatIndex == -1) {
		return('NONE');
	} else {
		var thisCondID = conditionsArray[whatIndex].split('|')[0];
		return(thisCondID);
	}

}


function getCPTCodesWindow(testName, testID) {

	var theParms = 'toolbar=0,status=0,resizable=1,scrollbars=0,width=300,height=400';
	window.open('/htmlGraphics/cpt_codes.html?testName=' + testName + '&testID=' + testID, 'cptWin', theParms);

}

function getICD9CodesWindow(testName, testID) {

	var theParms = 'toolbar=0,status=0,resizable=1,scrollbars=0,width=300,height=400';
	window.open('/htmlGraphics/icd9_codes.html?testName=' + testName + '&testID=' + testID, 'icd9Win', theParms);

}

function checkFirstView(reportURIandEMail, userIP) {

	//reportURIandEMail comes is as a pipe-delimited pair
	//of report URI and report email

	var theEmail = reportURIandEMail.split('|')[1];
	var reportURI = reportURIandEMail.split('|')[0];

	reportURI = reportURI.substring(reportURI.lastIndexOf('/') + 1, reportURI.length);

	//if it isn't us, check for a first-time user
	if (userIP.indexOf('69.107') != 0) {
		document.getElementById('invisibleF').src = replace(thisURL.substring(0, thisURL.indexOf('.com/')), 'http:', 'https:') + '.com/cgi-bin/notifyFirstReport.pl?reportURI=' + reportURI + "&email=" + theEmail;
	}

}

function failValidation(focusObj, tickingBtnID, color, size) {

	if (tickingBtnID) {
        var textClass = "btn_orange";

        if (exists(color)) {
            textClass = 'btn_' + color;
        }

        if (exists(size)) {
            textClass += '_' + size;
        }

        eval('stopTicks.' + tickingBtnID.split('|')[0] + ' = true;');
		document.getElementById(tickingBtnID.split('|')[0]).innerHTML = '<strong class="' + textClass + '">' + tickingBtnID.split('|')[1] + '</strong>';
	}

	if (focusObj) {
		focusObj.focus();
	}

	return(false);
}

//END EXE FUNCTIONS


//POP-UP WINDOW FUNCTIONS****************************************************************
function getDGSignupWindow() {

	var theParms = 'resizable=1,scrollbars=0,width=390,height=240';
	window.open('/tools/gdSignUp.html', 'signup', theParms);
}


function getRequestReminderWindow() {

	//var theParms = 'resizable=1,scrollbars=0,width=390,height=534';
	//trackClick('link_source=account_tools__reminder');
	//window.open('/patients/tools/requestReminder.html', 'reminderWin', theParms);
	document.location.href = '/patients/tools/reminder.jsp';
}

function getScheduleConsultationWindow(orderID) {

	//var theParms = 'resizable=1,scrollbars=0,width=390,height=640';
	//trackClick('link_source=tools__reminder');
	//window.open('/patients/tools/scheduleConsultation.html', 'consultWin', theParms);
	window.open('/web/article/genetic-consultation-services/consults-and-reports/468/schedule-a-consultation');
}

function getPhysicianInformationWindow() {

	//var theParms = 'resizable=1,scrollbars=0,width=450,height=660';
	//trackClick('link_source=tools__drInfo');
	//window.open('/patients/tools/sendInfo2Dr.html', 'sendIndo', theParms);
	document.location.href = '/patients/testing_services/tools/send_dr_info.jsp';

}

function getAskExpertWindow() {

	//var theParms = 'resizable=1,scrollbars=0,width=390,height=585';
	//trackClick('link_source=tools__ask_expert');
	//window.open('/patients/tools/askExpert.html', 'shareStory', theParms);
	document.location.href = '/patients/testing_services/consultation.jsp';

}

function getRequestMoreInformationWindow() {

	//var theParms = 'resizable=1,scrollbars=0,width=540,height=638';
	//trackClick('link_source=tools__more_information');
	//window.open('/professionals/tools/more_information.html', 'reminderWin', theParms);
	document.location.href = '/professionals/tools/more_info.jsp';

}

function getShareStoryWindow() {

	var theParms = 'resizable=1,scrollbars=0,width=390,height=597';
	trackClick('link_source=why__share_your_story');
	window.open('/' + whichSubSection + '/tools/shareComments.html', 'shareComments', theParms);

}


function startFindTool(callButtonDivID) {

	//no go for safari
	if (isSafari) {

		alert('FIND is not compatible with the Safari web browser. Please use Firefox for the Macintosh or PC to access FIND.');
		return(false);

	}


	//so we want to start the widget on the page where it will be fully visible
	//to do that we need to find where it was called from
	//to position the widget div correctly
	var callBtnPos = findPos(document.getElementById(callButtonDivID));

	var leftContentTopPos = findPos(document.getElementById('leftContentCol'))[1];

	var eY = callBtnPos[1] - leftContentTopPos;

	var leftColBottomPlace = document.getElementById('leftContentCol').offsetHeight;

	var bottomOffset = leftColBottomPlace - eY;

	if (bottomOffset < 500) {
		eY = eY - (500 - bottomOffset);
	} else {
		if (callBtnPos[1] > leftContentTopPos && (Math.abs(document.body.scrollTop - callBtnPos[1]) > leftContentTopPos)) {
			eY = eY - leftContentTopPos;
		}
	}

	if (eY < 180) {
		eY = 10;
	}

	//alert(callBtnPos[1] + ' ' + eY + ' ' + bottomOffset);

	//and offset the left and top of the tip box
	//if we're close to an edge
	if (!document.getElementById('findWidgetOuterDiv')) {
		document.getElementById('leftContentCol').innerHTML += '<div id="findWidgetOuterDiv" style="position:absolute;top:' + eY + 'px;"></div>';
	} else {
		document.getElementById('findWidgetOuterDiv').style.top = eY + 'px';
	}

	ajx_getWidgetContent('findWidgetOuterDiv', 'FIND: Ethnicity & Ancestry Testing');

	doFinishActions = finishFindToolLoad;

}

function finishFindToolLoad() {
	var headID = document.getElementsByTagName("head")[0];
	var widgetScript = document.createElement('script');
	widgetScript.type = 'text/javascript';
	widgetScript.src = '/js/findWidget.js?' + getSecondsParm();
	headID.appendChild(widgetScript);
}


function startFindDrugsAndGenesTool(callButtonDivID) {

	//so we want to start the widget on the page where it will be fully visible
	//to do that we need to find where it was called from
	//to position the widget div correctly
	var callBtnPos = findPos(document.getElementById(callButtonDivID));

	var leftContentTopPos = findPos(document.getElementById('leftContentCol'))[1];

	var eY = callBtnPos[1] - leftContentTopPos;

	var leftColBottomPlace = document.getElementById('leftContentCol').offsetHeight;

	var bottomOffset = leftColBottomPlace - eY;

	if (bottomOffset < 250) {
		eY = eY - (250 - bottomOffset);
	} else {
		if (callBtnPos[1] > leftContentTopPos && (Math.abs(document.body.scrollTop - callBtnPos[1]) > leftContentTopPos)) {
			eY = eY - leftContentTopPos;
		}
	}

	if (eY < 180) {
		eY = 10;
	} else {
		eY = eY - 70;
	}

	eY = eY - (leftColBottomPlace + 20);

	//alert(callBtnPos[1] + ' ' + eY + ' ' + bottomOffset);

	//and offset the left and top of the tip box
	//if we're close to an edge
	createAndPopulateFindDrugsAndGenesTooDiv(eY);

}

function createAndPopulateFindDrugsAndGenesTooDiv(divTop) {
	if (!document.getElementById('findWidgetOuterDiv')) {
		document.getElementById('widgetToolDiv').innerHTML += '<div id="findWidgetOuterDiv" style="position:absolute;top:' + divTop + 'px;font-size:12px;color:#000000;"></div>';
	} else if (exists(divTop)) {
		document.getElementById('findWidgetOuterDiv').style.top = divTop + 'px';
	}

	ajx_getWidgetContent('findWidgetOuterDiv', 'FIND: Drug & Gene Associations');

	doFinishActions = finishFindDrugsAndGenesToolLoad;
}

var drugsAndGenesToolLoadedJS = false;

function finishFindDrugsAndGenesToolLoad() {
	if (!drugsAndGenesToolLoadedJS) {
		var headID = document.getElementsByTagName("head")[0];
		var widgetScript = document.createElement('script');
		widgetScript.type = 'text/javascript';
		widgetScript.src = '/js/gene_drugs_data.js?' + getSecondsParm();
		headID.appendChild(widgetScript);
		var widgetScript = document.createElement('script');
		widgetScript.type = 'text/javascript';
		widgetScript.src = '/js/findWidget_drugsAndGenes.js?' + getSecondsParm();
		headID.appendChild(widgetScript);
		drugsAndGenesToolLoadedJS = true;
	} else {
		startWidget();
	}

}


//END POP-UP WINDOW FUNCTIONS



//AJAX FUNCTIONS******************************************************************

var eleCount = 0;

function ajx_getWidgetContent(loadIntoDivID, widgetTitle) {

	var reqParseObject = new Object();

	reqParseObject.parseFunction = function(http_request) {
		catchWidgetContent(http_request, loadIntoDivID)
	};

	reqParseObject.url = '/jsp/ajax/getWidgetContent.jsp?title=' + widgetTitle;

	ajx_makeRequest(loadIntoDivID, reqParseObject)

}

function ajx_makeRequest(loadIntoDivID, reqParseObject) {

	var http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
			}
		}
	}

	if (!http_request) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}

	http_request.onreadystatechange = function() {
		ajx_fillElement(http_request, reqParseObject);
	};
	http_request.open('GET', reqParseObject.url, true);
	http_request.send(null);
}


function ajx_fillElement(http_request, reqParseObject, loadIntoDivID) {

	if (http_request.readyState == 4) {
		if (http_request.status == 200) {

			reqParseObject.parseFunction(http_request, loadIntoDivID);

			//alert(http_request.responseText);
		} else {
			alert('There was a problem with the request.');
		}
	}

}

function catchWidgetContent(http_request, loadIntoDivID) {


	var feedML = http_request.responseText;

	if (feedML != '') {

		//if (feedML.substring(feedML.length-3,feedML.length) != '...') {
		//	feedML += '...';
		//}

		//and a little clean up for weird characters
		feedML = replace(feedML, '?s', '\'s');
		feedML = replace(feedML, '?t', '\'t');
		feedML = replace(feedML, '?ll', '\'ll');

		document.getElementById(loadIntoDivID).innerHTML = feedML;

		doFinishActions();

	}

}


function doFinishActions() {

}

//END AJAX FUNCTIONS



//RETURN2TOP FUNCTIONS******************************************************************

var global_r2TopLeft = 520;

var ret2TopListener = null;

function showReturn2TopButton(r2TopLeft) {

	if (!exists(r2TopLeft)) {
		r2TopLeft = global_r2TopLeft;
	}

	var winWidth = document.body.clientWidth;
	var winHeight = document.body.clientHeight;
	var pageHeight = document.body.scrollHeight;

	//we don't need a return if the window already shows the whole page
	if (winHeight < pageHeight) {

		document.getElementById('ret2Top').style.left = document.getElementById('mainContent').offsetLeft + r2TopLeft + 'px';
		document.getElementById('ret2Top').style.top = (pageHeight - 35) + 'px';

		ret2TopListener = window.setInterval('showHideReturn2Top(\'ret2Top\')', 50);

	}

}

function snapToPageHeight() {
	var pageHeight = document.getElementById('main').offsetHeight;
	document.getElementById('ret2Top').style.top = (pageHeight - 20) + 'px';
}

function scroll2Top() {

	trackClick('link_source=global__return_to_top');
	document.body.scrollTop = 0;

}

function showHideReturn2Top(what) {

	var bodyTop = document.body.scrollTop - 0;

	if (bodyTop > 10) {

		var winHeight = document.body.clientHeight;
		var pageHeight = document.body.scrollHeight;

		document.getElementById(what).style.display = 'block';

		var topPos = document.body.clientHeight - 35;
		var menuTop = document.getElementById(what).offsetTop;

		if (menuTop != (bodyTop + topPos)) {

			var theDiff = (bodyTop + topPos) - menuTop;
			var signVal = theDiff / Math.abs(theDiff);

			var howMuch = menuTop + Math.abs(theDiff / 2) * signVal;

			//window.status = signVal;
			//window.status = document.getElementById(what).offsetTop;
			document.getElementById(what).style.top = howMuch + 'px';
		}


	} else {
		document.getElementById(what).style.display = 'none';
	}

}

//END RETURn2TOP FUNCTIONS


//SEARCH FUNCTIONS**********************************************************************

var searchDef = 'Enter search terms...';

function doSearch(what, whichForm) {
	if (replace(what, ' ', '') != '' && what != searchDef) {
		trackClick('link_source=footer__search_' + escape(what));
		//setTimeout('document.location.href=\'http://www.google.com/search?q=' + escape(what) + '&num=10&hl=en&btnG=Google+Search&as_ft=i&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=dnadirect.com&safe=off\'', 1);
		qs(whichForm);
	} else {
		alert('Please enter a search term in the text box.');
		if (whichForm.searWords) {
			clearDef(what);
			whichForm.searWords.focus();
		}
	}
}

function clearDef(what, whichForm) {
	if (what) {
		if (what == searchDef) {
			whichForm.searWords.value = '';
		}
	}
}

function qs(whichForm) {
	if (!window.encodeURIComponent)  return true;

	var f = whichForm;
	var qe = encodeURIComponent(f.searWords.value);

	if (f.area)
		if (f.area.value == 2) {
			document.location = "http://www.google.com/search?q=" + qe;
			return false;
		}

	var pt = document.location.pathname;

	if (f.action)
		if (f.action != "")
			pt = f.action;

	var ue = pt + "?searWords=" + qe;

	if (f.search)
		ue += "&search=" + f.search.value;

	if (f.match)
		ue += "&match=" + f.match.value;

	document.location = ue;

	return false;
}

//END SEARCH FUNCTIONS


//UTILITY FUNCTIONS**********************************************************************
//general use functions

var stopTicks = {dummyItem:0,dummyItem2:1};

function tickElipsis(eleID, setStopID) {

	if (setStopID) {
		eval('stopTicks.' + eleID + ' = false;');
	}

	if ((eval('stopTicks.' + eleID) + '') != 'undefined') {
		if (!eval('stopTicks.' + eleID)) {


			if (document.getElementById(eleID)) {

				if (document.getElementById(eleID).innerHTML.indexOf('...') != -1) {
					document.getElementById(eleID).innerHTML = replace(document.getElementById(eleID).innerHTML, '...', '');
				} else {
					document.getElementById(eleID).innerHTML += '.';
				}

				setTimeout('tickElipsis(\'' + eleID + '\')', 800);

			}
		}
	}

}

function getCurrentDate() {

	var currDate = '';

	var theDate = new Date();
	var monthname = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	currDate += monthname[theDate.getMonth()] + " ";
	currDate += theDate.getDate() + ", ";
	currDate += theDate.getFullYear();

	return(currDate);
}

var validEmailChars = 'abcdefghijklmnopqrstuvwxyz1234567890@._-+';

function validateEmail(theEmail, emailTitle, emailObjectName) {

	if (Trim(theEmail) == '') {
		alert('Please enter an email address.');
		if (exists(emailObjectName)) {
			if (eval('document.' + emailObjectName)) {
				eval('document.' + emailObjectName + '.focus();');
			}
		}
		return(false);
	}

	theEmail = theEmail.toLowerCase();

	if (theEmail != null) {

		for (i = 0; i < theEmail.length; i++) {
			if (validEmailChars.indexOf(theEmail.charAt(i)) == -1) {
				alert((exists(emailTitle) ? emailTitle : 'This') + ' email address contains a \'' + theEmail.charAt(i) + '\' character which is invalid. Please re-enter this email address.');
				if (exists(emailObjectName)) {
					if (eval('document.' + emailObjectName)) {
						eval('document.' + emailObjectName + '.focus();');
					}
				}
				return(false);
			}

		}
	}
	if (theEmail.indexOf('@') == -1) {
		alert((exists(emailTitle) ? emailTitle : 'This') + ' email address lacks an \'@\' character. Please re-enter this email address.');
		if (exists(emailObjectName)) {
			if (eval('document.' + emailObjectName)) {
				eval('document.' + emailObjectName + '.focus();');
			}
		}
		return(false);
	} else if ((theEmail.indexOf('@') == theEmail.length - 1) || (theEmail.length < 6) || (theEmail.indexOf('@') == 0)) {
		alert((exists(emailTitle) ? emailTitle : 'This') + ' email address appears to be incomplete. Please re-enter this email address.');
		if (exists(emailObjectName)) {
			if (eval('document.' + emailObjectName)) {
				eval('document.' + emailObjectName + '.focus();');
			}
		}
		return(false);
	} else if (theEmail.indexOf('.') == -1 || (theEmail.lastIndexOf('.') < theEmail.indexOf('@'))) {
		alert((exists(emailTitle) ? emailTitle : 'This') + ' email address lacks a domain extension such as .com or .net. Please re-enter this email address.');
		if (exists(emailObjectName)) {
			if (eval('document.' + emailObjectName)) {
				eval('document.' + emailObjectName + '.focus();');
			}
		}
		return(false);
	}

	return(true);
}

function exists(thing) {

	if (thing != null) {
		if ((thing + '') == '0') {
			return(true);
		} else if (thing) {
			return(true);
		}
	}

	return(false);
}

function countChar(thisObj) {

	var count = thisObj.value.length;
	var theMax = document.getElementById(thisObj.name + '_charMax').innerHTML - 0;
	document.getElementById(thisObj.name + '_charRem').innerHTML = theMax - count;

}

function countCharRem(thisObj) {

	countChar(thisObj);

	if (thisObj.focused) {
		setTimeout('countCharRem(document.getElementById(\'' + thisObj.id + '\'))', 150);
	}

}


var thisImagePop = null;
var thisCurrImage = null;

function popPic(thisURL, caption) {

	var imgURL = thisURL;

	thisCurrImage = new Image;
	thisCurrImage.src = imgURL;

	if (!exists(caption)) {
		thisImagePop = window.open(imgURL, 'pic', 'title=0,resizable=1,scrollbars=0,status=0,width=300,height=300');
		watchResize();
	} else {
		var thisImagePageML = '<html><head>' +
		                      '<link REL="shortcut icon" HREF="/siteIcon.ico">' +
		                      '<script type="text/javascript" src="/js/siteFunctions.js"></script>' +
		                      '<link rel="stylesheet" type="text/css" href="/css/site.css" media="screen">' +
		                      '</head>' +
		                      '<body style="margin-top:5px;" onLoad="watchResize(\'contDiv\')">' +
		                      '<div id="contDiv" style="text-align:left;margon-left:auto;margin-right:auto;">' +
		                      '<img src="' + imgURL + '" id="img1"><br>' +
		                      '<img src="/img/blank.gif" height="5"><br>' +
		                      caption +
		                      '</div>' +
		                      '</body></html>';

		thisImagePop = window.open(imgURL, 'pic', 'title=0,resizable=1,scrollbars=0,status=0,width=300,height=300');
		thisImagePop.document.write(thisImagePageML);
		thisImagePop.document.close();

	}


	thisImagePop.focus();
}

function watchResize(divName) {

	if (exists(divName)) {
		if (opener.thisCurrImage.height > 0) {
			window.resizeTo(opener.thisCurrImage.width + 50, document.getElementById(divName).offsetHeight + 80);

		} else {
			setTimeout('watchResize(\'' + divName + '\')', 100);
		}


	} else {
		if (thisCurrImage.height > 0) {
			thisImagePop.resizeTo(thisCurrImage.width + 50, thisCurrImage.height + 80);
		} else {
			setTimeout('watchResize()', 100);
		}
	}

}

var poppedWin = null;

function popWin(theURL, theWidth, theHeight) {

	var width = 200;
	var height = 200;

	if (exists(theWidth)) {
		width = theWidth - 0;
	}

	if (exists(theHeight)) {
		height = theHeight - 0;
	}

	poppedWin = window.open(theURL, 'PoppedWindow', 'title=0,resizable=1,scrollbars=1,status=0,width=' + width + ',height=' + height);

}

function printArticle() {

	trackClick('link_source=print__' + escape(thisURL.substring(thisURL.lastIndexOf('/') + 1)));

	var thePrintWindow = window.open('', 'printWin', 'toolbar=1;resizable=1,scrollbars=1,status=1,width=620');

	thePrintWindow.document.open();

	var contentML = '';

	if (thisURL.indexOf('/view_report.jsp') != -1) {
		contentML = document.getElementById(currArticleID).innerHTML;
	} else if (document.location.href.indexOf('questionnaire_content_uri') != -1) {

		contentML = document.getElementById('leftContentCol').innerHTML.substring(document.getElementById('leftContentCol').innerHTML.toLowerCase().indexOf('<table style="margin-bottom: 10px'), document.getElementById('leftContentCol').innerHTML.toLowerCase().lastIndexOf('</form>'));

		//then we need to strip the page of all the javascript
		while (contentML.toLowerCase().indexOf('<scr' + 'ipt') != -1) {
			contentML = contentML.substring(0, contentML.toLowerCase().indexOf('<scr' + 'ipt')) + contentML.substring(contentML.toLowerCase().indexOf('</scr' + 'ipt>') + 9);
		}

	} else if (document.getElementById('leftContentCol')) {
		contentML = document.getElementById('leftContentCol').innerHTML;
	}

	//alert(contentML)

	var theWinHTML = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>' +
	                 '<title>Print Article from DNA Direct.com</title>' +
	                 '<link rel="stylesheet" type="text/css" href="/css/site.css" media="screen">' +
	                 '<link rel="stylesheet" type="text/css" href="/css/site.css" media="print">' +
	                 '<script type="text/javascript" src="/js/menuDataStructure.js"></script>' +
	                 '<script type="text/javascript" src="/js/siteFunctions.js"></script>' +
	                 '<style>input {visibility: hidden; margin-bottom: -15px;} .printFriendly {height:1px;width:1px;overflow:hidden;visibility: hidden;}</style>' +
	                 '<script>window.focus(); function writeNextLink() {return(document.getElementById(\'nextPageLink\').innerHTML);} function writeCurrSectionsLinks() {return(document.getElementById(\'sectionLinks\').innerHTML);}</script>'
	'</head><body style="margin: 0px;text-align:left;">';

	theWinHTML += '<div style="background-color: #dddddd;padding: 2px;text-align: center;margin-bottom: 10px;">This article printed from http://www.dnadirect.com</div>';

	theWinHTML += '<div style="padding-left: 10px; padding-right: 10px;text-align:left;">' +
	              contentML + '</div>';

	theWinHTML += '<div style="background-color: #dddddd;padding: 2px;text-align: center;margin-top: 10px;clear:both;">Copyright &copy; 2006 DNA Direct Inc. All rights reserved. http://www.dnadirect.com</div>';

	theWinHTML += '</body></html>';

	thePrintWindow.document.write(theWinHTML);
	thePrintWindow.document.close();
	thePrintWindow.print();

}

function emailArticle() {

	trackClick('link_source=email__' + escape(thisURL.substring(thisURL.lastIndexOf('/') + 1)));

	var theParms = 'resizable=1,scrollbars=0,width=390,height=530';

	var articleURL = document.location.href;
	var articleTitle = document.getElementById('pageHeadline').innerHTML;

	reportWindow = window.open('/tools/emailArticle.html?articleTitle=' + escape(articleTitle) + '&articleURL=' + escape(cleanEmailURL(articleURL)), 'emailArticleWin', theParms);
}

function cleanEmailURL(thisURL) {

	return(replace(replace(replace(thisURL, '?refLink=emailArticleGD', ''), '&refLink=emailArticleGD', ''), '#null', ''));

}

//string manipulation functions


function breakUpURL(theURL, length) {

	if (theURL.length < length) {
		return(theURL);
	}

	var returnURL = '';

	var sub = theURL.substring(0, length - 1);

	var lastSlash = sub.lastIndexOf('/');

	if (lastSlash != -1) {
		returnURL = theURL.substring(0, lastSlash + 1) + '<br>' +
		            breakUpURL(theURL.substring(lastSlash + 1, theURL.length), length);
	} else {
		returnURL = sub + '<br>' +
		            breakUpURL(theURL.substring(length, theURL.length), length);
	}

	return(returnURL);
}

function replace(string, text, by) {
	// Replaces text with by in string
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;

	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0, txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0, i) + by;

	if (i + txtLength < strLength)
		newstr += replace(string.substring(i + txtLength, strLength), text, by);

	return newstr;
}

function Trim(TRIM_VALUE) {
	if (TRIM_VALUE.length < 1) {
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if (TRIM_VALUE == "") {
		return "";
	}
	else {
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE) {
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if (v_length < 0) {
		return"";
	}
	var iTemp = v_length - 1;

	while (iTemp > -1) {
		if (VALUE.charAt(iTemp) == w_space) {
		}
		else {
			strTemp = VALUE.substring(0, iTemp + 1);
			break;
		}
		iTemp = iTemp - 1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE) {
	var w_space = String.fromCharCode(32);
	if (v_length < 1) {
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while (iTemp < v_length) {
		if (VALUE.charAt(iTemp) == w_space) {
		}
		else {
			strTemp = VALUE.substring(iTemp, v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function


function fixBreakingChars(inString) {
	var outString = '';
	outString = replace(inString, ' ', '&nbsp;');
	outString = replace(outString, '-', '&minus;');
	return(outString);
}


function countCharTokens(string, token) {

	var count = 0;

	for (var i = 0; i < string.length; i++) {
		if (string.charAt(i) == token) {
			count++;
		}
	}

	return(count);

}


function capName(theName) {
	var cappedName = '';

	cappedName = theName.substring(0, 1).toUpperCase() + theName.substring(1, theName.length).toLowerCase();

	return(cappedName);
}

function toSentenceCase(what) {

	var cappedWhat = Trim(what);

	var spCount = cappedWhat.split(' ').length - 1;

	cappedWhat = cappedWhat.charAt(0).toUpperCase() + cappedWhat.substring(1);

	for (var i = 0; i < spCount; i++) {
		cappedWhat = cappedWhat.substring(0, cappedWhat.indexOf(' ')) + '!!@!!' + cappedWhat.charAt(cappedWhat.indexOf(' ') + 1).toUpperCase() + cappedWhat.substring(cappedWhat.indexOf(' ') + 2);
	}

	cappedWhat = replace(cappedWhat, '!!@!!', ' ');

	return(cappedWhat);

}

var alphaNumericChars = 'abcdefghijklmnopqrstuvwxyz1234567890_-+/';

function alphaNumericOnly(inString) {

	var outString = '';

	for (var i = 0; i < inString.length; i++) {

		var thisChar = inString.charAt(i).toLowerCase();

		if (alphaNumericChars.indexOf(thisChar) != -1) {
			outString += thisChar;
		}
	}

	return(outString);

}

function findPos(obj) {

	obj = document.getElementById(obj.id);

	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}

	return [curleft,curtop];
}

function formatDollars(decimalDollars) {

	var formattedDollars = decimalDollars + '';

	if (formattedDollars.indexOf('.') == -1) {
		formattedDollars += '.00';
	} else if (formattedDollars.indexOf('.') == formattedDollars.length - 2) {
		formattedDollars += '0';
	}

	formattedDollars = '$' + formattedDollars;

	return(formattedDollars);

}

//************cookies

/*
 name - name of the cookie
 value - value of the cookie
 [expires] - expiration date of the cookie
 (defaults to end of current session)
 [path] - path for which the cookie is valid
 (defaults to path of calling document)
 [domain] - domain for which the cookie is valid
 (defaults to domain of calling document)
 [secure] - Boolean value indicating if the cookie transmission requires
 a secure transmission
 * an argument defaults when it is assigned null as a placeholder
 * a null placeholder is not required for trailing omitted arguments
 */

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	                ((expires) ? "; expires=" + expires.toGMTString() : "") +
	                ((path) ? "; path=" + path : "") +
	                ((domain) ? "; domain=" + domain : "") +
	                ((secure) ? "; secure" : "");
	document.cookie = curCookie;
}


/*
 name - name of the desired cookie
 return string containing value of specified cookie or null
 if cookie does not exist
 */

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}


/*
 name - name of the cookie
 [path] - path of the cookie (must be same as path used to create cookie)
 [domain] - domain of the cookie (must be same as domain used to
 create cookie)
 path and domain default if assigned null or omitted if no explicit
 argument proceeds
 */

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" +
		                  ((path) ? "; path=" + path : "") +
		                  ((domain) ? "; domain=" + domain : "") +
		                  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"

function fixDate(date) {
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
		date.setTime(date.getTime() - skew);
}

//************ end cookies


rnd.today = new Date();
rnd.seed = rnd.today.getTime();

function rnd() {
	rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
	return rnd.seed / (233280.0);
}
;

function rand(number) {
	return Math.ceil(rnd() * number);
}
;

function addLoadEvent(func, order) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {

		var addOrder = 'back';

		if (order != null) {
			addOrder = order;
		}

		if (addOrder == 'front') {

			window.onload = function() {
				func();
				oldonload();
			}

		} else {

			window.onload = function() {
				oldonload();
				func();
			}

		}
	}
}


function QA_alert(aStr) {
	if (document.location.href.indexOf('#QA_JS') != -1) {
		alert(aStr);
	}
}


function getSecondsParm() {
	var thisTime = new Date();
	return(thisTime.getTime());
}

//END UTILITY FUNCTIONS