	
	var httpCgiPath = "<!--$HttpCgiPath-->";
	var httpRelativeFragmentsRoot = "<!--$HttpRelativeFragmentsRoot-->";
	var httpRelativeWebRoot = "<!--$HttpRelativeWebRoot-->";
	var SearchResults = new Array();
	var SavedSearches =  new Array();	
			
	function display_dynamiccontent(containerIndex,searchResults,resultCount,TitleText,isCollapsible)
   	{
		var containerIdBase = "CollapsiblePanelSingle" + containerIndex + "_Base";
		var ContainerID = "CollapsiblePanelSingle" + containerIndex;
	
		document.write('<div style="margin:0px 0px 0px 0px; border-left:none;border-right:none;border-top:none; border-bottom:none;">' +
			'<div id="' + containerIdBase + '"></div>' +
	   	   '</div>');
	 
	
	document.write();
	
	
	var resultdiv = document.getElementById(containerIdBase);
	window.RESULTDIV = resultdiv;
	
	if(resultdiv)
	{
		drawCateSearchResults(ContainerID,searchResults,containerIndex,resultCount,TitleText,isCollapsible);
	}
}

function fillLinksArray(DocTitle,Comments,FileURL,dID,Extension,DocName,ContentType)
{
	//build results array
	//create a doc object
	var doc = new Object();
	doc.title = DocTitle;
	doc.comments = Comments;
	doc.URL = FileURL;
	doc.dID = dID;
	doc.extension = Extension;
	doc.dDocName = DocName;
	doc.xContentType = ContentType;
	//add doc object to the SearchResults array
	SearchResults.push(doc);
}

// extract the search results and
// draw them to the page in collapsible panels
function drawCateSearchResults(containerId,searchResults,containerIndex,resultCount,titleText,isCollapsible)
{
	

	//var htmlString = '<table Title="Help text goes here" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td>';
	var htmlString = "";
	
	if(searchResults == null)
	{
		htmlString += "";
	}
	else //extract and categorize results then build html to draw them
	{
		htmlString += makeHtmlLinks(searchResults,containerId,containerIndex,resultCount,titleText,isCollapsible);
	}
	
	//htmlString += '</td></tr></tbody></table>';

	window.RESULTDIV.innerHTML = htmlString;
	//if the pane is collapsible pane
	if(isCollapsible)
	{
		//register Spry collapsible panel
		if(searchResults && searchResults.length)
		{
			var panelID = containerId;
			window[panelID] = new Spry.Widget.CollapsiblePanel(panelID);
			//window[panelID].close();
		}
	}
}


function makeHtmlLinks(items,containerId,ContainerIndex,resultCount,titleText,isCollapsible)
{
	var htmlString = "";
	var containerArrow = containerId + "_arrow";
	var numResultsToDisplay;//number of results to display in a pane
	var showMoreLink;//boolean determines whether to show the 'Show All ...' link at the end of a pane
		
	
	//if(items.length==0)
	//{
	//	htmlString = "";
	//	return htmlString;
	//}
	
	//find out how many results to show in a pane an if a 'More ...' link is required
			if(items.length > resultCount && isCollapsible){
				numResultsToDisplay = resultCount;
				showMoreLink = true;
			}else{
				numResultsToDisplay = items.length;
				showMoreLink = false;
			}
	
	if(isCollapsible)
	{
		htmlString += '<div id="'+ containerId + '" class="CollapsiblePanel">';
		htmlString += '<div class="CollapsiblePanelTab" tabindex="0" style="font-size:1em;">';
	
		htmlString += '<image src="'+ httpRelativeFragmentsRoot +'ss_it_fr_related_links/images/DT-Header-left-u.gif" id="'+ containerArrow + '" />';
		//htmlString += '<image src="'+ httpRelativeWebRoot +'groups/webasset/@wbasst/@extranet/documents/webasset/dt_header_left_u_imag.gif" id="'+ containerArrow + '" />';
	    
		//htmlString += window.PARAMS.title + ' (' + items.length + ') ';
		htmlString += titleText + ' (' + items.length + ') ';
		htmlString += '</div>';
	}
	else
	{
		//htmlString += '<div id="'+ containerId + '" class="nonCollapsiblePanel">';
		htmlString += '<table class="RelatedLinks">';
		htmlString += '<tbody><tr>';
		htmlString += '<td style="COLOR: #fff; HEIGHT: 20px; BACKGROUND-COLOR: #003572; text-size: 10pt; valign: middle">&nbsp;&nbsp;&nbsp; <b>Related Links (' + items.length + ') </b></td>';
		htmlString += '</tr>';
		var WhiteStr = '<tr><td><li><div class="titleText">White Papers </div>'
		var NewsStr = '<li><div class="titleText">News and Events </div>'
		var ThoughtStr = '<li><div class="titleText">Thought Leadership </div>'
		var SuccessStr = '<li><div class="titleText">Success Stories </div>'
	}
		
	
	//loop through results and show
	var numW = 0;
	var numN = 0;
	var numT = 0;
	var numS = 0;
	for(var i=0; i<items.length; i++)
	{	
		if(items[i].xContentType == "Whitepapers" && numW < numResultsToDisplay){
				WhiteStr += makeHtmlLink(items[i]);
				numW++;
		}else if(items[i].xContentType == "News and Events" && numN < numResultsToDisplay){
				NewsStr += makeHtmlLink(items[i]);
				numN++;
		}else if(items[i].xContentType == "Thought Leadership" && numT < numResultsToDisplay){
				ThoughtStr += makeHtmlLink(items[i]);
				numT++;
		}else if(items[i].xContentType == "Success Story" && numS < numResultsToDisplay){
				SuccessStr += makeHtmlLink(items[i]);
				numS++;
		}
	}
		
	if(numW >= numResultsToDisplay && showMoreLink){WhiteStr += '<div style="text-align:right;cursor:pointer;" onclick="refreshPaneResults(this.parentNode,' + ContainerIndex +')">Show All ...</div>';}
	if(numN >= numResultsToDisplay && showMoreLink){NewsStr += '<div style="text-align:right;cursor:pointer;" onclick="refreshPaneResults(this.parentNode,' + ContainerIndex +')">Show All ...</div>';}
	if(numT >= numResultsToDisplay && showMoreLink){ThoughtStr += '<div style="text-align:right;cursor:pointer;" onclick="refreshPaneResults(this.parentNode,' + ContainerIndex +')">Show All ...</div>';}
	if(numS >= numResultsToDisplay && showMoreLink){SuccessStr += '<div style="text-align:right;cursor:pointer;" onclick="refreshPaneResults(this.parentNode,' + ContainerIndex +')">Show All ...</div>';}
	
	htmlString += WhiteStr + '<hr>' + NewsStr + '<hr>' + ThoughtStr + '<hr>' + SuccessStr + '</td></tr></tbody></table>';
	//htmlString += '</div>';
	return htmlString;
}

function makeHtmlLink(item)
{	var HStr = "";

	HStr += '<table width="100%" cellspacing="0" cellpadding="6" border="0">';
	HStr += '<tr valign="top">';
	HStr += '<td>';
	HStr += '<span class="portlet-table-header"><a class="portlet-table-header" href = "javascript:popup(\'' + '<!--$HttpCgiPath-->?IdcService=GET_FILE&dID=' + item.dID + '&dDocName=' + item.dDocName + '\')" />-'+ item.title +'</a>&nbsp;&nbsp;</span>';
	HStr += '</td>';
	HStr += '</tr>';
	HStr += '</table>';
	
	return HStr;
}

function getImageFilename(extension){
		switch(extension.toLowerCase())
		{
			case "doc": return "icon_doc_imag.gif"; 
			case "exe": return "icon_exe_imag.gif";
			case "gif": return "icon_image_imag.gif";
			case "bmp": return "icon_image_imag.gif";
			case "jpg": return "icon_image_imag.gif";
			case "jp2": return "icon_image_imag.gif";
			case "jpeg": return "icon_image_imag.gif";
			case "png": return "icon_image_imag.gif";
			case "pcx": return "icon_image_imag.gif";
			case "svg": return "icon_image_imag.gif";
			case "ai": return "icon_image_imag.gif";
			case "pdf": return "icon_pdf_imag.gif";
			case "ppt": return "icon_ppt_imag.gif";
			case "swf": return "icon_swf_imag.gif";
			case "vsd": return "icon_vsd_imag.gif";
			case "xls": return "icon_xls_imag.gif";
			case "zip": return "icon-zip_imag.gif";
			default: 	return "icon_misc_imag.gif";
		}
		return "icon_misc_imag.gif";
	}

	function navigate(loc){
		window.location = loc;
	}

	//open url in new window
	function popup(url){
		//mywindow = window.open (url,"properties_window","location=0,toolbar=0,status=1,scrollbars=1,width=900,height=900");
		mywindow = window.open (url,"MewWindow","location=0,directories=0,toolbar=0,status=0,scrollbars=1");
		//mywindow.moveTo(0,0);  
	}
	