<!--	
	/************************************************************************
	//	File:		core.js
	//	Author:		David Lu
	//	Date:		Feb 15, 2007
	//	Project:	Workflow Application
	//
	//	Last Mod:	10/10/2007  David Lu
	//	Comments:	This is the core javascript file, application functionality.
	//	Notes:		some useful alignment map functions:
	//				var selected_entities = ['siRNA_12345','GeXassay_Mm1234567_m1', 'siRNA_54321'];
    //				map.setSelected(selected_entities); // multiple IDs
    //				map.setSelected(['siRNA_34567']); // a single ID
    //				map.unselect('siRNA_12345'); // a single ID
    //				map.unselectAll();
	//	History:	 
	*************************************************************************/
	var sBrowser = navigator.appName;
	var nVersion = navigator.appVersion;
	var sAgent = navigator.userAgent;
	var coll = "";
	var styleObj = "";
	var show;
	var hide;
	var str_DOMDocument;
	var bisIE = false;
	var bisNav = false;
	var bisff = false;
	var bisff2 = false;
	var bissaf = false;
	var oldID = "";
	var oldiID = "";
	var checkflag = "false";

	if (sBrowser == "Microsoft Internet Explorer") {
		bisIE = true;
		if (nVersion.indexOf ("MSIE 7") != -1) { sBrowser = "ie"; nVersion = "7"; }
		else if (nVersion.indexOf ("MSIE 6") != -1) { sBrowser = "ie"; nVersion = "6"; }
    	else if (nVersion.indexOf ("MSIE 5") != -1) { sBrowser = "ie"; nVersion = "5"; }
    	else if (nVersion.indexOf ("MSIE 4") != -1) { sBrowser = "ie"; nVersion = "4"; }
    	else if (nVersion.indexOf ("MSIE 3") != -1) { sBrowser = "ie"; nVersion = "3"; }
    	else { 
			sBrowser = "ie";
			nVersion = "0";
		}
	} else if (nVersion.indexOf ("Safari") != -1) {
		bissaf = true;
    } else if (sAgent.indexOf ("Firefox/1") != -1) {
		bisff = true;
    } else if (sAgent.indexOf ("Firefox/2") != -1) {
		bisff2 = true;
    } else if (sBrowser == "Netscape") {
		bisNav = true;
	    if (parseInt(nVersion) == 7) { sBrowser = "nn";	nVersion = "7";	}	    
	    else if (parseInt(nVersion) == 6) {	sBrowser = "nn"; nVersion = "6"; }	    
	    else if (parseInt(nVersion) == 5) { sBrowser = "nn"; nVersion = "5"; }	    
	    else if (parseInt(nVersion) == 4) { sBrowser = "nn"; nVersion = "4"; }    	
    	else if (parseInt(nVersion) == 3) { sBrowser = "nn"; nVersion = "3"; }
    	else if (parseInt(nVersion) == 2) { sBrowser = "nn"; nVersion = "2"; }
   		else { sBrowser = "nn"; nVersion = "0"; }
	}

	if (bisIE)
	{
	    str_DOMDocument = "document.all";
        coll="all.";
        styleObj=".style";
		show = "visible";
		hide = "hidden";
	}
	else if (bisNav)
	{
	    if (nVersion == 5)
	    {
	        str_DOMDocument = "document.getElementById";
		    show = "visible";
		    hide = "hidden";
	    }
	    else
	    {
	        str_DOMDocument = "document.layers";
		    show = "show";
		    hide = "hide";
	    }
		// Reload document when user resizes window. This is necessary as
		// Netscape often fails to re-translate css styles and js code 
		// when document is resized.
		//if( document.layers)
		window.captureEvents( Event.RESIZE );
		window.onresize = reloadDoc;
	} else {
	        str_DOMDocument = "document.getElementById";
		    show = "visible";
		    hide = "hidden";
	}

	
	function reloadDoc()
	{
		parent.location.reload();
	}

	function pickStyleSheet()
	{ 
		//return the appropriate stylesheet
		if (bisIE) {
			if ("7" == nVersion)
			{
				return sBaseUrl + 'css/workflow_7.css';
			}
			else
			{
				return sBaseUrl + "css/workflow.css";
			}
		} else if (bissaf) {
			return sBaseUrl + "css/workflow_saf.css";
		} else {
			tmp = sAgent.split("/");
			version = tmp[tmp.length-1];			
			major = version.split(".")[0];
			if ("2" == major)
			{
				bisff2 = true;
				return sBaseUrl + "css/workflow_simple_ff2.css";
			}
			else
			{
				return sBaseUrl + "css/workflow_simple.css";
			}
		}
	}

	/***************** FORM FUNCTIONS ********************/

	function getRequestBody(oForm)  {
		//DL - helper function
		var aParams = new Array();
		for (var i=0 ; i < oForm.elements.length; i++)
		{
			if (oForm.elements[i].type == 'radio' || oForm.elements[i].type == 'checkbox') {
				if (oForm.elements[i].checked) {
					var sParam = encodeURIComponent(oForm.elements[i].name);
					sParam += "=";
					sParam += encodeURIComponent(oForm.elements[i].value);
					aParams.push(sParam);
				}
			} else {
				var sParam = encodeURIComponent(oForm.elements[i].name);
				sParam += "=";
				sParam += encodeURIComponent(oForm.elements[i].value);
				aParams.push(sParam);
			}
		}
		return aParams.join("&");
	}


	function sendRequest(sParam,sUrl,sMethod)  {
		//use Ajax to send request to page
		var oRequest = new Ajax.Request(sUrl,
			{
			method: sMethod,
			parameters: sParam,
			onSuccess: function(transport) {
				var response = transport.responseText || "no response";
			},
			onFailure: function(transport) {
			}
				
		});
	}

	function sendRequestExt(sParam,sUrl,sMethod, act, sEval)  {
		//use Ajax to send request to page. Same as sendRequest
		//except one additional parameter, string to evaluate on success.
		
		var oRequest = new Ajax.Request(sUrl,
			{
			method: sMethod,
			parameters: sParam,
			requestHeaders: {Accept: 'application/json'}, 
			onSuccess: function(transport) {				
				if (act=='get')	{
					var prod_val = transport.responseText;
					sParams = "prod=" + prod_val + "&act=rem";
					sendRequestExt(sParams, sBaseUrl + "pages/updatebasket.php","get", "rem", "toggleProduct('"+prod_val+"',1)");
				}
				if (sEval) {
					//evaluate the expression
					eval(sEval);
				}
			},
			onFailure: function(transport) {
			}
				
		});
	}

	function removeAllItemsFromHistory() {
		//New for version 3.1
		var str_divid = "divHistory";
		var DOM_main = document.getElementById(str_divid);
		var oChild, divItems;
		var count;

		divItems=DOM_main.getElementsByTagName("div");
		count = divItems.length;
		while (divItems.length > 0) {
			oChild = divItems[0];
			DOM_main.removeChild(oChild);
		}
		
		return;
	}

	function removeAllItemsFromResultsHistory() {
		//DL - 3/18/2008
		var str_divid = "divResultsHistory";
		var DOM_main = document.getElementById(str_divid);
		var oChild, divItems;
		var count;

		if (DOM_main) {
			divItems=DOM_main.getElementsByTagName("div");
			count = divItems.length;
			while (divItems.length > 0) {
				oChild = divItems[0];
				DOM_main.removeChild(oChild);
			}
		}
				
		return;
	}

	function btnHistoryOver(e) {
		//New for version 3.1
		var DOM_div = document.getElementById("divHistory");
		if (DOM_div.style.display == "block") {
			//do nothing
			return;
		} else {
			e.src = "images/btn_history_over.gif";
		}
		return;
	}

	function btnHistoryOut(e) {
		//New for version 3.1
		var DOM_div = document.getElementById("divHistory");
		if (DOM_div.style.display == "block") {
			//do nothing
			return;
		} else {
			e.src = "images/btn_history.gif";
		}
		return;
	}

	function btnHistoryResultsOver(e) {
		//DL 3/18/2008
		var DOM_div = document.getElementById("divResultsHistory");
		if (DOM_div) {
			if (DOM_div.style.display == "block") {
				//do nothing
				return;
			} else {
				e.src = "images/btn_results_history_over.gif";
			}
		}
		return;
	}

	function btnHistoryResultsOut(e) {
		//DL - 3/19/2008
		var DOM_div = document.getElementById("divResultsHistory");
		if (DOM_div) {
			if (DOM_div.style.display == "block") {
				//do nothing
				return;
			} else {
				e.src = "images/btn_results_history.gif";
			}
		}
		return;
	}

	function mouseOverHx(event) {
		//New for version 3.1
		var id;
		var DOM_sp;
		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_sp = document.getElementById(id);
		DOM_sp.className = "searchhistorylistHOVER";
		DOM_sp.style.backgroundColor = "#F9F9FF";
		DOM_sp.style.border = "1px dotted #000000";
	}

	function mouseOutHx(event) {
		//New for version 3.1
		var id;
		var DOM_sp;
		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_sp = document.getElementById(id);		
		DOM_sp.style.backgroundColor = "#E3EAF6";
		DOM_sp.style.border = "1px solid #E3EAF6";
		DOM_sp.className = "searchhistorylist";
	}


	function mouseclickHx(event)  {
		//New for version 3.1
		var selval;
		var div = t.tabs[0].div;
		var sdiv = '';
		var id;
		var DOM_sp;
		var DOM_div = document.getElementById("divHistory");

		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_sp = document.getElementById(id);
		selval = DOM_sp.innerHTML;

		for (i=0;i<n_maxhxitems;i++) {
			if (arr_oHx[i][0] == selval) {
				sdiv = arr_oHx[i][1];
				sStep = arr_oHx[i][2];
				s_curHx = selval;
				bNewHx = true;
			}
		}
		DOM_div.style.display = "none";
		document.getElementById("imgHistory").src = 'images/btn_history.gif';

		if (sdiv != '')	{
			n_curStep = sStep;
			arr_curTabSubstep[0] = n_curStep;
			setStepIcons(0,n_curStep);
			//displayNextPrevStep();


			oForm = document.getElementById('frmsearchForm');
			sParams = getRequestBody(oForm);
			//go fetch the results page	
			t.sSearchcat = oForm.selSearchCategory.value;
			t.sSearchSpecies = oForm.selSearchSpecies.value;
			t.sSearchtype = oForm.selSearchType.value;
			t.sSearchTerms = oForm.searchText.value;

			div.innerHTML = sdiv;
			if (n_curStep == 1)	{
				oDiv1 = sdiv;
			} else if (n_curStep == 2) {
				oDiv2 = sdiv;
			}
			SyncProducts();		

			sendRequest(sParams, sBaseUrl + "pages/updatesession.php","get");
			if (bissaf) {
				sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
			} else {
				if (ib && ib._properties.visible) {
					ib.hide();
				}
				ib.setURL("help/stepinfo" + n_curStep + ".php");
			}
			//don't need to set hb object's url because it only changes for tabs, not steps.
			//Since users must be on tab 1 to even click on a history item, there's no change.
		}
	}

	function mouseclickResultsHx(event)  {
		//DL - 3/19/2008
		var selval;
		var div = t.tabs[0].div;
		var sdiv = '';
		var id;
		var DOM_sp;
		var DOM_div = document.getElementById("divResultsHistory");

		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_sp = document.getElementById(id);
		selval = DOM_sp.innerHTML;

		for (i=0;i<n_maxhxitems;i++) {
			if (arr_oResultsHx[i][0] == selval) {
				sdiv = arr_oResultsHx[i][1];
				sStep = arr_oResultsHx[i][2];
				s_curResultsHx = selval;
				bNewResultsHx = true;
			}
		}
		if (DOM_div) {
			DOM_div.style.display = "none";
			document.getElementById("imgHistory").src = 'images/btn_history.gif';
		}

		if (sdiv != '')	{
			n_curStep = 2;
			arr_curTabSubstep[0] = 2;
			setStepIcons(0,2);
			//displayNextPrevStep();

			div.innerHTML = sdiv;
			oDiv2 = sdiv;
			
			SyncProducts();

			//sendRequest(sParams, sBaseUrl + "pages/updatesession.php","get");
			if (bissaf) {
				sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
			} else {
				if (ib && ib._properties.visible) {
					ib.hide();
				}
				ib.setURL("help/stepinfo" + n_curStep + ".php");
			}
			//don't need to set hb object's url because it only changes for tabs, not steps.
			//Since users must be on tab 1 to even click on a history item, there's no change.
		}
	}

	function displayHistory() {
		//New as of version 3.1
		if (n_curStep == 0 && n_hxcursor > 0) {		
			document.getElementById("spHistory").style.display = 'block';
			document.getElementById("imgHistory").style.display = 'block';
		}
		return;
	}

	function displayResultsHistory() {
		//DL - 3/19/2008
		if (n_curStep == 2 && n_resultshxcursor > 0) {		
			document.getElementById("spResultsHistory").style.display = 'block';
			document.getElementById("imgResultsHistory").style.display = 'block';
		}
		return;
	}

	function hideHistory() {
		if (n_curStep != 0) {
			document.getElementById("spHistory").style.display = 'none';
			document.getElementById("imgHistory").style.display = 'none';
			document.getElementById("divHistory").style.display = 'none';
		}
		return;
	}

	function hideResultsHistory() {
		if (n_curStep != 2) {
			document.getElementById("spResultsHistory").style.display = 'none';
			document.getElementById("imgResultsHistory").style.display = 'none';
			document.getElementById("divResultsHistory").style.display = 'none';
		}
		return;
	}

	function fillHistory() {
		//New as of version 3.1
		var DOM_div = document.getElementById("divHistory");
		var DOM_img = document.getElementById("imgHistory");
		if (DOM_div.style.display == "block") {
			//hide it again
			DOM_div.style.display = "none";
			DOM_img.src = "images/btn_history.gif";
			return;
		} else if (!bNewHx && n_hxcursor > 0) {
			DOM_img.src = "images/btn_history_on.gif";
			DOM_div.style.display = "block";
			return;
		}
		
		var DOM_sp;
		var n_count = 0;
		var n_hsize = 0;
		
		removeAllItemsFromHistory()
		for (i=n_maxhxitems-1;i>=0;i--) {
			s_val = arr_oHx[i][0];
			if (s_val != '') {
				DOM_sp = document.createElement("div");
				if (s_val != s_curHx) {
					DOM_sp.className = "searchhistorylist";
					DOM_sp.onclick = mouseclickHx;
					DOM_sp.id = "sphxid" + i;
					DOM_sp.onmouseover = mouseOverHx;
					DOM_sp.onmouseout = mouseOutHx;								
					DOM_sp.appendChild(document.createTextNode(s_val));
					DOM_div.appendChild(DOM_sp);
					bNewHx = false;
					n_count++;
				}
			}
		}
		
		if (!bisIE) {
			if (bisff2)	{
				n_hsize = (n_count * 22);
			} else {
				n_hsize = (n_count * 24);
			}
			s_hsize = n_hsize.toString() + 'px';
			DOM_div.style.height = s_hsize;
			if (n_count > 0) {
				DOM_img.src = "images/btn_history_on.gif";
				DOM_div.style.display = "block";
			}
		}  else {
			DOM_div.style.height = (n_count * 24);
			if (n_count > 0) {
				DOM_img.src = "images/btn_history_on.gif";
				DOM_div.style.display = "block";
			}
		}
	return;
	}

	function fillResultsHistory() {
		//New as of version 3.1
		var DOM_div = document.getElementById("divResultsHistory");
		var DOM_img = document.getElementById("imgResultsHistory");
		if (DOM_div && DOM_img) {
			if (DOM_div.style.display == "block") {
				//hide it again
				DOM_div.style.display = "none";
				DOM_img.src = "images/btn_results_history.gif";
				return;
			} else if (!bNewResultsHx && n_resultshxcursor > 0) {
				DOM_img.src = "images/btn_results_history_on.gif";
				DOM_div.style.display = "block";
				return;
			}
		
			var DOM_sp;
			var n_count = 0;
			var n_hsize = 0;
			
			removeAllItemsFromResultsHistory()
			for (i=n_maxhxitems-1;i>=0;i--) {
				s_val = arr_oResultsHx[i][0];
				if (s_val != '') {
					DOM_sp = document.createElement("div");
					if (s_val != s_curResultsHx) {
						DOM_sp.className = "searchhistorylist";
						DOM_sp.onclick = mouseclickResultsHx;
						DOM_sp.id = "sprehxid" + i;
						DOM_sp.onmouseover = mouseOverHx;
						DOM_sp.onmouseout = mouseOutHx;								
						DOM_sp.appendChild(document.createTextNode(s_val));
						DOM_div.appendChild(DOM_sp);
						bNewResultsHx = false;
						n_count++;
					}
				}
			}
			
			if (!bisIE) {
				if (bisff2)	{
					n_hsize = (n_count * 22);
				} else {
					n_hsize = (n_count * 24);
				}
				s_hsize = n_hsize.toString() + 'px';

				DOM_div.style.height = s_hsize;
				if (n_count > 0) {
					DOM_img.src = "images/btn_results_history_on.gif";
					DOM_div.style.display = "block";
				}
			}  else {
				DOM_div.style.height = (n_count * 24);
				if (n_count > 0) {
					DOM_img.src = "images/btn_results_history_on.gif";
					DOM_div.style.display = "block";
				}
			}
		} //end if DOM_div && DOM_img
	return;
	}

	function checkClick(event) {
		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}
		if (id == 'imgHistory' || id == 'spHistory' || id.indexOf('sphxid') != -1 || id == 'imgResultsHistory' || id == 'spResultsHistory' || id.indexOf('sprehxid') != -1) {
			return;
		}
		var DOM_div = document.getElementById("divHistory");
		var DOM_img = document.getElementById("imgHistory");
		if (DOM_div && DOM_img && DOM_div.style.display == "block") {
			//hide it
			DOM_div.style.display = "none";
			DOM_img.src = "images/btn_history.gif";
			return;
		}
		DOM_div = document.getElementById("divResultsHistory");
		DOM_img = document.getElementById("imgResultsHistory");
		if (DOM_div && DOM_img && DOM_div.style.display == "block") {
			//hide it
			DOM_div.style.display = "none";
			DOM_img.src = "images/btn_results_history.gif";
			return;
		}
	}

	document.onmousedown = checkClick;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown = checkClick;

	function checkUniqueHistory(item) {
		//see if item already exists in array.
		if (item == '') {
			return false;
		}
		for (var i=0;i<n_maxhxitems;i++) {
			if (arr_oHx[i][0] == item) {
				return false;
			}
		}
		return true;
	}

	function checkUniqueResultsHistory(item) {
		//see if item already exists in array.
		if (item == '') {
			return false;
		}
		for (var i=0;i<n_maxhxitems;i++) {
			if (arr_oResultsHx[i][0] == item) {
				return false;
			}
		}
		return true;
	}

	function History_Pop() {
		//New of as version 3.1
		for (i=0;i<n_maxhxitems-1;i++) {
			arr_oHx[i][0] = arr_oHx[i + 1][0];
			arr_oHx[i][1] = arr_oHx[i + 1][1];
			arr_oHx[i][2] = arr_oHx[i + 1][2];
		}
		n_hxcursor--;
		return;
	}

	function HistoryResults_Pop() {
		//DL - 3/19/2008
		for (i=0;i<n_maxhxitems-1;i++) {
			arr_oResultsHx[i][0] = arr_oResultsHx[i + 1][0];
			arr_oResultsHx[i][1] = arr_oResultsHx[i + 1][1];
			arr_oResultsHx[i][2] = arr_oResultsHx[i + 1][2];
		}
		n_resultshxcursor--;
		return;
	}

	function toggle_vis(prod_type) {
		var bOn = false;
		var name = 'hide_' + prod_type;
		elem = document.getElementById(name);
		if (elem) {
			if (elem.style.display == 'none') {
				elem.style.display = 'block';
				bOn = true;
				//display the sirnas in alignment map if present.
				if (prod_type == 'sirna') {
					var amap = document.getElementById('hide_amap');
					if (amap) {
						map.showSilencersiRNAs();
						map.reloadMap();
					}
				}
			} else {
				elem.style.display = 'none';
				bOn = false;
			}
		}
		if (bOn) {
			//change the className
			var name = 'td_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.className = "catimgheaderbarOn Assay";
			}
			//change the image
			var name = 'img_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.src = "images/btn_arrow_dn.gif";
			}
			arr_Expand[prod_type] = '1';	//opened
		} else {
			//change the className
			var name = 'td_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.className = "catimgheaderbar Assay";
			}
			//change the image
			var name = 'img_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.src = "images/btn_arrow_rt.gif";
			}
			arr_Expand[prod_type] = '0';	//closed
		}
	}

	function toggle_vis_ext(prod_type, nStatus) {
		var name = 'hide_' + prod_type;
		elem = document.getElementById(name);
		if (nStatus > 0) {
			//show the block
			if (elem) {
				elem.style.display = 'block';
			}
			//change the className
			var name = 'td_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.className = "catimgheaderbarOn Assay";
			}
			//change the image
			var name = 'img_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.src = "images/btn_arrow_dn.gif";
			}
		} else {
			//Hide the block
			if (elem) {
				elem.style.display = 'none';
			}
			//change the className
			var name = 'td_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.className = "catimgheaderbar Assay";
			}
			//change the image
			var name = 'img_' + prod_type;
			elem = document.getElementById(name);
			if (elem) {
				elem.src = "images/btn_arrow_rt.gif";
			}
		}
	}
	
	function hover_head(sId) {
		var bOn = false;
		var name = 'hide_' + sId;
		elem = document.getElementById(name);
		if (elem) {
			bOn = (elem.style.display == 'block')?true:false;
		} else {
			bOn = false;
		}
		var name = 'td_' + sId;
		elem = document.getElementById(name);
		if (bOn) {
			//change the className
			if (elem) {
				elem.className = "catimgheaderbarOn Assay";
			}

			//change the image
			var name = 'img_' + sId;
			elem = document.getElementById(name);
			if (elem) {
				elem.src = "images/btn_arrow_dn.gif";
			}
		} else {
			//change the className
			if (elem) {
				elem.className = "catimgheaderbar Assay";
			}

			//change the image
//			var name = 'img_' + sId;
//			elem = document.getElementById(name);
//			if (elem) {
//				elem.src = "images/btn_arrow_rt.gif";
//			}
		}
	}

	function hover_head_over(sId) {
		var name = 'td_' + sId;
		elem = document.getElementById(name);
		//change the className
		if (elem) {
			elem.className = "catimgheaderbarHover Assay";
		}
		//change the image
//		var name = 'img_' + sId;
//		elem = document.getElementById(name);
//		if (elem) {
//			elem.src = "images/processing_circle_3.gif";
//		}
	}

	function GeXassay_selected(assay_id) {
		// Tell the map to display the assay as selected (or unselected):
		// map.toggleSelected ("GeXassay_" + assay_id);
		var assays = document.getElementById('hide_taqman').getElementsByTagName('img');
		if (!assays) {
			return false;
		}
		var found = null;
		for(var i = 0; i < assays.length; i++) {
			if (assays[i].id.indexOf(assay_id) != -1)
			{
				found = assays[i];
			}
		}
		checkProduct(found);
	}

	function siRNA_selected(siRNA_id) {
		// Tell the map to display the assay as selected (or unselected):
		// map.toggleSelected ("siRNA" + siRNA_id);
		var assays = document.getElementById('hide_sirna').getElementsByTagName('img');
		var seassays =  document.getElementById('hide_ssirna').getElementsByTagName('img');
		var found = null;
		if (assays) {
			for(var i = 0; i < assays.length; i++) {
				if (assays[i].id.indexOf(siRNA_id) != -1)
				{
					found = assays[i];
				}
			}
		}
		if (seassays) {
			if (!found)	{
				for(var i = 0; i < seassays.length; i++) {
					if (seassays[i].id.indexOf(siRNA_id) != -1)
					{
						found = seassays[i];
					}
				}
			}
		}
		if (!assays && !seassays) {
			return false;
		}
		checkProduct(found);
	}

	function ssiRNA_selected(siRNA_id) {
		// Tell the map to display the assay as selected (or unselected):
		// map.toggleSelected ("siRNA" + siRNA_id);
		var assays = document.getElementById('hide_ssirna').getElementsByTagName('img');
		if (!assays) {
			return false;
		}
		var found = null;
		for(var i = 0; i < assays.length; i++) {
			if (assays[i].id.indexOf(siRNA_id) != -1)
			{
				found = assays[i];
			}
		}
		checkProduct(found);
	}

	function getmap(div,gene_id) {
		map = new AlignMap(div,null);
	    map.setIncludedFeatures('siRNA,GeX');
		map.setEventHook("GeXassay", GeXassay_selected);
		map.setEventHook("siRNA",    siRNA_selected);
		map.setEventHook("onFirstLoaded", SyncProducts);
		//see if Silencer is expanded on initial display.
		var elem = document.getElementById('hide_sirna');
		if (elem) {
			if (elem.style.display == 'block') {
				map.showSilencersiRNAs();
			} else {
				if (n_sirna < 1) {
					map.hideSilencersiRNAs();
				}				
			}
		}
		map.showMap("gene_id", gene_id);
	}

	function postToPage(div,sParam,sUrl,sMethod)  {
		//use Ajax to send request to page
		showprogress(progcode);
		sParam += '&tab=' + (parseInt(n_curTab) + 1);
		var oRequest = new Ajax.Updater(div, sUrl,
		{
			method:sMethod,
			parameters:sParam,
			evalScripts:true,
			onFailure: function(transport) {
				div.innerHTML += "<BR><BR>Error:" + transport.statustext;
			},
			onComplete: function() {
				hideprogress();
				if (bSearch || bGene) {
					//change info content to post-search content
					if (bissaf) {
						ib = "help/stepinfo" + n_curStep + ".php";
					} else {
						if (ib && ib._properties.visible) {
							ib.hide();
						}
						ib.setURL("help/stepinfo" + n_curStep + ".php");
					}
				}
				if (bSearch) {
					var newdiv = t.tabs[0].div;
					if (t.sSearchSpecies == 'Homo sapiens') {
						var str_species = 'Human';
					} else if (t.sSearchSpecies == 'Mus musculus') {
						var str_species = 'Mouse';
					} else if (t.sSearchSpecies == 'Rattus norvegicus') {
						var str_species = 'Rat';
					} else {
						var str_species = 'All species';
					}
					var tsST = ''
					if (t.sSearchTerms.length <= 10)
					{
						tsST = t.sSearchTerms;
					} else {
						tsST = t.sSearchTerms.slice(0,7) + '...';
					}
					var s_hx = t.sSearchcat + ' ' + t.sSearchtype + ' ' + tsST + ' for ' + str_species;
					//Check to see if this one already exists first.
					if (!checkUniqueHistory(s_hx)) {
						bSearch = false;
						return;
					}
					if (n_hxcursor == n_maxhxitems) {
						History_Pop();
					}
					arr_oHx[n_hxcursor][0] = s_hx;
					arr_oHx[n_hxcursor][1] = newdiv.innerHTML;
					arr_oHx[n_hxcursor][2] = n_curStep;
					s_curHx = arr_oHx[n_hxcursor][0];
					bSearch = false;
					bNewHx = true;
					n_hxcursor++;
					if (n_hxcursor > 1) {
						displayHistory();
					}
				} else if (bGene) {
					bGene = false;
					bNewHx = true;
					s_curHx = '';
					getmap('hide_amap', t.sGeneID);
					saveResultsHistory();
				} else {
					s_curHx = '';
				}
				if (bissaf && oSafWin) {
					oSafWin.close();
					oSafWin = 0;
				}
				if (n_curStep == 0) {
					displayHistory();
				} else if (n_curStep == 2)	{
					displayResultsHistory();
				}
			}
		});	
	}

	function saveResultsHistory() {
		var newdiv = t.tabs[0].div;
		if (t.sSearchSpecies == 'Homo sapiens') {
			var str_species = 'Human';
		} else if (t.sSearchSpecies == 'Mus musculus') {
			var str_species = 'Mouse';
		} else if (t.sSearchSpecies == 'Rattus norvegicus') {
			var str_species = 'Rat';
		} else {
			var str_species = 'All species';
		}

		var s_hx = 'Gene ID = ' + t.sGeneID + ' - ' + str_species;
		//Check to see if this one already exists first.
		if (!checkUniqueResultsHistory(s_hx)) {
			bGene = false;
			return;
		}
		if (n_resultshxcursor == n_maxhxitems) {
			HistoryResults_Pop();
		}
		arr_oResultsHx[n_resultshxcursor][0] = s_hx;
		arr_oResultsHx[n_resultshxcursor][1] = newdiv.innerHTML;
		arr_oResultsHx[n_resultshxcursor][2] = 2;
		s_curResultsHx = arr_oResultsHx[n_resultshxcursor][0];
		bNewResultsHx = true;
		n_resultshxcursor++;
		if (n_resultshxcursor > 1) {
			displayResultsHistory();
		}
	}

	function goSearchGene(i,fid,url) {
		var div = t.tabs[i].div;
		var sURL = "";
		oForm = document.getElementById(fid);
		sParams = getRequestBody(oForm);
		sURL = sBaseUrl + url;
		//go fetch the results page	
		bSearch = true;
		t.sSearchcat = oForm.selSearchCategory.value;
		t.sSearchSpecies = oForm.selSearchSpecies.value;
		t.sSearchtype = oForm.selSearchType.value;
		t.sSearchTerms = oForm.searchText.value;
		t.sGeneID = "";		//reset
		progcode = 1;
		oDiv = div.innerHTML;
		postToPage(div,sParams,sURL,"get");
		if (t.sSearchcat != 'sirna_id' && t.sSearchcat != 'assay_id') {
			bSubmit = true;
			bPrevSubmit = true;
			n_curStep = 1;
			setStepIcons(i,n_curStep);			
		} else {
			bSubmit = false;
			bPrevGene = true;
			n_curStep = 2;
			setStepIcons(i,n_curStep);
		}
		n_curTab = i;
		arr_curTabSubstep[n_curTab] = n_curStep;
		//displayNextPrevStep();
	}

	function goGeneSirnaPage(i,str_geneid,str_species,str_prodid,url,count) {
		var div = t.tabs[i].div;
		var sURL = "";
		var prevstep;		
		var sParams = "geneid=" + str_geneid + "&species=" + str_species + "&count=" + count + "&act=get";		
		var sURL = sBaseUrl + url;	// + strGoto;
		bGene = true;
		bPrevGene = true;
		progcode = 1;

		prevstep = n_curStep;
		setStepIcons(i,2);
		n_curStep = 2;
		arr_curTabSubstep[i] = n_curStep;
		//displayNextPrevStep();

		//change the select button to green, and previous green one to orange again.
		oImg = document.getElementById('img_' + t.sPrevGeneID);
		if (oImg) {
			oImg.src = 'images/btn_select.gif';
		}
		oImg = document.getElementById('img_' + str_geneid);
		if (oImg) {
			oImg.src = 'images/btn_select_on.gif';
			t.sPrevGeneID = str_geneid;
		}

		//store the results page
		if (prevstep == 1 && bSubmit) {
			oDiv1 = div.innerHTML;
		} else if (prevstep == 2) {
			oDiv2 = div.innerHTML;
		} else if (prevstep == 0) {
			oDiv = div.innerHTML;
		}

		postToPage(div,sParams,sURL,"get");
		//set to one customer clicked
		t.sGeneID = str_geneid;
		t.sSearchSpecies = str_species;

		// WE NEED TO STORE THE DIV FOR THIS CALL
	}

	function jumpToProduct(i,str_type,str_geneid,str_species,str_prodid,n_step,count) {
		//later on use product_id to scroll page to product line.
		var div = t.tabs[i].div; 
		var sURL = "";
		var i, nAct, nTab, nPrevstep;
		var geneid, species, searchcat;
		var searchtype, searchterms, sParams;
		var str_step, str_page;
		var arr_temp;

		nPrevstep = n_curStep;
		n_curStep = n_step;
		str_page = getItem(arr_steps[n_curStep],'|',2);

		if (i != n_curTab)	{
			//DL - Make sure we are not already on the target tab.
			//we need to switch the view to the new tab containing the step we need.			
			t.tabShow(i);
			//
			//assign the current tab
			n_curTab = i;
			setStepIcons(n_curTab,n_curStep);
		}
		else {
			hiliteStep(n_curStep,nPrevstep);
		}
		//displayNextPrevStep();
		arr_curTabSubstep[i] = n_curStep;

		if (n_curStep != 0) {
			hideHistory();
		}

		sParams = "geneid=" + str_geneid + "&species=" + str_species + "&prodid=" + str_prodid + "&count=" + count + "&type=" + str_type + "&act=get";
		bGene = true;
		bPrevGene = true;
		t.sGeneID = str_geneid;
		t.sSearchSpecies = str_species;

		//change the info and help button links
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			//ib.options.dataURL = "help/stepinfo" + n_curStep + ".php";
			//hb.options.dataURL = "help/userhelp" + n_curTab + ".php";
			if (ib._properties.visible) {
				ib.hide();
			}
			ib.setURL("help/stepinfo" + n_curStep + ".php");

			//change the help button link
			if (hb._properties.visible) {
				hb.hide();
			}
			hb.setURL("help/userhelp" + n_curTab + ".php");
		}
		sURL = sBaseUrl + sBaseFolder + str_page;
		progcode = 1;
		postToPage(div,sParams,sURL,"get");
		// WE NEED TO STORE THE DIV FROM THIS CALL
		return;
	}

	function jumpToTm(i,str_type,str_geneid,str_species,str_prodid,n_step,count) {
		//later on use product_id to scroll page to product line.
		var div = t.tabs[i].div; 
		var sURL = "";
		var i, nAct, nTab, nPrevstep;
		var geneid, species, searchcat;
		var searchtype, searchterms, sParams;
		var str_step, str_page;
		var arr_temp;

		nPrevstep = n_curStep;
		n_curStep = n_step;
		str_page = getItem(arr_steps[n_curStep],'|',2);

		if (i != n_curTab)	{
			//DL - Make sure we are not already on the target tab.
			//we need to switch the view to the new tab containing the step we need.			
			t.tabShow(i);
			//
			//assign the current tab
			n_curTab = i;
			setStepIcons(n_curTab,n_curStep);
		}
		else {
			hiliteStep(n_curStep,nPrevstep);
		}
		//displayNextPrevStep();
		arr_curTabSubstep[i] = n_curStep;

		if (n_curStep != 0) {
			hideHistory();
		}

		sParams = "geneid=" + str_geneid + "&species=" + str_species + "&searchText=" + str_prodid + "&count=" + count + "&type=" + str_type + "&selSearchCategory=assay_id&act=submit";
		bGene = true;
		bPrevGene = true;
		t.sGeneID = str_geneid;
		t.sSearchSpecies = str_species;

		//change the info and help button links
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			ib.options.dataURL = "help/stepinfo" + n_curStep + ".php";
			hb.options.dataURL = "help/userhelp" + n_curTab + ".php";
		}
		sURL = sBaseUrl + sBaseFolder + str_page;
		progcode = 1;
		postToPage(div,sParams,sURL,"get");
		return;
	}

	function jumpTosiRNA(i,str_type,str_geneid,str_species,str_prodid,n_step,count) {
		//later on use product_id to scroll page to product line.
		var div = t.tabs[i].div; 
		var sURL = "";
		var i, nAct, nTab, nPrevstep;
		var geneid, species, searchcat;
		var searchtype, searchterms, sParams;
		var str_step, str_page;
		var arr_temp;

		nPrevstep = n_curStep;
		n_curStep = n_step;
		str_page = getItem(arr_steps[n_curStep],'|',2);

		if (i != n_curTab)	{
			//DL - Make sure we are not already on the target tab.
			//we need to switch the view to the new tab containing the step we need.			
			t.tabShow(i);
			//
			//assign the current tab
			n_curTab = i;
			setStepIcons(n_curTab,n_curStep);
		}
		else {
			hiliteStep(n_curStep,nPrevstep);
		}
		//displayNextPrevStep();
		arr_curTabSubstep[i] = n_curStep;

		if (n_curStep != 0) {
			hideHistory();
		}

		sParams = "geneid=" + str_geneid + "&species=" + str_species + "&searchText=" + str_prodid + "&count=" + count + "&type=" + str_type + "&selSearchCategory=sirna_id&act=submit";
		bGene = true;
		bPrevGene = true;
		t.sGeneID = str_geneid;
		t.sSearchSpecies = str_species;

		//change the info and help button links
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			ib.options.dataURL = "help/stepinfo" + n_curStep + ".php";
			hb.options.dataURL = "help/userhelp" + n_curTab + ".php";
		}
		sURL = sBaseUrl + sBaseFolder + str_page;
		progcode = 1;
		postToPage(div,sParams,sURL,"get");
		return;
	}

	function reloadPage(n_scrollTop) {
		 var div, geneid, species, searchcat,str_step, str_page, str_url, pkCountry;
		 var searchtype, searchterms, sParams;

		 str_step = arr_steps[n_curStep];		//get step info
		 //parse out the page we need
		 str_url = sBaseFolder + getItem(str_step,'|',2);
		 str_page = sBaseUrl + str_url;
		 //target page will be within current tab
		 div = t.tabs[n_curTab].div;
		 geneid = (t.sGeneID != '')?t.sGeneID:'';
		 species = (t.sSearchSpecies != '')?t.sSearchSpecies:'';
		 searchcat = (t.sSearchcat != '')?t.sSearchcat:'';
		 searchtype = (t.sSearchtype != '')?t.sSearchtype:'';
		 searchterms = (t.sSearchTerms != '')?t.sSearchTerms:'';
		 pkCountry = (t.sCountry != '')?t.sCountry:'';
		 sParams = "geneid=" + geneid + "&species=" + species + "&searchcat=" + searchcat + "&searchtype=" + searchtype + "&searchterms=" + searchterms + "&choose_country=" + pkCountry;
		 if (n_curStep == 2 && geneid != '') {
			 bGene = true;
			 bPrevGene = true;
			 sParams = sParams + "&act=get";
		 } 
		 else if (n_curStep == 1 && searchcat != '' && searchterms != '') {
			sParams = sParams + '&act=submit';
		 }
		progcode = 2;	//2=loading page

		if (n_scrollTop > 0) {
			postToPageScroll(div,sParams,str_page,"get",n_scrollTop);
		} else {
			postToPage(div,sParams,str_page,"get");
		}
		return;
	}

	function sp2engl(spname) {
		if ("Mus musculus" == spname)
		{
			return "Mouse";
		}
		else if ("Homo sapiens" == spname)
		{
			return "Human";
		}
		else if ("Rattus norvegicus" == spname)
		{
			return "Rat";
		}
		else
		{
			return "Unknown";
		}
	}

	function mouseOverStatusItem(event) {
		var id, sId, sId2, sName;
		var elem, elem2;
		if (window.event) {
			elem = window.event.srcElement;
			id = elem.id;
		}
		else {
			elem = Event.element(event);
			id = elem.id;
		}
		if (elem.name && elem.name.length > id.length) {
			id=elem.name;
			var arr_prod = getArrayFromRequestString(id, '|~|' );
			var str_type = arr_prod[0].substr(2, id.length);
			if ('sirna' == str_type || 'ge' == str_type || 'sise' == str_type) {
				sName = arr_prod[1];
			} else {
				sName = arr_prod[2];
			}
		} else {
			sName = elem.name;
		}
		window.status = "Go to product page for " + sName;
		if (n_curTab < 4) {
			sId = 'tr_' + id.substr(2, id.length);
			sId2 = 'ts_' + id.substr(2, id.length);
		} else {
			sId = 'tc_' + id.substr(2, id.length);
		}

		elem = document.getElementById(sId);
		elem2 = document.getElementById(sId2);
		if (elem) {
			elem.style.backgroundColor = '#bec5de';
		}
		if (elem2) {
			elem2.style.backgroundColor = '#bec5de';
		}
		return true;
	}

	function mouseOutStatusItem(event) {
		var id, sId2;
		var elem;
		if (window.event) {
			elem = window.event.srcElement;
			id = elem.id;
		}
		else {
			elem = Event.element(event);
			id = elem.id;
		}

		window.status = "";
		if (n_curTab < 4) {
			sId = 'tr_' + id.substr(2, id.length);
			sId2 = 'ts_' + id.substr(2, id.length);
		} else {
			sId = 'tc_' + id.substr(2, id.length);
		}		
		elem = document.getElementById(sId);
		elem2 = document.getElementById(sId2);
		if (elem) {
			elem.style.backgroundColor = '';
		}
		if (elem2) {
			elem2.style.backgroundColor = '';
		}
		return true;
	}

	function mouseOverStatusLine(spid) {
		var sId;
		var elem;

		window.status = "";
		sId = 'a_' + spid;
		elem = document.getElementById(sId);

		if (elem) {
			elem.className = 'statusitemhover';
		}
		return true;
	}

	function mouseOutStatusLine(spid) {
		var sId;
		var elem;

		window.status = "";
		sId = 'a_' + spid;
		elem = document.getElementById(sId);
		if (elem) {
			elem.className = '';
		}
		return true;
	}

	function getStringOptions(s_prod) {
		var s_options = '';
		var arr_product = getArrayFromRequestString(s_prod, "|~|");
		switch (arr_product[0])	{
			case 'sise':
			case 'sirna':
				s_options = ', ' + (arr_product[8]).toLowerCase() + ', ' + ((arr_product[10] != 'None')?(arr_product[10] + ', '):'') + arr_product[7];
				break;
			case 'tmctrl':
			default:
				// 02/12/08 Matt: Added quick fix for inventoried/made to order taqman
				if (arr_product[0] == "ge" && 0 == arr_product[2])
				{
					s_options = ', 360 ul';
				  
				} else { 
					s_options = ', ' + arr_product[7];
				}
				re = /reactions/g;
				s_options.replace(re, 'rxns');
		}
		return s_options;
	}

	function updateStatusPanelOptions(s_new_strprod) {

		var arr_product = getArrayFromRequestString(s_new_strprod, "|~|");
		var str_type = arr_product[0];
		var s_id, a_id, i;
		var obj_options;

		if ('sirna' == str_type || 'sise' == str_type) {
			s_id = 'opt_' + arr_product[1];
			a_id = arr_product[1];
		} else {
			s_id = 'opt_' + arr_product[2];
			a_id = arr_product[2];
		}
		obj_options = document.getElementById(s_id);

		if (obj_options) {
			obj_options.innerHTML = getStringOptions(s_new_strprod);
			//update the status panel item ids
			obj_options.name = 'o_' + s_new_strprod;
			var sItems = document.getElementsByTagName("a");
			for (i=0;i<sItems.length;i++) {
				if (sItems[i].name.indexOf(a_id) != -1) {
					sItems[i].id = 'a_' + s_new_strprod;
					i = sItems.length;
				}
			}
		}
	}

	function addItemToStatusPanel(elem) {
		if (elem.type == 'checkbox') {
			var prod_val = elem.value;
		} else if (elem.type == 'button') {
			var prod_val = elem.id;
		} else if (typeof(elem) == 'string') {
			var prod_val = elem;
		} else {
			return false;
		}

		var arr_prod = getArrayFromRequestString( prod_val, "|~|" );
		var str_type = arr_prod[0];
		var str_heading = "";
		var str_catid = '';
		var str_geneid = "";
		var str_unknown = "";
		var str_status = '';
		var str_species = "";
		var str_species_verified = "";
		var str_prodid = "";
		var str_spprodid = "";
		var str_spanid = '';
		var str_spanc = '';
		var str_headid = "";
		var str_divid = "";
		var str_href = "";
		var str_spid = "sp_";
		var str_lab = "";
		var str_options = '';
		var str_inventoried = '';
		if (str_type == "sise") {
			str_heading = arr_prod[5];		//gene_symbol
			str_geneid = arr_prod[3];		//gene id
			if (str_geneid == 0)
			{
				str_unknown = "Unknown";
			}
			str_species = arr_prod[6];		//species
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[1];		//used for span id
			str_status = arr_prod[2];
			str_divid = "sirnaproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Genes Targeted";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);	
			str_heading += "  " + str_unknown + " [" + sp2engl(str_species) + "]";
			str_catid = str_headid + '_silencerselect';
			if (str_heading.indexOf('/') > 0 || str_geneid == "0") {
				str_href = "javascript: jumpTosiRNA(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			} else {
				str_href = "javascript: jumpToProduct(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			}					
			str_lab = "Select siRNA";
		} else if (str_type == "sirna") {
			str_heading = arr_prod[5];		//gene_symbol
			str_geneid = arr_prod[3];		//gene id
			if (str_geneid == 0)
			{
				str_unknown = "Unknown";
			}
			str_species = arr_prod[6];		//species
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[1];		//used for span id
			str_status = arr_prod[2];
			str_divid = "sirnaproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Genes Targeted";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);	
			str_heading += "  " + str_unknown + " [" + sp2engl(str_species) + "]";
			str_catid = str_headid + '_silencer';
			if (str_heading.indexOf('/') > 0 || str_geneid == "0") {
				str_href = "javascript: jumpTosiRNA(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			} else {
				str_href = "javascript: jumpToProduct(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			}
			str_lab = "siRNA";
		} else if (str_type == "ge") {
			str_heading = arr_prod[5];		//gene_symbol
			str_geneid = arr_prod[3];		//gene id
			if (str_geneid == 0)
			{
				str_unknown = "Unknown";
			}
			str_species = arr_prod[6];		//species
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[1];		//used for span id
			str_divid = "sirnaproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Genes Targeted";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);
			str_heading += "  " + str_unknown + " [" + sp2engl(str_species) + "]";
			str_catid = str_headid + '_taqman';
			if (str_heading.indexOf('/') > 0 || str_geneid == "0") {
				str_href = "javascript: jumpToTm(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			} else {
				str_href = "javascript: jumpToProduct(0,'" + str_type + "','" + str_geneid + "','" + str_species + "','" + str_prodid + "',2,0);";
			}
			str_lab = "Assay";
		} else if (str_type == "sposctrl") {
			str_heading = "siRNA Pos Controls";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "spc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		} else if (str_type == "seposctrl") {
			str_heading = "siRNA Pos Controls";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = 'Silencer Select ' + arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "spc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		}  else if (str_type == "snegctrl") {
			str_heading = "siRNA Neg Controls";
			str_prodid = arr_prod[1]		//product_id
			//use regex to add the # symbol. Because putting it in DB data and Php causes problems.
			var str_test = str_prodid;
			var pos = str_test.match('Negative Control.\d*?');
			if (pos) {
				re = /Negative Control.[0-9]*?/g;
				str_prodid = str_test.replace(re, 'Negative Control #');
			}
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "snc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		}  else if (str_type == "senegctrl") {
			str_heading = "siRNA Neg Controls";
			str_prodid = arr_prod[1];		//product_id
			//use regex to add the # symbol. Because putting it in DB data and Php causes problems.
			var str_test = str_prodid;
			var pos = str_test.match('Negative Control.\d*?');
			if (pos) {
				re = /Negative Control.[0-9]*?/g;
				str_prodid = str_test.replace(re, 'Negative Control #');
			}
			str_spprodid = 'Silencer Select ' + arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "snc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		} else if (str_type == "splabctrl" || str_type == "snlabctrl") {
			str_heading = "siRNA Labeled Controls";
			str_prodid = arr_prod[1];		//product_id
			//use regex to add the # symbol. Because putting it in DB data and Php causes problems.
			var str_test = str_prodid;
			var pos = str_test.match('Negative Control.\d*?');
			if (pos) {
				re = /Negative Control.[0-9]*?/g;
				str_prodid = str_test.replace(re, 'Negative Control #');
			}
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "slc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		} else if (str_type == "seplabctrl" || str_type == "senlabctrl") {
			str_heading = "siRNA Labeled Controls";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = 'Silencer Select ' + arr_prod[2];	//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "slc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',3,0);";
		} else if (str_type == "tmctrl") {
			str_heading = "TaqMan<sup>&reg;</sup> Controls";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tmproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Controls";
			str_headid = "tmc_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(1,'" + str_type + "','','','" + str_spprodid + "',4,0);";
		} else if (str_type == "tfa") {
			str_heading = "Transfection Agents";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tfproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Transfection";
			str_headid = "tfa_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(2,'" + str_type + "','','','" + str_spprodid + "',5,0);";
		} else if (str_type == "epa") {
			str_heading = "Reagents";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "epproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Electroporation";
			str_headid = "epa_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(2,'" + str_type + "','','','" + str_spprodid + "',6,0);";
		} else if (str_type == "tfk") {
			str_heading = "Optimization Kits";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "tfproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Transfection";
			str_headid = "tfk_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(2,'" + str_type + "','','','" + str_spprodid + "',7,0);";
		} else if (str_type == "epk") {
			str_heading = "Optimization Kits";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "epproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Electroporation";
			str_headid = "epk_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(2,'" + str_type + "','','','" + str_spprodid + "',7,0);";
		} else if (str_type == "riso") {
			str_heading = "Kits";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "riproducts";
			str_spanid = str_divid + "head";
			str_spanc = "RNA Isolation";
			str_headid = "riso_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',8,0);";
		} else if (str_type == "rstb") {
			str_heading = "Stabilizing Solution";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "riproducts";
			str_spanid = str_divid + "head";
			str_spanc = "RNA Isolation";
			str_headid = "rstb_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',8,0);";
		} else if (str_type == "rdcs") {
			str_heading = "Decontamination Solution";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "riproducts";
			str_spanid = str_divid + "head";
			str_spanc = "RNA Isolation";
			str_headid = "rdcs_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',8,0);";
		}  else if (str_type == "gect") {
			str_heading = "TaqMan<sup>&reg;</sup> Cells-to-CT";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "addproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Additional Products";
			str_headid = "gect_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',9,0);";
		} else if (str_type == "cdna") {
			str_heading = "cDNA Reverse Transcription";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "addproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Additional Products";
			str_headid = "cdna_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',9,0);";
		} else if (str_type == "mmix") {
			str_heading = "TaqMan<sup>&reg;</sup> Master Mix";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "addproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Additional Products";
			str_headid = "mmix_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',9,0);";
		} else if (str_type == "rnamp") {
			str_heading = "RNA Amplification Kits";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "ampproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Amplification";
			str_headid = "rnamp_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',10,0);";
		} else if (str_type == "csig") {
			str_heading = "Cell Signaling";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "cellproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Cell-Based Assays";
			str_headid = "csig_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',10,0);";
		} else if (str_type == "rgene") {
			str_heading = "Reporter Gene";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "cellproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Cell-Based Assays";
			str_headid = "rgene_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',10,0);";
		} else if (str_type == "ab") {
			str_heading = "Antibodies";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "immunoproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Immunodetection";
			str_headid = "ab_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',11,0);";
		} else if (str_type == "imm") {
			str_heading = "Systems";
			str_prodid = arr_prod[1];		//product_id
			str_spprodid = arr_prod[2];		//used for span id
			str_divid = "immunoproducts";
			str_spanid = str_divid + "head";
			str_spanc = "Immunodetection";
			str_headid = "imm_statusgenehead_" + str_heading;
			str_href = "javascript: jumpToProduct(3,'" + str_type + "','','','" + str_spprodid + "',11,0);";
		} 
//alert(str_type+"\n"+str_heading+"\n"+str_prodid+"\n"+str_spprodid+"\n"+str_divid+"\n"+str_spanid+"\n"+str_spanc+"\n"+str_headid+"\n"+str_href);
		//sync with the alignment map if present
		var amap = document.getElementById('hide_amap');
		if (amap) {
			var cur_gene = t.sGeneID;
			if (str_geneid && cur_gene == str_geneid) {
				if ('sirna' == str_type) {
					map.setSelected(['siRNA' + str_prodid]); // add a single sirna ID
					//map.toggleSelected ("siRNA" + id);
				} else if ('ge' == str_type) {
					map.setSelected(['GeXassay_' + str_prodid]); // add a single gex ID
					//map.toggleSelected ("GeXassay_" + id);
				} else if ('sise' == str_type) {
					map.setSelected(['siRNA' + str_prodid]); // add a single gex ID
					//map.toggleSelected ("ssiRNA_" + id);
				}
			}
		}
		
		//create heading and item spans
		DOM_head = document.getElementById(str_headid);
		if (!DOM_head)
		{	//create the heading if not present
				
			DOM_head = document.createElement("span");
			DOM_head.className = "statusgenehead";
			DOM_head.id = str_headid;
			//DOM_head.appendChild(document.createTextNode(str_heading));
			DOM_head.innerHTML = str_heading;
			if ('sirna' == str_type || 'sise' == str_type)
			{
				if (str_heading.indexOf('/') > 0) {
					DOM_head.title="Click siRNA id for additional information";
				}
			} else if ('ge' == str_type) {
				if (str_heading.indexOf('/') > 0) {
					DOM_head.title="Click assay id for additional information";
				}
			}

			DOM_div = document.getElementById(str_divid);
			DOM_div.appendChild(DOM_head);

			if (DOM_div && 'sirna' == str_type || 'ge' == str_type || 'sise' == str_type)
			{
				DOM_head = document.createElement("div");
				DOM_head.className = "statusgenesubcat";
				DOM_head.id = str_headid + '_silencerselect';
				DOM_div.appendChild(DOM_head);
				DOM_head = document.createElement("div");
				DOM_head.className = "statusgenesubcat";
				DOM_head.id = str_headid + '_silencer';
				DOM_div.appendChild(DOM_head);
				DOM_head = document.createElement("div");
				DOM_head.className = "statusgenesubcat";
				DOM_head.id = str_headid + '_taqman';
				DOM_div.appendChild(DOM_head);
			}
		}
		//make sure it's not already there!
		str_spid += str_spprodid;
		DOM_sp = document.getElementById(str_spid);

		if (!DOM_sp)
		{
			//create the delete button
			DOM_img = document.createElement("img");
			DOM_img.className = "statusitemline";
			DOM_img.id = "del_" + str_spprodid;
			DOM_img.title = 'Click to remove ' + str_spprodid + ' from your shopping list';
			DOM_img.align = 'left';
			DOM_img.src= "images/btn_delete.gif";
			DOM_img.style.height = '12px';
			DOM_img.style.width = '13px';
			DOM_img.onmouseover = mouseOverDelImg;
			DOM_img.onmouseout = mouseOutDelImg;
			DOM_img.onclick = new Function("updateProducts('"+prod_val+"','delete')");


			DOM_sp = document.createElement("span");
			DOM_sp.className = "statusproducts";
			DOM_sp.id = "sp_" + str_spprodid;
			

			//create anchor						
			DOM_a = document.createElement("a");
			if ("sirna" == str_type && 1 == str_status)
			{
				str_prodid = str_prodid + "&nbsp;&nbsp;v";
			}

			//11-10-2007 DL - Add size or options to staus panel item
			str_options = getStringOptions(prod_val);

			if ('sirna' == str_type || 'ge' == str_type || 'sise' == str_type) {
				//11-10-2007 DL - insert new span for options into displayed item - after adding options
				DOM_a.innerHTML = str_prodid + '<span id="opt_' + arr_prod[1] + '" name="o_' + prod_val + '" onmouseover="mouseOverStatusItem" onmouseout="mouseOutStatusItem">' + str_options + '</span>' + ' : ' + str_lab;
				//original code below - before adding options
				//DOM_a.innerHTML = str_prodid + " &nbsp : " + str_lab;
			} else {
				//11-10-2007 DL - insert new span for options into displayed item - after adding options
				DOM_a.innerHTML = str_prodid + '<span id="opt_' + arr_prod[2] + '" name="o_' + prod_val + '" onmouseover="mouseOverStatusItem" onmouseout="mouseOutStatusItem">' + str_options + '</span>';
				//original code below - before adding options
				//DOM_a.innerHTML = str_prodid;
			}
			DOM_a.id = 'a_' + prod_val;
			DOM_a.name = str_spprodid;
/*
			DOM_a.href = str_href;
			DOM_a.title = "Click to go to product page for " + str_spprodid;


			DOM_a.onmouseover = mouseOverStatusItem;
			DOM_a.onmouseout = mouseOutStatusItem;
			//
			//Issue with firefox showing a selection outline around the parent object of a button when it has focus.
			//It also puts a I-beam carat inside the text content.
			//Tried setting the hideFocus property, the UNSELECTABLE & contentEditable attributes, but does not work.
			if (bisff || bisff2) {
				DOM_a.onclick = onClickBlurElem;
			}			
*/
			//append elements
			DOM_sp.appendChild(DOM_img);
			DOM_sp.appendChild(DOM_a);
			
			if ('sirna' == str_type || 'ge' == str_type || 'sise' == str_type)
			{
				DOM_head = document.getElementById(str_catid);
			}
			DOM_head.appendChild(DOM_sp);
		}
		DOM_head = document.getElementById(str_spanid);
		DOM_head.innerHTML = str_spanc;
		DOM_head.style.display = "block";
		DOM_head = document.getElementById(str_divid);
		if (DOM_head) {
			DOM_head.style.display = "block";
		}		
		
		if (n_prodcount == 0) {
			document.getElementById("btnOrderNow").src = "images/btn_ordernow.gif";
			document.getElementById("btnOrderNow").title = "Order Now";
			document.getElementById("btnOrderNow").style.cursor = "pointer";
			document.getElementById("paragraphTitle").style.color = '#ffffff';
			document.getElementById("paragraphTitle").style.backgroundColor = '#1279C6';
		}
		n_prodcount++;

		return;
	}

	function checkOrderBtnStatus() {
		if (n_curTab == 3) {
			document.getElementById("btnOrderNow").src = "images/btn_ordernow_disabled.gif";
			document.getElementById("btnOrderNow").style.cursor = "default";
			document.getElementById("paragraphTitle").style.color = '#F5F7FA';
			document.getElementById("paragraphTitle").style.backgroundColor = '#B0B0B0';
			if (n_prodcount > 0) {
				document.getElementById("btnOrderNow").title = "Use button on order page.";
				document.getElementById("idstatuspanel").style.visibility = 'hidden';
			} else {
				document.getElementById("btnOrderNow").title = "Your list is empty.";
			}
		} else {
			document.getElementById("idstatuspanel").style.visibility = 'visible';
			if (n_prodcount > 0) {				
				document.getElementById("btnOrderNow").src = "images/btn_ordernow.gif";
				document.getElementById("btnOrderNow").title = "Order Now";
				document.getElementById("btnOrderNow").style.cursor = "pointer";
				document.getElementById("paragraphTitle").style.color = '#ffffff';
				document.getElementById("paragraphTitle").style.backgroundColor = '#1279C6';
			} else {
				document.getElementById("btnOrderNow").src = "images/btn_ordernow_disabled.gif";
				document.getElementById("btnOrderNow").title = "Your list is empty.";
				document.getElementById("btnOrderNow").style.cursor = "default";
				document.getElementById("paragraphTitle").style.color = '#F5F7FA';
				document.getElementById("paragraphTitle").style.backgroundColor = '#B0B0B0';
			}
		}
	}

	function mouseOverDelImg(event) {
		var id, file;
		var DOM_img;
		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_img = document.getElementById(id);
        DOM_img.src= 'images/btn_delete_hover.gif';
		window.status = 'Remove Item from shopping list';
		return true;
	}

	function mouseOutDelImg(event) {
		var id, file;
		var DOM_img;
		if (window.event) {
			id = window.event.srcElement.id;
		}
		else {
			var element = Event.element(event);
			id = element.id;
		}

		DOM_img = document.getElementById(id);
		DOM_img.src= 'images/btn_delete.gif';
		window.status = '';
		return true;
	}

	function hidestatusspans() {
		document.getElementById('sirnaproductshead').style.display = 'none';
		document.getElementById('tmproductshead').style.display = 'none';
		document.getElementById('tfproductshead').style.display = 'none';
		document.getElementById('epproductshead').style.display = 'none';
		document.getElementById('riproductshead').style.display = 'none';
		document.getElementById('pcrproductshead').style.display = 'none';
		document.getElementById('addproductshead').style.display = 'none';
		document.getElementById('cellproductshead').style.display = 'none';
		document.getElementById('immunoproductshead').style.display = 'none';
		document.getElementById('sirnaproducts').style.display = 'none';
		document.getElementById('tmproducts').style.display = 'none';
		document.getElementById('tfproducts').style.display = 'none';
		document.getElementById('epproducts').style.display = 'none';
		document.getElementById('riproducts').style.display = 'none';
		document.getElementById('pcrproducts').style.display = 'none';
		document.getElementById('addproducts').style.display = 'none';
		document.getElementById('cellproducts').style.display = 'none';
		document.getElementById('immunoproducts').style.display = 'none';
		return true;
	}

	function removeItemFromStatusPanel(elem) {
		if (elem.type == 'checkbox') {
			var prod_val = elem.value;
		} else if (elem.type == 'button') {
			var prod_val = elem.id;
		} else if (typeof(elem) == 'string') {
			var prod_val = elem;
		} else {
			return false;
		}
		
		var arr_prod = getArrayFromRequestString( prod_val, "|~|" );
		var str_type = arr_prod[0];
		var str_heading = "";
		var str_geneid = "";
		var str_prodid = "";
		var str_spprodid = "";
		var str_headid = "";
		var str_divid = "";
		var str_spid = "sp_";

		if (str_type == "sise") {
			str_heading = arr_prod[5];		//gene_symbol
			str_species = arr_prod[6]		//species
			str_prodid = arr_prod[1]		//product_id
			str_divid = "sirnaproducts";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);	
			str_catid = str_headid + '_silencerselect';
		} else if (str_type == "sirna") {
			str_species = arr_prod[6]		//species
			str_heading = arr_prod[5];		//gene_symbol
			str_prodid = arr_prod[1]		//product_id
			str_divid = "sirnaproducts";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);
			str_catid = str_headid + '_silencer';
		} else if (str_type == "ge") {
			str_species = arr_prod[6]		//species
			str_heading = arr_prod[5];		//gene_symbol
			str_prodid = arr_prod[1]		//product_id
			str_divid = "sirnaproducts";
			str_headid = "si_statusgenehead_" + str_heading + "_" + sp2engl(str_species);
			str_catid = str_headid + '_taqman';
		} else if (str_type == "sposctrl") {
			str_heading = "siRNA Pos Controls";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "spc_statusgenehead_" + str_heading;
		} else if (str_type == "snegctrl") {
			str_heading = "siRNA Neg Controls";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "snc_statusgenehead_" + str_heading;
		} else if (str_type == "splabctrl" || str_type == "snlabctrl") {
			str_heading = "siRNA Labeled Controls";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "slc_statusgenehead_" + str_heading;
		}  else if (str_type == "seposctrl") {
			str_heading = "siRNA Pos Controls";
			str_prodid = 'Silencer Select ' + arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "spc_statusgenehead_" + str_heading;
		} else if (str_type == "senegctrl") {
			str_heading = "siRNA Neg Controls";
			str_prodid = 'Silencer Select ' + arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "snc_statusgenehead_" + str_heading;
		} else if (str_type == "seplabctrl" || str_type == "senlabctrl") {
			str_heading = "siRNA Labeled Controls";
			str_prodid = 'Silencer Select ' + arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "slc_statusgenehead_" + str_heading;
		} else if (str_type == "tmctrl") {
			str_heading = "TaqMan<sup>&reg;</sup> Controls";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tmproducts";
			str_headid = "tmc_statusgenehead_" + str_heading;
		} else if (str_type == "tfa") {
			str_heading = "Transfection Agents";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tfproducts";
			str_headid = "tfa_statusgenehead_" + str_heading;
		} else if (str_type == "epa") {
			str_heading = "Reagents";
			str_prodid = arr_prod[2]		//product name
			str_divid = "epproducts";
			str_headid = "epa_statusgenehead_" + str_heading;
		} else if (str_type == "tfk") {
			str_heading = "Optimization Kits";
			str_prodid = arr_prod[2]		//product name
			str_divid = "tfproducts";
			str_headid = "tfk_statusgenehead_" + str_heading;
		} else if (str_type == "epk") {
			str_heading = "Optimization Kits";
			str_prodid = arr_prod[2]		//product name
			str_divid = "epproducts";
			str_headid = "epk_statusgenehead_" + str_heading;
		}  else if (str_type == "riso") {
			str_heading = "Kits";
			str_prodid = arr_prod[2]		//product name
			str_divid = "riproducts";
			str_headid = "riso_statusgenehead_" + str_heading;
		}  else if (str_type == "rstb") {
			str_heading = "Stabilizing Solution";
			str_prodid = arr_prod[2]		//product name
			str_divid = "riproducts";
			str_headid = "rstb_statusgenehead_" + str_heading;
		}  else if (str_type == "rdcs") {
			str_heading = "Decontamination Solution";
			str_prodid = arr_prod[2]		//product name
			str_divid = "riproducts";
			str_headid = "rdcs_statusgenehead_" + str_heading;
		}  else if (str_type == "gect") {
			str_heading = "TaqMan<sup>&reg;</sup> Cells-to-CT";
			str_prodid = arr_prod[2]		//product name
			str_divid = "addproducts";
			str_headid = "gect_statusgenehead_" + str_heading;
		}  else if (str_type == "cdna") {
			str_heading = "cDNA Reverse Transcription";
			str_prodid = arr_prod[2]		//product name
			str_divid = "addproducts";
			str_headid = "cdna_statusgenehead_" + str_heading;
		}  else if (str_type == "mmix") {
			str_heading = "TaqMan<sup>&reg;</sup> Master Mix";
			str_prodid = arr_prod[2]		//product name
			str_divid = "addproducts";
			str_headid = "mmix_statusgenehead_" + str_heading;
		}  else if (str_type == "rnamp") {
			str_heading = "RNA Amplification Kits";
			str_prodid = arr_prod[2]		//product name
			str_divid = "ampproducts";
			str_headid = "rnamp_statusgenehead_" + str_heading;
		}  else if (str_type == "rgene") {
			str_heading = "Reporter Gene";
			str_prodid = arr_prod[2]		//product name
			str_divid = "cellproducts";
			str_headid = "rgene_statusgenehead_" + str_heading;
		}    else if (str_type == "csig") {
			str_heading = "Cell Signaling";
			str_prodid = arr_prod[2]		//product name
			str_divid = "cellproducts";
			str_headid = "csig_statusgenehead_" + str_heading;
		}  else if (str_type == "ab") {
			str_heading = "Antibodies";
			str_prodid = arr_prod[2]		//product name
			str_divid = "immunoproducts";
			str_headid = "ab_statusgenehead_" + str_heading;
		}  else if (str_type == "imm") {
			str_heading = "Systems";
			str_prodid = arr_prod[1]		//product name
			str_divid = "immunoproducts";
			str_headid = "imm_statusgenehead_" + str_heading;
		}

		str_spanid = str_divid + "head";

		if('sirna' == str_type || 'ge' == str_type  || 'sise' == str_type) 	{
			str_spid += str_prodid;
			DOM_div = document.getElementById(str_catid); //category
			DOM_sp = document.getElementById(str_spid); //item
			if(DOM_sp && DOM_div) {
				DOM_div.removeChild(DOM_sp); //remove it
			}
			DOM_div = document.getElementById(str_divid);
			DOM_head = document.getElementById(str_headid);
			if(DOM_div && DOM_head) {
				var count = 0;
				count = document.getElementById(str_headid + "_silencer").childNodes.length;
				count += document.getElementById(str_headid + "_silencerselect").childNodes.length;
				count += document.getElementById(str_headid + "_taqman").childNodes.length;
				if(0 == count) {
					DOM_div.removeChild(DOM_head);
					DOM_head = document.getElementById(str_headid + "_silencer");
					DOM_div.removeChild(DOM_head);
					DOM_head = document.getElementById(str_headid + "_silencerselect");
					DOM_div.removeChild(DOM_head);
					DOM_head = document.getElementById(str_headid + "_taqman");
					DOM_div.removeChild(DOM_head);
				}
			}
			sItems = DOM_div.getElementsByTagName("span");
			if (0 == sItems.length)
			{
				DOM_sp = document.getElementById(str_spanid);
				DOM_sp.innerHTML = '';
				DOM_sp.style.display = "none";
				DOM_sp = document.getElementById(str_divid);
				DOM_sp.style.display = "none";
			}
		} else {
			//get the required elements
			str_spid += str_prodid;
			DOM_div = document.getElementById(str_divid);
			DOM_head = document.getElementById(str_headid);
			DOM_sp = document.getElementById(str_spid);

			if (DOM_sp && DOM_div) {
				DOM_head.removeChild(DOM_sp); //remove it
			}
			if(DOM_div && DOM_head) {
				var count = 0;
				//count = DOM_head.childNodes.length;
				count = DOM_head.getElementsByTagName("a").length;
				if(0 == count) {
					DOM_div.removeChild(DOM_head);
				}
			}
			sItems = DOM_div.getElementsByTagName("span");
			if (0 == sItems.length)
			{
				DOM_sp = document.getElementById(str_spanid);
				DOM_sp.innerHTML = '';
				DOM_sp.style.display = "none";
				DOM_sp = document.getElementById(str_divid);
				DOM_sp.style.display = "none";
			}


		} // end else if sirna, sise, ge

		//sync with the alignment map if present
		var amap = document.getElementById('hide_amap');
		if (amap) {
			str_geneid = arr_prod[3];						//gene id
			var cur_gene = t.sGeneID;
			if (cur_gene == str_geneid) {
				if ('sirna' == str_type) {
					map.unselect('siRNA' + str_prodid);		 // remove a single sirna ID
				} else if ('ge' == str_type) {
					map.unselect('GeXassay_' + str_prodid);		 // remove a single gex ID
				} else if ('sise' == str_type) {
					map.unselect('siRNA' + str_prodid);		 // remove a single sirna ID
				}
			}
		}
        var f = document.resultsForm;
		if (f) {
			for (i=0;i<f.elements.length;i++) {
				if (prod_val == f.elements[i].value) {
					f.elements[i].checked = (elem.checked == true)?true:false;
				}
			}
		}

		n_prodcount--;
		if (n_prodcount <= 0) {
			document.getElementById("btnOrderNow").src = "images/btn_ordernow_disabled.gif";
			document.getElementById("btnOrderNow").title = "Your list is empty.";
			document.getElementById("btnOrderNow").style.cursor = "default";
			document.getElementById("paragraphTitle").style.color = '#F5F7FA';
			document.getElementById("paragraphTitle").style.backgroundColor = '#B0B0B0';
		}
		return;
	}

	function removeAllItemsFromStatusPanel() {
		var str_divid = "idstatuspanel";
		var DOM_main = document.getElementById(str_divid);
		var DOM_div, oChild, divItems, spanItems, subdivitems;
		var count, countDiv, countHead;

		if (DOM_main) {
			divItems=DOM_main.getElementsByTagName("div");
			for (i=0;i<divItems.length;i++) {
				DOM_div = divItems[i];

				DOM_div.innerHTML = '';
				DOM_div.style.display = "none";
			}
			divItems = DOM_main.getElementsByTagName("span");
			for (i=0; i<divItems.length ; i++)
			{
				divItems[i].innerHTML='';
				divItems[i].style.display = "none";
			}
		}
		n_prodcount = 0;

		document.getElementById("btnOrderNow").src = "images/btn_ordernow_disabled.gif";
		document.getElementById("btnOrderNow").title = "Your list is empty.";
		document.getElementById("btnOrderNow").style.cursor = "default";
		document.getElementById("paragraphTitle").style.color = '#F5F7FA';
		document.getElementById("paragraphTitle").style.backgroundColor = '#B0B0B0';

		//sync with the alignment map if present
		var amap = document.getElementById('hide_amap');
		if (amap) {
			map.unselectAll();
		}
		return;
	}



	function checkProduct(elem)  {
		//product was checked
		//changed 8-14-2007 changed from checkbox object to img object.
		var sparam = '';
		var sAct = '';
		var bChecked = false;
		var oOptionDiv;

		if (typeof(elem) == 'object' && elem.type == 'checkbox') {
			bChecked = (elem.checked)?true:false;
			sAct = (elem.checked)?"add":"rem";
			sparam = "prod=" + elem.value + "&";
		} else if (typeof(elem) == 'object' && elem.type != 'checkbox') {
			var s_filename = elem.src;
			var pos = s_filename.lastIndexOf('/');
			s_filename = s_filename.substr(pos + 1, s_filename.length);
			
			if (s_filename == 'btn_add.gif') {
				bChecked = true;
				sAct = 'add';
				elem.src = 'images/btn_remove.gif';
				s_prod = elem.id;
				var arr_prod = getArrayFromRequestString(s_prod, '|~|' );
				s_prod = arr_prod[0];
				if (s_prod == 'ge') {
					n_TaqMan++;
				} else if (s_prod == 'sirna') {
					n_sirna++;
				} else if (s_prod.indexOf('sise') != -1) {
					n_sise++;
				}

			} else {
				bChecked = false;
				sAct = 'rem';
				elem.src = 'images/btn_add.gif';
				s_prod = elem.id;
				var arr_prod = getArrayFromRequestString(s_prod, '|~|' );
				s_prod = arr_prod[0];
				if (s_prod == 'ge') {
					n_TaqMan--;
				} else if (s_prod == 'sirna') {
					n_sirna--;
				} else if (s_prod.indexOf('sise') != -1) {
					n_sise--;
				}
			}

			sparam = "prod=" + elem.id + "&";
		}
		sparam += "act=" + sAct;
		oOptionDiv = document.getElementById('quantity_' + elem.id);
		
		if (bChecked)
		{
			//changed 8-14-2007 from elem to elem.id, because changed from checkbox object to img object.
			addItemToStatusPanel(elem.id);
			bSaved = 'NO';

			if (oOptionDiv)	{
				if (oOptionDiv.value < 1) {
					oOptionDiv.value = 1;
				}
				sparam += '&quantity=' + oOptionDiv.value;
			}
		} else {
			removeItemFromStatusPanel(elem.id);
			bSaved = 'NO';

			if (oOptionDiv)	{
				oOptionDiv.value = 0;
			}
		} // end if checked
		sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");

	}

	function validateLength(str, l)
	{
		if (str.length <= l) return true;
		else return false;
	}

	function validateSearchForm(v)
	{
		var queryName = v.value;
		if(queryName == "")
		{
			alert("Please specify query string.");
			v.focus();
			return false;
		}
		
		var listStr = queryName.split(' ');
		
		for (var i = 0; i < listStr.length; i ++)
		{
			if (listStr[i].charAt(0) == "*" || listStr[i].charAt(0) == "?")
			{
				alert('Search word cannot start with "*" or "?".');
				v.focus();		
				return false;	
			}
		}

		if(!validateLength(queryName, 256)) 
		{
			alert("Please enter a search string less than 256 characters long.");
			v.focus();		
			return false;
		}
		return true;
	}



	function getFormattedRequestString( A_values, char_delimiter )
	{
		//this will separate the array of values into delimited values.
		var str_values = "";
		var nCount = A_values.length;
		for( var i = 0; i < nCount; i++ ) {
			if(  A_values[i] != null ) {
				if (i < nCount - 1) {				
					str_values += ( A_values[i] + char_delimiter );
				} else {
					str_values += A_values[i];
				}
			}
		}
			
		return str_values;
	}

	function getArrayFromRequestString( str_values, char_delimiter )
	{
		//this will separate the delimited values into an array of values.
		var liststr = str_values.split(char_delimiter);			
		return liststr;
	}

	function clearSelect(src)  {
		//clear options in dropdown for element
		while (src.length > 0)  {
			src.remove(0);
		}
	return;
	}

	function addOption(src, sOpt, sVal) {
		var oOption = document.createElement("OPTION");
		oOption.text = sOpt;
		oOption.value = sVal;
		if (bisIE)
		{
			src.add(oOption);
		} else {
			src.appendChild(oOption);
		}		
	}

	function onChangeCategory(src)  {
		var elem = document.getElementById("selSearchType");
		clearSelect(elem);
		if (src.value=="gene_symbol" || src.value=="gene_alias") {			
			addOption(elem, "Contains", "contains");
			addOption(elem, "Matches", "matches");
			elem.value = "contains";
		} else if (src.value == "gene_id" || src.value == "omim_ids" || src.value == "unigene_id" || src.value == "sirna_id" || src.value == "assay_id") {
			addOption(elem, "Matches", "matches");
			addOption(elem, "Starts with", "starts");
			elem.value = "matches";
		} else if (src.value == "transcript_acc" ) {
			addOption(elem, "Contains", "Contains");
		} else {			
			addOption(elem, "Contains", "contains");
			addOption(elem, "Matches", "matches");
			addOption(elem, "Starts with", "starts");
			addOption(elem, "Ends with", "ends");
			elem.value = "contains";
		}

	return true;
	}

	function getItem(str,delim,index) {
		var arr_temp = getArrayFromRequestString(str, delim);
		return arr_temp[index];
	}

	function getStepNum(page) {
		var nStep = 0;
		var str_page;
		str_page = getItem(arr_steps[nStep],'|',2);
		while (nStep < arr_steps.length && str_page != page) {
			nStep++;
			str_page = getItem(arr_steps[nStep],'|',2);
		}
		return nStep;		
	}

	function onClickBlurElem(event) {
		var elem;
		if (window.event) {
			elem = window.event.srcElement;
		} else {
			var elem = Event.element(event);			
		}
		elem.blur();
	}

	function setStepIcons(tab,step) {		
		//insert the appropriate icons for the substeps of tab
		var str_icons, str_filename, str_stepnum, str_stepname;
		var n_stepnum, k, bDisabled;
		var arrSteps, arrItems;		
		var DOM_sp = document.getElementById("tdButtons");
		var DOM_img, DOM_a;

		//hide the search history if appropriate
		hideHistory();
		hideResultsHistory();
		//
		//first remove the current tab's icons
		if (DOM_sp)
		{
			var sItems = DOM_sp.getElementsByTagName("a");
			var count = sItems.length;
			var oChild;
			if (count > 0)	{
				for (k=0;k<count;k++) {
					//oChild = document.getElementById(sItems[0].id);
					//DOM_sp.removeChild(oChild);
					DOM_sp.removeChild(sItems[0]);
				}
			}
			var sItems = DOM_sp.getElementsByTagName("img");
			var count = sItems.length;
			var oChild;
			if (count > 0)	{
				for (k=0;k<count;k++) {
					DOM_sp.removeChild(sItems[0]);
				}
			}

			//retrieve the icon file names
			str_icons = arr_icons[tab];
			if(str_icons) {
				arrSteps = getArrayFromRequestString(str_icons, '|');
			} else {
				arrSteps = [];
			}
			for (var i=0;i<arrSteps.length;i++)	{
				bDisabled = false;
				//parse out the file name and step number
				arrItems = getArrayFromRequestString(arrSteps[i], ',');			
				str_stepnum = arrItems[1];
				n_stepnum = parseInt(str_stepnum);
				//7-24-2007 width of icons
				str_iconwidth = arrItems[2];				
				str_filename = arrItems[0];
				str_stepname = getItem(arr_steps[n_stepnum],'|',1);
				DOM_img = document.createElement("img");				
				DOM_img.id = "imgStep_" + str_stepnum;
				//determine if step should be on or off.
				if (n_stepnum == parseInt(step)) {					
					str_filename += "_on";
					DOM_img.className = "imgStepsOn";
					DOM_img.title = "You are at the " + str_stepname + " step";
				} else {
					//DL - added 3-18-2008
					if ((n_stepnum == 1 && !bPrevSubmit) || (n_stepnum == 2 && (!bPrevGene || t.sPrevGeneID == ''))) {
						str_filename += "_disabled";
						DOM_img.className = "imgSteps";
						if (n_stepnum == 1)	{
							DOM_img.title = "You must first perform a search to access this " + str_stepname + " step";
						} else {
							DOM_img.title = "You must select a target first to reach the " + str_stepname + " step";
						}						
						bDisabled = true;
					} else {
						DOM_img.className = "imgSteps";
						DOM_img.title = "Click for the " + str_stepname + " step";
					}
				}

				if (bDisabled)	{
					DOM_img.src= "images/" + str_filename + ".gif";
					DOM_img.style.height = "20px";
					DOM_img.style.width = str_iconwidth + 'px';
					DOM_img.tabindex = "-1";
					//create anchor
					DOM_a = document.createElement("a");
					DOM_a.className = "aidStep";
					DOM_a.id = "aidStep_" + str_stepnum;
					DOM_img.tabindex = "-1";
					//DOM_a.href = "javascript: void();";
				} else {
					DOM_img.src= "images/" + str_filename + ".gif";
					DOM_img.style.height = "20px";
					DOM_img.style.width = str_iconwidth + 'px';
					DOM_img.onmouseover = mouseOverImg;
					DOM_img.onmouseout = mouseOutImg;
					DOM_img.tabindex = "-1";
					//create anchor
					DOM_a = document.createElement("a");
					DOM_a.className = "aidStep";
					DOM_a.id = "aidStep_" + str_stepnum;
					DOM_img.tabindex = "-1";
					DOM_a.href = "javascript: gotoStep(" + str_stepnum + ");";
				}
				//
				//Issue with firefox showing a selection outline around the parent object of a button when it has focus.
				//Tried setting the hideFocus property, the UNSELECTABLE attribute, but does not work.
				if (bisff || bisff2) {
					DOM_a.onclick = onClickBlurElem;					
				}
				DOM_a.appendChild(DOM_img);
				//append the step image
				DOM_sp.appendChild(DOM_a);

				//DL - added 03/12/2008 - Now insert the separator image between the step images.
				if (arrSteps.length > 1 && i < (arrSteps.length - 1)) {
					DOM_img = document.createElement("img");				
					DOM_img.id = "imgStep_" + str_stepnum;
					DOM_img.className = "imgSteps";
					DOM_img.src= "images/btn_step_sep.gif";
					DOM_img.style.height = "20px";
					DOM_img.style.width = "12px";
					DOM_img.tabindex = "-1";
					//append the separator image
					DOM_sp.appendChild(DOM_img);
				}


			}
		} // if DOM_sp
		else {
			return false;
		}

		return true;
	}

	function hiliteStep(step,prevstep) {
		if (step == prevstep) {
			return;
		}
		var str_tab, str_stepname, str_step, str_icon, str_previcon;
		var nItem, arr_items, i;
		var imgid = "imgStep_" + step;
		var imgid_old = "imgStep_" + prevstep;
		var DOM_img = document.getElementById(imgid);
		
		str_tab = getItem(arr_steps[step],'|',0);				//both step and prevstep should be at same tab
		str_stepname = getItem(arr_steps[step],'|',1);
		str_step = arr_icons[parseInt(str_tab)];				//btn_step_tf,2|btn_step_ep,3
		arr_items = getArrayFromRequestString(str_step, '|');	//btn_step_tf,2
		for (i=0;i<arr_items.length;i++) {
			nItem = getItem(arr_items[i],',',1);
			if (nItem == step) {
				str_icon = getItem(arr_items[i],',',0);	
				//str_iconwidth = getItem(arr_items[i],',',2);
			}
			else if (nItem == prevstep)	{
				str_previcon = getItem(arr_items[i],',',0);
				str_iconwidth_prev = getItem(arr_items[i],',',2);
			}
			//7-24-2007
			
		}
		//switch the image
		DOM_img.className = "imgStepsOn"
		DOM_img.src = "images/" + str_icon + "_on.gif";
		//7-24-2007
		//DOM_img.style.height = "20px";		
		//DOM_img.style.width = str_iconwidth + 'px';
		DOM_img.title = "You are at the " + str_stepname + " step";
		//unhilite the prevstep icon
		DOM_img = document.getElementById(imgid_old);
		DOM_img.className = "imgSteps"
		DOM_img.src = "images/" + str_previcon + ".gif";
		DOM_img.title = "Click for the " + str_stepname + " step";

		return;
	}

	function gotoStep(stepnum) {
		if (stepnum == n_curStep && stepnum > 0)	{
			return;
		} 

		var div, geneid, species, searchcat,str_step, str_page, str_url;
		var searchtype, searchterms, sParams;
		var prevstep
		if (stepnum >= arr_steps.length)	{
			//step number is out of range!
			return false;
		}
		prevstep = n_curStep;
		n_curStep = stepnum;					//jump to step number
		str_step = arr_steps[n_curStep];		//get step info
		//parse out the page we need
		str_url = sBaseFolder + getItem(str_step,'|',2);
		str_page = sBaseUrl + str_url;
		//target page will be within current tab
		 div = t.tabs[n_curTab].div;

		if (prevstep == 1 && bSubmit) {
			oDiv1 = div.innerHTML;
		} else if (prevstep == 332) {
			oDiv2 = div.innerHTML;
		} else if (prevstep == 0) {
			oDiv = div.innerHTML;
		}

		 geneid = (t.sGeneID != '')?t.sGeneID:'';
		 species = (t.sSearchSpecies != '')?t.sSearchSpecies:'';
		 searchcat = (t.sSearchcat != '')?t.sSearchcat:'';
		 searchtype = (t.sSearchtype != '')?t.sSearchtype:'';
		 searchterms = (t.sSearchTerms != '')?t.sSearchTerms:'';
		 sParams = "geneid=" + geneid + "&species=" + species + "&searchcat=" + searchcat + "&searchtype=" + searchtype + "&searchterms=" + searchterms;
		 if (n_curStep == 0 && stepnum == 0) {
			 sParams = "act=new";
		 } else if (stepnum == 2 && geneid != '') {
			 sParams = sParams + "&act=get";
		 } else if (stepnum == 1 && searchcat != '' && searchterms != '') {
			sParams = sParams + '&act=submit';
		 } 

		arr_curTabSubstep[n_curTab] = n_curStep;
		hiliteStep(n_curStep,prevstep);
		//displayNextPrevStep();

		//change the info button link
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			if (ib._properties.visible) {
				ib.hide();
			}
			ib.setURL("help/stepinfo" + n_curStep + ".php");

			//change the help button link
			if (hb._properties.visible) {
				hb.hide();
			}
			hb.setURL("help/userhelp" + n_curTab + ".php");
		}

		if (n_curStep != 0)	{
			hideHistory();
		}
		if (n_curStep != 2) {
			hideResultsHistory();
		}

		//go get the page to display in target tab.	
		if (bSubmit && stepnum == 0 && oDiv) {
			t.tabs[n_curTab].div.innerHTML = oDiv;
			displayHistory();
		} else if (bSubmit && stepnum == 1 && oDiv1) {
			//save time by not having to search again
			t.tabs[n_curTab].div.innerHTML = oDiv1;

			//change the select button to green, and previous green one to orange again.
			oImg = document.getElementById('img_' + t.sPrevGeneID);
			if (oImg) {
				oImg.src = 'images/btn_select.gif';
			}
			oImg = document.getElementById('img_' + geneid);
			if (oImg) {
				oImg.src = 'images/btn_select_on.gif';
				t.sPrevGeneID = geneid;
			}
		} else if (stepnum == 2 && oDiv2) {
			//save time by not having to search again
			t.tabs[n_curTab].div.innerHTML = oDiv2;
			SyncProducts();
			displayResultsHistory();
		}  else {
			progcode = 2;	//2=loading page
			postToPage(div,sParams,str_page,"get");
		}

		return;
	}

	function goOrderPage() {
		var sParams =  '';
		t.tabShow(3); 
		n_curStep=4; 
		n_curTab=3;
		str_step = arr_steps[n_curStep];		//get step info
		//parse out the page we need
		str_url = sBaseFolder + getItem(str_step,'|',2);
		str_page = sBaseUrl + str_url;
		//target page will be within current tab
		hideHistory();
		hideResultsHistory();
		setStepIcons(n_curTab,n_curStep);
		 div = t.tabs[n_curTab].div;
		//change the info button link
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			if (ib._properties.visible) {
				ib.hide();
			}
			ib.setURL("help/stepinfo" + n_curStep + ".php");

			//change the help button link
			if (hb._properties.visible) {
				hb.hide();
			}
			hb.setURL("help/userhelp" + n_curTab + ".php");
		}
		 checkOrderBtnStatus();
		 progcode = 2;
		postToPage(div,sParams,str_page,"get");
	}

	function displayNextPrevStep() {		
		/* display the appropriate step buttons
		   since users are allowed the freedom to skip steps by 
		   clicking on any tab or step icon, we need to check for 
		   which buttons are currently present first.
		*/
		var DOM_td = document.getElementById("tdStep");
		var DOM_Previmg, DOM_Nextimg;
		if (n_curTab > 0 && n_curTab < (t.tabs.length - 1)) {
			//Steps in between 0 and max so need both step buttons.
			//Check this 1st since majority will be this situation.
			//see if prev step btn is already present			
			DOM_Previmg = document.getElementById("btnPrevStep");
			DOM_Nextimg = document.getElementById("btnNextStep");
			if (DOM_Previmg && DOM_Previmg.className == 'btnDisableStep') {
				if (DOM_Nextimg) {
					DOM_td.removeChild(DOM_Nextimg);
					DOM_Nextimg = null;
				}
				DOM_td.removeChild(DOM_Previmg);
				DOM_Previmg = null;
				DOM_Previmg = document.createElement("img");
				DOM_Previmg.className = "btnStep";
				DOM_Previmg.id = "btnPrevStep";
				DOM_Previmg.src= "images/btn_prevstep.gif";
				DOM_Previmg.style.height = "20px";
				DOM_Previmg.style.width = '70px';
				DOM_Previmg.title = "return to previous step in the workflow";
				DOM_Previmg.onclick = t.navNextStepClick;
				DOM_Previmg.onmouseover = mouseOverImg;
				DOM_Previmg.onmouseout = mouseOutImg;
				//if (DOM_Nextimg) {
				//	This only works for ie so used alternative instead.
				//	DOM_Nextimg.insertAdjacentElement("BeforeBegin",DOM_Previmg);
				//}
				DOM_td.appendChild(DOM_Previmg);
			}

			//see if next step btn is already present
			if (!DOM_Nextimg || DOM_Nextimg.className == 'btnDisableStep') {
				if (DOM_Nextimg) {
					DOM_td.removeChild(DOM_Nextimg);
					DOM_Nextimg = null;
				}
				DOM_Nextimg = document.createElement("img");
				DOM_Nextimg.className = "btnStep";
				DOM_Nextimg.id = "btnNextStep";
				DOM_Nextimg.src= "images/btn_nextstep.gif";
				DOM_Nextimg.style.height = "20px";
				DOM_Nextimg.style.width = '54px';
				DOM_Nextimg.title = "go to next step in the workflow";
				DOM_Nextimg.onclick = t.navNextStepClick;
				DOM_Nextimg.onmouseover = mouseOverImg;
				DOM_Nextimg.onmouseout = mouseOutImg;
				DOM_td.appendChild(DOM_Nextimg);
			}
		} else if (n_curTab == 0)	{
			//at first step so show disabled prev and next step			
			DOM_Previmg = document.getElementById("btnPrevStep");
			DOM_Nextimg = document.getElementById("btnNextStep");
			if (DOM_Previmg) {
				DOM_td.removeChild(DOM_Previmg);				
			}			
			if (DOM_Nextimg) {
				DOM_td.removeChild(DOM_Nextimg);				
			}
			DOM_Previmg = document.createElement("img");
			DOM_Previmg.className = "btnDisableStep";
			DOM_Previmg.id = "btnPrevStep";
			DOM_Previmg.src= "images/btn_prevstep_disabled.gif";
			DOM_Previmg.style.height = "20px";
			DOM_Previmg.style.width = '70px';
			DOM_Previmg.title = "You are already at the beginning.";
			DOM_td.appendChild(DOM_Previmg);
			//next
			DOM_Nextimg = document.createElement("img");
			DOM_Nextimg.className = "btnStep";
			DOM_Nextimg.id = "btnNextStep";
			DOM_Nextimg.src= "images/btn_nextstep.gif";
			DOM_Nextimg.style.height = "20px";
			DOM_Nextimg.style.width = '54px';
			DOM_Nextimg.title = "Go to next step in the workflow";
			DOM_Nextimg.onclick = t.navNextStepClick;
			DOM_Nextimg.onmouseover = mouseOverImg;
			DOM_Nextimg.onmouseout = mouseOutImg;
			DOM_td.appendChild(DOM_Nextimg);
		} else if (n_curTab >= (t.tabs.length - 1)) {
			//at last step so need prev step and disabled next step buttons.
			DOM_Previmg = document.getElementById("btnPrevStep");
			if (DOM_Previmg && DOM_Previmg.className == 'btnDisableStep') {
				DOM_td.removeChild(DOM_Previmg);
				DOM_Previmg = document.createElement("img");
				DOM_Previmg.className = "btnStep";
				DOM_Previmg.id = "btnPrevStep";
				DOM_Previmg.src= "images/btn_prevstep.gif";				
				DOM_Previmg.style.height = "20px";
				DOM_Previmg.style.width = '70px';
				DOM_Previmg.title = "return to previous step in the workflow";
				DOM_Previmg.onclick = t.navNextStepClick;
				DOM_Previmg.onmouseover = mouseOverImg;
				DOM_Previmg.onmouseout = mouseOutImg;
				DOM_td.appendChild(DOM_Previmg);
			}
			DOM_Nextimg = document.getElementById("btnNextStep");
			DOM_td.removeChild(DOM_Nextimg);
			DOM_Nextimg = document.createElement("img");
			DOM_Nextimg.className = "btnDisableStep";
			DOM_Nextimg.id = "btnNextStep";
			DOM_Nextimg.src= "images/btn_nextstep_disabled.gif";
			DOM_Nextimg.style.height = "20px";
			DOM_Nextimg.style.width = '54px';
			DOM_Nextimg.title = "You are at the end.";
			DOM_td.appendChild(DOM_Nextimg);
		}
	}

	function nextStep(id) {
		//DL - go to next step forward or back: 1=next 0=prev
		//get the info we need to determine which step is next
		var div;
		var i, nAct, nTab, nPrevstep, nPrevtab;
		var geneid, species, searchcat;
		var searchtype, searchterms; 
		var str_step, str_page;
		var arr_temp;
		var sParams = '';

		//Issue with firefox showing a selection outline around the parent object of a button when it has focus.
		//Tried setting the hideFocus property, the UNSELECTABLE attribute, but does not work.
		if (bisff || bisff2) {
			elem = document.getElementById('tdStep');
			elem.blur();
		}
		

		nPrevstep = n_curStep;
		nPrevtab = n_curTab;

		if (id == "btnNextStep") {
			n_curTab++;		
		} else if (id == "btnPrevStep") {
			n_curTab--;
		}

		//asset we are within the tab range
		if (n_curTab > t.tabs.length - 1) {
			n_curTab = t.tabs.length - 1;
		} else if (n_curTab < 0) {
			n_curTab = 0;
		}
		n_curStep = arr_curTabSubstep[n_curTab];


		if (!n_curStep || n_curStep == 0)	{
			//need to find the step # to the first substep of this tab
			for(i = 0; i < arr_steps.length; i++) {
				str_step = arr_steps[i];
				arr_temp = getArrayFromRequestString(str_step, '|');
				nTab = parseInt(arr_temp[0]);
				if (nTab == n_curTab) {
					//found the step# we need - step# of 1st substep of this tab.
					n_curStep = i;
					str_page = sBaseUrl + sBaseFolder + arr_temp[2];
					//exit loop
					i = arr_steps.length;
				}
			}
		} else {
			str_step = arr_steps[n_curStep];
			arr_temp = getArrayFromRequestString(str_step, '|');
			str_page = sBaseUrl + sBaseFolder + arr_temp[2];
		}

		
		//tabindex should always be within range of tabs at this point.
		div = t.tabs[n_curTab].div;

		if (nPrevstep == 1 && bSubmit) {
			oDiv1 = t.tabs[0].div.innerHTML;
		} else if (nPrevstep == 2) {
			oDiv2 = t.tabs[0].div.innerHTML;
		} else if (nPrevstep == 0) {
			oDiv = t.tabs[0].div.innerHTML;
		}

		geneid = (t.sGeneID != '')?t.sGeneID:'';
		species = (t.sSearchSpecies != '')?t.sSearchSpecies:'';
		searchcat = (t.sSearchcat != '')?t.sSearchcat:'';
		searchtype = (t.sSearchtype != '')?t.sSearchtype:'';
		searchterms = (t.sSearchTerms != '')?t.sSearchTerms:'';
		sParams += "geneid=" + geneid + "&species=" + species + "&searchcat=" + searchcat + "&searchtype=" + searchtype + "&searchterms=" + searchterms;
		 if (n_curStep == 0 && geneid != '') {
			 sParams = sParams + '&act=get';
		 } else if (n_curStep == 0 && searchcat != '' && searchterms != '') {
			sParams = sParams + '&act=submit';
		 }
		//check to see if we are already displaying the needed tab

		//DL - we need to switch the view to the new tab we need.			
		t.tabShow(n_curTab);
		setStepIcons(n_curTab,n_curStep);

		if (n_curStep != 0) {
			hideHistory();
		}
		if (n_curStep != 2) {
			hideResultsHistory();
		}
		//displayNextPrevStep();
		arr_curTabSubstep[n_curTab] = n_curStep;

		//go get the page to display in target tab.
		if (n_curStep == 1 && oDiv1) {
			//save time by not having to search again
			t.tabs[n_curTab].div.innerHTML = oDiv1;
		} else if (n_curStep == 2 && oDiv2) {
			//save time by not having to search again
			t.tabs[n_curTab].div.innerHTML = oDiv2;
			SyncProducts();
			displayResultsHistory();
		} else if (bSubmit && n_curStep == 0 && oDiv) {
			//save time by not having to search again
			t.tabs[n_curTab].div.innerHTML = oDiv;
			displayHistory();
		} else {
			progcode = 2;	//2=load page
			postToPage(div,sParams,str_page,"get");
		}

		//change the info button link
		if (bissaf) {
			sHelpUrl = "help/userhelp" + n_curTab + ".php?path=" + sBaseUrl;
			sInfoUrl = "help/stepinfo" + n_curStep + ".php?path=" + sBaseUrl;
		} else {
			if (ib._properties.visible) {
				ib.hide();
			}
			ib.setURL("help/stepinfo" + n_curStep + ".php");

			//change the help button link
			if (hb._properties.visible) {
				hb.hide();
			}
			hb.setURL("help/userhelp" + n_curTab + ".php");
		}


		return;
	}	

	function mouseOverImg(event) {
		var id, file;
		var DOM_img;
		if (window.event) {
			DOM_img = window.event.srcElement;
		}
		else {
			DOM_img = Event.element(event);
		}
		file = DOM_img.src;
		if (file.indexOf('_on') == -1) {
			//it's not the highlighted step
			 npos = file.lastIndexOf('.gif');
			 file = file.substr(0,npos) + '_hover.gif';
			 DOM_img.src= file;
		}
	}

	function mouseOutImg(event) {
		var id, file;
		var DOM_img;
		if (window.event) {
			DOM_img = window.event.srcElement;
		}
		else {
			DOM_img = Event.element(event);
		}
		file = DOM_img.src;		
		if (file.indexOf('_on') == -1) {
			//it's not the highlighted step - must be _hover when mouse out.
			 npos = file.lastIndexOf('_hover.gif');
			 if (npos != -1) {
				 file = file.substr(0,npos) + '.gif';
				 DOM_img.src= file;
			 }
		}
	}

	function findProduct(prod, elem)  {
		//use Ajax to send request to page
		var s_filename = '';
		var pos;
		var sParams = 'prod=' + prod;
		var sUrl = 'pages/checkbasket.php';

		var oRequest = new Ajax.Request(sUrl,
			{
			method: 'get',
			parameters: sParams,
			requestHeaders: {Accept: 'application/json'}, 
			onSuccess: function(transport) {
				//var json = transport.responseText.evalJSON(); 
				var response = transport.responseText;				
				if (response.indexOf('YES') >= 0) {
					if (typeof(elem) == 'object' && elem.type == 'checkbox') {
						elem.checked = true;
					} else {
						s_filename = elem.src;
						pos = s_filename.lastIndexOf('/');
						s_filename = s_filename.substr(pos + 1, s_filename.length);
						if (s_filename == 'btn_add.gif') {
							elem.src = 'images/btn_remove.gif';
						}
					}
			
					var amap = document.getElementById('hide_amap');
					if (amap) {
						var item_arr = getArrayFromRequestString(prod,'|~|');
						var type = item_arr[0];
						var id = item_arr[1];
						var gene_id = item_arr[3];
						var cur_gene = t.sGeneID;
						if (cur_gene == gene_id)
						{
							if ('sirna' == type) {
								map.setSelected(['siRNA' + id]); // add a single sirna ID
								//map.toggleSelected ("siRNA" + id);
							} else if ('ge' == type) {
								map.setSelected(['GeXassay_' + id]); // add a single gex ID
								//map.toggleSelected ("GeXassay_" + id);
							} else if ('sise' == type) {
								map.setSelected(['siRNA' + id]); // add a single gex ID
								//map.toggleSelected ("siRNA_" + id);
							}
						}
					}  

					return true;
				}
				else {
					if (typeof(elem) == 'object' && elem.type == 'checkbox') {
						elem.checked = false;
					} else {
						s_filename = elem.src;
						pos = s_filename.lastIndexOf('/');
						s_filename = s_filename.substr(pos + 1, s_filename.length);
						if (s_filename == 'btn_remove.gif') {
							elem.src = 'images/btn_add.gif';
						}
					}
					return false;
				}
			
			},
			onFailure: function(transport) {
				//displayResponse("Error:" + transport.statustext);
				return false;
			}
				
		});
	}

	function callBack() {
			switch (n_curStep)	{
				case 0:
					break;
				case 1:
					break;
				case 2:
					//reloadPage(n_scrollTop);
					break;
				case 3:
					break;
				case 4:
					var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
					var n_scrollTop = 0;
					if (oMainDiv) {
						n_scrollTop = oMainDiv.scrollTop;
					}
					reloadPage(n_scrollTop);
					break;
				default:
			}
	}

	function SyncProducts() {
		var ret = false;
		var str = '';
		var field = document.getElementsByTagName("img");
		var pos,npos;		
		var s_filename = '';
		for (i = 0; i < field.length; i++) {
			ret = findProduct(field[i].id, field[i]);
//			str = field[i].id;
//			pos = str.match('[0-9]');
//			if (pos) {
//				npos = str.indexOf(pos);
//				ret = findProduct(field[i].id, field[i]);
//			} else if (str.indexOf('product_id') != -1) {
//				ret = findProduct(field[i].id, field[i]);
//			}
		} //end for
		callBack();
	}

	function toggleProduct(sProd, pos) {
		var elem = document.getElementById(sProd);
		if (elem) {
			if (pos == 1) {
				elem.src = 'images/btn_add.gif';
			} else {
				elem.src = 'images/btn_remove.gif';
			}
		}
		//Toggle the display of product options on product page.
		//elem = document.getElementById('idDivOptions_' + sProd);

//		if (elem) {
//			if (pos == 1) {
//				elem.style.display = 'none';
//			} else {
//				elem.style.display = 'inline';
//			}			
//		}
		callBack();
	}

	function fillPurity(str_prod, status, field, src_val, prodtype, inventory) {
		var sId;
		var elem, elem_inv, elem_label;
		var cur_elem_val, elem_inv_val, cur_label_val;
		var sparam;
		var bChanged = false;
		if (field != 'Purity') {
			sId = 'Purity_' + str_prod;
			elem = document.getElementById(sId);
			cur_elem_val = elem.value;
			clearSelect(elem);

			sId = 'label_' + str_prod;
			elem_label = document.getElementById(sId);
			if (elem_label) {
				cur_label_val = elem_label.value;
			}
		} else {
			return false;
		}

		if (prodtype == 'sirna') {
			if (field=='Size') {
				if (src_val == '5 nmol') {
					addOption(elem, "STD", "STD");
					if (cur_elem_val != 'STD') {
						elem.value = 'STD';
						bChanged = true;
					}
					// 12/4/2007 DL - removed Validated 5 nmol HPLC
				} else if (src_val == "20 nmol")	{
					if (status=='0') {
						addOption(elem, "STD", "STD");
						addOption(elem, "HPLC", "HPLC");
						if (cur_elem_val == 'STD' || cur_elem_val == 'HPLC') {
							elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
						} else {
							if (cur_label_val != 'None') {
								elem.value = "HPLC";	
							} else {
								elem.value = "STD";				//otherwise make the default STD purity.
							}
							bChanged = true;
						}
					} else {
						//validated
						if (cur_label_val != 'None') {
							//HPLC only
							addOption(elem, "HPLC", "HPLC");
							if (cur_elem_val != 'HPLC') {
								elem.value = 'HPLC';
								bChanged = true;
							}
						} else {
							//STD only
							addOption(elem, "STD", "STD");
							if (cur_elem_val != 'STD') {
								elem.value = 'STD';
								bChanged = true;
							}
						}
					}
				} else if (src_val=="40 nmol")	{
					addOption(elem, "STD", "STD");
					addOption(elem, "HPLC", "HPLC");
					if (cur_elem_val == 'STD' || cur_elem_val == 'HPLC') {
						elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
					} else {
						elem.value = "STD";				//otherwise make the default STD purity.
						bChanged = true;
					}
				} else if (src_val=="100 nmol" || src_val=="250 nmol" || src_val=="1 umol" || src_val=="10 umol") {
					addOption(elem, "In-Vivo", "In-Vivo");
					if (cur_elem_val != 'In-Vivo')	{
						elem.value = "In-Vivo";
						bChanged = true;
					}
				}
			} else if (field=='Label') {
				if (src_val=='None') {
					addOption(elem, "STD", "STD");
					addOption(elem, "HPLC", "HPLC");
					addOption(elem, "In-Vivo", "In-Vivo");
					elem.value = cur_elem_val;
				} else {
					addOption(elem, "HPLC", "HPLC");
					elem.value = "HPLC";
					if (cur_elem_val != "HPLC")	{						
						bChanged = true;
					}
				}
			}
		} else if (prodtype == 'sise') {

			pId = 'Inventory_' + str_prod;
			elem_inv = document.getElementById(pId);
			elem_inv_val = elem_inv.innerHTML;
			if (field=='Size') {
				if (src_val=='5 nmol') {
					addOption(elem, "STD", "STD");
					if (cur_elem_val != 'STD') {
						elem.value = 'STD';
						bChanged = true;
					}
				} else if (src_val == '20 nmol' || src_val == '40 nmol') {
					if (status == '0') {
						//pre-designed
						addOption(elem, "STD", "STD");
						addOption(elem, "HPLC", "HPLC");
						if (cur_elem_val == 'STD' || cur_elem_val == 'HPLC') {
							elem.value = cur_elem_val;
						} else {
							elem.value = "STD";		//otherwise make the default STD purity.
							bChanged = true;
						}
					} else {
						//validated
						addOption(elem, "STD", "STD");
						addOption(elem, "HPLC", "HPLC");
						if (cur_elem_val == 'STD' || cur_elem_val == 'HPLC') {
							elem.value = cur_elem_val;
						} else {
							elem.value = "STD";		//otherwise make the default STD purity.
							bChanged = true;
						}
					} // end status
				}
// MattT.01/31/08 removed 100 nmol for Silencer Select.
/*
				  else if (src_val=='100 nmol') {
					if (inventory == '0')	{
						//100 nmol only available for non-inventory
						addOption(elem, "HPLC", "HPLC");
						if (cur_elem_val != 'HPLC')	{
							elem.value = "HPLC";
							bChanged = true;
						}
					}
				}
*/

			} else if (field=='Strands') {
				//only double stranded are available. No drop down option for Strands so leave alone.
				addOption(elem, "STD", "STD");
				addOption(elem, "HPLC", "HPLC");
				elem.value = cur_elem_val;
			} else if (field=='Label') {
				if (src_val=='None') {
					//No Label option is available for SS right now
					addOption(elem, "STD", "STD");
					addOption(elem, "HPLC", "HPLC");
					if (cur_elem_val == 'STD' || cur_elem_val == 'HPLC') {
						elem.value = cur_elem_val;
					} else {
						elem.value = 'STD';
						if (cur_elem_val != "STD")	{						
							bChanged = true;
						}
					}
				} 
			}
		}
		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=Purity&val=" + elem.value;
		}
		if (prodtype == 'sise') {
			if (!bChanged) {
				sparam = "prod=" + str_prod + "&act=update";
			}
			if (elem.value != 'STD' && elem_inv_val == 'Inventoried') {
				sparam = sparam + "&field1=Inventory&val1=0";
				elem_inv.innerHTML = 'Made to Order';
				bChanged = true;
			} else if (status == '1' && elem.value == 'STD' && elem_inv_val == 'Made to Order') {
				sparam = sparam + "&field1=Inventory&val1=1";
				elem_inv.innerHTML = 'Inventoried';
				bChanged = true;
			} else if (status == '0' && elem.value == 'STD' && elem_inv_val == 'Made to Order') {
				//return it to default status
				var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
				sparam = sparam + "&field1=Inventory&val1=" + arr_prod[12];		//default availability
				elem_inv.innerHTML = (arr_prod[12] == '1')?'Inventoried':'Made to Order';
				bChanged = true;
			}
		}
		if (bChanged) {
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true;
		}
	return false;
	}

	function fillStrands(str_prod, status, field, src_val) {
		//8-18-2007 DL - removed Strands option per request, but leave this
		// in here just in case it is needed for future requirements.
		var sId;
		var elem;
		var cur_elem_val;
		var sparam;
		var bChanged = false;

		if (field != 'Strands' ) {
			sId = 'Strands_' + str_prod;
			elem = document.getElementById(sId);
			cur_elem_val = elem.value;
			clearSelect(elem);
		} else {
			return false;
		}

		if (field=='Size') {
			if (src_val=='20 nmol' || src_val=="25 nmol" || src_val=="40 nmol" || src_val=="160 nmol")	{
				if (status == '0') {
					addOption(elem, "Single", "Single");
				}
				addOption(elem, "Double", "Double");
				if (status == '0') {
					elem.value = cur_elem_val;
				} else {
					elem.value = 'Double';
					if (cur_elem_val != 'Double') {						
						bChanged = true;
					}
				}				
			} else {
				addOption(elem, "Double", "Double");
				elem.value = 'Double';
				if (cur_elem_val != 'Double') {
					bChanged = true;
				}
			}
		} else if (field=='Purity') {
			//doesn't matter, all are available
			if (status == '0') {
				addOption(elem, "Single", "Single");
			}
			addOption(elem, "Double", "Double");
			if (status == '0') {
				elem.value = cur_elem_val;
			} else {
				elem.value = 'Double';
				if (cur_elem_val != "Double") {						
					bChanged = true;
				}
			}
		} else if (field=='Label') {
			if (src_val=='None')	{
				if (status == '0') {
					addOption(elem, "Single", "Single");
				}
				addOption(elem, "Double", "Double");
				if (status == '0') {
					elem.value = cur_elem_val;
				} else {
					elem.value = 'Double';
					if (cur_elem_val != 'Double') {						
						bChanged = true;
					}
				}
			} else {
				addOption(elem, "Double", "Double");
				elem.value = 'Double';
				if (cur_elem_val != "Double")	{						
					bChanged = true;
				}
			}
		} else if (field=='Invivo') {
			if (src_val=='Yes') {
				addOption(elem, "Double", "Double");
				elem.value = 'Double';
				if (cur_elem_val != "Double")	{						
					bChanged = true;
				}
			} else {
				if (status == '0') {
					addOption(elem, "Single", "Single");
				}
				addOption(elem, "Double", "Double");
				if (status == '0') {
					elem.value = cur_elem_val;
				} else {
					elem.value = 'Double';
					if (cur_elem_val != 'Double') {						
						bChanged = true;
					}
				}
			}
		}

		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=Strands&val=" + elem.value;
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true;
		}
	return false;
	}

	function fillLabel(str_prod, status, field, src_val, type, inventory) {
		var sId;
		var elem;
		var cur_elem_val;
		var str_field;
		var s_field;
		var s_value;
		var sparam;
		var bChanged = false;

		if (type=='sirna') {
			str_field = 'Label';
			if (field != 'Label' ) {
				sId = 'Label_' + str_prod;
				elem = document.getElementById(sId);
				cur_elem_val = elem.value;
				clearSelect(elem);
			} else {
				return false;
			}
			if (field=='Size') {
				if (src_val=='20 nmol')	{
					addOption(elem, "FAM", "FAM");
					addOption(elem, "Cy3", "Cy3");
					addOption(elem, "None", "None");
					elem.value = cur_elem_val;
				} else {
					addOption(elem, "None", "None");
					elem.value = 'None';
					if (cur_elem_val != "None")	{
						bChanged = true;
					}
				}
			} else if (field=='Purity') {
				if (src_val=='HPLC') {
					addOption(elem, "FAM", "FAM");
					addOption(elem, "Cy3", "Cy3");
					addOption(elem, "None", "None");
					elem.value = cur_elem_val;
				} else {
					addOption(elem, "None", "None");
					elem.value = 'None';
					if (cur_elem_val != "None")	{
						bChanged = true;
					}
				} 
			} 
		} else if (type == 'sise')  {
			//No label option at this time for SS.
			//Leave at None
			if (field == 'Label' ) {
				return false;
			}
		} else if (type=='tmctrl') {
			var str_field = 'Probe';
			var sId;
			var pId;
			var elem, elem_new;
			var s_field = new Array(3);
			var s_value = new Array(3);
			var cur_elem_val, cur_size_val, cur_species_val, cur_primer_val, name;
			var sparam;
			bChanged = false;

			if (field != 'Probe') {
				pId = 'Size_' + str_prod;
				elem = document.getElementById(pId);
				cur_size_val = elem.value;

				pId = 'Primer_' + str_prod;
				elem = document.getElementById(pId);
				cur_primer_val = elem.value;

				pId = 'Species_' + str_prod;
				elem = document.getElementById(pId);
				cur_species_val = elem.value;

				sId = 'Probe_' + str_prod;
				elem = document.getElementById(sId);
				cur_elem_val = elem.value;

				name = status;
				
			} else {
				return false;
			}

			if (field=='Size') {
				if (src_val=='50 reactions' || src_val=='200 reactions')	{
					clearSelect(elem);
					addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
					if (cur_elem_val != "FAM / MGB Probe") {
						elem.value = "FAM / MGB Probe";	
						bChanged = true;
					}
				} else if (src_val=='1000 reactions') {
					if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
						if ((name=='ACTB (beta actin) Endogenous Control' && cur_primer_val=='Non-Primer Limited') || (name=='GAPD (GAPDH) Endogenous Control' && cur_species_val == 'Mus musculus' && cur_primer_val=='Non-Primer Limited'))	{
							//can only be one option
							clearSelect(elem);
							addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
							if (cur_elem_val != "FAM / MGB Probe") {
								elem.value = "FAM / MGB Probe";	
								bChanged = true;
							}
						} else if (name=='GAPD (GAPDH) Endogenous Control' && cur_species_val == 'Rattus norvegicus') {
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							if (cur_elem_val != "VIC / MGB Probe") {
								elem.value = "VIC / MGB Probe";	
								bChanged = true;
							}
							if (cur_primer_val=='Non-Primer Limited') {
								//change it to VIC
								pId = 'Primer_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Primer Limited", "Primer Limited");
								elem_new.value = "Primer Limited";
								s_field[0] = 'Primer';
								s_value[0] = 'Primer Limited';
								bChanged = true;
							}
						} else {
							if (cur_species_val == 'Homo sapiens') {
								clearSelect(elem);
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
								if (cur_elem_val != 'FAM / MGB Probe') {
									elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
								} else {
									elem.value = "VIC / MGB Probe";				
									bChanged = true;
								}
							} else {
								clearSelect(elem);
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								if (cur_elem_val != "VIC / MGB Probe") {
									elem.value = "VIC / MGB Probe";	
									bChanged = true;
								}
							}
						}
					} else {
						if (cur_species_val=='Human')	{
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
							if (cur_elem_val != 'FAM / MGB Probe') {
								elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
							} else {
								elem.value = "VIC / MGB Probe";				
								bChanged = true;
							}
						} else {
							//not possible option
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
							if (cur_elem_val != 'FAM / MGB Probe') {
								elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
							} else {
								elem.value = "VIC / MGB Probe";				
								bChanged = true;
							}
							//change the values
							pId = 'Primer_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);							
							addOption(elem_new, "Primer Limited", "Primer Limited");
							addOption(elem_new, "Non-Primer Limited", "Non-Primer Limited");
							elem_new.value = "Primer Limited";
							s_field[0] = 'Primer';
							s_value[0] = 'Primer Limited';

							pId = 'Species_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "Human", "Homo sapiens");
							elem_new.value = "Homo sapiens";
							s_field[1] = 'Species';
							s_value[1] = 'Homo sapiens';
						}
					}
				} 
			} else if (field=='Primer') {
				if (src_val=='Primer Limited')	{
					if (cur_size_val=='1000 reactions') {
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
							if (cur_elem_val != 'FAM / MGB Probe') {
								elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
							} else {
								elem.value = "VIC / MGB Probe";				
								bChanged = true;
							}
						} else {
							//has to be GAPD or ACTB
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')	{
								clearSelect(elem);
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								if (cur_elem_val != "VIC / MGB Probe") {
									elem.value = "VIC / MGB Probe";	
									bChanged = true;
								}
							}else {
								//not possible option
								clearSelect(elem);
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
								if (cur_elem_val != 'FAM / MGB Probe') {
									elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
								} else {
									elem.value = "VIC / MGB Probe";				
									bChanged = true;
								}
								//change the values
								pId = 'Primer_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);							
								addOption(elem_new, "Primer Limited", "Primer Limited");
								addOption(elem_new, "Non-Primer Limited", "Non-Primer Limited");
								elem_new.value = "Primer Limited";
								s_field[0] = 'Primer';
								s_value[0] = 'Primer Limited';

								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[1] = 'Species';
								s_value[1] = 'Homo sapiens';
							}
						}
					} else {
						//Primer Limited | 50/200 reactions
						//can not have this combo - must be 1000 reactions + VIC MGB
						clearSelect(elem);
						addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
						addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
						if (cur_elem_val != 'FAM / MGB Probe') {
							elem.value = cur_elem_val;		//keep same value that is there currently since it's a possible option.
						} else {
							elem.value = "VIC / MGB Probe";				
							bChanged = true;
						}						
						pId = 'Size_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "1000 reactions", "1000 reactions");
						elem_new.value = "1000 reactions";
						s_field[0] = 'Size';
						s_value[0] = '1000 reactions';
						bChanged = true;

					}
				} else {
					//Non-Primer Limited
					if ((name=='ACTB (beta actin) Endogenous Control') || (name=='GAPD (GAPDH) Endogenous Control' && cur_species_val == 'Mus musculus'))	{
						//can only be one option
						clearSelect(elem);
						addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
						if (cur_elem_val != "FAM / MGB Probe") {
							elem.value = "FAM / MGB Probe";	
							bChanged = true;
						}
					} else if (name=='GAPD (GAPDH) Endogenous Control' && cur_species_val == 'Rattus norvegicus') {
						clearSelect(elem);
						addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
						if (cur_elem_val != "VIC / MGB Probe") {
							elem.value = "VIC / MGB Probe";	
						}
						//change it to Primer Limited
						pId = 'Primer_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "Primer Limited", "Primer Limited");
						elem_new.value = "Primer Limited";
						s_field[0] = 'Primer';
						s_value[0] = 'Primer Limited';
						bChanged = true;
					} else if (cur_species_val == 'Homo sapiens') {
						clearSelect(elem);
						addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
						if (cur_elem_val != "FAM / MGB Probe") {
							elem.value = "FAM / MGB Probe";	
							bChanged = true;
						}
					} else {
						//non-human is not a possible option to get here. Set to defaults, but
						//can't use the setProductDefault fxn because it posts a new page with new 
						//ids which would interfere with remaining fxns in the SyncSelectionsExt
						//function. Unless we return an updated str_prod string after each of these
						//fillXXXX fxns so the next fill fxn will have the right ids to work with.
						//It is easier to just do it this way.
						//
						//change the values
						pId = 'Primer_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "Non-Primer Limited", "Non-Primer Limited");
						addOption(elem_new, "Primer Limited", "Primer Limited");
						elem_new.value = "Non-Primer Limited";
						s_field[0] = 'Primer';
						s_value[0] = 'Non-Primer Limited';

						pId = 'Species_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "Human", "Homo sapiens");
						elem_new.value = "Homo sapiens";
						s_field[1] = 'Species';
						s_value[1] = 'Homo sapiens';

						pId = 'Size_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "50 reactions", "50 reactions");
						addOption(elem_new, "200 reactions", "200 reactions");
						addOption(elem_new, "1000 reactions", "1000 reactions");
						elem_new.value = "50 reactions";
						s_field[2] = 'Size';
						s_value[2] = '50 reactions';

						addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
						addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
						addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
						elem.value = "FAM / MGB Probe";

						bChanged = true;
					}
				} 
			} else if (field=='Species') {
				if (src_val=='Homo sapiens')	{
					if (cur_primer_val=='Primer Limited')	{
						if (cur_size_val == '1000 reactions') {
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
							if (cur_elem_val != 'FAM / MGB Probe') {
								elem.value = cur_elem_val;
							} else {
								elem.value = "VIC / MGB Probe";				
								bChanged = true;
							}
						} else {
							clearSelect(elem);
							addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
							if (cur_elem_val != "FAM / MGB Probe") {
								elem.value = "FAM / MGB Probe";	
								bChanged = true;
							}
						}
					} else {
						clearSelect(elem);
						addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
						if (cur_elem_val != "FAM / MGB Probe") {
							elem.value = "FAM / MGB Probe";	
							bChanged = true;
						}
					}
				} else if (src_val=='Mus musculus' || src_val=='Rattus norvegicus') {
					if (cur_primer_val=='Primer Limited')	{
						if (cur_size_val == '1000 reactions') {
							clearSelect(elem);
							addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
							if (cur_elem_val != "VIC / MGB Probe") {
								elem.value = "VIC / MGB Probe";	
								bChanged = true;
							}
						} else {
							//Mouse/Rat | Primer Limited | 50/200 reactions - not an option
							clearSelect(elem);
							pId = 'Size_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "1000 reactions", "1000 reactions");
							elem_new.value = "1000 reactions";
							s_field[0] = 'Size';
							s_value[0] = '1000 reactions';

							if (name=='ACTB (beta actin) Endogenous Control')	{
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
								elem.value = "VIC / MGB Probe";				
							} else if (name=='GAPD (GAPDH) Endogenous Control')	{
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								elem.value = "VIC / MGB Probe";				
							} else {
								//cannot be non-human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[1] = 'Species';
								s_value[1] = 'Homo sapiens';

								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
								if (cur_elem_val != "VIC / MGB Probe") {
									elem.value = "VIC / MGB Probe";										
								}
							}
							bChanged = true;
						}
					} else {
						//Non-Primer Limited | Changed to Mouse/Rat
						if (cur_size_val == '1000 reactions') {
							clearSelect(elem);
							bChanged = true;
							if ((name=='ACTB (beta actin) Endogenous Control') || (name=='GAPD (GAPDH) Endogenous Control' && src_val=='Mus musculus'))	{
								addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
								elem.value = "FAM / MGB Probe";												
							} else {
								//not possible combo so change to 50/200 reactions | FAM | Human
								//change the values
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[0] = 'Species';
								s_value[0] = 'Homo sapiens';

								pId = 'Size_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "50 reactions", "50 reactions");
								addOption(elem_new, "200 reactions", "200 reactions");
								addOption(elem_new, "1000 reactions", "1000 reactions");
								elem_new.value = "50 reactions";
								s_field[1] = 'Size';
								s_value[1] = '50 reactions';

								addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
								addOption(elem, "VIC / MGB Probe", "VIC / MGB Probe");
								addOption(elem, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
								elem.value = "FAM / MGB Probe";
							}
						} else {
							clearSelect(elem);
							addOption(elem, "FAM / MGB Probe", "FAM / MGB Probe");
							if (cur_elem_val != "FAM / MGB Probe") {
								elem.value = "FAM / MGB Probe";
							}
							pId = 'Species_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "Human", "Homo sapiens");
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control' ) {
								addOption(elem_new, "Mouse", "Mus musculus");
								addOption(elem_new, "Rat", "Rattus norvegicus");
							}
							elem_new.value = "Homo sapiens";
							s_field[0] = 'Species';
							s_value[0] = 'Homo sapiens';
							bChanged = true;
						}
					}
				} 
			} //end if field
		} // end if type

		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=" + str_field + "&val=" + elem.value;
			for (var i=1; i <= s_field.length; i++)	{
				if (s_field[i] != '' && s_value[i] != '') {
					sparam+= '&field' + i + '=' + s_field[i] + '&val' + i + '=' + s_value[i];
				}
			}
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true;
		}
	return false;
	}

	function fillSize(str_prod, status, field, src_val, type, inventory) {
		//Updated 6-8-2007 DL
		var sId;
		var pId;
		var elem, elem_new;
		var s_field = new Array(3);
		var s_value = new Array(3);
		var cur_elem_val, cur_purity_val, cur_strand_val, cur_label_val, cur_invivo_val;
		var sparam;
		var bChanged = false;

		if (type=='sirna') {
			if (field != 'Size') {
				pId = 'Purity_' + str_prod;
				elem = document.getElementById(pId);
				cur_purity_val = elem.value;				
				pId = 'Label_' + str_prod;
				elem = document.getElementById(pId);
				cur_label_val = elem.value;
				sId = 'Size_' + str_prod;
				elem = document.getElementById(sId);
				cur_elem_val = elem.value;
				//always double-stranded, single strand obsoleted
				cur_strand_val = 'Double';
			} else {
				return false;
			}

			if (field=='Purity') {
				if (status=='0') {
					if (src_val == 'STD') {
						//Std, ds
						clearSelect(elem);
						addOption(elem, "5 nmol", "5 nmol");
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
						if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "5 nmol";
							bChanged = true;
						}
						//make sure label=none
						if (cur_label_val != 'None') {
							//change Label back to None
							pId = 'Label_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "None", "None");
							elem_new.value = "None";
							s_field[0] = 'Label';
							s_value[0] = 'None';
							bChanged = true;
						}
					} // end if src_val == STD
					  else if (src_val == 'HPLC') {
						clearSelect(elem);
						if (cur_label_val == 'None') {
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
							if (cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
								elem.value = cur_elem_val;
							} else {
								elem.value = "20 nmol";
								bChanged = true;
							}	
						} else {
							//label=yes can only be 20nmol
							addOption(elem, "20 nmol", "20 nmol");
							elem.value = "20 nmol";
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						}						  
					} // end src_val == HPLC
					 else if (src_val == 'In-Vivo') {
						clearSelect(elem);
						addOption(elem, "100 nmol", "100 nmol");
						addOption(elem, "250 nmol", "250 nmol");
						addOption(elem, "1 umol", "1 umol");
						addOption(elem, "10 umol", "10 umol");
						if (cur_elem_val == '100 nmol' || cur_elem_val == '250 nmol' || cur_elem_val == '1 umol' || cur_elem_val == '10 umol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "100 nmol";
							bChanged = true;
						}

						if (cur_label_val != 'None') {
							//change Label back to None
							pId = 'Label_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "None", "None");
							elem_new.value = "None";
							s_field[0] = 'label';
							s_value[0] = 'None';
							bChanged = true;
						}
					 } // end src_val == In-Vivo
				} //end if status==0
				else { // staus==1
					if (src_val == 'STD') {
						clearSelect(elem);
						addOption(elem, "5 nmol", "5 nmol");
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
						if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							elem.value = cur_elem_val;
						} else {
							elem.value = "5 nmol";
							bChanged = true;
						}
						if (cur_label_val != 'None') {
							pId = 'Label_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "None", "None");
							elem_new.value = "None";
							s_field[0] = 'Label';
							s_value[0] = 'None';
							bChanged = true;
						}
					} else if (src_val == 'HPLC') {
						clearSelect(elem);
						if (cur_label_val == 'None') {
							//12/4/2007 - removed obsoleted 5 nmol option for Validated HPLC
							addOption(elem, "20 nmol", "20 nmol");								
							addOption(elem, "40 nmol", "40 nmol");
							elem.value = "20 nmol";
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							//labeled HPLC must be 20 nmol
							addOption(elem, "20 nmol", "20 nmol");
							elem.value = "20 nmol";
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						}
					} // end src_val == HPLC
					else if (src_val == 'In-Vivo') {
						clearSelect(elem);
						addOption(elem, "100 nmol", "100 nmol");
						addOption(elem, "250 nmol", "250 nmol");
						addOption(elem, "1 umol", "1 umol");
						addOption(elem, "10 umol", "10 umol");
						if (cur_elem_val == '100 nmol' || cur_elem_val == '250 nmol' || cur_elem_val == '1 umol' || cur_elem_val == '10 umol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "100 nmol";
							bChanged = true;
						}
						if (cur_label_val != 'None') {
							pId = 'Label_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "None", "None");
							elem_new.value = "None";
							s_field[0] = 'Label';
							s_value[0] = 'None';
							bChanged = true;
						}
					} // end src_val == In-Vivo
				} // end status == 1
			//end if field==Purity
			} else if (field == 'Label') {
				if (src_val != 'None') {
					//label is Cy3 or FAM
					//regardless of validated or not, it is the same.
					clearSelect(elem);
					addOption(elem, "20 nmol", "20 nmol");
					elem.value = "20 nmol";
					if (cur_elem_val != elem.value) {
						bChanged = true;
					}
					//must be HPLC purified
					if (cur_purity_val != 'HPLC') {
						pId = 'Purity_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "HPLC", "HPLC");
						elem_new.value = "HPLC";
						s_field[0] = 'Purity';
						s_value[0] = 'HPLC';
						bChanged = true;
					}
				// end if src_val != none
				} else { //src_val (label) == none
					if (cur_purity_val == 'STD') {
						//regardless of validation status
						clearSelect(elem);
						addOption(elem, "5 nmol", "5 nmol");
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
						if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "5 nmol";
							bChanged = true;
						}						
					//end purity == STD
					} else if (cur_purity_val == 'HPLC') {
						//12/4/2007 removed obsolete validated hplc 5 nmol option.
						clearSelect(elem);
						if (status=='1') {
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
							elem.value = "20 nmol";
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
							if (cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "20 nmol";
								bChanged = true;
							}
						}
					//end purity == HPLC
					} else if (cur_purity_val == 'In-Vivo') {
						//regardless of status, options are the same.
						clearSelect(elem);
						addOption(elem, "100 nmol", "100 nmol");
						addOption(elem, "250 nmol", "250 nmol");
						addOption(elem, "1 umol", "1 umol");
						addOption(elem, "10 umol", "10 umol");
						if (cur_elem_val == '100 nmol' || cur_elem_val == '250 nmol' || cur_elem_val == '1 umol' || cur_elem_val == '10 umol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "100 nmol";
							bChanged = true;
						}
					} else { // none of the above
						//reset options.
						clearSelect(elem);
						addOption(elem, "5 nmol", "5 nmol");
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
						addOption(elem, "100 nmol", "100 nmol");
						addOption(elem, "250 nmol", "250 nmol");
						addOption(elem, "1 umol", "1 umol");
						addOption(elem, "10 umol", "10 umol");
						elem.value = "5 nmol";
						//change to HPLC
						pId = 'Purity_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "STD", "STD");
						addOption(elem_new, "HPLC", "HPLC");
						addOption(elem_new, "In-Vivo", "In-Vivo");
						elem_new.value = "STD";
						s_field[0] = 'Purity';
						s_value[0] = 'STD';
						bChanged = true;
					} // end purity
				} // end label = none
			} //end field = Label
		} // end if sirna
		else if (type == 'sise') {
			if (field != 'Size') {
				pId = 'Purity_' + str_prod;
				elem = document.getElementById(pId);
				cur_purity_val = elem.value;
				
				//pId = 'Label_' + str_prod;
				//elem = document.getElementById(pId);
				cur_label_val = 'None';

				sId = 'Size_' + str_prod;
				elem = document.getElementById(sId);
				cur_elem_val = elem.value;

				//pId = 'Strands_' + str_prod;
				//elem = document.getElementById(pId);
				cur_strand_val = 'Double';

				pId = 'Inventory_' + str_prod;
				elem_inv = document.getElementById(pId);
				elem_inv_val = elem_inv.innerHTML;
			} else {
				return false;
			}
			if (field=='Purity') {
				if (status=='0') {
					if (src_val == 'STD') {
						clearSelect(elem);
						addOption(elem, "5 nmol", "5 nmol");
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
						if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "5 nmol";
							bChanged = true;
						}
					} else if (src_val == 'HPLC') {
							clearSelect(elem);
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
// MattT.01/31/08 removed 100 nmol for Silencer Select.
//							addOption(elem, "100 nmol", "100 nmol");
//							if (cur_elem_val == '100 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							if (cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "20 nmol";
								bChanged = true;
							}						 
					} // end HPLC
					//end status=0
				} else {
					//status=1
					if (src_val == 'STD') {
						if (inventory == '1') {
							clearSelect(elem);
							addOption(elem, "5 nmol", "5 nmol");
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
							if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "5 nmol";
								bChanged = true;
							}
						} else {
							//Validated STD --> to Inventoried
							clearSelect(elem);
							addOption(elem, "5 nmol", "5 nmol");
							addOption(elem, "20 nmol", "20 nmol");
							addOption(elem, "40 nmol", "40 nmol");
							if (cur_elem_val == '5 nmol' || cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "5 nmol";
								bChanged = true;
							}
						}
					} else if (src_val == 'HPLC') {
						//will be changed to MTO
						clearSelect(elem);
						addOption(elem, "20 nmol", "20 nmol");
						addOption(elem, "40 nmol", "40 nmol");
// MattT.01/31/08 removed 100 nmol for Silencer Select.
//						addOption(elem, "100 nmol", "100 nmol");
//						if (cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol' || cur_elem_val == '100 nmol') {
						if (cur_elem_val == '20 nmol' || cur_elem_val == '40 nmol') {
							elem.value = cur_elem_val;		
						} else {
							elem.value = "20 nmol";
							bChanged = true;
						}
					} // end HPLC
				} // end status=1
			} else if (field == 'Label') {
				//label option not available for SS yet
			}
		} // end if sise
		else if (type=='tmctrl') {
			var sId;
			var pId;
			var elem, elem_new;
			var cur_elem_val, cur_probe_val, cur_species_val, cur_primer_val, name;
			var sparam;
			bChanged = false;

			if (field != 'Size') {
				pId = 'Probe_' + str_prod;
				elem = document.getElementById(pId);
				cur_probe_val = elem.value;

				pId = 'Primer_' + str_prod;
				elem = document.getElementById(pId);
				cur_primer_val = elem.value;

				pId = 'Species_' + str_prod;
				elem = document.getElementById(pId);
				cur_species_val = elem.value;

				sId = 'Size_' + str_prod;
				elem = document.getElementById(sId);
				cur_elem_val = elem.value;

				name = status;
				

			} else {
				return false;
			}

			if (field=='Probe') {
				if (src_val=='FAM / MGB Probe')	{
					if (cur_primer_val == 'Non-Primer Limited') {
						if (cur_species_val == 'Homo sapiens') {
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								addOption(elem, "1000 reactions", "1000 reactions");
								elem.value = cur_elem_val;
							} else {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								if (cur_elem_val != '1000 reactions') {
									elem.value = cur_elem_val;		
								} else {
									elem.value = "50 reactions";
									bChanged = true;
								}
							}

						} else {
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								addOption(elem, "1000 reactions", "1000 reactions");
								elem.value = cur_elem_val;
							} else {
								//human is the only species possible for this combo
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								s_field[0] = 'Species';
								s_value[0] = 'Homo sapiens';
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
								bChanged = true;
							}
						}

					} else {
						//FAM|Primer Limited - not possible combo
						if (cur_species_val != 'Homo sapiens' && (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')) {
							//only be VIC MGB and 1000 reactions
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");							
							//change probe back to VIC MGB
							pId = 'Probe_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "VIC / MGB Probe", "VIC / MGB Probe");
							elem_new.value = "VIC / MGB Probe";
							s_field[0] = 'Probe';
							s_value[0] = 'VIC / MGB Probe';
							//sparam = "prod=" + str_prod + "&";
							//sparam = sparam + "act=update&field=Probe&val=VIC / MGB Probe";
							//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
							bChanged = true;
						} else {
							//only be either VIC MGB or TAMRA and 1000 reactions
							addOption(elem, "1000 reactions", "1000 reactions");							
							//change probe back to VIC MGBm,. '

							pId = 'Probe_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
							addOption(elem_new, "VIC / MGB Probe", "VIC / MGB Probe");
							elem_new.value = "VIC / MGB Probe";
							s_field[0] = 'Probe';
							s_value[0] = 'VIC / MGB Probe';
							//sparam = "prod=" + str_prod + "&";
							//sparam = sparam + "act=update&field=Probe&val=VIC / MGB Probe";
							//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
							bChanged = true;
						}
					}
				} else if (src_val=='VIC / MGB Probe') {
					if (cur_primer_val == 'Primer Limited') {
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");
								if (cur_elem_val != elem.value) {
									bChanged = true;
								}
							}
						}

					} else {
						//VIC-MGB|Non-Primer Limited - not possible combo
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "50 reactions", "50 reactions");
							addOption(elem, "200 reactions", "200 reactions");
							if (cur_elem_val != '1000 reactions') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "50 reactions";
							}
							//change probe back to FAM MGB
							pId = 'Probe_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
							elem_new.value = "FAM / MGB Probe";
							s_field[0] = 'Probe';
							s_value[0] = 'FAM / MGB Probe';
							//sparam = "prod=" + str_prod + "&";
							//sparam = sparam + "act=update&field=Probe&val=FAM / MGB Probe";
							//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
							bChanged = true;
						} else {
							addOption(elem, "1000 reactions", "1000 reactions");
							//change probe back to FAM MGB
							pId = 'Probe_' + str_prod;
							elem_new = document.getElementById(pId);
							clearSelect(elem_new);
							addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
							elem_new.value = "FAM / MGB Probe";
							s_field[0] = 'Probe';
							s_value[0] = 'FAM / MGB Probe';
							//sparam = "prod=" + str_prod + "&";
							//sparam = sparam + "act=update&field=Probe&val=FAM / MGB Probe";
							//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
							bChanged = true;
						}

					}
				} else if (src_val=='VIC / TAMRA Probe') {
					if (cur_primer_val == 'Primer Limited') {
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							//VIC/TAMRA|Primer Limited|Non-Human - not possible combo
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");
								//change probe back to FAM MGB
								pId = 'Probe_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
								elem_new.value = "FAM / MGB Probe";
								s_field[0] = 'Probe';
								s_value[0] = 'FAM / MGB Probe';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Probe&val=FAM / MGB Probe";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
								bChanged = true;
							} else {
								//only be either VIC MGB or TAMRA and 1000 reactions
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");	
								
								//change probe back to VIC MGB
								pId = 'Probe_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
								addOption(elem_new, "VIC / MGB Probe", "VIC / MGB Probe");
								elem_new.value = "VIC / MGB Probe";
								s_field[0] = 'Probe';
								s_value[0] = '"VIC / MGB Probe';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Probe&val=VIC / MGB Probe";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");

								//change species back to Human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[1] = 'Species';
								s_value[1] = 'Homo sapiens';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
								bChanged = true;
							}
						}
					} else {
						//VIC-TAMRA|Non-Primer Limited - not possible combo
						if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");
								bChanged = true;

								//change probe back to FAM MGB

								pId = 'Probe_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
								elem_new.value = "FAM / MGB Probe";
								s_field[0] = 'Probe';
								s_value[0] = 'FAM / MGB Probe';

								
						} else {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								if (cur_elem_val != '1000 reactions') {
									elem.value = cur_elem_val;		
								} else {
									elem.value = "50 reactions";
								}

								//change probe back to FAM MGB
								pId = 'Probe_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
								elem_new.value = "FAM / MGB Probe";
								s_field[0] = 'Probe';
								s_value[0] = 'FAM / MGB Probe';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Probe&val=FAM / MGB Probe";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
								bChanged = true;
							if (cur_species_val != 'Homo sapiens') {
								//change species back to Human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[1] = 'Species';
								s_value[1] = 'Homo sapiens';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");								
							}
						}
					}
				} 
			} else if (field=='Primer') {
				if (src_val=='Primer Limited')	{
					if (cur_probe_val=='VIC / TAMRA Probe') {
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							//not possible combo- Primer Limited|VIC TAMRA|Non-Human - couldn't have had option for VIC TAMRA
							//leave blank since it should be impossible to trigger this.
						}
					} else if (cur_probe_val=='VIC / MGB Probe') {
						if (cur_species_val == 'Homo sapiens') {
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");
								if (cur_elem_val != elem.value) {
									bChanged = true;
								}
							} else {
								//can only be Human
								clearSelect(elem);
								addOption(elem, "1000 reactions", "1000 reactions");
								//change species back to Human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[0] = 'Species';
								s_value[0] = 'Homo sapiens';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");	
								bChanged = true;
							}
						}
					}
				} else {
					//Non-Primer Limited
					if (cur_probe_val=='FAM / NGB Probe') {
						if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
							clearSelect(elem);
							addOption(elem, "50 reactions", "50 reactions");
							addOption(elem, "200 reactions", "200 reactions");
							addOption(elem, "1000 reactions", "1000 reactions");
							elem.value = cur_elem_val;
						} else {
							if (cur_species_val == 'Homo sapiens') {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								if (cur_elem_val != '1000 reactions') {
									elem.value = cur_elem_val;		
								} else {
									elem.value = "50 reactions";
									bChanged = true;
								}
							} else {
								//not possible to have Non-Primer|FAM/MGB|Non ACTB/GAPDH|non-human
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								if (cur_elem_val != '1000 reactions') {
									elem.value = cur_elem_val;		
								} else {
									elem.value = "50 reactions";
								}
								//change species back to Human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[0] = 'Species';
								s_value[0] = 'Homo sapiens';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");	
								bChanged = true;
							}
						}
					} else {
						//not possible to be non-primer and Vic probes
						//change probe back to FAM MGB
						pId = 'Probe_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "FAM / MGB Probe", "FAM / MGB Probe");
						elem_new.value = "FAM / MGB Probe";
						s_field[0] = 'Probe';
						s_value[0] = 'FAM / MGB Probe';
						//sparam = "prod=" + str_prod + "&";
						//sparam = sparam + "act=update&field=Probe&val=FAM / MGB Probe";
						//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");

						if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
							clearSelect(elem);
							addOption(elem, "50 reactions", "50 reactions");
							addOption(elem, "200 reactions", "200 reactions");
							addOption(elem, "1000 reactions", "1000 reactions");
							elem.value = cur_elem_val;
						} else {
							if (cur_species_val == 'Homo sapiens') {
								clearSelect(elem);
								addOption(elem, "50 reactions", "50 reactions");
								addOption(elem, "200 reactions", "200 reactions");
								if (cur_elem_val!='' && cur_elem_val != '1000 reactions') {
									elem.value = cur_elem_val;		
								} else {
									elem.value = "50 reactions";
								}
							} else {
								if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
									clearSelect(elem);
									addOption(elem, "50 reactions", "50 reactions");
									addOption(elem, "200 reactions", "200 reactions");
									addOption(elem, "1000 reactions", "1000 reactions");
									elem.value = cur_elem_val;
								} else {
									clearSelect(elem);
									addOption(elem, "50 reactions", "50 reactions");
									addOption(elem, "200 reactions", "200 reactions");
									if (cur_elem_val!='' && cur_elem_val != '1000 reactions') {
										elem.value = cur_elem_val;		
									} else {
										elem.value = "50 reactions";
									}
								}
								//non human - not an option
								//change species back to Human
								pId = 'Species_' + str_prod;
								elem_new = document.getElementById(pId);
								clearSelect(elem_new);
								addOption(elem_new, "Human", "Homo sapiens");
								elem_new.value = "Homo sapiens";
								s_field[0] = 'Species';
								s_value[0] = 'Homo sapiens';
								//sparam = "prod=" + str_prod + "&";
								//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
								//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");	
							}
						}
						bChanged = true;
					}
				} 
			} else if (field=='Species') {
				if (src_val=='Homo sapiens') {
					if (cur_primer_val=='Non-Primer Limited')	{
						if (cur_probe_val=='FAM / NGB Probe' && (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')) {
							clearSelect(elem);
							addOption(elem, "50 reactions", "50 reactions");
							addOption(elem, "200 reactions", "200 reactions");
							addOption(elem, "1000 reactions", "1000 reactions");
							elem.value = cur_elem_val;
						} else if (cur_probe_val=='FAM / NGB Probe') {
							clearSelect(elem);
							addOption(elem, "50 reactions", "50 reactions");
							addOption(elem, "200 reactions", "200 reactions");
							if (cur_elem_val != '1000 reactions') {
								elem.value = cur_elem_val;		
							} else {
								elem.value = "50 reactions";
								bChanged = true;
							}
						}
					} else {
						//Primer Limited Human
						if (cur_probe_val=='VIC / TAMRA Probe' || cur_probe_val=='VIC / MGB Probe') {
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						} else {
							//not possible to have FAM
						}
					}
				} else if (src_val=='Mus musculus' || src_val=='Rattus norvegicus') {
					if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
						if ((cur_primer_val=='Primer Limited' && cur_probe_val=='VIC / NGB Probe') || (cur_primer_val=='Non-Primer Limited' && cur_probe_val=='FAM / NGB Probe'))	{
							clearSelect(elem);
							addOption(elem, "1000 reactions", "1000 reactions");
							if (cur_elem_val != elem.value) {
								bChanged = true;
							}
						}
					} else {
						//cannot be anything else
						//change species back to Human
						pId = 'Species_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "Human", "Homo sapiens");
						elem_new.value = "Homo sapiens";
						s_field[0] = 'Species';
						s_value[0] = 'Homo sapiens';
						//sparam = "prod=" + str_prod + "&";
						//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
						//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");	
						bChanged = true;
					}
				} 
			} //end if field
		}
		var n_fieldcount = 1;
		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=Size&val=" + elem.value;			
			for (var i=1; i <= s_field.length; i++)	{
				if (s_field[i] != '' && s_value[i] != '') {
					sparam = sparam + '&field' + i + '=' + s_field[i] + '&val' + i + '=' + s_value[i];
					n_fieldcount++;
				}
			}
		}
		if (type == 'sise') {
			if (!bChanged) {
				sparam = "prod=" + str_prod + "&act=update";
			}
			if (src_val != 'STD' && elem_inv_val == 'Inventoried') {
				sparam = sparam + "&field" + n_fieldcount + "=Inventory&val" + n_fieldcount + "=0";
				elem_inv.innerHTML = 'Made to Order';
				bChanged = true;
			} else if (status == '1' && src_val == 'STD' && elem_inv_val == 'Made to Order') {
				sparam = sparam + "&field" + n_fieldcount + "=Inventory&val" + n_fieldcount + "=1";
				elem_inv.innerHTML = 'Inventoried';
				bChanged = true;
			} else if (status == '0' && src_val == 'STD' && elem_inv_val == 'Made to Order') {
				//return it to default status
				var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
				sparam = sparam + "&field" + n_fieldcount + "=Inventory&val" + n_fieldcount + "=" + arr_prod[12];		//default availability
				elem_inv.innerHTML = (arr_prod[12] == '1')?'Inventoried':'Made to Order';
				bChanged = true;
			}
		}
		if (bChanged) {
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true;
		}

	return false;
	}

	function fillPrimer(str_prod, status, field, src_val) {
		var sId;
		var pId;
		var elem, elem_new;
		var s_field = new Array(3);
		var s_value = new Array(3);
		var cur_elem_val, new_elem_val, cur_size_val, cur_species_val, cur_probe_val, name;
		var sparam;
		var bChanged = false;

		if (field != 'Primer') {
			pId = 'Probe_' + str_prod;
			elem = document.getElementById(pId);
			cur_probe_val = elem.value;

			pId = 'Size_' + str_prod;
			elem = document.getElementById(pId);
			cur_size_val = elem.value;

			pId = 'Species_' + str_prod;
			elem = document.getElementById(pId);
			cur_species_val = elem.value;

			sId = 'Primer_' + str_prod;
			elem = document.getElementById(sId);
			cur_elem_val = elem.value;

			name = status;			
		} else {
			sId = 'Primer_' + str_prod;
			elem = document.getElementById(sId);
			cur_elem_val = src_val;
		}

		if (field=='Probe') {
			if (src_val=='FAM / MGB Probe')	{
				new_elem_val = "Non-Primer Limited";
				bChanged = true;
			} else if (src_val=='VIC / MGB Probe' || src_val=='VIC / TAMRA Probe') {
				new_elem_val = "Primer Limited";
				bChanged = true;
			} 
		} else if (field=='Size') {
			if (src_val=='50 reactions' || src_val=='200 reactions') {
				new_elem_val = "Non-Primer Limited";
				bChanged = true;
			} else if (src_val=='1000 reactions') {
				if (cur_species_val == 'Homo sapiens') {
					if (cur_probe_val == 'FAM / MGB Probe') {
						new_elem_val = "Non-Primer Limited";
						bChanged = true;
					} else {
						new_elem_val = "Primer Limited";
						bChanged = true;
					}
				} else {
					if (cur_probe_val=='FAM / NGB Probe' && (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')) {
						new_elem_val = "Non-Primer Limited";
						bChanged = true;
					} else if (cur_probe_val=='VIC / NGB Probe' && (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')) {
						new_elem_val = "Primer Limited";
						bChanged = true;
					} else {
						new_elem_val = "Primer Limited";
						bChanged = true;

						//change species back to Human
						pId = 'Species_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "Human", "Homo sapiens");
						elem_new.value = "Homo sapiens";
						s_field[0] = 'Species';
						s_value[0] = 'Homo sapiens';
						//sparam = "prod=" + str_prod + "&";
						//sparam = sparam + "act=update&field=Species&val=Homo sapiens";
						//sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");	

						pId = 'Probe_' + str_prod;
						elem_new = document.getElementById(pId);
						clearSelect(elem_new);
						addOption(elem_new, "VIC / MGB Probe", "VIC / MGB Probe");
						addOption(elem_new, "VIC / TAMRA Probe", "VIC / TAMRA Probe");
						elem_new.value = "VIC / MGB Probe";
						s_field[1] = 'Probe';
						s_value[1] = 'VIC / MGB Probe';
					}
				}
			} 
		} else if (field=='Species') {
			//doesn't matter - contains both for all species.
			new_elem_val = cur_elem_val;
		}

		clearSelect(elem);
		addOption(elem, "Primer Limited", "Primer Limited");
		addOption(elem, "Non-Primer Limited", "Non-Primer Limited");
		if (field=='Primer') {
			elem.value = cur_elem_val;
		} else {
			elem.value = new_elem_val;
		}

		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=Primer&val=" + elem.value;
			for (var i=1; i <= s_field.length; i++)	{
				if (s_field[i] != '' && s_value[i] != '') {
					sparam = sparam + '&field' + i + '=' + s_field[i] + '&val' + i + '=' + s_value[i];
				}
			}
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true;
		}
	return false;
	}

	function fillSpecies(str_prod, field, src_val, name) {
		var sId;
		var elem;
		var cur_elem_val;
		var sparam;
		var bChanged = false;

		sId = 'Species_' + str_prod;
		elem = document.getElementById(sId);
		cur_elem_val = elem.value;
		if (field != 'Species') {			
			clearSelect(elem);
		} 

		if (field=='Species' && src_val != 'Homo sapiens') {
			if (name!='ACTB (beta actin) Endogenous Control' && name!='GAPD (GAPDH) Endogenous Control')	{
				clearSelect(elem);
				addOption(elem, "Human", "Homo sapiens");
				bChanged = true;
			} 
		} else if (field=='Species') {
			if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control')	{
				clearSelect(elem);
				addOption(elem, "Human", "Homo sapiens");
				addOption(elem, "Mouse", "Mus musculus");
				addOption(elem, "Rat", "Rattus norvegicus");
				elem.value = cur_elem_val;
				bChanged = true;
			} 
		}else if (field=='Probe') {
			if (src_val=='FAM / MGB Probe' || src_val=='VIC / MGB Probe')	{
				addOption(elem, "Human", "Homo sapiens");
				addOption(elem, "Mouse", "Mus musculus");
				addOption(elem, "Rat", "Rattus norvegicus");
				elem.value = cur_elem_val;
			} else if (src_val=='VIC / TAMRA Probe') {
				addOption(elem, "Human", "Homo sapiens");
				bChanged = true;
			} 
		} else if (field=='Size') {
			addOption(elem, "Human", "Homo sapiens");
			if (name=='ACTB (beta actin) Endogenous Control' || name=='GAPD (GAPDH) Endogenous Control') {
				addOption(elem, "Mouse", "Mus musculus");
				addOption(elem, "Rat", "Rattus norvegicus");
				elem.value = cur_elem_val;
			} else {
				if (cur_elem_val != elem.value) {
					bChanged = true;
				}
			}
		} else if (field=='Primer') {
			//contains all species regardless of primer
			addOption(elem, "Human", "Homo sapiens");
			addOption(elem, "Mouse", "Mus musculus");
			addOption(elem, "Rat", "Rattus norvegicus");
			elem.value = cur_elem_val;
		} 

		if (bChanged) {
			sparam = "prod=" + str_prod + "&";
			sparam = sparam + "act=update&field=Species&val=" + elem.value;
			sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
			return true
		}
	return false;
	}

	function setProductDefault(str_prod, type, n_scrollTop) {
		var div = t.tabs[n_curTab].div; 
		var sParams = "act=default&type=" + type + "&prod=" + str_prod;
		sParams += '&tab=' + (parseInt(n_curTab) + 1);
		//var sUrl = sBaseUrl + sBaseFolder + sBasePage + n_curTab + '.php'; 
		var str_step = arr_steps[n_curStep];		//get step info
		var sUrl = sBaseUrl + sBaseFolder + getItem(str_step,'|',2);
		progcode = 3;
		postToPageScroll(div,sParams,sUrl,"get", n_scrollTop);
	return;
	}

	function updateControlIds(str_prod_new, str_prod_old, field) {
		var name = new Array();
		var str_purity, str_size, str_strands, str_invivo, str_label;
		//Purity
		name[0] = 'Purity_';

		//Size
		name[1] = 'Size_';

		//Price
		name[2] = 'Price_';

		//Label
		name[3] = 'Label_';

		for (var i=0; i < name.length; i++) {
			document.getElementById(name[i] + str_prod_old).id = name[i] + str_prod_new;
		}
		//11-10-2007 DL
		updateStatusPanelOptions(str_prod_new);
	}

	function changeElemID(str_prod_old, type, field, n_scrollTop) {
		var str_prod_new = '';
		var sOldId, i;		
		var arr_prod;
		var elem = new Array();
		var name = new Array();
		if (type=='sirna') {
			//added 5/31/2007
			var sparam = "act=get&type=sirna&prod=" + str_prod_old;
			var arr_prod = getArrayFromRequestString(str_prod_old, '|~|' );
			s_fieldval = 'sirna|=|' + field + '|=|sirna|=|' + str_prod_old + '|=|' + n_scrollTop;
			updateResponse('get', s_fieldval, sparam, sBaseUrl + "pages/updatebasket.php");
		} else if (type == 'sise') {
			var str_size, str_label, str_purity, str_inventory;

			//Purity
			name[0] = 'Purity_';
			sOldId = name[0] + str_prod_old;
			elem[0] = document.getElementById(sOldId);
			str_purity = elem[0].value;

			//Label
			//name[1] = 'label_';
			//sOldId = name[1] + str_prod_old;
			//elem[1] = document.getElementById(sOldId);
			str_label =	'None';		// elem[1].value;

			//Size
			name[1] = 'Size_';
			sOldId = name[1] + str_prod_old;
			elem[1] = document.getElementById(sOldId);
			str_size = elem[1].value;

			//Availability
			name[2] = 'Inventory_';
			sOldId = name[2] + str_prod_old;
			elem[2] = document.getElementById(sOldId);
			str_inventory = elem[2].innerHTML;
			str_inventory = (str_inventory == 'Inventoried')?'1':'0';

			arr_prod = getArrayFromRequestString(str_prod_old, '|~|' );
			arr_prod[7] = str_size;
			arr_prod[8] = str_purity;
			arr_prod[10] = str_label;
			arr_prod[11] = str_inventory;
			str_prod_new = getFormattedRequestString( arr_prod, '|~|' );

			//11-10-2007 DL
			updateStatusPanelOptions(str_prod_new);

			for (var i=0; i < elem.length; i++) {
				elem[i].id = name[i] + str_prod_new;				
				if (elem[i].value == '') {
					if (3 != i) {
						setProductDefault(str_prod_new, type, n_scrollTop);
					}
				}
			}
		} else if (type == 'tmctrl') {
			var str_probe, str_size, str_species, str_primer;

			//Probe select
			name[0] = 'Probe_';
			sOldId = name[0] + str_prod_old;
			elem[0] = document.getElementById(sOldId);
			str_probe = elem[0].value;

			//Primer
			name[1] = 'Primer_';
			sOldId = name[1] + str_prod_old;
			elem[1] = document.getElementById(sOldId);
			str_primer = elem[1].value;

			//Size
			name[2] = 'Size_';
			sOldId = name[2] + str_prod_old;
			elem[2] = document.getElementById(sOldId);
			str_size = elem[2].value;

			//Species
			name[3] = 'Species_';
			sOldId = name[3] + str_prod_old;
			elem[3] = document.getElementById(sOldId);
			str_species = elem[3].value;

			arr_prod = getArrayFromRequestString(str_prod_old, '|~|' );	
			arr_prod[3] = str_probe;
			arr_prod[4] = str_primer;
			arr_prod[6] = str_species;
			arr_prod[7] = str_size;
			str_prod_new = getFormattedRequestString( arr_prod, '|~|' );
		
			//11-10-2007 DL
			updateStatusPanelOptions(str_prod_new);

			//DL - Added 03/12/2008 - mechanism for products with multiple options.
			//oOptionDiv = document.getElementById('idDivOptions_' + str_prod_old);
			//oOptionDiv.id = 'idDivOptions_' + str_prod_new;

			DOM_div = document.getElementById('divTMControls');
			sItems = DOM_div.getElementsByTagName("img");
			for(i=0;i<sItems.length;i++) {
				if (sItems[i].name == 'tmctrl[]') {
					sImgID = sItems[i].id;
					arr_temp = getArrayFromRequestString(sImgID, '|~|' );
					if (arr_temp[2] == arr_prod[2]) {
						sItems[i].id = str_prod_new;
					}
				}
			}

			DOM_imgDel_id = "del_" + arr_prod[2];
			DOM_imgDel = document.getElementById(DOM_imgDel_id);
			DOM_imgDel.onclick = new Function("updateProducts('"+str_prod_new+"','delete')");


			for (i=0; i < elem.length; i++) {
				elem[i].id = name[i] + str_prod_new;
				if (elem[i].value == '') {
					if (3 != i) {
						setProductDefault(str_prod_new, type, n_scrollTop);
					}
				}
			}

		}
		return str_prod_new;
	}

	function FireAjax3(str_prod, value, value1, value2) {
		var sparam = "prod=" + str_prod + "&act=update&field=Probe&val=" + value + "&field1=Size&val1=" + value1 + "&field2=Primer&val2=" + value2;
		sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");
	}

	function SyncSelectionsExt(str_prod, s_fieldval) {
		var arr_parts = getArrayFromRequestString(s_fieldval, '|=|' );
		var field = arr_parts[0];
		var src_value = arr_parts[1];
		var prodtype = arr_parts[2];
		var s_name = arr_parts[3];
		var n_scrollTop = arr_parts[4];

		var bChanged = false;
		var pId;
		var Pbelem;
		var Pmelem;
		var Szelem;
		var Spelem;
		var old_value;

		//scroll to it
		var s_new_strprod = field + '_' + str_prod;
		var obj = document.getElementById(s_new_strprod);
		if (n_scrollTop > 0) {
			//obj.scrollIntoView(true);
			//var oMainDiv = document.getElementById('idMainDiv');
			var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
			if (oMainDiv) {
				oMainDiv.scrollTop = n_scrollTop;
			}
		}
		if (obj) {
			obj.style.backgroundColor = '#C9E4C6';
		}

		if (prodtype == 'sise') {
			var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
			bChanged = fillPurity(str_prod, arr_prod[2], field, src_value, prodtype, arr_prod[11]);
			//bChanged = fillLabel(str_prod, arr_prod[2], field, src_value, prodtype, arr_prod[11]) || bChanged;
			bChanged = fillSize(str_prod, arr_prod[2], field, src_value, prodtype, arr_prod[11]) || bChanged;
		} else if ('Eukaryotic 18S rRNA Endogenous Control' == s_name) {
			pId = 'Probe_' + str_prod;
			Pbelem = document.getElementById(pId);
			var cur_probe_val = Pbelem.value;

			pId = 'Size_' + str_prod;
			Szelem = document.getElementById(pId);
			var cur_size_val = Szelem.value;

			pId = 'Species_' + str_prod;
			Spelem = document.getElementById(pId);
			var cur_species_val = Spelem.value;

			sId = 'Primer_' + str_prod;
			Pmelem = document.getElementById(sId);
			var cur_prim_val = Pmelem.value;

			if ('Probe' == field) {
				if ('FAM / MGB Probe' == src_value) {
					//Non-Probe Limited
					clearSelect(Pmelem);
					addOption(Pmelem, "Non-Primer Limited", "Non-Primer Limited");
					Pmelem.value = "Non-Primer Limited";
					//All Sizes (keep current choice)
					old_value = Szelem.value;
					clearSelect(Szelem);
					addOption(Szelem, "50 reactions", "50 reactions");
					addOption(Szelem, "200 reactions", "200 reactions");
					addOption(Szelem, "1000 reactions", "1000 reactions");
					Szelem.value = old_value;
				} else {
					//Probe Limited
					clearSelect(Pmelem);
					addOption(Pmelem, "Primer Limited", "Primer Limited");
					Pmelem.value = "Primer Limited";
					//1000 reactions only
					clearSelect(Szelem);
					addOption(Szelem, "1000 reactions", "1000 reactions");
					Szelem.value = "1000 reactions";
				}
			} else if ('Primer' == field) {
				if ('Primer Limited' == src_value) {
					//1000 reactions only
					clearSelect(Szelem);
					addOption(Szelem, "1000 reactions", "1000 reactions");
					Szelem.value = "1000 reactions";
					//VIC type probes
					old_value = Pbelem.value;
					clearSelect(Pbelem);
					addOption(Pbelem, "VIC / MGB Probe", "VIC / MGB Probe");
					addOption(Pbelem, "VIC / TAMARA Probe", "VIC / TAMARA Probe");
					if ('FAM / MGB Probe' == old_value) {
						Pbelem.value = 'VIC / MGB Probe';
					} else {
						Pbelem.value = old_value;
					}
				} else {
					//All Sizes
					old_value = Szelem.value;
					clearSelect(Szelem);
					addOption(Szelem, "50 reactions", "50 reactions");
					addOption(Szelem, "200 reactions", "200 reactions");
					addOption(Szelem, "1000 reactions", "1000 reactions");
					Szelem.value = old_value;
					//FAM / MGB Probe
					clearSelect(Pbelem);
					addOption(Pbelem, "FAM / MGB Probe", "FAM / MGB Probe");
					Pbelem.value = 'FAM / MGB Probe';
				}
			} else if ('Size' == field) {
				if ('1000 reactions' == src_value) {
					//All Probe Types (keep current)
					old_value = Pbelem.value;
					clearSelect(Pbelem);
					addOption(Pbelem, "VIC / MGB Probe", "VIC / MGB Probe");
					addOption(Pbelem, "VIC / TAMARA Probe", "VIC / TAMARA Probe");
					addOption(Pbelem, "FAM / MGB Probe", "FAM / MGB Probe");
					Pbelem.value = old_value;
					//Both Primer types (match probe type)
					clearSelect(Pmelem);
					addOption(Pmelem, "Non-Primer Limited", "Non-Primer Limited");
					addOption(Pmelem, "Primer Limited", "Primer Limited");
					if ('FAM / MGB Probe' == old_value) {
						Pmelem.value = "Non-Primer Limited";
					} else {
						Pmelem.value = "Primer Limited";
					}
				} else {
					//FAM / MGB Probe
					clearSelect(Pbelem);
					addOption(Pbelem, "FAM / MGB Probe", "FAM / MGB Probe");
					Pbelem.value = 'FAM / MGB Probe';
					//Non-Primer Limited
					clearSelect(Pmelem);
					addOption(Pmelem, "Non-Primer Limited", "Non-Primer Limited");
					Pmelem.value = "Non-Primer Limited";
				}
			}
			if (cur_probe_val != Pbelem.value) {
				bChanged = true;
			}
			if (cur_prim_val != Pmelem.value) {
				bChanged = true;
			}
			if (cur_species_val != Spelem.value) {
				bChanged = true;
			}
			if (cur_size_val != Szelem.value) {
				bChanged = true;
			}

			FireAjax3(str_prod, Pbelem.value, Szelem.value, Pmelem.value);
		} else {
			bChanged = fillLabel(str_prod, s_name, field, src_value, prodtype, '0');
			bChanged = fillPrimer(str_prod, s_name, field, src_value) || bChanged;
			bChanged = fillSpecies(str_prod, field, src_value, s_name) || bChanged;
			bChanged = fillSize(str_prod, s_name, field, src_value, prodtype, '0') || bChanged;
		}

		if (bChanged) {
			changeElemID(str_prod, prodtype, field, n_scrollTop);
		} else {
			//11-10-2007 DL
			updateStatusPanelOptions(str_prod);
		}

	}

	function SyncSelections(src_id, prodtype, src_value, n_scrollTop) {
		// need to determine possible dropdown selections based on change made.	

		var arr_id = getArrayFromRequestString(src_id, '_' );
		var field = arr_id[0];
		var str_prod = arr_id[1];
		var bChanged = false;

		if (prodtype=='sirna') {
			var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
			if (field=='Size') {
				arr_prod[7] = src_value;
			} else if (field=='Strands') {
				arr_prod[9] = src_value;
			} else if (field=='Label') {
				arr_prod[10] = src_value;
			} else if (field=='Purity') {
				arr_prod[8] = src_value;
			} else if (field=='Probe') {
				arr_prod[3] = src_value;
			} else if (field=='Primer') {
				arr_prod[4] = src_value;
			} else if (field=='Species') {
				arr_prod[6] = src_value;
			}

			var status = arr_prod[2];
			var inventory = arr_prod[11];
			str_prod = getFormattedRequestString(arr_prod, '|~|' );

			//scroll to it
			var s_new_strprod = field + '_' + str_prod;
			var obj = document.getElementById(s_new_strprod);
			if (n_scrollTop > 0) {
				//obj.scrollIntoView(true);
				//var oMainDiv = document.getElementById('idMainDiv');
				var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
				if (oMainDiv) {
					oMainDiv.scrollTop = n_scrollTop;
				}
			}
			if (obj) {
				obj.style.backgroundColor = '#C9E4C6';
			}

			bChanged = fillPurity(str_prod, status, field, src_value, prodtype, inventory);
			bChanged = fillLabel(str_prod, status, field, src_value, prodtype, inventory) || bChanged;
			bChanged = fillSize(str_prod, status, field, src_value, prodtype, inventory) || bChanged;

			if (bChanged) {
				changeElemID(str_prod, prodtype, field, n_scrollTop);
			} else {
				//11-10-2007 DL
				updateStatusPanelOptions(str_prod);
			}

		} else if (prodtype=='tmctrl') {
			var sparam = "act=get&type=tmctrl&prod=" + str_prod;
			var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
			s_fieldval = field + '|=|' + src_value + '|=|' + prodtype + '|=|' + arr_prod[2] + '|=|' + n_scrollTop;
			updateResponse('get',s_fieldval, sparam, sBaseUrl + "pages/updatebasket.php");
		}  else if (prodtype=='sise') {
			var sparam = "act=get&type=sise&prod=" + str_prod;
			var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
			s_fieldval = field + '|=|' + src_value + '|=|' + prodtype + '|=|empty|=|' + n_scrollTop;
			updateResponse('get',s_fieldval, sparam, sBaseUrl + "pages/updatebasket.php");
		} else  {
			var arr_prod = getArrayFromRequestString(str_prod, '|~|' );
			if (field=='Size') {
				arr_prod[7] = src_value;
			}
			var s_new_strprod = getFormattedRequestString(arr_prod, '|~|' );

			//11-10-2007 DL - need to update the items options displayed
			updateStatusPanelOptions(s_new_strprod);

			s_new_strprod = field + '_' + s_new_strprod;
			var obj = document.getElementById(s_new_strprod);
			if (n_scrollTop > 0) {
				//obj.scrollIntoView(true);
				var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
				if (oMainDiv) {
					oMainDiv.scrollTop = n_scrollTop;
				}
			}
			if (obj) {
				obj.style.backgroundColor = '#C9E4C6';
			}

		}

	}

	function postToPageExt(div,sParam,sUrl,sMethod,src, prod_val, n_scrollTop)  {
		//use Ajax to send request to page
		showprogress(progcode);
		var src_id = src.id;
		var src_name = src.name;
		var arr_name;
		var prodtype;		
		sParam += '&tab=' + (parseInt(n_curTab) + 1);
		var oRequest = new Ajax.Updater(div, sUrl,
		{
			method:sMethod,
			parameters:sParam,
			evalScripts:true,
			onFailure: function(transport) {
				div.innerHTML += "<BR><BR>Error:" + transport.statustext;
			},
			onComplete: function() {
				hideprogress();
				arr_id = getArrayFromRequestString(src_id, '_' );

				if (n_curStep < 4)	{
					//we need to do this first to expand any hidden list, but only for 
					//the product pages.
					callBack();
				}
				if (arr_id[0] == 'options' || arr_id[0] == 'partnum' || arr_id[0] == 'quantity') {
					return;
				} else {
					arr_name = getArrayFromRequestString(src_name, '_' );
					prodtype = arr_name[0];
					SyncSelections(src_id, prodtype, prod_val, n_scrollTop);
				}
			}
		});	
	}

	function postToPageScroll(div,sParam,sUrl,sMethod,n_scrollTop)  {
		//use Ajax to send request to page
		showprogress(progcode);
		sParam += '&tab=' + (parseInt(n_curTab) + 1);
		var oRequest = new Ajax.Updater(div, sUrl,
		{
			method:sMethod,
			parameters:sParam,
			evalScripts:true,
			onFailure: function(transport) {
				div.innerHTML += "<BR><BR>Error:" + transport.statustext;
			},
			onComplete: function() {
				hideprogress();
				if (n_scrollTop > 0) {
					//var oMainDiv = document.getElementById('idMainDiv');
					var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
					if (oMainDiv) {
						oMainDiv.scrollTop = n_scrollTop;
					}
				}

				if (sParam.indexOf('act=default') != -1)	{
					//update status panel option display
					updateResponse('default', n_scrollTop, sParam, sBaseUrl + "pages/updatebasket.php");
				}
				
			}
		});	
	}

	function postToPageExec(div, sParam, sUrl, sMethod, act, sEval)  {
		//use Ajax to send request to page. Same as sendRequest
		//except one additional parameter, string to evaluate on success.
		var oRequest = new Ajax.Updater(div, sUrl,
		{
			method:sMethod,
			parameters:sParam,
			evalScripts:true,
			onFailure: function(transport) {
				div.innerHTML += "<BR><BR>Error:" + transport.statustext;
			},
			onComplete: function() {
				if (sEval) {
					//evaluate the expression
					eval(sEval);
				}
			}
		});	
	}

	function postToPageOptions(div, sParam, sUrl,sMethod, field, new_prod_str, prod_val, n_scrollTop)  {
//alert(div+"\n\n"+sParam+"\n\n"+sUrl+"\n\n"+sMethod+"\n\n"+field+"\n\n"+prod_val);
		//use Ajax to send request to page
		showprogress(progcode);
		sParam += '&tab=' + (parseInt(n_curTab) + 1);
		var oRequest = new Ajax.Updater(div, sUrl,
		{
			method:sMethod,
			parameters:sParam,
			evalScripts:true,
			onFailure: function(transport) {
				div.innerHTML += "<BR><BR>Error:" + transport.statustext;
			},
			onComplete: function() {
				hideprogress();

				if (n_curStep < 4)	{
					//we need to do this first to expand any hidden list, but only for 
					//the product pages.
					callBack();
				}

				s_new_strprod = field + '_' + new_prod_str;
				var obj = document.getElementById(s_new_strprod);
				if (n_scrollTop > 0) {
					var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
					if (oMainDiv) {
						oMainDiv.scrollTop = n_scrollTop;
					}
				}
				if (obj) {
					obj.style.backgroundColor = '#C9E4C6';
				}
			}
		});	
	}

	function updateProducts(elem,act) {
		//DL - perform live updates via Ajax, just like everything else in application
		if (typeof(elem) == 'object') {
			var prod_val = elem.value;
		} else if (typeof(elem) == 'string') {
			var prod_val = elem;
		}
		action = act.toLowerCase();
		
		var sParams = '';
		var sUrl;
		var str_step;
		var n_scrollTop = 0;
		var div = t.tabs[n_curTab].div;
		var type;
		var DOM_img;
		var str_prod_new;

		if (action == 'delete')	{
			sParams = 'prod=' + prod_val;
			s_prod = prod_val.substr(0, 5);
			if (s_prod == 'ge|~|') {
				n_TaqMan--;
			} else if (s_prod == 'sirna') {
				n_sirna--;
			} else if (s_prod.indexOf('sise') != -1) {
				n_sise--;
			}
			removeItemFromStatusPanel(prod_val);
		} else if (action == 'deleteall') {
			//var arr_items = getArrayFromRequestString(prod_val, '|=|' );
			removeAllItemsFromStatusPanel();
			sParams = 'prod=all';
		} else if (action=='update') {
			var arr_items = getArrayFromRequestString(elem.id, '_' );
			var field = arr_items[0];
			var prod = arr_items[1];
			var elem_new;
			var pId;
			var s_options;
			var arr_options;
			var s_label = 'None';

			if (arr_items.length > 2) {
				//ge has underscore in its ID
				prod = arr_items[1] + '_' + arr_items[2];
			}

			var arr_prod = getArrayFromRequestString(prod, '|~|' );
			type = arr_prod[0];
			sParams = "type=" + type;

			if (field == 'options') {
				//DL - added 3/12/2008
				if (arr_prod[0] == 'tmctrl') {
					s_options = prod_val;
					arr_options = getArrayFromRequestString(s_options, ', ' );

					var s_probe = arr_options[1];
					var s_primer = arr_options[2];
					var s_species = arr_options[3];
					var s_size = arr_options[4];
					if (s_species == 'Human') {
						s_species = 'Homo sapiens';
					} else if (s_species == 'Mouse') {
						s_species = 'Mus musculus';
					} else if (s_species == 'Rat') {
						s_species = 'Rattus norvegicus';
					}
					sParams += "&field=options&field1=Probe&val1=" + s_probe + "&field2=Primer&val2=" + s_primer + "&field3=Species&val3=" + s_species + "&field4=Size&val4=" + s_size;
					
					//determine new product string
					arr_prod[3] = s_probe;
					arr_prod[4] = s_primer;
					arr_prod[6] = s_species;
					arr_prod[7] = s_size;
					str_prod_new = getFormattedRequestString( arr_prod, '|~|' );
				} else {
					s_options = prod_val;
					arr_options = getArrayFromRequestString(s_options, ', ' );

					var s_inv = arr_options[1];
					if (s_inv == 'Inventoried') {
						s_inv = 1;
					} else {
						s_inv = 0;
					}
					var s_purity = arr_options[2];
					var s_size = arr_options[3];

					sParams += "&field=options&field1=Inventory&val1=" + s_inv + "&field2=Purity&val2=" + s_purity + "&field3=Size&val3=" + s_size;
					
					if (arr_options.length > 4) {
						s_label = arr_options[4];
						//s_label = s_label.split(" ")[0];
						sParams += "&field4=Label&val4=" + s_label;
					} else {
						sParams += "&field4=Label&val4=" + s_label;
					}

					//determine new product string
					arr_prod[7] = s_size;
					arr_prod[8] = s_purity;
					arr_prod[10] = s_label;
					arr_prod[11] = s_inv;
					str_prod_new = getFormattedRequestString( arr_prod, '|~|' );
				}

				updateStatusPanelOptions(str_prod_new);


			} else if (field == 'partnum') {
				//DL - added 3/12/2008
				sParams += "&field=partnum&val=" + prod_val;

				var opt_selIndex = elem.selectedIndex;
				pId = 'options_' + prod;
				elem_new = document.getElementById(pId);
				elem_new.selectedIndex = opt_selIndex;
				s_options = elem_new.value;
				var arr_options = getArrayFromRequestString(s_options, ', ' );
				var s_inv = arr_options[1];
				if (s_inv == 'Inventoried') {
					s_inv = 1;
				} else {
					s_inv = 0;
				}
				var s_purity = arr_options[2];
				var s_size = arr_options[3];
				if (arr_options.length > 4) {
					s_label = arr_options[4];
					//s_label = s_label.split(" ")[0];
				}
				//determine new product string
				arr_prod[7] = s_size;
				arr_prod[8] = s_purity;
				arr_prod[10] = s_label;
				arr_prod[11] = s_inv;
				str_prod_new = getFormattedRequestString( arr_prod, '|~|' );

				updateStatusPanelOptions(str_prod_new);


			} else if (field == 'Size') {
				//DL - added 3/12/2008

				sParams += "&field=Size&val=" + prod_val;
				arr_prod[7] = prod_val;
				str_prod_new = getFormattedRequestString( arr_prod, '|~|' );

			}  else if (field == 'quantity') {
				//DL - added 3/12/2008

				sParams += "&field=quantity&val=" + prod_val;
				arr_prod[13] = prod_val;
				str_prod_new = getFormattedRequestString( arr_prod, '|~|' );

			}  else {
				sParams += "&field=" + field;
				sParams += "&val=" + prod_val;
			}
			sParams += "&prod=" + prod;

			//check to see if button is checked
			DOM_img = document.getElementById(prod);
			
			if (DOM_img) {
				var s_filename = DOM_img.src;
				var pos = s_filename.lastIndexOf('/');
				s_filename = s_filename.substr(pos + 1, s_filename.length);
				
				if (s_filename == 'btn_add.gif') {
					DOM_img.id = str_prod_new;
					var DOM_options = document.getElementById('options_' + prod);
					if (DOM_options) {
						DOM_options.id = 'options_' + str_prod_new;
					}
					DOM_options = document.getElementById('quantity_' + prod);
					if (DOM_options) {
						DOM_options.id = 'quantity_' + str_prod_new;
					}
					DOM_options = document.getElementById('Size_' + prod);
					if (DOM_options) {
						DOM_options.id = 'Size_' + str_prod_new;
					}
					return;
				}
			}

		} else if (action=='reset') {
			var arr_prod = getArrayFromRequestString(prod_val, '|~|' );
			type = arr_prod[0];
		}

		bSaved = 'NO';
		sParams += "&act=" + action;
		//sUrl = sBaseUrl + sBaseFolder + sBasePage + n_curTab + '.php';
		str_step = arr_steps[n_curStep];		//get step info
		sUrl = sBaseUrl + sBaseFolder + getItem(str_step,'|',2);

		//get the current scroll position so we can return to the same spot afterwards.
		var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
		if (oMainDiv) {
			n_scrollTop = oMainDiv.scrollTop;
		} else {
			n_scrollTop = 0;
		}

		if (action=='update') {
			progcode = 3;	//3=updating
			SyncOptions(type);
			if (field == 'options' || field == 'partnum' || field == 'quantity') {
				postToPageOptions(div, sParams, sUrl, 'get', field, str_prod_new, prod_val, n_scrollTop);
			} else {
				postToPageExt(div, sParams, sUrl, "get", elem, prod_val, n_scrollTop);
			}
		} else if (action=='resetopt') {
			//postToPageOptions(div, sParams, sUrl, 'get', field, str_prod_new, prod_val, n_scrollTop);
			var arr_prod = getArrayFromRequestString(prod_val, '|~|' );
			type = arr_prod[0];
			setProductDefault(prod_val, type, n_scrollTop);
		}  else if (action=='reset') {
			setProductDefault(prod_val, type, n_scrollTop);
		} else if('delete' == action) {
			progcode = 3;			
			//call toggleproduct to uncheck this product after basket is updated.

			//if (n_curStep < 3 && n_curStep > 1) {			
			if (n_curStep < 4 && n_curStep > 2) {			
				//now that we can change options on the product page
				var arr_prod = getArrayFromRequestString(prod_val, '|~|' );
				type = arr_prod[0];
				sParams += "&act=get&type=" + type;
				sendRequestExt(sParams, sBaseUrl + "pages/updatebasket.php","get", "get", "");
			} else {
				//sParams = "prod=" + prod_val + "&act=rem";
				sParams += "&act=rem";
				sendRequestExt(sParams, sBaseUrl + "pages/updatebasket.php","get", "rem", "toggleProduct('"+prod_val+"',1)");
			}

		} else {
			progcode = 3;
			postToPage(div,sParams,sUrl,"get");
		}

	}

	function SyncOptions(type) {
		
		switch (type)	{
			case 'sise':
			case 'sirna':
			case 'ge':
				t.tabs[n_curTab].div.innerHTML = '';
				break;
			case 'sposctrl':
			case 'snegctrl':
			case 'splabctrl':
			case 'snlabctrl':
			case 'seposctrl':
			case 'senegctrl':
			case 'seplabctrl':
			case 'senlabctrl':
			case 'tmctrl':
				t.tabs[1].div.innerHTML = '';
				break;
			case 'epa':
			case 'epk':
			case 'tfa':
			case 'tfk':
				t.tabs[2].div.innerHTML = '';
//				var div = t.tabs[2].div;
//				var sUrl = sBaseUrl + sBaseFolder + 'workflow-step-2.php';
//				if (n_curTab != 2) {
//					postToPage(div,"",sUrl,"post");
//				}
				break;
			case 'riso':
			case 'rstb':
			case 'rdcs':
			case 'mmix':
			case 'cdna':
			case 'ab':
			case 'imm':
			case 'cdet':
			case 'csig':
			case 'rgene':
			case 'gect':
				t.tabs[3].div.innerHTML = '';
				break;
			default:
		}
	}

	function checkAll(elem) {
		var field = document.getElementsByTagName("input");
		if (elem.checked) {
			for (i = 0; i < field.length; i++) {
				if (field[i].type == 'checkbox' && field[i].name == elem.name) {
					if (bisIE) {
						if (!field[i].checked) {
							field[i].click();
						}
					} else {
						field[i].checked = true;
						if (field[i].id != elem.id) {
							DOM_check = document.getElementById(field[i].id);
							checkProduct(DOM_check);
						}

						
					}					
				}				
			}
		} else {
			for (i = 0; i < field.length; i++) {
				if (field[i].type == 'checkbox' && field[i].name == elem.name) {
					if (bisIE) {
						if (field[i].checked) {
							field[i].click();
						}
					} else {
						field[i].checked = false;
						if (field[i].id != elem.id) {
							DOM_check = document.getElementById(field[i].id);
							checkProduct(DOM_check);
						}						
					}	
				}	
			}
		}
	return;
	}

	function resetAllControls() {
		var field = document.getElementsByTagName("img");
		var s_filename = '';
		var pos;
		var sId, oDiv;
		for (i = 0; i < field.length; i++) {
			s_filename = field[i].src;
			pos = s_filename.lastIndexOf('/');
			s_filename = s_filename.substr(pos + 1, s_filename.length);
			if (s_filename == 'btn_remove.gif') {
				field[i].src = 'images/btn_add.gif';

				//toggle the product options to hide
//				sId = 'idDivOptions_' + field[i].id;
//				oDiv = document.getElementById(sId);
//				if (oDiv) {
//					oDiv.style.display = 'none';
//				}

			}
		}
		
	return;
	}

	function sendCartToAB2() {
		if (n_prodcount <= 0) {
			alert('Your shopping list is empty.');
			return;
		}
        document.allBasketForm.submit();
     }

	function toggleCtrls(id, elem) {		
		oTb = document.getElementById(id);
		var re;
		if (oTb)  {
			//oTb.style.display = (oTb.style.display == 'none') ? 'block' : 'none';
			if (oTb.style.display == 'none') {
				oTb.style.display = 'block';
				arr_Expand[id] = '1';
			} else {
				oTb.style.display = 'none';
				arr_Expand[id] = 'n';
			}
			var sLinkText =  elem.innerHTML;
			var sText = sLinkText.substr(0, 4);
			if (sText == 'Show') {
				re = /Show/g;
			} else {
				re = /Hide/g;
			}
			strNew = (sText=='Show')?'Hide':'Show';
			ret = sLinkText.replace(re, strNew);
			elem.innerHTML = ret;
		}
	return;
	}

	function toggleCtrlsExt(id, elem, nStatus) {		
		oTb = document.getElementById(id);
		var re;
		if (oTb && elem)  {
			var sLinkText =  elem.innerHTML;
			var sText = sLinkText.substr(0, 4);
			if (nStatus > 0) {
				oTb.style.display = 'block';
				arr_Expand[id] = '1';
				if (sText == 'Show') {
					re = /Show/g;
					elem.innerHTML = sLinkText.replace(re, 'Hide');
				}
			} else {
				oTb.style.display = 'none';
				arr_Expand[id] = 'n';
				if (sText == 'Hide') {
					re = /Hide/g;
					elem.innerHTML = sLinkText.replace(re, 'Show');
				}
			}		
		}
	return;
	}

	function getCookieExpire(name) {
		 //Obsolete right now
		 expires = new Date();
		 expires.setMonth(expires.getMonth() + 1);
		 return expires;
	}

	function updateResponse(s_act,s_name, sParams, sUrl)  {
		//use Ajax to send request to page and process response

		var oRequest = new Ajax.Request(sUrl,
			{
			method: 'get',
			parameters: sParams,
			requestHeaders: {Accept: 'application/json'}, 
			onSuccess: function(transport) {
				//var json = transport.responseText.evalJSON(); 
				var response = transport.responseText;
				if (s_act == 'save') {
					alert(response);
					if (response == '' || response == 'COOKIE OFF') {
						alert('Your Cookies setting appears to be disabled. You must have Cookies enabled in your browser application in order to save a shopping list.\nPlease enable your Cookies and try again, or continue shopping with this shopping list.\n\nThis shopping list could not be stored.');
					} else {
						cartlist = response;
						bSaved = 'YES';
						t.setCartName(s_name);
						alert('This shopping list is now saved.');
					}
				} else if (s_act == 'open') {
					alert(response);
					if (response == '') {
						//list not not found in cookie
						bSaved = 'NONE';
						alert("Sorry, the shopping list named '" + s_name + "' could not be found. The list was saved on your computer as a cookie, so it may have expired or it has been deleted.\n\nPlease try a different name or continue shopping with your current list.");
						return;
					} else if (response.indexOf('Bad Request') != -1) {
						//cookie error
						bSaved = 'NONE';
						alert("Sorry, the shopping list named '" + s_name + "' could not be opened. Please delete your browser cookies and reload the page.");
						return;
					} else {
						var arr_Temp = getArrayFromRequestString(response, "|exp|" );
						var arr_items = getArrayFromRequestString(arr_Temp[0], "|=|" );
						removeAllItemsFromStatusPanel();
						for (i=0;i<arr_items.length;i++) {
							if (arr_items[i].indexOf('|~|') != -1) {
								addItemToStatusPanel(arr_items[i]);
							}						
						}
						bSaved = 'YES';
						t.setCartName(s_name);
						if (n_curTab > 0) {
							reloadPage(0);
						} else {
							SyncProducts();
						}
						//document.getElementById("spCartExpire").innerHTML = arr_Temp[1];
					}
				} else if (s_act == 'del')	{
					bSaved = 'NONE';
					t.setCartName('');
					if (n_curTab >= 3) {
						reloadPage(0);
					}
				} else if (s_act == 'get') {
					//retrieve the product line from basket
					var arr_parts = getArrayFromRequestString(s_name, '|=|' );
					if (arr_parts[2] == 'sirna') {
						updateResponse('getprice', arr_parts[3], 'act=getprice&type=sirna&prod='+response, sUrl);						
						updateControlIds(response, arr_parts[3], arr_parts[1]);
					} else {
						SyncSelectionsExt(response, s_name);
					}
				} else if (s_act == 'scroll') {					
					var arr_parts = getArrayFromRequestString(s_name, '|=|' );					
					var field = arr_parts[0];
					var n_scrollTop = arr_parts[4];
					var s_newid = field + '_' + response;
					var obj = document.getElementById(s_newid);
					if (n_scrollTop > 0) {
						//obj.scrollIntoView(true);
						//var oMainDiv = document.getElementById('idMainDiv');
						var oMainDiv = document.getElementById('idMainDiv' + n_curStep);
						if (oMainDiv) {
							oMainDiv.scrollTop = n_scrollTop;
						}
					}
					if (obj) {
						obj.style.backgroundColor = '#C9E4C6';
					}
				} else if (s_act == 'default') {
					//11-10-2007 DL
					updateStatusPanelOptions(response);
				}else if('email' == s_act) {
					if (bissaf && oSafWin) {
						oSafWin.close();
						oSafWin = 0;
					}
					if ("yes" == response)	{
						alert("Your shopping list has been emailed.");
					} else {
						alert(response);
						//alert("Your shopping list has not been emailed.");
					}
				} else if('getprice' == s_act) {
					if ('reloadpage' == response) {
						reloadPage(0);
					} else {
						var price_field = document.getElementById('Price_' + s_name);
						price_field.innerHTML = response;
					}
				}
				return true;
			},
			onFailure: function(transport) {
				var response = transport.responseText;
				alert('Error: ' + response);
				return false;
			}
				
		});
	}

	function exportCart() {
		var sparam = '';
		var s_name = t.getCartName();
		//var div = t.tabs[0].div;
		if (s_name) {
			sparam = "?basket=" + s_name;
		}		
		var popup = window.open(sBaseUrl + "workflow/exportbasket.php");

		return true;
	}

	function OpenCountry() {
		if (bissaf) {
			oSafWin = window.open('pages/country_select_popup.php', 'Country', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=375,height=150,left = 400,top = 200');

		} else {
			sm('countrybox',350,150,false);
			var drop = document.getElementById("choose_country");
			drop.style.visibility = "visible";
			if (t.sCountry != '') {
				drop.value = t.sCountry;
			}
		}
		return true;
	}
	
	function OpenCountryName(s_country) {
		t.sCountry = s_country;
		reloadPage(0);
		return true;		
	}

	function DeleteCart(code) {
		var sparam = '';
		//
		//we don't really need the name of the current cart to delete it, but later
		//it may need to distinguish from removing it from cookie also, in which we
		//will need the name (if it was saved to cookie).
		//argument:  0=local	1=cookie also
		//
		
		//8-19-2007 removed
		var s_name = 'New';	//document.getElementById("spCartName").innerHTML;
		//document.getElementById("spCartName").innerHTML = 'New';	
		sparam = "act=del&name=" + s_name;
		//remove everything from status panel
		removeAllItemsFromStatusPanel();
		resetAllControls();
		updateResponse('del',s_name, sparam, sBaseUrl + "pages/updatebasket.php");
		return true;
	}


	function Confirm() {
		//Replaced modalDialog code with a better cross browser solution.
		if (bSaved == 'NONE') {
			return false;
		} else if (bSaved == 'YES') {
			//changed message 11/2/2007 because currently don't allow saving of list.
			//var msg = '<br>Your shopping list has been saved so you may retrieve it later.<br><br><b>Do you wish to continue?</b>';
			var msg = '<br>Your shopping list will be emptied and cannot be reversed.<br><br><b>Do you wish to continue?</b>';
			ob('confirmdeltxt').innerHTML = msg;		
		} else {
			//var msg = '<br>The current shopping list has not been saved!<br><br><b>Are you sure you wish to delete this list?</b>';
			var msg = '<br>Your shopping list will be emptied and cannot be reversed.<br><br><b>Do you wish to continue?</b>';
			ob('confirmdeltxt').innerHTML = msg;	
		}
		sm('deletebox',300,150,true);
	}

	function togglemoz(elem,sel)	{
		if (sel == 1) {
			var L = document.getElementById("LS1");
		} else {
			var L = document.getElementById("L1");
		}
	  
	  if (L.style.display == "" || L.style.display == "none") {
		L.style.display = "block"; 
		elem.innerHTML = "Hide Additional siRNA(s) ";
	  }
	  else { 
		L.style.display = "none"; 
		elem.innerHTML = "Show Additional siRNA(s)"; 
	  }
	  return true;
	}

	function togglesirna(num,id)	
	{
	  /* 
		 Toggle additional siRNA items
		 num=starting#, id=total# of items
	  */
	  var SAS = document.getElementById("SAS"+num);
	  var oTr;
	  
	  oTr = document.getElementById('LBlock');
	  if (oTr)  {
		  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
	  }	  

	  if (SAS.innerHTML == "Show Additional siRNA(s)") {
			SAS.innerHTML = "Hide Additional siRNA(s)";		
	  }
	  else {
			SAS.innerHTML = "Show Additional siRNA(s)"; 
	  }
	  
	  return;
	}

	function toggleselsirna(num,id)	
	{
	  /* 
		 Toggle additional Si Select siRNA items
		 num=starting#, id=total# of items
	  */
	  var SAS = document.getElementById("SASS"+num);
	  var oTr;
	  
	  oTr = document.getElementById('LSBlock');
	  if (oTr)  {
		  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
	  }
	  
	  if (SAS.innerHTML == "Show Additional siRNA(s)") {
			SAS.innerHTML = "Hide Additional siRNA(s)";	

			var amap = document.getElementById('hide_amap');
			if (amap) {
				map.showAdditionalSiSelectsiRNAs();
				map.reloadMap();
			}
	  }
	  else {
			SAS.innerHTML = "Show Additional siRNA(s)"; 
	  }
	  
	  return;
	}

	function toggletaqmanmoz(elem)	{
	  var L = document.getElementById("L2");
	  var SM = document.getElementById("tmShowmore"); 
	  if (L.style.display == "" || L.style.display == "none") {
			L.style.display = "block"; 
			elem.innerHTML = "Hide Additional Assay(s) ";
			SM.style.paddingBottom = '8px';			
			SM.scrollIntoView(true);

			var amap = document.getElementById('hide_amap');
			if (amap) {
				map.showAdditionalGeXassays();
				map.reloadMap();
			}
	  }
	  else { 
			L.style.display = "none"; 
			elem.innerHTML = "Show Additional Assay(s)";
			SM.style.paddingBottom = '0px';
	  }
	  return true;
	}

	function toggletaqman(num,id)	{

	  // num=starting#, id=total# of items
	  var SAT = document.getElementById("SAT"+num);
	  var oTr;

	  oTr = document.getElementById('TBlock');
	  if (oTr)  {
		  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
	  }	
	  
	  //replaced on 10/24/2007 with the code above
//	  for (var i=num; i < id; i++ )	  {
//		  oTr = document.getElementsByName('T'+i);
//
//		  if (oTr)  {
//			  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
//		  }
//		  oTr = document.getElementById("TV"+i);
//		  if (oTr) {
//			  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
//		  }
//		  oTr = document.getElementById("TP"+i);
//		  if (oTr) {
//			  oTr.style.display = (oTr.style.display == 'none') ? 'block' : 'none'; 
//		  }
//	  }

	  var SM = document.getElementById("tmShowmore"); 
	  if (SAT.innerHTML== "Show Additional Assay(s)") {			  
			SAT.innerHTML = "Hide Additional Assay(s)";			
			SM.style.paddingBottom = '8px';			
			SM.scrollIntoView(true);

			var amap = document.getElementById('hide_amap');
			if (amap) {
				map.showAdditionalGeXassays();
				map.reloadMap();
			}
	  }
	  else {
			SAT.innerHTML = "Show Additional Assay(s)";
			SM.style.paddingBottom = '0px';
	  }
	  
	  return;
	}

	function MsgBox (textstring) {
		alert (textstring)
	}
	function popUp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=400,left = 112,top = 184');");
	}
	function popUp22(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=400,left = 112,top = 184');");
                return id;
	}
	function popUp2(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=600,height=480,left = 10,top = 200');");
	}
	function popUp3(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=625,height=300,left = 10,top = 300');");
	}
	function popUp4(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=625,left = 500,top = 100');");

	}
	function popUpHelp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=625,left = 500,top = 100');");

	}
	function popUp8(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=800,height=400,left = 112,top = 184');");
	}
	function popUpWindow(URL, wd, ht) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,titlebar=1,location=1,statusbar=0,menubar=1,resizable=1,width=" + wd + ",height=" + ht + ",left = " + ((screen.availWidth - wd) / 2) + ",top = " + (((screen.availHeight - ht) / 2) - 60)+ "');");
	}
	function popUpDialog(URL, wd, ht) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + wd + ",height=" + ht + ",left = " + ((screen.availWidth - wd) / 2) + ",top = " + (((screen.availHeight - ht) / 2) - 60)+ "');");
	}

	var curRow = -1;
	var selectRow = -1;

	function onMouseOverMozItem(srcElem) {
		//last modified 10/22/2007 DL to accomodate nested table
		//crawl up to find the row
		while ((srcElem.tagName != "TR" && srcElem.tagName != "TABLE") || (srcElem.tagName == "TABLE" && srcElem.id == 'tbSub') || (srcElem.tagName == "TR" && srcElem.id == 'trSub'))
			srcElem = srcElem.parentElement;

		if(srcElem.tagName != "TR") {
			return;
		}

		if (srcElem.rowIndex > 0) {
			hilite(srcElem);
		} else {
			hilite(-1);
		}
	}

	function onMouseOutMozItem(srcElem) {
		// Make sure we catch exit from the table
		while (srcElem.tagName != "TR" && srcElem.tagName != "TABLE")
			srcElem = srcElem.parentElement;

		if(srcElem.tagName != "TR") {		
			return;
		}
		srcElem.style.backgroundColor = '';
		
		selectRow = -1;

		hilite(-1, -1);
	}

	function hilite(newRow)	{
		//last modified 10/22/2007 to sync hilite status panel item

		if (curRow != -1 && curRow!=selectRow)
		{
			curRow.style.backgroundColor = '';

			var sId = curRow.id			
			if ((sId.substr(0,1) == 'L' && sId != 'LSpacer') || (sId.substr(0,1) == 'T' && sId.substr(2,1) != '_')) {
				sId = curRow.name;
			}
			sId = sId.substr(3, sId.length);
			var newRow2 = document.getElementById('ts_' + sId);
			if (newRow2) {
				newRow2.style.backgroundColor = '';
			}

			mouseOutStatusLine(sId);
		}

		if (newRow != -1 && newRow!=selectRow)
		{
			newRow.style.backgroundColor = '#bec5de';

			var sId = newRow.id
			if ((sId.substr(0,1) == 'L' && sId != 'LSpacer') || (sId.substr(0,1) == 'T' && sId.substr(2,1) != '_')) {
				sId = newRow.name;
			}
			sId = sId.substr(3, sId.length);
			var newRow2 = document.getElementById('ts_' + sId);
			if (newRow2) {
				newRow2.style.backgroundColor = '#bec5de';
			}
			
			mouseOverStatusLine(sId);
		}		
		curRow = newRow;
	}


	//validate the input of the search form
	function validate(position) {
		if(document.form1.keyword.value==''){
			alert('Fill the Input box before submitting!');
			//alert(document.form1.search_option[1].value);
			return false;
		}else if(form1.search_option[position].checked == true){		  
				if(IsNumeric(document.form1.keyword.value)){
					 return true;
			  }else {
				 alert('This field must be a valid integer!');
				 return false;
			  }
		}else{
			return true;
		}
	}

	function IsNumeric(sText){
	   var ValidChars = "0123456789";
	   var IsNumber=true;
	   var Char; 
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
		  { 
		  Char = sText.charAt(i); 
		  if (ValidChars.indexOf(Char) == -1) 
			 {
			 IsNumber = false;
			 }
		  }
	   return IsNumber;
	}

function pageWidth() {
	return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
	}
	
function pageHeight() {
	return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
	}

function posLeft() {
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
	}
	
function posTop() {
	return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
	}

function ob(x){
	return document.getElementById(x);
	}

function scrollFix(){
	var obol=ob('ol');
	obol.style.top=posTop()+'px';
	obol.style.left=posLeft()+'px';
	}
	
function sizeFix(){
	var obol=ob('ol');
	obol.style.height=pageHeight()+'px';
	obol.style.width=pageWidth()+'px';
	}
	
function kp(e){
	ky=e?e.which:event.keyCode;
	if(ky==88||ky==120)
		hm();
	return false;
	}

function scrollFix(){
	var obol=ob('ol');
	obol.style.top=posTop()+'px';
	obol.style.left=posLeft()+'px';
	}
	
function sizeFix(){
	var obol=ob('ol');
	obol.style.height=pageHeight()+'px';
	obol.style.width=pageWidth()+'px';
	}
	
function kp(e){
	ky=e?e.which:event.keyCode;
	if(ky==88||ky==120)
		hm();
	return false;
	}

function inf(h){
	tag=document.getElementsByTagName('select');
	for(i=tag.length-1;i>=0;i--)
		tag[i].style.visibility=h;
	tag=document.getElementsByTagName('iframe');
	for(i=tag.length-1;i>=0;i--)
		tag[i].style.visibility=h;
	tag=document.getElementsByTagName('object');
	for(i=tag.length-1;i>=0;i--)
		tag[i].style.visibility=h;
	}
	
function sm(obl, wd, ht, bg){
	var h='hidden';
	var b='block';
	var p='px';
	var obbxd = ob('mbd');
	obbxd.innerHTML = ob(obl).innerHTML;
	if (bg) {
		var obol=ob('ol');	
		obol.style.height=pageHeight()+p;
		obol.style.width=pageWidth()+p;
		obol.style.top=posTop()+p;
		obol.style.left=posLeft()+p;
		obol.style.display=b;
	}
	var tp=posTop()+((pageHeight()-ht)/2)-12;
	var lt=posLeft()+((pageWidth()-wd)/2)-12;
	var obbx=ob('mbox');
	obbx.style.top=(tp<0?0:tp)+p;
	obbx.style.left=(lt<0?0:lt)+p;
	obbx.style.width=wd+p;
	obbx.style.height=ht+p;
	if (!bissaf)
		inf(h);
	obbx.style.display=b;
	return false;
	}
	
function hm(){
	var v='visible';
	var n='none';
	ob('ol').style.display=n;
	ob('mbox').style.display=n;
	inf(v);
	document.onkeypress='';
	}
	
function initmb(){
	var ab='absolute';
	var n='none';
	var obody=document.getElementsByTagName('body')[0];
	var frag=document.createDocumentFragment();
	var obol=document.createElement('div');
	obol.setAttribute('id','ol');
	obol.style.display=n;
	obol.style.position=ab;
	obol.style.top=0;
	obol.style.left=0;
	obol.style.zIndex=998;
	obol.style.width='100%';
	frag.appendChild(obol);
	var obbx=document.createElement('div');
	obbx.setAttribute('id','mbox');
	obbx.style.display=n;
	obbx.style.position=ab;
	obbx.style.zIndex=999;
	var obl=document.createElement('span');
	obbx.appendChild(obl);
	var obbxd=document.createElement('div');
	obbxd.setAttribute('id','mbd');
	obl.appendChild(obbxd);
	frag.insertBefore(obbx,obol.nextSibling);
	obody.insertBefore(frag,obody.firstChild);
	window.onscroll = scrollFix; 
	window.onresize = sizeFix;
}

function goUMapItSearch(i,fid,url) {
	var div = t.tabs[i].div; 
	var sURL = "";
	uForm = document.iframeUploadForm;
	if (uForm.fileUMapIt.value != '') {
	  pausecomp(400);
	}
	sURL = sBaseUrl + url;
	oForm = document.getElementById(fid);        
	sParams = getRequestBody(oForm);
	postToPage(div,sParams,sURL,"post");


	n_curStep = 1;
	n_curTab = i;
	//bSubmit = true;
	setStepIcons(i,n_curStep);
	arr_curTabSubstep[n_curTab] = n_curStep;


}

function goUMapItClearForm(fid) {
	oForm = document.getElementById(fid);
	uForm = document.iframeUploadForm;
	oForm.selUMapItPlatform.selectedIndex=0;
	oForm.selUMapItFormat.selectedIndex=0;
	oForm.selUMapItAbiPlatformSpecies.selectedIndex=0;
	oForm.textareaUMapItList.value=' ';
	uForm.fileUMapIt.value='';
}

function changePage(i,startRow,maxRows,url) {
		var div = t.tabs[i].div;
		var sURL = "";
		if (maxRows == 0)
		{
				sParams = "act=page&startRow=" + startRow;
		} else {
				sParams = "act=page&startRow=" + startRow + "&maxRows=" + maxRows;
		}

		cA = false; cB = false;
		sURL = sBaseUrl + url;
		postToPage(div,sParams,sURL,"post");
}

function selectSameProducts(f,elem) {
	for (i=0;i<f.elements.length;i++) {
		if (elem.value == f.elements[i].value) {
			f.elements[i].checked = (elem.checked == true)?true:false;
			checkProductFromValue(elem)
		}
	}
}

function selectAllColumn(c) {
	var f = $('resultsForm');
	var cElem; var r;
	if (c == "a") {
		cElem = f.a;
		if (cA == false) {
			document.getElementById("cButtonAImg").src='./images/remove_all.gif';
			cA = true; r = cA;
		} else {
			document.getElementById("cButtonAImg").src='./images/add_all.gif';
			document.getElementById("cButtonBImg").src='./images/add_all.gif';
			cA = false; r = cA; cB = false;
		}
	} else {
		cElem = f.b;
		if (cB == false) {
			document.getElementById("cButtonBImg").src='./images/remove_all.gif';
			cB = true; r = cB;
		} else {
			document.getElementById("cButtonAImg").src='./images/add_all.gif';
			document.getElementById("cButtonBImg").src='./images/add_all.gif';
			cB = false; r = cB; cA = false;
		}
	}
	// If only 1 row, then checkboxs are not arrays, but single elements.
	if (f.elements.length > 2) {
		for (n = 0; n <= (cElem.length - 1); n++) {
			cElem[n].checked=r;
			selectSameProducts(f,cElem[n]);
		}
	} else {
		cElem.checked=r;
		selectSameProducts(f,cElem);
	}
}

function checkProductFromValue(elem)  {
	//product was checked
	var sparam = '';
	var sAct = '';
	sAct = (elem.checked)?"add":"rem";
	sparam = "prod=" + elem.value + "&";
	sparam = sparam + "act=" + sAct;

	sendRequest(sparam, sBaseUrl + "pages/updatebasket.php","get");

	if (elem.checked)
	{
		addItemToStatusPanel(elem);
		bSaved = 'NO';
	}
	else {
		removeItemFromStatusPanel(elem);
		bSaved = 'NO';
	} // end if elem.checked
}

function pausecomp(millis) {
	var date = new Date();
	var curDate = null;
	do { curDate = new Date(); }
	while(curDate-date < millis);
} 
