 var tvar=0;
 var Target1;
 var Style1;
 var Div1;
 var Span;
 var ie = document.all ? true : false;
 var opera = (window.opera || navigator.userAgent.indexOf("Opera") != -1) ? true : false;
 var currentHelpLevel;
 
 
 // !!! pay attention to the fact, that we need 
 // 'currentHelpLevel' defined (at helpLev.js), and
 // 'helpLevName', an array, defined (at helpLev.js) !!!

 function showiTxt(textToDisplay, k, strlen, tableWidth, restriction, sessHelpLevel, itextBgColor, itextBorderColor) {

	
	
	var goes = false;
    var ieHelpLevel;
	
    
	if(!strlen)
    strlen = textToDisplay.length;
	
    
	//if(ie && sessHelpLevel)
    //currentHelpLevel = sessHelpLevel;
    // using sessHelpLevel makes sense ony for load status (starting help level assignment) of current page,
    // where sessHelpLevel == session(_helpLevel)
    // all other versions has to bee excluded
    // e.g. switching at helLev.js from last help level option to first one,
    // changes  currentHelpLevel from 'n' to '0', but not sessHelpLevel at the same time,
    // where sessHelpLevel != session(_helpLevel) !!!!!
    if((!currentHelpLevel && currentHelpLevel !=0) && sessHelpLevel)
    currentHelpLevel = sessHelpLevel;


    
	
	// restriction is assigned at addiText-call, e.g. at secmenu-function where restriction==menu
    // otherwize, if it was not assigned, Restriction=='none'
    if(helpLevName[currentHelpLevel] == restriction ||
       helpLevName[currentHelpLevel] == "all")
    goes = true;


    
	
	if(restriction == "none" ||  goes == true)  {


	// '&& strlen' is not yet clear, but it is neccessary to avoid a secondary call
    // during mouseout ...?!
    // => mouse-in, only
    if (tvar==0 && strlen) {
		

 	padding=10;

	if  (strlen < 30) {
	    relFactor = 0.6;
	}
	else {

	    if	(strlen < 50) {
	    	relFactor = 0.5;
	    }
	    else {
	    	    if	(strlen < 100) {
		    	relFactor = 0.3;
		    }
		    else {
		    	    if	(strlen < 200) {
			    	relFactor = 0.3;
			    }
			    else {
			    	relFactor = 0.1;
			    }
		    }
	    }
	}

	if(ie && !opera) innerWindowWidth = document.body.offsetWidth;
	else innerWindowWidth = window.innerWidth;
	columnDistance= innerWindowWidth/90;
	leftColumnWidth = (innerWindowWidth - tableWidth)/2;
	leftSpace = relFactor*leftColumnWidth;
	elementWidth=leftColumnWidth-leftSpace-2*padding-columnDistance-5;
	
	

	// attention: white-space:normal does not work for ie5.5 !
	if(ie && !opera)
	divStyleTxtIE = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid "+itextBorderColor+"; background-color:"+itextBgColor+"; padding:"+padding+"px; white-space:normal; text-align:left; line-height:13px;";
	else if (opera ) {
	divStyleTxt = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid "+itextBorderColor+"; background-color:"+itextBgColor+"; padding:"+padding+"px; white-space:normal; text-align:left; line-height:13px; ";
	}
	else
	divStyleTxt = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid "+itextBorderColor+"; background-color:"+itextBgColor+"; padding-left:"+padding+"px; padding-right:"+padding+"px; white-space:normal; text-align:left; line-height:13px;";

	spanStyleTxt = "font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt;";

	// get access to parent span-element
	Target1 = document.getElementById("iTarg_"+k);

	// create new div element dynamically
	if(ie && !opera) {


	    document.all["iTarg_"+k].insertAdjacentHTML('BeforeEnd', '<div style="'+divStyleTxtIE+'" id="divTarg_'+k+'"></div>');

	    Div1 = document.getElementById("divTarg_"+k);
	
	}
		
	
	else {

	    Div1 = document.createElement("div");

		Style1 = document.createAttribute("style");
		Style1.nodeValue = divStyleTxt;

	    Div1.setAttributeNode(Style1);
	}



	
	// create an js-array from splitting glossary text by |
	arrTextToDisplay = textToDisplay.split("|");

	// create new span elements for each value from js-array (child nodes to Div1)
	for(var i=0;i<arrTextToDisplay.length;i++) { // 003-11

	    if(ie && !opera) { // 004-11


		document.all["divTarg_"+k].insertAdjacentHTML('BeforeEnd', '<p style="'+spanStyleTxt+'" id="spanTarg_'+k+'_'+i+'">'+arrTextToDisplay[i]+'</p>');

		//Span = document.getElementById("spanTarg_"+k+"_"+i);
	      //Div1.appendChild(Span);

	    } // 004-12
		
		
		
		else { // 004-31

		Span = document.createElement("p");
		    //
		    SpanStyle = document.createAttribute("style");
		    SpanStyle.nodeValue = spanStyleTxt;

		    Span.setAttributeNode(SpanStyle);

		    Texti = document.createTextNode(arrTextToDisplay[i]);

		Span.appendChild(Texti);
	       Div1.appendChild(Span);

	    } // 004-32


	    

	} // 003-12
	
	
	Target1.appendChild(Div1);
	tvar=1;

    }
    // onMouseout
	else if (tvar==1)
    {

		
		if(opera && window.name != "exampleWin") {
		
		if(Target1.childNodes[1])
		Target1.childNodes[1].style.visibility = "hidden";
		Target1.removeChild(Div1);				
		}
		else
		Target1.removeChild(Div1);
		
		tvar=0;
		
		
    }
	
 }} // end of function showiTxt
 
 
  function showHelpTxt(textToDisplay, k, strlen, tableWidth, restriction, sessHelpLevel) {

	
    var goes = false;
    var ieHelpLevel;

    if(!strlen)
    strlen = textToDisplay.length;

    //if(ie && sessHelpLevel)
    //currentHelpLevel = sessHelpLevel;
    // using sessHelpLevel makes sense ony for load status (starting help level assignment) of current page,
    // where sessHelpLevel == session(_helpLevel)
    // all other versions has to bee excluded
    // e.g. switching at helLev.js from last help level option to first one,
    // changes  currentHelpLevel from 'n' to '0', but not sessHelpLevel at the same time,
    // where sessHelpLevel != session(_helpLevel) !!!!!
    if((!currentHelpLevel && currentHelpLevel !=0) && sessHelpLevel)
    currentHelpLevel = sessHelpLevel;
	



    // restriction is assigned at addiText-call, e.g. at secmenu-function where restriction==menu
    // otherwize, if it was not assigned, Restriction=='none'
    if(helpLevName[currentHelpLevel] == restriction ||
       helpLevName[currentHelpLevel] == "all")
    goes = true;



    if(restriction == "none" ||  goes == true)  {


    // '&& strlen' is not yet clear, but it is neccessary to avoid a secondary call
    // during mouseout ...?!
    // => mouse-in, only
    if (tvar==0 && strlen) {

	padding=10;

	if  (strlen < 30) {
	    relFactor = 0.6;
	}
	else {

	    if	(strlen < 50) {
	    	relFactor = 0.5;
	    }
	    else {
	    	    if	(strlen < 100) {
		    	relFactor = 0.3;
		    }
		    else {
		    	    if	(strlen < 200) {
			    	relFactor = 0.3;
			    }
			    else {
			    	relFactor = 0.1;
			    }
		    }
	    }
	}

	if(ie && !opera) innerWindowWidth = document.body.offsetWidth;
	else innerWindowWidth = window.innerWidth;
	columnDistance= innerWindowWidth/90;
	leftColumnWidth = (innerWindowWidth - tableWidth)/2;
	leftSpace = relFactor*leftColumnWidth;
	elementWidth=leftColumnWidth-leftSpace-2*padding-columnDistance-5;


	if(ie && !opera)
	divStyleTxtIE = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid #FF3300; background-color:rgb(255,255,221); padding:"+padding+"px; white-space:normal; text-align:left;";
	
	else if (opera ) {
	divStyleTxt = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid #FF3300; background-color:rgb(255,255,221); padding:"+padding+"px; white-space:normal; text-align:left;";
	}

	else
	divStyleTxt = "position:absolute; left:"+leftSpace+"px; width:"+elementWidth+"px; border:1px solid #FF3300; background-color:rgb(255,255,221); padding-left:"+padding+"px; padding-right:"+padding+"px; white-space:normal; text-align:left;";

	spanStyleTxt = "font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8pt;";

	// get access to parent span-element
	Target1 = document.getElementById("glossTarg_"+k);

	// create new div element dynamically
	if(ie && !opera) {


	    document.all["glossTarg_"+k].insertAdjacentHTML('BeforeEnd', '<div style="'+divStyleTxtIE+'" id="divTarg_'+k+'"></div>');

	    Div1 = document.getElementById("divTarg_"+k);

	}

	else {

	    Div1 = document.createElement("div");

		Style1 = document.createAttribute("style");
		Style1.nodeValue = divStyleTxt;

	    Div1.setAttributeNode(Style1);
	}


	// create an js-array from splitting glossary text by |
	arrTextToDisplay = textToDisplay.split("|");

	// create new span elements for each value from js-array (child nodes to Div1)
	for(var i=0;i<arrTextToDisplay.length;i++) { // 003-11

	    if(ie && !opera) { // 004-11


		document.all["divTarg_"+k].insertAdjacentHTML('BeforeEnd', '<p style="'+spanStyleTxt+'" id="spanTarg_'+k+'_'+i+'">'+arrTextToDisplay[i]+'</p>');

		//Span = document.getElementById("spanTarg_"+k+"_"+i);
	      //Div1.appendChild(Span);

	    } // 004-12
	    else { // 004-21

		Span = document.createElement("p");
		    //
		    SpanStyle = document.createAttribute("style");
		    SpanStyle.nodeValue = spanStyleTxt;

		    Span.setAttributeNode(SpanStyle);

		    Texti = document.createTextNode(arrTextToDisplay[i]);

		Span.appendChild(Texti);
	       Div1.appendChild(Span);

	    } // 004-22


	    Target1.appendChild(Div1);
	    tvar=1;

	} // 003-12

    }
    else if (tvar==1)
    {
	
		if(opera) {
		
		Target1.childNodes[1].style.visibility = "hidden";
		Target1.removeChild(Div1);				
		}
		else
		Target1.removeChild(Div1);
		tvar=0;
    }
 }} // end of function showHlpTxt
