//------------------------------------------------------------------------------
// Copyright (c) 2005, 2006 IBM Corporation and others.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
// 
// Contributors:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------


var elementUrls = new Array();

function buildProcessElementBreadCrumb(backPath) {

	var linksText = "";
	var paths = par_path.split(",");
	var path = "";
   	for (var i = 0; i < paths.length-1; i++) {
     		var guid = paths[i];
     		if ( path != "" ) path += ",";
     		path += guid;
     		var text = getProcessElementLinkHtmlFromId(guid, path, backPath);
     		if ( text != "" ) {
     			linksText += text + "&nbsp;>&nbsp";
     		}
	}

	linksText += getProcessElementLinkHtmlFromId(paths[paths.length-1], par_path, backPath);
	
	document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">");
	document.write("<tr><td align=\"right\">" + linksText + "</td><tr>");
	document.write("</table>");

}


function getProcessElementLinkHtmlFromId(guid, elementPath, backPath) {

	var str = "";
	var item = elementUrls[guid];
	if ( item != null ) {
		var text = item[0];
		var url = backPath + item[1];
		
		// escape the quotes
		url = url.replace(/'/g, "\\'");
		url = url.replace(/\"/g, "\\\"");
		
		str = "<a href=\"javascript:location.href=getActivityItemUrl('" + url + "', '" + par_proc + "', '" + elementPath + "', '');\">" + text + "</a>";
	}

	
	return str;
}

// dynamically generated element url info from RMC publishing service 


