var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
var isIE = false;
var isFirefox = false;
var toggleSolMap = new Object()
var currentId=new Object();
var ringId = new Object();
var tabContent = new Object();
var xmlDataIslands = new Object();
var solutionMapIDs = new Array();

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('firefox')) {browser = "Firefox";isFirefox=true;}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) {browser = "Internet Explorer"; isIE = true;}
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";



if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}



function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function addSCLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}



function TableController(tableID,rowCount,visibleRows,columnSize) {
	this.tableID = tableID;
	this.index = 1;
	this.rowCount = rowCount;
	this.visibleRows = visibleRows;
	this.columnSize = columnSize;
	this.reverse = false;
}

TableController.prototype.nextPage = function() {
	this.index++;
	this.changePage();
		  
}

TableController.prototype.previousPage = function() {
	this.index--;
	this.changePage();		  
}

TableController.prototype.firstPage = function() {
	this.index=1;
	this.changePage();		  
}

TableController.prototype.lastPage = function() {
	this.index = Math.ceil(this.rowCount / this.visibleRows);
	
	this.changePage();		  
}

TableController.prototype.changePage = function() {
	var ID = this.tableID;
	 var startCell = (this.index-1)*this.visibleRows;
		for(var i = 1; i<=this.visibleRows;i++) {
		for(var j=1;j<=this.columnSize;j++) {
		try {
			var td = document.getElementById('table_'+this.tableID+'_'+i+'_'+j);
		
			//td.innerHTML = tabContent['array'+this.tableID][startCell+i-1][j-1];
			var s = "tablecolumn_"+this.tableID+"_"+(startCell+i-1)+"_"+(j-1);			
			var nod = document.getElementById(s);		
			if(nod == null) {
			   var xml = document.getElementById("XML_"+this.tableID).XMLDocument;
			   nod = xml.selectNodes("//tab-col");
			   alert(nod.length);
				
			}	
		else {	
			td.innerHTML = '';
			td.appendChild(nod.cloneNode(true)); 
		}
		
		}catch(e){
		   try{td.innerHTML = '&nbsp;';}catch(e){ }
		}
	}
	} 
	divCounter = document.getElementById('table_counter_'+this.tableID);
	divCounter.innerHTML = '<nobr>Page&#160;'+this.index+' / '+Math.ceil(this.rowCount / this.visibleRows)+'</nobr>'
	if(this.rowCount == 0) {
		divCounter.innerHTML = '<nobr>Page&#160;'+1+' / '+1+'</nobr>';
	}
	if(this.index == 1) {
		tdFirst = document.getElementById('table_first_'+this.tableID);
		tdFirst.className='urPagDummy urBtnIcoDsbl urSTbvBtnTopDsbl';		
		tdFirst.onclick = ""
		tdPrevious = document.getElementById('table_previous_'+ID);
		tdPrevious.className='urPagDummy urBtnIcoDsbl urSTbvBtnPgUpDsbl';		
		tdPrevious.onclick = "";
	}else {
		tdFirst = document.getElementById('table_first_'+this.tableID);
		tdFirst.className='urPagDummy urBtnIco urSTbvBtnTop';		
		tdFirst.onclick = function() {			
			var con = tabContent['controller'+ID];
			con.firstPage();
		}
		tdPrevious = document.getElementById('table_previous_'+ID);
		tdPrevious.className='urPagDummy urBtnIco urSTbvBtnPgUp';		
		tdPrevious.onclick = function() {			
			var con = tabContent['controller'+ID];
			con.previousPage();
		}
	}
	
	if(this.index == Math.ceil(this.rowCount / this.visibleRows) || this.rowCount == 0) {
		tdLast = document.getElementById('table_last_'+this.tableID);
		tdLast.className='urPagDummy urBtnIcoDsbl urSTbvBtnBottomDsbl';		
		tdLast.onclick = ""
		tdNext = document.getElementById('table_next_'+ID);
		tdNext.className='urPagDummy urBtnIcoDsbl urSTbvBtnPgDownDsbl';		
		tdNext.onclick = "";
	}else {
			tdLast = document.getElementById('table_last_'+this.tableID);
		tdLast.className='urPagDummy urBtnIco urSTbvBtnBottom';		
		tdLast.onclick = function() {			
			var con = tabContent['controller'+ID];
			con.lastPage();
		}
		tdNext = document.getElementById('table_next_'+ID);
		tdNext.className='urPagDummy urBtnIco urSTbvBtnPgDown';		
		tdNext.onclick = function() {			
			var con = tabContent['controller'+ID];
			con.nextPage();
		}
	}
	
}

TableController.prototype.sortTableData = function(sortindex)  {
	

	tabContent['array'+this.tableID].sort(function(row1,row2) {
		//document.write("<br/>sortindex: "+sortindex+" -- row1: "+row1[sortindex-1]+" -- row2: "+row2[sortindex-1]+" result: "+ (row1[sortindex-1] > row2[sortindex-1]));
	     if(row1[sortindex-1] > row2[sortindex-1]) {
	     	return 1;
	   }
	    if(row1[sortindex-1] < row2[sortindex-1]) {
	     	return -1;
	   }else {return 0;}
	});
	if(this.reverse) {
	tabContent['array'+this.tableID].reverse();
	this.reverse = false;
}else this.reverse = true;
	this.changePage();
}


	

function SMCRequest(url,doOnDone, payload, contenttype, smcVersion)
{
	this.url = url;
	this.doOnDone = doOnDone;
	this.payload = payload;
	this.smcVersion = smcVersion;
	this.contenttype = contenttype != null ? contenttype : "text/xml";
	this.responseStatus = null;
	//this.execute = SMCRequest_execute;
}

 SMCRequest.prototype.execute = function (handler)
{
	if (handler != null)
		this.doOnDone = handler;
	return __performRequest(this.url, this.doOnDone, this.payload, this.contenttype);
}

function createXMLDocument()
{
	return new ActiveXObject("Microsoft.XMLDOM");
}

//handling the HTTP Request
function __HTTPRequestWrapper(req, contenttype)
{
	this.contenttype = (null == contenttype ? "text/xml" : contenttype);
	this.http = req;
	this.done = false;
}

function __performRequest(url, doOnDone, payload, contenttype)
{
   if (null == contenttype) contenttype = "text/xml";
	
	var bAsync = (doOnDone != null);
	
	
	var httpreq = null;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    httpreq = new XMLHttpRequest();
    } else if (window.ActiveXObject) { // IE
    httpreq = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	var smcreq = new __HTTPRequestWrapper(httpreq, contenttype);
	
	//if (this.smcVersion)
	//	httpreq.setRequestHeader("smc-version", this.smcVersion);
	
	if (bAsync)
		httpreq.onreadystatechange = 
			function() { __handleAsyncRequest(smcreq, doOnDone); };
	try {
		var fullURL = url; //makeURL(url);
		if (fullURL != null)
		{
			httpreq.open(payload != null ? "POST" : "GET", fullURL , bAsync);
			if (payload == null)
				httpreq.send(null);
			else
			{
				var tempXMLDoc = createXMLDocument();
				tempXMLDoc.async = false;
				tempXMLDoc.loadXML(payload.xml);
				httpreq.send(tempXMLDoc);
			}
			if (!bAsync)
			{
				smcreq.done = true;
				return __handleSynchronousRequest(smcreq);
			}
		}	
		else alert("URL incomplete: " + url); // REVIEW throw
	}
	catch(e)
	{
		alert(e);
	}	
}

function __setTimeStamp(xmlroot)
{
	xmlroot.setAttribute("timestamp", "" + (new Date()).getTime());
}

function SMCResponse(xmlenvelope)
{
	this.returnData = xmlenvelope;
}

function __handleAsyncRequest(req, handler)
{
	
	if (req.done)
		return;
	
	
	if (!req.done && req.http.readyState == 4)
	{
		
		req.done = true;
		var http = req.http;
		/*if (req.contenttype && http.getResponseHeader("Content-Type").indexOf(req.contenttype) != 0)
		{
			alert("ContentType expected: " + req.contenttype + "\nReceived: " + 
					http.getResponseHeader("Content-Type") + "\n "+ http.responseText);
			return;
		}
		*/
		req.responseStatus=http.statusText;	
		
		if (http.getResponseHeader("Content-Type").indexOf("text/xml") > -1)
		{
			//var xmlDoc = createXMLDocument();
			//xmlDoc.async = false;
			//http.responseXML.save(xmlDoc);
			
			var xmlDoc = http.responseXML;
			if (xmlDoc == null || !xmlDoc.hasChildNodes())
			{
				req.http = null;
				postError(http.statusText, 4);
			}
			else 
			{
				var response = new SMCResponse(xmlDoc);
				//try {
					if (handler != null)
					{
						handler(response.returnData);
						return;
					}
				//}
				//catch (e)
				//{			
					// REVIEW throw
					alert("Could not handle Response data:", e, req.http.responseText);	
				//}				
			}	
		}
		else
		{
			if (http.getResponseHeader("Content-Type").indexOf("text/html") == 0)
			{
				handler(http.responseText);
			}
			else alert("could not handle response contenttype:\n" + http.getResponseHeader('Content-Type'));
		}	
		return;	
	}
}

function __handleSynchronousRequest(req)
{
	req.done = true;
	var http = req.http;
	
	req.responseStatus=http.statusText;	
	
	if (http.getResponseHeader("Content-Type").indexOf(req.contenttype) != 0)
	{
		alert(http.responseText);
		return;
	}	
	if (http.getResponseHeader("Content-Type").indexOf("text/xml") > -1)
	{
		var xmlDoc = http.responseXML;
		if (xmlDoc == null || !xmlDoc.hasChildNodes())
		{
				req.http = null;
				postError(http.statusText, 4);
				return null;
		}
		else 
		{
			var response = new SMCResponse(xmlDoc);
			return response.returnData;
		}		
	}
	else
	{
		if (http.getResponseHeader("Content-Type").indexOf("text/html") == 0)
		{
			return http.responseText;
		}
		else alert("could not handle response contenttype:\n" + http.getResponseHeader('Content-Type'));
	}
}

function postError(statusTxt, refError)
{
    var s = function(){returnError(statusTxt, refError);};
    setTimeout(s, 1);
}

function returnError(statusTxt, refError)
{
    
    //window.clipboardData.clearData();
    //window.clipboardData.setData("text",err.detail.string);
    
    alert(statusTxt);
    //throw(err);
}

function showWait(htmlid,imgURL) {
		var elem = document.getElementById(htmlid);
		
	elem.innerHTML = "<div class='urTxtEmph' style='text-align:center;min-height:400px'><table style='width:100%;min-height:400px;'><tr><td style='width:100%;text-align:center;vertical-align:middle;height:100%'><br/><br/><br/><img src='"+imgURL+"'/>&nbsp;&nbsp;<span style='vertical-align:middle' class='urFontStd urTxtEmph'>Please wait while your request is being processed...</span><br/><br/><br/></td></tr></table></div>";
}

function refreshHTMLElement(URLPrefix, URLPostfix, htmlid)
{

	var URL = URLPrefix;
	if(URLPostfix != null) {
		URL +=URLPostfix;
	}
	
	//alert(URL);
	var req= new SMCRequest(URL,
			function (htmltxt)
			{
				//alert('ready'+htmltxt);
				var elem = document.getElementById(htmlid);
				if (elem != null)
				{
					//alert(htmltxt);
					if(!isIE) {
					
					var span = document.createElement("span");
					span.innerHTML = htmltxt;
					elem.innerHTML = "";
					elem.appendChild(span);
					}else {
						elem.innerHTML = htmltxt;
					}
				} 									
			}
			
	, null , "text/html", "");
	req.execute();
}

function refreshHTMLElementRewrite(URLPrefix, htmlid,xsltFile, callback)
{

	var URL = URLPrefix;
	

	URL = escape(URL);
	if(!xsltFile) {
		xsltFile = "linkrewriting.xslt";
	}
	URL = transformerURL+'&xsl='+xsltFile+'&xml='+URL;
	
	var req= new SMCRequest(URL,
			function (htmltxt)
			{
				
				var elem = document.getElementById(htmlid);
				if (elem != null)
				{
					//alert(htmltxt);
					if(browser != "Internet Explorer") {
					
					var span = document.createElement("span");
					span.innerHTML = htmltxt;
					elem.innerHTML = "";
					elem.appendChild(span);
					}else {
						elem.innerHTML = htmltxt;
					}			
				}
				try{callback();}catch(e) {}
			}
	, null , "text/html", "");
	

	req.execute();
}


     


function setCookie(name, value, domain, expires, path, secure){
   var cook = name+"="+unescape(value);
   cook += (domain) ? "; domain="+ domain : "";
   cook += (expires) ? "; expires="+expires : "";
   cook += (path) ? "; path="+path : "";
   cook += (secure) ? "; secure":"";
   document.cookie = cook;
}
function getCookie(name){
	var i=0 ; //Suchposition im Cookie
   var suche = name+"=";
   while (i<document.cookie.length){
      if (document.cookie.substring(i, i+suche.length)==suche){
         var ende = document.cookie.indexOf(";", i+suche.length);
         ende = (ende>-1) ? ende : document.cookie.length;
         var cook = document.cookie.substring(i+suche.length, ende);
         return unescape(cook);
      }
      i++;
   }
   return false;
}

function deleteCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function nextSibling(node) {
	result = node.nextSibling;
	while(result.nodeType != 1) {
		result = result.nextSibling;
	}
	return result;
}

function previousSibling(node) {
	result = node.previousSibling;
	while(result.nodeType != 1) {
		result = result.previousSibling;
	}
	return result;
}

function firstChild(node) {
	result = node.childNodes;
	for(i=0;i<result.length;i++) {
		if(result[i].nodeType == 1) {
			return result[i];
		}
	}
}


  // check for XPath implementation 
  if( document.implementation.hasFeature("XPath", "3.0") ) 
  { 
  	
	 if(isFirefox) {
	 // prototying the XMLDocument 
		XMLDocument.prototype.selectNodes = function(cXPathString, xNode) 
		{ 
			try{ if( !xNode ) { xNode = this; }
			  var oNSResolver = this.createNSResolver(this.documentElement) 
			  var aItems = this.evaluate(cXPathString, xNode, oNSResolver,
			  XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) 
			  var aResult = [];
			  for( var i = 0; i < aItems.snapshotLength; i++) 
				  { 
						aResult[i] = aItems.snapshotItem(i);
				  } 
			 
			  return aResult;}catch(e) {return new Array(0);}
		} 
		  
		XMLDocument.prototype.selectSingleNode = function(xPathString) {
			return this.selectNodes(xPathString)[0];
		}
		  
		Element.prototype.selectSingleNode = function(xPathString) {
		 	  return this.selectNodes(xPathString)[0];
		 	
		}
 
		// prototying the Element 
		Element.prototype.selectNodes = function(cXPathString) 
		{ 
		  if(this.ownerDocument.selectNodes) 
		  { 
			return this.ownerDocument.selectNodes(cXPathString, this);
		  } 
		  else{throw "For XML Elements Only";} 
		} 
	}
  } 

 if(!isIE)  {
	var sc_lastSize;
	var sc_lastWidth;
	if( document.defaultView.getComputedStyle ) { 
		sc_lastSize = document.defaultView.getComputedStyle(document.documentElement,"").fontSize;
		sc_lastWidth = window.innerWidth;
		setInterval(function () {
			var sz = document.defaultView.getComputedStyle(document.documentElement,"").fontSize;
			var lw = window.innerWidth;
			if( sz !== sc_lastSize || lw !== sc_lastWidth) {
				//alert("window size changed: "sc_lastWidth+" "+lw);
				for(var i =0;i<solutionMapIDs.length;i++) {
					setContainerSizeID(solutionMapIDs[i]);
				}
				sc_lastSize = sz;
				sc_lastWidth = lw;
			}
		},300);
	
	}

 
 
 
 }
		    
function setContainerSizeOV() {
	try{
		var size= document.getElementById("smapContentOV");
		var rootDiv = document.getElementById("smc_canvasOV");
		rootDiv.style.height = (size.offsetHeight+60)+"px";
		var smapBackground = document.getElementById("smapBackgroundOV");
		smapBackground.style.height = size.offsetHeight;
	}catch(e) {}
}

function drawVChainCanvasLeft(id) {
	var canvas = document.getElementById(id);
	try {
	canvas.parentNode.getElementsByTagName("span")[0].style.display="none";
	}catch(e){}
	var height= canvas.parentNode.parentNode.getElementsByTagName("td")[1].getElementsByTagName("tr")[0].offsetHeight;

	var width = canvas.parentNode.offsetWidth;
	var ctx = canvas.getContext("2d");
	canvas.width = width;
	canvas.height = height+10;
	ctx.fillStyle = "#225a8d";
	ctx.strokeStyle = "#225a8d";
	ctx.lineWidth=0.5;
	ctx.arc(20,height+5,5,0,2*Math.PI,false);
	ctx.fill();
	ctx.beginPath();
	ctx.moveTo(20,height+5);
	ctx.lineTo(width,height+5);
	ctx.closePath();
	ctx.stroke();
}

function drawVChainCanvasRight(id) {
	var canvas = document.getElementById(id);
	try {
	canvas.parentNode.getElementsByTagName("span")[0].style.display="none";
	}catch(e){}
	var height= canvas.parentNode.parentNode.getElementsByTagName("td")[1].getElementsByTagName("tr")[0].offsetHeight;
	var width = canvas.parentNode.offsetWidth;
	var ctx = canvas.getContext("2d");
	canvas.width = width;
	canvas.height = height+10;
	ctx.fillStyle = "#225a8d";
	ctx.strokeStyle = "#225a8d";
	ctx.lineWidth=0.5;
	ctx.arc(width-20,height+5,5,0,2*Math.PI,false);
	ctx.fill();
	ctx.beginPath();
	ctx.moveTo(width-20,height+5);
	ctx.lineTo(0,height+5);
	ctx.closePath();
	ctx.stroke();
}

function drawOvalCanvas(id) {
	var canvas = document.getElementById(id);
	try {
		canvas.parentNode.getElementsByTagName("span")[0].style.display="none";
	}catch(e){}
	if(canvas.width <10) canvas.width=10;
	if(canvas.height <10) canvas.height = 10;
	
	var ctx = canvas.getContext("2d");
	//console.log(canvas.width);
	ctx.fillStyle = canvas.getAttribute("fillStyle");
	ctx.strokeStyle = canvas.getAttribute("strokeStyle");
	ctx.arc(5,5,5,0,2*Math.PI,false);
	ctx.fill();
	//ctx.stroke();
}

function drawAllOtherCanvas() {
	
	if(!isIE) {
		var canvas = document.getElementsByTagName("canvas");
		for(var i=0;i<canvas.length;i++) {
			
			 if(canvas[i].id.indexOf("oval") >-1) {
				drawOvalCanvas(canvas[i].id);				
			}
		}
	}

}

addSCLoadEvent(drawAllOtherCanvas);

function setContainerSizeID(id) {
	//	alert(id);
	try{
		var size= document.getElementById("smapContent_"+id);
		//size.style.display='inline';
		var rootDiv = document.getElementById("smc_canvas_"+id);
		rootDiv.style.height = (size.offsetHeight+60)+"px";		
		
		var smapBackground = document.getElementById("smapBackground_"+id);
		var oldSize = smapBackground.offsetHeight;
		
		smapBackground.style.height = size.offsetHeight+"px"; 
		if(!isIE) {
			smapBackground.style.width = rootDiv.offsetWidth+"px";
			size.style.width=rootDiv.offsetWidth+"px";
			var canvas = rootDiv.getElementsByTagName("canvas");
			for(var i=0;i<canvas.length;i++) {
				
				//console.log("canvas id:",canvas[i].id);
				if(canvas[i].id.indexOf("right") > 0) {
					drawVChainCanvasRight(canvas[i].id);
				}
				else if(canvas[i].id.indexOf("left") >0) {
					drawVChainCanvasLeft(canvas[i].id);
				}
							
			}
			
			
		}
		//var refresh = document.getElementById("smc_refresh_"+id);
		//refresh.innerHTML="<span>&#160;&#160;</span>";	 
	}catch(e) {}
}

   function toggleSolutionMap(mapID,expand,elem) {
		  for(i=0;i < toggleSolMap[mapID].length;i++) {
			 if(expand) {
				document.getElementById(toggleSolMap[mapID][i]).style.display='';
			 } else {
				  document.getElementById(toggleSolMap[mapID][i]).style.display='none';
			 }
		  } if(expand) {
		  	 try {
			    elem.getElementsByTagName("a")[0].innerHTML = 'Collapse All';
			   }catch(e) {
			   	try {   elem.innerHTML = 'Collapse All';
			   	}catch(e){}
			   }
			}
			 else {
			 	try{
			    elem.getElementsByTagName("a")[0].innerHTML= 'Expand All';
			   }catch(e) {
			   	try {   elem.innerHTML = 'Expand All';
			   	}catch(e){}
			   }			  
			 }
		  setContainerSizeID(mapID);
		  return !expand;
	}
	function toogleNextRowDisplay(event,row,mapID)
	{
		if (window.event) {
			if (window.event.srcElement.tagName == "SPAN" || window.event.srcElement.tagName == "A") {
				return false;			
			}
		}
		else if(event !== undefined){
			try {
				if(event.target.nodeName === "span" || event.target.nodeName ==="a"||event.target.nodeName === "SPAN" || event.target.nodeName ==="A") {
					event.stopPropagation();			
					return false;
				}
			}catch(exception) {
				;
			}
		}
		
		try {
			var nextRow = row.parentNode.rows[row.rowIndex+1];
			if (nextRow)
			{
				nextRow.style.display = nextRow.style.display=='none' ? '' : 'none';
				
				if (nextRow.style.display != 'none') {
					//nextRow.scrollIntoView();
				}
			} 
				
			
		}
		catch (e)
		{
			;
		}
		setContainerSizeID(mapID);
		
	}
			
			
			function editElement(source_id,edit_id) {
				try{
				 
		      var source = document.getElementById(source_id);
		     
		      var edit = document.getElementById(edit_id);
		      if(edit.style.display=="none") {
		      	source.style.padding ="5px";
		      edit.style.display="inline";
		       source.style.border="2px dotted red";
		      }else {
		      	edit.style.display="none";
		       source.style.border="";
		       source.style.padding="0px";
		      }
		      		
				
			}catch(e){}
		}
		
function getDropdownBoxData(id){
    var xmlData = getXMLDataIsland("XML_"+id);
    var buf =xmlData.selectNodes("//listdata/entry");
    var data = new Array(buf.length);
     for(i=0;i<buf.length;i++) {
        data[i] = new Array(3);
        data[i][0] = buf[i].getAttribute("id");
        data[i][2] = buf[i].getAttribute("title");
        var temp = buf[i].getAttribute("onselectfunction");
   
        if(temp == null || temp == "") {
           data[i][1]="XXX";
        }else data[i][1]=temp;
     } 
     document.getElementById("dropdown_"+id+"_1").innerHTML = generateDropdownBox("dropdownselect_"+id+"_1",data,"entrySelected(this,'"+id+"')");
  
  }

	   
function generateDropdownBox(id, data,onchange){
	var result='<select id="'+id+'" class="urCoBItmDsc" onchange="'+onchange+'">';
	
   result += '<option value="not_selected">Select one entry</option>';
	for(i=0;i<data.length;i++) {
	   
	   if(data[i][1] != 'XXX') 
		result +='<option class="urCoBItm" value="'+data[i][1]+'">'+data[i][2]+'</option>';
		else
			result +='<option class="urCoBItm" value="XXX_'+data[i][0]+'">'+data[i][2]+'</option>';
	}
	result += '</select>';
	return result;
}	

	function entrySelected(node,dropdownID) {
	  var level = node.id.substring(node.id.lastIndexOf("_")+1);
	  level = level - 0;
	   level++;
	  var follow = document.getElementById(dropdownID+"_"+level);
	  while(follow != null) {
	    var dropBox =  document.getElementById(dropdownID+"_"+level);
	    if(dropBox != null) dropBox.style.visibility = 'hidden';
	     level++;
	     follow = document.getElementById(dropdownID+"_"+level);
	  }
	  
	  level = node.id.substring(node.id.lastIndexOf("_")+1);
	  
	  level = level - 0;
	  // check if another listbox is necessary
	  if(node.value.indexOf("XXX_") == 0) {
	 
	      var id = node.value.substring(4);
	      var xmlData = getXMLDataIsland("XML_"+dropdownID);
	      var buf =xmlData.selectSingleNode("//entry[@id='"+id+"']").selectNodes("entry");
	     
	          var data = new Array(buf.length);
              for(i=0;i<buf.length;i++) {
                 data[i] = new Array(3);
                 data[i][0] = buf[i].getAttribute("id");
                 data[i][2] = buf[i].getAttribute("title");
                 var temp = buf[i].getAttribute("onselectfunction");
                 if(temp == null || temp == "") {
                    data[i][1]="XXX";
                 }else data[i][1]=temp;
              } 
              var nextDropdown = document.getElementById(dropdownID+"_"+(level+1))
             if(nextDropdown != null) nextDropdown.style.visibility = 'visible';
              document.getElementById("dropdown_"+dropdownID+"_"+(level+1)).innerHTML = generateDropdownBox(dropdownID+"dropdown_"+(level+1),data,"entrySelected(this,'"+dropdownID+"')");
	  }else {
	     eval(node.value);
	  }
	 
	
	}
	
	function getXMLDataIsland(id) {
		if(xmlDataIslands[id] == null) {
			if(isIE) {
			  xmlDataIslands[id] = document.getElementById(id).XMLDocument	;
			}else {
				var content = document.getElementById(id).innerHTML;
				var parser=new DOMParser();
				xmlDataIslands[id] = parser.parseFromString(content,"text/xml");
			}
		}
		return xmlDataIslands[id];
	}
		
		
function show (id) {
  if (document.getElementById)
  {
    var style=document.getElementById(id).style.display;
    if (style=='none'){
      document.getElementById(id).style.display = "block";
      document.getElementById(id+'button').src = "/irj/portalapps/com.sap.scr.renderer/webcontent/icon_open.gif";
      document.getElementById(id+'button').alt = "Minimize this Section";
      document.getElementById(id+'button').title = "Minimize this Section";
    }else
    {
      document.getElementById(id).style.display = "none";
      document.getElementById(id+'button').src = "/irj/portalapps/com.sap.scr.renderer/webcontent/icon_close.gif";
      document.getElementById(id+'button').alt = "Maximize this Section";
      document.getElementById(id+'button').title = "Maximize this Section";    }
  }
}