	var displayCount = 14;
	var startAt = 0;
	var divId = "c";

	var categoryId = '1001';
	var categoryId1;
	var categoryId2;
	var categoryId3;
	var categoryId4;
	var categoryId5;

	var menuValues;
	var menuValues1;
	var menuValues2;
	var menuValues3;
	var menuValues4;
	var menuValues5;

	function overUp(menuId) {
		divId = menuId;
		if (menuId == 'c') { menuValues = menuValues1; categoryId = categoryId1; }					//researcher 1
		else if (menuId == 'd') { menuValues = menuValues4; categoryId = categoryId4; }				//researcher 2
		else if (menuId == 'e') { menuValues = menuValues5; categoryId = categoryId5; }				//researcher 3
		else if (menuId == 'r') { menuValues = menuValues2; categoryId = categoryId2; }				//reagent 1
		else if (menuId == 'p') { menuValues = menuValues3; categoryId = categoryId3; }				//protocol 1
	//	else if (menuId == 't') { menuValues = menuValues4; categoryId = categoryId4; }				//trial 1
		startTimerUp();
	}
	function outOfUp() {
		stopTimerUp();
	}
	function overDown(menuId) {
		divId = menuId;
		if (menuId == 'c') { menuValues = menuValues1; categoryId = categoryId1; }					//researcher 1
		else if (menuId == 'd') { menuValues = menuValues4; categoryId = categoryId4; }				//researcher 2
		else if (menuId == 'e') { menuValues = menuValues5; categoryId = categoryId5; }				//researcher 3
		else if (menuId == 'r') { menuValues = menuValues2; categoryId = categoryId2; }				//reagent 1
		else if (menuId == 'p') { menuValues = menuValues3; categoryId = categoryId3; }				//protocol 1
	//	else if (menuId == 't') { menuValues = menuValues4; categoryId = categoryId4; }				//trial 1
		startTimer();
	}
	function outOfDown() {
		stopTimer();
	}

	function initMenu1(menuItems, catId) {
		menuValues1 = menuItems;
		categoryId1 = catId;
	}
	function initMenu2(menuItems, catId) {
		menuValues2 = menuItems;
		categoryId2 = catId;
	}
	function initMenu3(menuItems, catId) {
		menuValues3 = menuItems;
		categoryId3 = catId;
	}
	function initMenu4(menuItems, catId) {
		menuValues4 = menuItems;
		categoryId4 = catId;
	}
	function initMenu5(menuItems, catId) {
		menuValues5 = menuItems;
		categoryId5 = catId;
	}

	var myTimer = null;
	function doMagic() {
		if (startAt < 0) 
			startAt = 0;
		if (startAt <= (menuValues.length - displayCount)) {
			for (i=0; i<displayCount; i++) {
				var allValue = menuValues[startAt + i];
				var idx = allValue.indexOf('^');
				document.getElementById(divId+i).innerHTML = "<a href='javascript:tempMethod(\""+divId+"\", \"" + allValue.substring(0, idx) + "\", \""+allValue.substring(idx+1) + "\")'>" + allValue.substring(idx+1) + "</a>";
			}
			startAt = startAt + 1;
			myTimer = setTimeout('doMagic()',100);
		}
		else
	        clearTimeout(myTimer); 
	}
	function startTimer() {
	    myTimer = setTimeout('doMagic()',100); // myTimer holds the id of the timer
	    //timerRunning = true; whenever you start a timer set the timerRunning flag to true 
	}
	function stopTimer() {
        clearTimeout(myTimer); 
	}

	var myTimerUp = null;
	function doMagicUp() {
		if (startAt > (menuValues.length - displayCount))
			startAt = menuValues.length - displayCount;
		if (startAt >= 0) {
			for (i=0; i<displayCount; i++) {
				var allValueUp = menuValues[startAt + i];
				var idx = allValueUp.indexOf('^');
				document.getElementById(divId+i).innerHTML = "<a href='javascript:tempMethod(\""+divId+"\", \"" + allValueUp.substring(0, idx) + "\", \""+allValueUp.substring(idx+1)+"\")'>" + allValueUp.substring(idx+1) + "</a>";
			}
			startAt = startAt - 1;
			myTimerUp = setTimeout('doMagicUp()',100);
		}
		else
	        clearTimeout(myTimerUp); 
	}
	function startTimerUp() {
	    myTimerUp = setTimeout('doMagicUp()',100); // myTimerUp holds the id of the timer
	    //timerRunning = true; whenever you start a timer set the timerRunning flag to true 
	}
	function stopTimerUp() {
        clearTimeout(myTimerUp); 
	}

	function tempMethodNoScroll(divIdx, scId, scName, catId) {
		categoryId = catId;
		tempMethod(divIdx, scId, scName);
	}

	var subcatName;
	var subcatId;
	var divIndex;
	function tempMethod(divIdx, scId, scName) {
		//alert("Before dwr call subcatId: " + scId + " catId: " + categoryId);
		divIndex = divIdx;
		if (scName == ' All')
			scId = -1;
		if (categoryId == '1001') {									//Stem Cell
			if (divIdx == 'c') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
			else if (divIdx == 'r') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('reagentList.do?ccId='+categoryId+'&rscId='+scId+'&scName='+scName, 'contentClick');
			}
			else if (divIdx == 'p') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
		else if (categoryId == '1002') {							//Biomarker
			if (divIdx == 'd') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
		}
		else if (categoryId == '1008') {							//Metabolomics
			if (divIdx == 'e') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
		}
		else if (categoryId == '1009') {							//Proteomics
			if (divIdx == 'c') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
			else if (divIdx == 'r') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('reagentList.do?ccId='+categoryId+'&rscId='+scId+'&scName='+scName, 'contentClick');
			}
			else if (divIdx == 'p') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
		else if (categoryId == '1003') {							//Drug Discovery
			if (divIdx == 'r') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('reagentList.do?ccId='+categoryId+'&rscId='+scId+'&scName='+scName, 'contentClick');
			}
			else if (divIdx == 'p') {
				refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
		else if (categoryId == '1010') {							//Tuberculosis
			if (divIdx == 'c') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
			else if (divIdx == 'p') {
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
		else if (categoryId == '1018') {							//Mosquitoes
			if (divIdx == 'c') {
				subcatName = scName;
				subcatId = scId;
				refreshMapDesc(scName);
				document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
			else if (divIdx == 'p') {
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
		else if (categoryId == '1019') {							//Share Research Reagent
			refreshMapDesc(scName);
			ajaxpage('reagentList.do?ccId=1019&rscId='+scId+'&scName='+scName+'&catId='+1019, 'contentClick');
		}
		else if (categoryId == '1020') {
			if (divIdx == 'c') {
				subcatName = scName;
				subcatId = scId;
				//refreshMapDesc(scName);
				//document.body.style.cursor = "wait";
				ColSubcatCount.getColSubcatCount(categoryId, scId, showLocations);
			}
			else if (divIdx == 'r') {
				//refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('reagentList.do?ccId='+categoryId+'&rscId='+scId+'&scName='+scName, 'contentClick');
			}
			else if (divIdx == 'p') {
				//refreshMapDesc(scName);
				document.getElementById("contentMain").style.display = 'none';
				document.getElementById("map").style.display = 'none';
				document.getElementById("contentClick").style.display = 'block';
				document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
				ajaxpage('protocolList.do?ccId='+categoryId+'&pscId='+scId+'&scName='+scName, 'contentClick');
			}
		}
	}

	function showLocations(data) {
		//var globalMap = window.detailsIframe.globalMap;
		globalMap.clearOverlays();
		//alert(data);
		var allLocations = data.split("~");

        globalMap.addControl(new GSmallMapControl());
        globalMap.addControl(new GMapTypeControl());

        // Create a base icon for all of our markers that specifies the
        // shadow, icon dimensions, etc.
        var baseIcon = new GIcon(G_DEFAULT_ICON);
        //baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);

        // Create a marker 
        function createMarker(point, wHtml) {
          // Create a lettered icon for this point using our icon class
          var letteredIcon = new GIcon(baseIcon);
          letteredIcon.image = "http://www.google.com/mapfiles/marker.png";

          // Set up our GMarkerOptions object
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
            //marker.openInfoWindowHtml(wHtml);
            eval(wHtml);
          });
          return marker;
        }

		for (i=0; i<allLocations.length; i++) {
			var locStr = allLocations[i];
			var locData = locStr.split("^");
			if (locData[2]=='null' || locData[3]=='null')
				continue;
			var point = new GLatLng(locData[2], locData[3]);
			//var marker = new GMarker(point);
			//alert(locData[1] + " articles: " + locData[0]);
			//GEvent.addListener(marker, "click", function() {
			//	marker.openInfoWindowHtml("Marker <b>" + "letter" + "</b>");
			//});
			//var wndHtml = "<font face='Arial' size='2'><strong>"+locData[1]+"<br>"+subcatName+": <a href='javascript:getArticles(\""+subcatId+"\",\""+locData[1]+"\")'>"+locData[0]+" articles</strong></font>"
			var wndHtml = "getArticles('"+subcatId+"','"+locData[1]+"','"+categoryId+"')";
			globalMap.addOverlay(createMarker(point, wndHtml));
		}
		document.body.style.cursor = "default";
	}

	function getArticles(scId, country, catId) {
		//alert(scId+" - "+country+" - "+catId);
		//document.getElementById("articlesFrame").src = "#";
		opensearchresults(scId, country, catId);
	}

	function opensearchresults(scId, country, catId){
		searchwindow=dhtmlmodal.open('SearchBox', 'iframe', 'forward.do?scId='+scId+'&country='+country+'&catId='+catId+'&section=stemCellResearch', country, 'width=950px,height=450px,center=1,resize=0,scrolling=1')
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}

	function openpresentation(location){
		searchwindow=dhtmlmodal.open('PresentationBox', 'iframe', 'presentation/'+location+'/index.html', location, 'width=850px,height=475px,center=1,resize=0,scrolling=1')
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}

	function tempMethodCt(catId) {
		document.body.style.cursor = "wait";
		ColSubcatCount.getClinicalTrialLocationsForCat(catId, showCtLocations);
	}

	function showCtLocations(data) {
		globalMap.clearOverlays();
		//alert(data);
		var allLocations = data.split("~");

        globalMap.addControl(new GSmallMapControl());
        globalMap.addControl(new GMapTypeControl());

        // Create a base icon for all of our markers that specifies the
        // shadow, icon dimensions, etc.
        var baseIcon = new GIcon(G_DEFAULT_ICON);
        //baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);

        // Create a marker 
        function createMarker(point, someUrl, country) {
          // Create a lettered icon for this point using our icon class
          var letteredIcon = new GIcon(baseIcon);
          letteredIcon.image = "http://www.google.com/mapfiles/marker.png";

          // Set up our GMarkerOptions object
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
            //window.open(someUrl);
			searchwindow=dhtmlmodal.open('SearchBox', 'iframe', 'includect.jsp?getCtUrl='+escape(someUrl), country, 'width=950px,height=450px,center=1,resize=0,scrolling=1')
			searchwindow.onclose=function(){ //Define custom code to run when window is closed
				var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
          });
          return marker;
        }

		for (i=0; i<allLocations.length; i++) {
			var locStr = allLocations[i];
			var locData = locStr.split("^");
			if (locData[2]=='null' || locData[3]=='null') {
				//alert(locData[0]);
				continue;
			}
			var point = new GLatLng(locData[2], locData[3]);
			globalMap.addOverlay(createMarker(point, locData[0], locData[1]));
		}
		document.body.style.cursor = "default";
	}

	function refreshMapDesc(scName) {
		if (document.getElementById("mapDesc").style.display == 'none')
			document.getElementById("mapDesc").style.display = 'block';
		if (divIndex == 'c' || divIndex == 'd' || divIndex == 'e')
			document.getElementById("btnSearchId").style.visibility = 'visible';
		else
			document.getElementById("btnSearchId").style.visibility = 'hidden';
		if (divIndex == 'p' || divIndex == 'r')
			document.getElementById("btnProtocolSearchId").style.visibility = 'visible';
		else
			document.getElementById("btnProtocolSearchId").style.visibility = 'hidden';
		document.getElementById("prevDesc").innerHTML = document.getElementById("currentDesc").innerHTML;
		document.getElementById("currentDesc").innerHTML = scName;
	}

	function cleanMapDesc() {
		document.getElementById("mapDesc").style.display = 'block';
		document.getElementById("prevDesc").innerHTML = "";
		document.getElementById("currentDesc").innerHTML = "";
		document.getElementById("mapDesc").style.display = 'none';
	}

	function showAnArticle(someUrl, title) {
		searchwindow=dhtmlmodal.open('SearchBox', 'iframe', 'includect.jsp?getCtUrl='+escape(someUrl), title, 'width=950px,height=450px,center=1,resize=0,scrolling=1')
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}

	function setCategoryId(selCatId) {
		categoryId = selCatId;
	}

	function refineSearch() {
		var catId = categoryId;
		searchwindow=dhtmlmodal.open('SearchBox', 'iframe', 'searchResearchersParent.jsp?catId='+catId, 'Search Researcher', 'width=950px,height=450px,center=1,resize=0,scrolling=1')
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}
	
	function refineProtocolSearch(keyword) {
		document.getElementById("contentMain").style.display = 'none';
		document.getElementById("contentClick").style.display = 'block';
		document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
		ajaxpage('protocolList.do?keyword='+keyword+'&catId='+categoryId, 'contentClick');
	}
	
	function refineReagentSearch(companyName) {
		if (companyName!= null && companyName.length>4) {
			document.getElementById("contentMain").style.display = 'none';
			document.getElementById("contentClick").style.display = 'block';
			document.getElementById("contentClick").innerHTML = '<img src="images/ajaxloader.gif">';
			ajaxpage('reagentSearchList.do?cName='+companyName+'&catId='+categoryId, 'contentClick');
		}
	}

	function displaySearchBar(leftIdx, reagentIdx, protoIdx) {
		if (leftIdx == protoIdx) {
			document.getElementById('searchBarId').style.display='block';
			document.getElementById('searchReagentBarId').style.display='none';
		}
		else if (leftIdx == reagentIdx) {
			document.getElementById('searchReagentBarId').style.display='block';
			document.getElementById('searchBarId').style.display='none';
		}
	}

	function getReagentsForSubcatType(rgscId, subcatType) {
		var divObjs = document.getElementsByName("reagentSubcatTypeReagentListId")
		divObjs[0].innerHTML = '<br><br><img src="images/ajaxloader.gif">';
		if (divObjs[1])
			divObjs[1].innerHTML = '<br><br><img src="images/ajaxloader.gif">';
		ajaxpage('reagentSubcatTypeList.do?rgscId='+rgscId+'&subcatType='+subcatType, 'reagentSubcatTypeReagentListId');
	}
	function getReagentsForSubcatType2(rgscId, subcatType) {
		document.getElementById("reagentSubcatTypeReagentListId2").innerHTML = '<br><br><img src="images/ajaxloader.gif">';
		ajaxpage('reagentSubcatTypeList.do?rgscId='+rgscId+'&subcatType='+subcatType, 'reagentSubcatTypeReagentListId2');
	}
	function decorateCompareAllTable() {
		if (!document.getElementById("compareAllTblId")) return;
		var tableCols = document.getElementById("compareAllTblId").getElementsByTagName("tbody")[0].rows[0].cells.length;
	    YAHOO.example.ClientPagination = function() {
	        var myColumnDefs = null;
	        if (tableCols == 4) {
		        myColumnDefs = [
		            {key:"type", label:"Company", sortable:true},
		            {key:"kitName", label:"Assay Type", sortable:true},
		            {key:"method", label:"Method", sortable:true},
		            {key:"technique", label:"Technique", sortable:true}
		        ];
		        var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("compareAllTblId"));
		        myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
		        myDataSource.responseSchema = {
		            resultsList: "records",
		            fields: ["type","kitName","method","technique"]
		        };
		    } else {
		        myColumnDefs = [
		            {key:"type", label:"Company", sortable:true},
		            {key:"method", label:"Method", sortable:true}
				];
		        var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("compareAllTblId"));
		        myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
		        myDataSource.responseSchema = {
		            resultsList: "records",
		            fields: ["type","method"]
		        };
		    }

	        var oConfigs = {
	                paginator: new YAHOO.widget.Paginator({
	                    rowsPerPage: 50
	                }),
	                initialRequest: "results=200"
	        };
	        var myDataTable = new YAHOO.widget.DataTable("paginated", myColumnDefs,
	                myDataSource, oConfigs);
	
	        return {
	            oDS: myDataSource,
	            oDT: myDataTable
	        };
	    }();
	}

	function researcherAddNew(msgType, catId) {
		searchwindow = dhtmlmodal.open('SearchBox', 'iframe', 'researcherAdd.do?catId='+catId+'&type='+msgType+'&entity=researcher', 'List your research article with SciClips', 'width=950px,height=450px,center=1,resize=0,scrolling=1');
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}
	function protocolAddNew(msgType, catId) {
		searchwindow = dhtmlmodal.open('SearchBox', 'iframe', 'researcherAdd.do?catId='+catId+'&type='+msgType+'&entity=protocol', 'List your protocols with SciClips', 'width=950px,height=450px,center=1,resize=0,scrolling=1');
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}
	function reagentAddNew(msgType, catId) {
		searchwindow = dhtmlmodal.open('SearchBox', 'iframe', 'researcherAdd.do?catId='+catId+'&type='+msgType+'&entity=reagent', 'List your reagents with SciClips', 'width=950px,height=450px,center=1,resize=0,scrolling=1');
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}
	function recommend(msgType, catId) {
		searchwindow = dhtmlmodal.open('SearchBox', 'iframe', 'recommend.do?catId='+catId+'&type='+msgType, 'Tell a friend about Sciclips.com', 'width=950px,height=450px,center=1,resize=0,scrolling=1');
		searchwindow.onclose=function(){ //Define custom code to run when window is closed
			var theform=this.contentDoc.forms[0] //Access first form inside iframe just for your reference
		}
	}
	