/* wizard.js 

	Version		Date						Developer								Notes
	1.0	 			23. Dec 2002		Nicolai Lyng Als (NL)		Initial version supported by IE 5.5 and 6.0 (Not tested on Mac IE).
	1.1				3.  Jan 2003		Nicolai Lyng Als (NL)		Added keyboard control of stepsmenu using arrows up and down or/and tab key.
	1.2				5.	Feb	2003		Nicolai Lyng Als (NL)		Added multible steps in one HTML page by using toggleWizard function.
	1.21			11. Mar 2003		Nicolai Lyng Als (NL)		Added support for homepage frameset.
	1.22			2. 	Apr	2003		Nicolai Lyng Als (NL)		Additional support and bugfixes of homepage imagefile structure.
	1.3				3. 	Apr	2003		Nicolai Lyng Als (NL)		Added language support.
	1.31			21. Maj	2003		Claus Witt (CWI)				Changes to reflex moving dnbnetstyr to top
	1.32			25.	Jun	2003		Nicolai Lyng Als (NL)		Moving js to topframe and implementing proxy in top.logo.
	1.40			1.	Jul	2003		Nicolai Lyng Als (NL)		Added support for removing the helparea on intranet applications.
	1.41			17. Okt 2003		Nicolai Lyng Als (NL)		Added disable '?' functionality, Tooltip on numbers and up to 15 steps on intranet. 
	1.50			1. 	Sep 2004		Nicolai Lyng Als (NL)		Support for altenate browsers Mozilla, Netscape, Safari, Opera + userbility.
		  
	wizard.js is a frontend javascript/dhtml component, which generates a wizard dialogframework, for the developers in Danske Bank.
	This dialogframework is optimized for use in applikation, which need controlled steps and a posibility for getting imiate help.
	For each step, it is possible to specify whereto the user can navigate, thus controlling the workflow.

	Navigation is done via javascript or specifying Objects and Actions in Netstyr.


	The component uses following frameset-functions and variables:

	Function/variable		Description
	getBrand(); 				function in top.logo (intranet-portal), which returns brand string ex. BG or DB.
	brand								function in top (internetframeset), which contains brand string ex. BG or DB.
	framesetpath				variable in top (internetframeset), which contains full current framesetpath.
	gsBrand							function in top (homepageframeset), which contains brand string ex. BG or DB.
	domain_domino				variable in top (homepageframeset), which contains server path.
	jsframe							variable in dnbnetstyr.js/usfkb1.js which contains path to dnbnetstyr frame.
	ImgPath							variable in dnbnetstyr.js/usfkb1.js which contains path to image lib.

*/

// Global variables
var glWizardTargetFrame;
var glWizardMainArray;
var glWizardSize;
var glWizardSubLevel;
var glWizardEndPage;
var glWizardStepsMenuItemArray=new Array();
var glWizardStepsMenuAvailableItemsArray=new Array();
var glWizardBrandPath;
var glWizardLastCreated;
var glWizardHelpArea;

 
// Wizard object top
function wizardObjBegin(wizardId,wizardSize,wizardHeadline,wizardHelpString,wizardMainArray,wizardSubLevel,wizardEndPage,wizardTarget,wizardHelpArea){

	// getting brand from frameset, to use in inserting correct image paths.
	if ("" + top.brand == "undefined" && "" + top.gsBrand == "undefined"){
		// intranet portal
		wizardBrand = top.logo.getBrand();
	}
	else if ("" + top.brand == "undefined") {
		// homepage frameset
		wizardBrand = top.gsBrand;
	}
	else {
		// netbank frameset
		wizardBrand = top.brand;
	}
	glWizardBrandPath = wizardBrand.toUpperCase();

	// preparing wizard for working in different frames/iframes.
	if ("" + wizardTarget == "undefined" || "" + wizardTarget == ""){
		wizardTarget = "" + targetFrame;
	}
	else {
		wizardTarget = wizardTarget + ".";
	}
	setWizardTargetFrame(wizardTarget);

	// setting incoming wizardMainArray in global variable for use in wizardObjEnd()
	setWizardMainArray(wizardMainArray);

	// setting incoming wizardSize in global variable for use in wizardObjEnd()
	setWizardSize(wizardSize);


	// setting incoming wizardSubLevel in global variable for use in wizardSubLevel()
	if ("" + wizardSubLevel == "undefined" || "" + wizardSubLevel == ""){
		setWizardSubLevel(false);
	}
	else if (wizardSubLevel == true || wizardSubLevel == false){
		setWizardSubLevel(wizardSubLevel);
	}
	else {
		alert("Invalid parameter - wizardSubLevel");
	}


	// setting incoming wizardEndPage in global variable for use in wizardEndPage()
	if ("" + wizardEndPage == "undefined" || "" + wizardEndPage == ""){
		setWizardEndPage(false);
	}
	else if (wizardEndPage == true || wizardEndPage == false){
		setWizardEndPage(wizardEndPage);
	}
	else {
		alert("Invalid parameter - wizardEndPage");
	}


	// setting incoming wizardHelpArea in global variable for use in wizardHelpArea()
	if ("" + wizardHelpArea == "undefined" || "" + wizardHelpArea == ""){
		setWizardHelpArea(true);
	}	
	else if (wizardHelpArea == true || wizardHelpArea == false){
		setWizardHelpArea(wizardHelpArea);
	}
	else {
		alert("Invalid parameter - wizardHelpArea");
	}		

	// checking for invalid wizardHelpArea parameter
	if (getWizardHelpArea()==false && getWizardEndPage()== true){
		alert("Invalid parameter - wizardHelpArea - Help Area must be added on confirmation page");
	}

	// setting document attribute to simulate IE document.activeElement in other browsers
	eval("" + getWizardTargetFrame() + "document.body.setAttribute('activeElement','undefined')");
		
	// preparing and setting first wizard active/displayed if multible steps on one page,
	// attaching event to document . Done only once a page.
	glWizardLastCreated = wizardId;
	eval("wizardAttr = " + getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
	if("" + wizardAttr == "undefined" || "" + wizardAttr == "null" || "" + wizardAttr == "" ){
		// setting global variable glWizardActive to active wizard step.
		eval("" + getWizardTargetFrame() + "document.body.setAttribute('glWizardActive','" + wizardId + "')");
		try{
			// IE - attaching event to document to close stepsmenu on click and scroll.
			eval(getWizardTargetFrame() + "document.attachEvent('onmouseup'," + jsframe + "closeWizardStepsMenu);");
			eval(getWizardTargetFrame() + "window.attachEvent('onscroll'," + jsframe + "closeWizardStepsMenu);");
			// IE - attaching event to document to tap stepsmenu on arrowkeys.
			eval(getWizardTargetFrame() + "document.attachEvent('onkeyup'," + jsframe + "keybControllWizardStepsMenu);");
		}
		catch (e){
			// attaching event to document to close stepsmenu on click and scroll.
			eval(getWizardTargetFrame() + "document.addEventListener('click', " + jsframe + "closeWizardStepsMenu, true);");
			eval(getWizardTargetFrame() + "window.addEventListener('scroll'," + jsframe + "closeWizardStepsMenu, false);");
			// attaching event to document to tap stepsmenu on arrowkeys.
			eval(getWizardTargetFrame() + "document.addEventListener('keyup'," + jsframe + "keybControllWizardStepsMenu, false);");
		}
		// setting attribute to prevent further event attachment and display on next wizardsteps.
		wizardAttr = wizardId;
	}
	else {
	}



	// creating wizardHelpArray for use in CreateRubrikObj
	if ("" + wizardHelpString == "undefined" || "" + wizardHelpString == ""){
		wizardHelpArray = "";
	}
	else {
		wizardHelpArray = new Array("Hjælp","H",wizardHelpString,"");
	}

	// creating toggle span start

	str = "<td align='left'>";
	if (wizardAttr == wizardId){
		if (getWizardHelpArea()){
			str += "<span id='WizardOuterSpan" + wizardId + "' style='display:block' helpArea='true'>";
		}
		else {
			str += "<span id='WizardOuterSpan" + wizardId + "' style='display:block' helpArea='false'>";
		}
	}
	else {
		if (getWizardHelpArea()){
			str += "<span id='WizardOuterSpan" + wizardId + "' style='display:none' helpArea='true'>";
		}
		else {
			str += "<span id='WizardOuterSpan" + wizardId + "' style='display:none' helpArea='false'>";
		}
	}
	
	if (wizardSize==3){
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='800px'><tr>";
	}
	else {
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='596px'><tr>";
	}


	// creating paragraph/rubrik.
	if (wizardSize==3){
		eval("" + wizardId + " = new " + jsframe + "CreateRubrikObj('" + wizardId + "',4,wizardHeadline,wizardHelpArray,true,'N','',1,'',false);");
		str += eval("" + wizardId + ".RubrikBegin()");
	}
	else {
		eval("" + wizardId + " = new " + jsframe + "CreateRubrikObj('" + wizardId + "',3,wizardHeadline,wizardHelpArray,true,'N','',1,'',false);");
		str += eval("" + wizardId + ".RubrikBegin()");
	}

	// creating wizardcontent framework
	if (wizardSize==3){
		str += "<table cellpadding='0px' cellspacing='0px' border='0px' width='798px'>";
		str += "<tr style='height:0px'>";
		str += "<td width='187px'></td>";
		str += "<td width='16px'></td>";
		str += "<td width='188px'></td>";
		str += "<td width='16px'></td>";
		str += "<td width='188px'></td>";
		str += "<td width='16px'></td>";
		str += "<td width='1px'></td>";
		str += "<td width='186px'></td>";
		str += "</tr>";
		str += "<tr>";
		if (wizardEndPage){
				str += "<td colspan='6' valign='top' id='wizardInnerCell" + wizardId +"' class='gsWizardBottom' style='height:393px;'>";
		}
		else {
			if (getWizardHelpArea()){
				str += "<td colspan='6' valign='top' id='wizardInnerCell" + wizardId +"' style='height:393px;'>";
			}
			else {	
				str += "<td colspan='8' valign='top' id='wizardInnerCell" + wizardId +"' style='height:393px;'>";
			}
		}
	}
	else{
		str += "<table cellpadding='0px' cellspacing='0px' border='0px' width='594px'>";
		str += "<tr style='height:0px'>";
		str += "<td width='187px'></td>";
		str += "<td width='16px'></td>";
		str += "<td width='188px'></td>";
		str += "<td width='16px'></td>";
		str += "<td width='1px'></td>";
		str += "<td width='186px'></td>";
		str += "</tr>";
		str += "<tr>";
		if (wizardEndPage){
			if (wizardSize==2){
				str += "<td colspan='4' valign='top' id='wizardInnerCell" + wizardId +"' class='gsWizardBottom' style='height:393px;'>";
			}
			else {
				str += "<td colspan='4' valign='top' id='wizardInnerCell" + wizardId +"' class='gsWizardBottom' style='height:225px;'>";
			}
		}
		else {
			if (getWizardHelpArea()){			
				if (wizardSize==2){
					str += "<td colspan='4' valign='top' id='wizardInnerCell" + wizardId +"' style='height:393px;'>";
				}
				else {
					str += "<td colspan='4' valign='top' id='wizardInnerCell" + wizardId +"' style='height:225px;'>";
				}
			}
			else {
				if (wizardSize==2){
					str += "<td colspan='6' valign='top' id='wizardInnerCell" + wizardId +"' style='height:393px;'>";
				}
				else {
					str += "<td colspan='6' valign='top' id='wizardInnerCell" + wizardId +"' style='height:225px;'>";
				}
			}
		}
	}

	// creating stepsmenu
	createWizardStepsMenu(wizardMainArray,wizardId);

	// returns sting to document.write()
	return str;
}



// Wizard object bottom
function wizardObjEnd(obj){

	// declaration and variable setting
	var wizardIsCurrentLast;
	var wizardId = 	glWizardLastCreated;

	// getting array from global variable set by wizardObjBegin()'s incoming wizardMainArray.
	var wizardMainArray = getWizardMainArray();

	// getting size(int) from global variable set by wizardObjBegin()'s incoming wizardSize.
	var wizardSize = getWizardSize();

	// getting sublevel(boolean) from global variable set by wizardObjBegin()'s incoming wizardSubLevel.
	var wizardSubLevel = getWizardSubLevel();

	// getting endpage(boolean) from global variable set by wizardObjBegin()'s incoming wizardEndPage.
	var wizardEndPage = getWizardEndPage();
	
	// creating wizard bottom.
	if (getWizardHelpArea()){
		str = "</td><td></td></tr><tr style='height:8px'><td></td></tr></table></td></tr>";
	}
	else {
		str = "</td></tr>";		
	}
	str += "<tr style='height:1px;' class='gsWizardBottom'>";
	if (wizardSize == 3){
		if (wizardEndPage){
			str += "<td colspan='6'></td><td colspan='2' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif)'></td>";
		}
		else{
			str += "<td colspan='8' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif)'></td>";
		}
		str += "</tr>";
		str += "<tr class='gsWizardBottom'>";
		str += "<td colspan='6' align='left' style='height:22px;'>";
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='611px'>";
		str += "<tr>";
		str += "<td align='left'>";
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='150px'>";
		str += "<tr>";
		str += "<td style='width:3px;'></td>";
		if (wizardSubLevel){
			str += "<td class='gsWizardLinkSubLevel'><img src='" + getWizardImgPath() + "arrow_grey_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'>" + getWizardActionText('BACK') + "</td>";
		}
		else {
			if (wizardMainArray[1]=="A" || wizardMainArray[1]=="a"){
				str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[3] + "\",\"" + wizardMainArray[2] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;'>" + getWizardActionText('BACK') + "</a></td>";
			}
			else {
				if (wizardMainArray[1]=="F" || wizardMainArray[1]=="f"){
					str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'><a href='#' onClick='" + wizardMainArray[2] + "(\"" + wizardMainArray[3] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;'>" + getWizardActionText('BACK') + "</a></td>";
				}
				else {
					str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'>" + getWizardActionText('BACK') + "</td>";
				}
			}
		}
	}

	else{
		if (wizardEndPage){
			str += "<td colspan='4' align='left'></td><td colspan='2'  align='left' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif)'>";	
		}
		else{
			str += "<td colspan='6' align='left' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif)'></td>";
		}
		str += "</tr>";
		str += "<tr class='gsWizardBottom'>";
		str += "<td colspan='4' align='left' style='height:22px;'>";
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='407px'>";
		str += "<tr>";
		str += "<td align='left'>";
		str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='150px'>";
		str += "<tr>";
		str += "<td style='width:3px;'></td>";
		if (wizardSubLevel){
			str += "<td class='gsWizardLinkSubLevel'><img src='" + getWizardImgPath() + "arrow_grey_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'>" + getWizardActionText('BACK') + "</td>";
		}
		else {
			if (wizardMainArray[1]=="A" || wizardMainArray[1]=="a"){
				str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[3] + "\",\"" + wizardMainArray[2] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;'>" + getWizardActionText('BACK') + "</a></td>";
			}
			else {
				if (wizardMainArray[1]=="F" || wizardMainArray[1]=="f"){
					str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'><a href='#' onClick='" + wizardMainArray[2] + "(\"" + wizardMainArray[3] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;'>" + getWizardActionText('BACK') + "</a></td>";
				}
				else {
					str += "<td class='gsWizardLink'><img src='" + getWizardImgPath() + "arrow_left.gif' border='0px' alt='back arrow' style='height:11px;width:11px;'>" + getWizardActionText('BACK') + "</td>";
				}
			}
		}
	}

	str += "</tr>";
	str += "</table>";
	str += "</td>";
	str += "<td align='right'>";
	str += "<table cellspacing='0px' cellpadding='0px' border='0px'>";
	str += "<tr>";
	str += "<td align='right'>";
	
	// inserting numbers
	if (wizardEndPage){
	}
	else{
		for (var i=12, j=1; i<wizardMainArray.length; i=i+4 , j++){

	 		// limiting to only 10 or 15 pages 
			if (wizardSize==3){
				if (j==16){
				break
				}
			}
			else {
				if (j==11){
				break;
				}
			}

			// inserting spacer for pagenumber 10 for correct alignment
			if (j>=10){
				str +="<span style='width:4px'></span>";
			}

			// inserting linkable numbers with javascript funktion
			if (wizardMainArray[i+1] == "F" || wizardMainArray[i+1] == "f"){
				if (wizardSubLevel){
					// old str += "<span class='gsWizardLinkNrPreviousSubLevel' style='width:15px;text-align:center;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
					str += "<span class='gsWizardLinkNrPreviousSubLevel' style='text-align:center;padding:4px;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
				}
				else {
					// old 	str += "<span class='gsWizardLinkNrPrevious' style='width:15px;text-align:center;'><a href='#' onClick='" + wizardMainArray[i+2] + "(\"" + wizardMainArray[i+3] + "\")' class='gsWizardLinkNr' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;' title='" + wizardMainArray[i] + "'>" + j + "</a></span>";
					str += "<span class='gsWizardLinkNrPrevious' style='text-align:center;padding:4px;'><a href='#' onClick='" + wizardMainArray[i+2] + "(\"" + wizardMainArray[i+3] + "\")' class='gsWizardLinkNr' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;' title='" + wizardMainArray[i] + "'>" + j + "</a></span>";
				}
			}

			// inserting linkable numbers with Netstyr variables
			else if (wizardMainArray[i+1] == "A" || wizardMainArray[i+1] == "a"){
				if (wizardSubLevel){
					// old str += "<span class='gsWizardLinkNrPreviousSubLevel' style='width:15px;text-align:center;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
					str += "<span class='gsWizardLinkNrPreviousSubLevel' style='text-align:center;padding:4px;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
				}
				else {
					// old str += "<span class='gsWizardLinkNrPrevious' style='width:15px;text-align:center;'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[i+3] + "\",\"" + wizardMainArray[i+2] + "\")' class='gsWizardLinkNr' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;' title='" + wizardMainArray[i] + "'>" + j + "</a></span>";
					str += "<span class='gsWizardLinkNrPrevious' style='text-align:center;padding:4px;'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[i+3] + "\",\"" + wizardMainArray[i+2] + "\")' class='gsWizardLinkNr' onMouseOver='window.status=\"\"; return true;' onFocus='window.status=\"\"; return true;' title='" + wizardMainArray[i] + "'>" + j + "</a></span>";

				}
			}

			// inseting current pagenumber
			else if (wizardMainArray[i+1] == "C" || wizardMainArray[i+1] == "c"){
				str += "<span class='gsWizardLinkNrCurrent' style='text-align:center;padding-left:3px;padding-right:3px;' title='" + wizardMainArray[i] + "'>" + j + "</span>";

				// settting flag if this is last number
				if (i+1 == wizardMainArray.length-3){
					wizardIsCurrentLast = true;
				}
				else {
					wizardIsCurrentLast = false;
				}
			}

			// inserting nonlinkable numbers
			else{
				if (wizardSubLevel){
					// old str += "<span class='gsWizardLinkNrSubLevel' title='" + wizardMainArray[i] + "'>" + j + "</span>";
					str += "<span class='gsWizardLinkNrSubLevel' style='text-align:center;padding:4px;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
				}
				else {
					// old str += "<span class='gsWizardLinkNrNonActive' title='" + wizardMainArray[i] + "'>" + j + "</span>";
					str += "<span class='gsWizardLinkNrNonActive' style='text-align:center;padding:4px;' title='" + wizardMainArray[i] + "'>" + j + "</span>";
				}
			}
		}
	}

	// inserting spacer for pagenumber 10 for correct alignment
	if (wizardMainArray.length>=40){
		str += "</td><td width='30px' align='rigth'></td>";
	}
	// inserting spacer for pagenumbers 1-9 for correct alignment
	else {
		str += "</td><td width='29px' align='right'></td>";
	}


	// inserting nextpage link in bottom right hand corner.
	if (wizardEndPage){
		if (wizardMainArray[5]=="A" || wizardMainArray[5]=="a"){
			str += "<td align='right'><input type='button' style='margin-bottom:2px;margin-right:3px;' value='" + wizardMainArray[4] + "' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' onMouseover='window.status=\"\"; return true;' onclick='top.logo.move(\"" + wizardMainArray[7] + "\",\"" +  wizardMainArray[6] +"\")' class='gsWizardLink' id='WizardNextLink" + wizardId + "'></td>";
		}
		else if (wizardMainArray[5]=="F" || wizardMainArray[5]=="f"){
			str += "<td align='right'><input type='button' style='margin-bottom:2px;margin-right:3px;' value='" + wizardMainArray[4] + "' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' onMouseover='window.status=\"\"; return true;' onclick='" + wizardMainArray[6] + "(\"" + wizardMainArray[7] +"\")' class='gsWizardLink' id='WizardNextLink" + wizardId + "'></td>";
		}
		else if (wizardMainArray[5]=="N" || wizardMainArray[5]=="n"){
			str += "<td align='right'></td>";
		}
	}
	else {
		if (wizardSubLevel){
			str += "<td align='right' class='gsWizardLinkSubLevel'>";
			if (wizardIsCurrentLast){
				str += "" + getWizardActionText('END');
			}
			else {
				str += "" + getWizardActionText('NEXT');
			}
			str += "<img src='" + getWizardImgPath() + "arrow_grey_right.gif' border='0px' alt='forward arrow' style='height:11px;width:11px;'></td>";
		}
		else {
			if (wizardMainArray[5]=="A" || wizardMainArray[5]=="a"){
				str += "<td align='right'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[7] + "\",\"" +  wizardMainArray[6] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' id='WizardNextLink" + wizardId + "'>";
			}
			else if (wizardMainArray[5]=="F" || wizardMainArray[5]=="f"){
				str += "<td align='right'><a href='#' onClick='" + wizardMainArray[6] + "(\"" + wizardMainArray[7] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' id='WizardNextLink" + wizardId + "'>";
			}
			if (wizardIsCurrentLast){
				str += "&nbsp;" + getWizardActionText('END');
			}
			else {
				str += "" + getWizardActionText('NEXT');
			}
			str += "</a><img src='" + getWizardImgPath() + "arrow_right.gif' border='0px' alt='forward arrow' style='height:11px;width:11px;'></td>";
		}
	}
	str += "<td style='width:2px;'></td>";
	str += "</tr>";
	str += "</table>";
	str += "</td>";
	str += "</tr>";
	str += "</table>";
	str += "</td>";
	str += "<td width='1px' style='background-image:url(" + getWizardImgPath() + "wizardlinevertical.gif)'><img src=" + getBlankImgPath() + "space.gif' style='width:1px;height:1px;vertical-align:top;' alt='space gif'></td>";
	str += "<td width='186px'>";
	str += "<table cellspacing='0px' cellpadding='0px' border='0px' width='186px'>";
	str += "<tr>";
	str += "<td style='width:6px;'></td>";


	// inserting stepsmenu link in bottom right hand corner.
	if (wizardSubLevel){
		str += "<td class='gsWizardLinkSubLevel'>" + getWizardActionText('STEP') + "<img src='" + getWizardImgPath() + "arrow_grey_up.gif' border='0px' alt='up arrow' style='height:11px;width:11px;margin-left:4px;' id='WizardStepsMenuArrowImg" + wizardId + "' ></td>";
	}
	else {
		str += "<td><a href='#' onClick='" + jsframe + "openWizardStepsMenu();return false;' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='document.body.setAttribute(\"activeElement\",\"\" +this.id);window.status=\"\"; return true;' id='WizardStepsMenuArrowLink" + wizardId + "'>" + getWizardActionText('STEP') + "</a><img src='" + getWizardImgPath() + "arrow_up.gif' class='wizardTestImg' border='0px' alt='up arrow' style='height:11px;width:11px;margin-left:4px;' id='WizardStepsMenuArrowImg" + wizardId + "'></td>";
	}
	str += "<td style='width:6px'></td>";


	// inserting exit link in bottom right hand corner.
	if (wizardMainArray[9]=="A" || wizardMainArray[9]=="a"){
		str += "<td align='right'><a href='#' onClick='top.logo.move(\"" + wizardMainArray[11] + "\",\"" +  wizardMainArray[10] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' id='WizardExitLink" + wizardId + "'>" + getWizardActionText('CANC') + "</a></td>"
	}
	else if (wizardMainArray[9]=="F" || wizardMainArray[9]=="f"){
		str += "<td align='right'><a href='#' onClick='" + wizardMainArray[10] + "(\"" + wizardMainArray[11] +"\")' class='gsWizardLink' onMouseOver='window.status=\"\"; return true;' onFocus='" + jsframe + "closeWizardStepsMenu();window.status=\"\"; return true;' id='WizardExitLink" + wizardId + "'>" + getWizardActionText('CANC') + "</a></td>"
	}
	else {
		str += "<td align='right'>" + getWizardActionText('CANC') + "</td>";
	}

	// ending wizard bottom
	str += "<td style='width:5px;'></td>";
	str += "</tr>";
	str += "</table>";
	str += "</td>";
	str += "</tr>";
	str += "</table>";

	// adding paragraph/rubrik bottom.
	str += eval("" + obj + ".RubrikEnd();");

	// adding toggle span end
	str += "</tr>";
	str += "</table>";
	str += "</span>";
	str += "</td>";

	// returns string to document.write().
	return str;
}



// Wizard object dotted vertical separator
function wizardObjMiddle(){

	// declaration of varables
	var wizardId = 	glWizardLastCreated;

	// creating wizard dotted separator in html
	str =  "</td>";
	str += "<td id='wizardObjMiddleId" + wizardId + "' style='width:1px;padding-left:1px;background-image:url(" + getWizardImgPath() + "wizardlinevertical.gif)'></td>";
	str += "<td style='width:186px;' valign='top'>";
	str += "<table cellspacing='0px' cellpadding='0px' border='0px'>";
	str += "<tr>";
	str += "<td style='height:8px;width:6px;'></td><td></td><td style='width:6px;'>";
	str += "<tr><td></td><td>";

	// returns sting to document.write().
	return str;
}



// Wizard object dotted horizontal separator of helparea
function wizardObjHelpMiddle(){

	// creating wizard dotted separator in html
	str  = "</td><td></td></tr><tr><td style='height:8px'></td></tr></table>";
	str += "<table cellpadding='0px' cellspacing='0px' border='0px' style='width:186px;'>";
	str += "<tr style='height:1px;'><td style='height:1px;width:1px;'></td><td style='background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif)' style='width:185px;'></td></tr>";
	str += "</table>";
	str += "<table cellspacing='0px' cellpadding='0px' border='0px'>";
	str += "<tr>";
	str += "<td style='height:8px;width:6px;'></td><td></td><td style='width:6px;'>";
	str += "<tr>";
	str += "<td></td>";
	str += "<td>";

	// returns sting to document.write().
	return str;
}




// Creating wizard objects stepsmenu
function createWizardStepsMenu(wizardMainArray,wizardId){

	// declaration of variables.
	var stepsMenuHeight=0;
	var wizardStepMenuNoHelpLineSpan = (wizardMainArray.length-12)/4 + 2;
	eval("var wizardStepsMenuItemArray= new Array()");
		
	// getting size(int) from global variable set by wizardObjBegin()'s incoming wizardSize.
	var wizardSize = getWizardSize();

	// generating stepsmenu top html.
	var returnStr = "";

	if (getWizardHelpArea()==false){  
		returnStr =  "<table cellspacing='0px' cellpadding='0px' style='width:187px' class='gsWizardStepsMenu' id='WizardStepsMenuId" + wizardId + "'>";
		returnStr += "<tr><td rowspan='" + wizardStepMenuNoHelpLineSpan + "' style='width:1px;padding-left:1px;background-image:url(" + getWizardImgPath() + "wizardlinevertical.gif)'></td><td tabindex='31999' id='WizardStepsMenuHiddenTabCellFirst" + wizardId + "' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif);'></td></tr>";
	}
	else {
		returnStr =  "<table cellspacing='0px' cellpadding='0px' style='width:186px' class='gsWizardStepsMenu' id='WizardStepsMenuId" + wizardId + "'>";
		returnStr += "<tr><td tabindex='31999' id='WizardStepsMenuHiddenTabCellFirst" + wizardId + "' style='height:1px;background-image:url(" + getWizardImgPath() + "wizardlinehorizontal.gif);'></td></tr>";
	}	
	returnStr += "<tr><td style='height:1px;'></td></tr>";
	
	// generating stepsmenu item html.
	
	for (var i=12, j=1, k=0; i<wizardMainArray.length; i=i+4 , j++){
		if (j== 16 && wizardSize==3){
			break;
		}
		else if (j==11 && wizardSize!=3){
			break;
		}
		var tabindex = parseInt(parseInt("32000") + (j-1));
		if (wizardMainArray[i+1] == "F" || wizardMainArray[i+1] == "f"){
			returnStr += "<tr class='gsWizardStepsRow'><td id='WizardStepsMenuItem" + wizardId + j + "' tabindex='" + tabindex + "' class='gsWizardStepsMenuItem' onMouseOver='this.className=\"gsWizardStepsMenuItemHover\"; window.status=\"\"; return true;' onMouseOut='this.className=\"gsWizardStepsMenuItem\"' onClick='" + wizardMainArray[i+2] + "(\"" + wizardMainArray[i+3] + "\")' onFocus='" + jsframe + "setWizardStepsMenuFocus(this)' onBlur='" + jsframe + "clearingWizardStepsMenuFocus(this)'><div class='gsWizardStepsMenuItemInner'>" + (j) + ". " + wizardMainArray[i] +"</div></td></tr>";
			eval("wizardStepsMenuItemArray[" + k + "]= 'WizardStepsMenuItem" + wizardId + j + "'"); 
			k++;
		}
		else if (wizardMainArray[i+1] == "A" || wizardMainArray[i+1] == "a"){
			returnStr += "<tr class='gsWizardStepsRow'><td id='WizardStepsMenuItem" + wizardId + j + "' tabindex='" + tabindex + "' class='gsWizardStepsMenuItem' onMouseOver='this.className=\"gsWizardStepsMenuItemHover\"; window.status=\"\"; return true;' onMouseOut='this.className=\"gsWizardStepsMenuItem\"' onClick='top.logo.move(\"" + wizardMainArray[i+3] + "\",\"" +  wizardMainArray[i+2] + "\")' onFocus='" + jsframe + "setWizardStepsMenuFocus(this)' onBlur='" + jsframe + "clearingWizardStepsMenuFocus(this)'><div class='gsWizardStepsMenuItemInner'>" + (j) + ". "  + wizardMainArray[i] +"</div></td></tr>";
			eval("wizardStepsMenuItemArray[" + k + "]= 'WizardStepsMenuItem" + wizardId + j + "'"); 
			k++;
		}
		else{
			returnStr += "<tr class='gsWizardStepsRow'><td class='gsWizardStepsMenuItemNonSelect' onMouseOver='this.className=\"gsWizardStepsMenuItemNonSelectHover\"' onMouseOut='this.className=\"gsWizardStepsMenuItemNonSelect\"'><div class='gsWizardStepsMenuItemInner'>" + (j) + ". " + wizardMainArray[i] +"</div></td></tr>";
		}		
		stepsMenuHeight = stepsMenuHeight + 1;
	}

	// setting global array for use in keybControllWizardStepsMenu()
	glWizardStepsMenuAvailableItemsArray[wizardId] = wizardStepsMenuItemArray;

	// generating stepsmenu bottom html
	returnStr += "<tr><td tabindex='32017' id='WizardStepsMenuHiddenTabCellLast" + wizardId + "'></td></tr>";
	returnStr += "</table>";

	// inserting stepsmenu into document.body

	try {
		eval(getWizardTargetFrame() + "document.body.insertAdjacentHTML('afterBegin',returnStr);");
	}
	catch(e){
		var nytElement = eval(getWizardTargetFrame() + "document.createElement('span')");
		nytElement.setAttribute('id','WizardStepsMenuBodySpanId' + wizardId); 
		eval(getWizardTargetFrame() + "document.body.insertBefore(nytElement," + getWizardTargetFrame() + "document.body.firstChild)");
		eval(getWizardTargetFrame() + "document.getElementById('" + nytElement.id + "').innerHTML = returnStr");
	}

	// setting height attribute, bypassing default height (0), for use in openWizardStepsMenu()
		eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').height= 2 + (stepsMenuHeight*18);");

	// removing display of the element
		eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').style.display = 'none';");
}



// Opening wizard objects stepsmenu
function openWizardStepsMenu(){

	// declaration of variables.
	var wizardId = eval(getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
	var wizardHelpArea = eval(getWizardTargetFrame() + "document.getElementById('WizardOuterSpan" + wizardId + "').getAttribute('helpArea')");
	var stepsMenuOffsetObj = eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuArrowImg" + wizardId + "').offsetParent");
	var stepsMenuXpos=0;
	var stepsMenuYpos=0;

	// calculation of x & y position of stepsmenu.
	while (stepsMenuOffsetObj!=eval(getWizardTargetFrame() + "document.body")){
		stepsMenuOffsetObj = stepsMenuOffsetObj.offsetParent;
		stepsMenuXpos = stepsMenuXpos + stepsMenuOffsetObj.offsetLeft;
		stepsMenuYpos = stepsMenuYpos + stepsMenuOffsetObj.offsetTop;
	}
	if (wizardHelpArea=="false"){
		stepsMenuXpos = stepsMenuXpos -1
	}

	// positioning stepsmenu.
	eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').style.left = " + stepsMenuXpos);
	eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').style.top = " + stepsMenuYpos + " - " + getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').height - 4");

	// displaying stepsmenu.
	try {
		// CSS2 compliant ( Netscape , Opera , Mozilla o.a )
		eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').style.display = 'table';");
	}
	catch(e){
		// CSS1 compliant ( IE )
		eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "').style.display = 'block';");
	}
}


// Controlling wizard objects stepsmenu with arrowkeys
function keybControllWizardStepsMenu(e){

	// declarations of variables	
	if (!e) var e = window.event;
	var documentKeyCode = e.keyCode;

  if (document.activeElement){
	  var activeObj = eval(getWizardTargetFrame() + "document.activeElement");
	}
  else {
	  // getting simulated activeElement for non IE
	  var activeObj = eval(getWizardTargetFrame() + "document.getElementById(" + getWizardTargetFrame() + "document.body.getAttribute('activeElement'))");
  }
  
	if ("" + activeObj == "undefined" || "" + activeObj == "null"){
		activeObj = document.body;
	}
	
	var wizardId = eval(getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
	var wizardStepsMenuItemArray = glWizardStepsMenuAvailableItemsArray[wizardId];
		
	// checking for tabkey pressed
	if (documentKeyCode=="9"){
		if (activeObj.id=="WizardExitLink" + wizardId){
			closeWizardStepsMenu();
		}
		else if (activeObj.id=="WizardNextLink" + wizardId){
			closeWizardStepsMenu();
		}
	else if (activeObj.id=="WizardStepsMenuHiddenTabCellFirst" + wizardId){		
			nextObj = eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[0] + "')");
			nextObj.focus();
		}
		else if (activeObj.id=="WizardStepsMenuHiddenTabCellLast" + wizardId){
			nextObj = eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuArrowLink" + wizardId + "')");
			nextObj.focus();
			closeWizardStepsMenu();
		}
		else {
		}
	}

	// checking for enter pressed on stepsmenu item and firing click event.
	else if (documentKeyCode=="13"){
 		if(activeObj.id.slice(0,-1)=="WizardStepsMenuItem" + wizardId || activeObj.id.slice(0,-2)=="WizardStepsMenuItem" + wizardId){
			closeWizardStepsMenu();
			try {
				activeObj.click();
			}
			catch (e){
				eval(getWizardTargetFrame() + activeObj.getAttribute('onclick'));
			}
		}
	}


	// checking for arrowkey up pressed
	else if (documentKeyCode=="38"){
		if (documentKeyCode=="38" && activeObj.id=="WizardStepsMenuArrowLink" + wizardId){
			openWizardStepsMenu();
			var i=0;
			var j=0;
			obj = eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[(wizardStepsMenuItemArray.length-1)] + "')");
			setWizardStepsMenuFocus(obj)
			try {obj.focus();}catch(e){}
		}
		else if ((documentKeyCode=="38" && activeObj.id.slice(0,-1)=="WizardStepsMenuItem" + wizardId) || (documentKeyCode=="38" && activeObj.id.slice(0,-2)=="WizardStepsMenuItem" + wizardId)){
			var i=wizardStepsMenuItemArray.length;
			while (i>0){
				if (eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[i] + "')") == activeObj){
					nextObj = eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[i-1] + "')");
					try {nextObj.focus();}catch(e){}
					clearingWizardStepsMenuFocus(activeObj);					
					setWizardStepsMenuFocus(nextObj);
				}
				i--;
			}
		}
	}


	// checking for arrowkey down pressed
	else if (documentKeyCode=="40"){
		if (documentKeyCode=="40" && activeObj.id=="WizardStepsMenuArrowLink" + wizardId){
			closeWizardStepsMenu();
		}
		else if ((documentKeyCode=="40" && activeObj.id.slice(0,-1)=="WizardStepsMenuItem" + wizardId) || (documentKeyCode=="40" && activeObj.id.slice(0,-2)=="WizardStepsMenuItem" + wizardId)){
			var i=0;
			while (i<wizardStepsMenuItemArray.length){
				if (eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[i] + "')") == activeObj){
					if (i==wizardStepsMenuItemArray.length-1){
						nextObj = eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuArrowLink" + wizardId +"')");
						try {nextObj.focus();}catch(e){}
						clearingWizardStepsMenuFocus(activeObj);
						eval("" + getWizardTargetFrame() + "document.body.setAttribute('activeElement','" + nextObj.id + "')");
						closeWizardStepsMenu();
					}
					else {
						nextObj = eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[i+1] + "')");
						try {nextObj.focus();}catch(e){}
						clearingWizardStepsMenuFocus(activeObj);
						setWizardStepsMenuFocus(nextObj);					
					}
				}
				i++;
			}
		}
	}
}


// Intenal funktion for stylesheet controll in stepsmenu when keyboardcontroled.
function setWizardStepsMenuFocus(obj){
	eval("" + getWizardTargetFrame() + "document.body.setAttribute('activeElement','" + obj.id + "')");
	obj.className="gsWizardStepsMenuItemHover";
}

// Intenal funktion for stylesheet controll in stepsmenu when keyboardcontroled.
function clearingWizardStepsMenuFocus(obj){
	eval("" + getWizardTargetFrame() + "document.body.setAttribute('activeElement','undefined')");
	obj.className="gsWizardStepsMenuItem";
}



// Intenal funktion for hiding stepsmenu
function closeWizardStepsMenu(){
	var wizardId = eval(getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
	var wizardStepsMenuItemArray = glWizardStepsMenuAvailableItemsArray[wizardId];
  var i=0;
	while (i<wizardStepsMenuItemArray.length){
	  obj =eval(getWizardTargetFrame() + "document.getElementById('" + wizardStepsMenuItemArray[i] + "')")
    obj.className="gsWizardStepsMenuItem";
    i++;
  }	
	obj = eval(getWizardTargetFrame() + "document.getElementById('WizardStepsMenuId" + wizardId + "')");
	if (obj.style.display!='none'){
		obj.style.display='none';
	}
}


// Internal funktion for getting wizard image path
function getWizardImgPath(){
	if (top.ishomepage){
		return	getGeneralImgPath() + "usfke1_" + glExpandArrowBrandPath.toLowerCase() + "/$File/";
	}
	else if (top.indhold){
		return	getGeneralImgPath() + glWizardBrandPath + "/wizard/";
	}
	else if(top.appcontent){
		return getGeneralImgPath() + glWizardBrandPath + "/wizard/";
	}
}

// Internal function for setting targetframe.
function setWizardTargetFrame(target){
	glWizardTargetFrame = target;
}

// Internal function for getting targetframe.
function getWizardTargetFrame(){
	return glWizardTargetFrame;
}

// Internal function for setting global wizardMainArray variable.
function setWizardMainArray(wArray){
	glWizardMainArray = wArray;
}

// Internal function for getting global wizardMainArray variable.
function getWizardMainArray(){
	return glWizardMainArray;
}

// Internal function for setting global wizardSize variable.
function setWizardSize(wSize){
	glWizardSize = wSize;
}

// Internal function for getting global wizardSize variable.
function getWizardSize(){
	return glWizardSize;
}

// Internal function for setting global wizardSize variable.
function setWizardSubLevel(wSubLevel){
	glWizardSubLevel = wSubLevel;
}

// Internal function for getting global wizardSize variable.
function getWizardSubLevel(){
	return glWizardSubLevel;
}

// Internal function for setting global wizardEndPage variable.
function setWizardEndPage(wEndPage){
	glWizardEndPage = wEndPage;
}

// Internal function for getting global wizardEndPage variable.
function getWizardEndPage(){
	return glWizardEndPage;
}

// Internal function for setting global wizardHelpArea variable.
function setWizardHelpArea(wHelpArea){
	glWizardHelpArea = wHelpArea;
}

// Internal function for getting global wizardHelpArea variable.
function getWizardHelpArea(){
	return glWizardHelpArea;
}


// Internal function for getting language dependant text's.
function getWizardActionText(wInput){
	var wLanguage;
	if (top.ishomepage){
		wLanguage=top.gsSprog;
	}
	else if (top.indhold){
		wLanguage=top.indhold.document.getElementById('gsSprog').value;
	}
	else if(top.appcontent){
		wLanguage=top.logo.getLanguage();
	}
	switch (wLanguage){
		case "DA": {
			switch (wInput){
				case "BACK": return "Tilbage";
				case "NEXT": return "Næste";
				case "STEP": return "Vis trin";
				case "END":	 return "Afslut";
				case "CANC": return "Afbryd";
			}
		}
		case "SE": {
			switch (wInput){
				case "BACK": return "Föregående";
				case "NEXT": return "Nästa";
				case "STEP": return "Visa steg";
				case "END":  return "Avsluta";
				case "CANC": return "Avbryt";
			}
		}
		case "NO": {
			switch (wInput){
				case "BACK": return "Tilbake";
				case "NEXT": return "Neste";
				case "STEP": return "Vis trinn";
				case "END":  return "Avslutt";
				case "CANC": return "Avbryt";
			}
		}
		default: {
			switch (wInput){
				case "BACK": return "Previous";
				case "NEXT": return "Next";
				case "STEP": return "Show steps";
				case "END":  return "End";
				case "CANC": return "Cancel";
			}
		}
	}
}


// External funktion for changing steps where more than one step in one page is implemented.
function toggleWizard(wizardId){
	// main style.display settings
	var currentId = eval(getWizardTargetFrame() + "document.body.getAttribute('glWizardActive')");
	eval(getWizardTargetFrame() + "document.getElementById('WizardOuterSpan" + currentId + "').style.display='none'");
	eval(getWizardTargetFrame() + "document.getElementById('WizardOuterSpan" + wizardId + "').style.display='block'");

	// setting height on image in wizardObjMiddle, to prevent height/drawing-error in style.display with IE 5.5
	wHeight=eval(getWizardTargetFrame() + "document.getElementById('wizardInnerCell" + wizardId + "').style.height");
	eval(getWizardTargetFrame() + "document.getElementById('wizardInnerCell" + wizardId + "').style.height='" + wHeight + "'");

	// setting active wizardstep in global variable
	eval(getWizardTargetFrame() + "document.body.setAttribute('glWizardActive','" + wizardId + "')");
}




/*
	expandArrow

	Version		Date				Developer					Notes
	1.0	 		05. August	 2002	Nicolai Lyng Als (NL)		Initial version supported by IE 5.0 - 6.0 (Not tested on Mac IE).
	1.1			14. Februar  2003	Nicolai Lyng Als (NL)		Supports use in netbankframeset.

*/

var glExpandArrowBrandPath ="";


function expandArrowBegin(expandArrowHeadline,expandArrowSpanId,expandArrowExpanded,expandArrowTooltip,expandArrowTargetFrame){

	// preparing for brand-dependable imagepath;
	if ("" + top.brand == "undefined" && "" + top.gsBrand == "undefined"){
		// intranet portal
		expandArrowBrand = top.logo.getBrand();
	}
	else if ("" + top.brand == "undefined"){
		// homepage frameset
		expandArrowBrand = top.gsBrand;
	}
	else {
		// netbank frameset
		expandArrowBrand = top.brand;
	}
	glExpandArrowBrandPath = expandArrowBrand.toUpperCase();

	if ("" + expandArrowTargetFrame == "undefined" || "" + expandArrowTargetFrame == ""){
		expandArrowTargetFrame = "" + targetFrame;
	}
	else {
		expandArrowTargetFrame = expandArrowTargetFrame + ".";
	}

	if (expandArrowSpanId == "" || "" + expandArrowSpanId == "undefined" ){
		expandArrowSpanId = top.getgsUniqueID();
	}
 
	if ("" + expandArrowExpanded == "undefined"){
		expandArrowExpanded=false;
	}

	if ("" + expandArrowTooltip == "undefined"){
		expandArrowTooltip="";
	}

	var unID = expandArrowSpanId + "ArrowImg";
	returnStr  = "<table cellpadding='0px' cellspacing='0px' border='0px' width='100%'>";
	returnStr += "<tr style='height:6px;'><td colspan='2'></td></tr>";
	returnStr += "<tr>";
	returnStr += "<td align='left' colspan='2'>";

	if (expandArrowExpanded == true){
	  returnStr += "<img id='" + unID + "' src='" + getExpandArrowImgPath() + "arrow_red_down.gif' alt='red down arrow' border='0px' style='cursor:hand;margin-left:4px;margin-right:4px;height:11px;width:11px;' onClick='" + jsframe + "toggleExpandArrow(\"" + expandArrowSpanId + "\",\"" + expandArrowTargetFrame + "\");'>";
	}
	else {
	  returnStr += "<img id='" + unID + "' src='" + getExpandArrowImgPath() + "arrow_red_right.gif' alt='red right arrow' border='0px' style='cursor:hand;margin-left:4px;margin-right:4px;height:11px;width:11px;' onClick='" + jsframe + "toggleExpandArrow(\"" + expandArrowSpanId + "\",\"" + expandArrowTargetFrame + "\");'>";
	}

	returnStr += "<a class='gsExpandArrowLink' href='#' onClick='" + jsframe + "toggleExpandArrow(\"" + expandArrowSpanId + "\",\"" + expandArrowTargetFrame + "\")' onMouseOver=\"window.status=''; return true;\" onClick=\"window.status=''; return true;\" title='" + expandArrowTooltip + "'>" + expandArrowHeadline + "</a>";
	returnStr += "</td>";
	returnStr += "<td align='left'></td>";
	returnStr += "</tr>";
	returnStr += "<tr>";
	returnStr += "<td align='left'>";

	if (expandArrowExpanded == true){
  	returnStr += "<div id='" + expandArrowSpanId + "' style='display:block;margin-left:6px;'>";
	}
	else {
	  returnStr += "<div id='" + expandArrowSpanId + "' style='display:none;margin-left:6px;'>";
	}

 	returnStr += "<table cellspacing='0px' cellpadding='0px' border='0px'><tr style='height:6px;'><td></td></tr></table>";
 	return returnStr;
}



function expandArrowEnd(streg){
	if (streg == true){
		returnStr = "</div></td></tr><tr style='height:6px;'><td colspan='2'></td></tr><tr style='height:1px;'><td colspan='2' class='gsExpandArrowLine'></td></tr></table>";
	}
	else {
  		returnStr = "</div></td></tr><tr style='height:6px;'><td colspan='2'></td></tr></table>";
	}
	return returnStr;
}



function toggleExpandArrow(fieldObj,expandArrowTargetFrame){
	if ("" + expandArrowTargetFrame == "undefined" || expandArrowTargetFrame== "" ){
		expandArrowTargetFrame = "" + targetFrame;
	}
	else {
		var newStr = "" + expandArrowTargetFrame;
		if (newStr.lastIndexOf(".") != newStr.length-1){
			expandArrowTargetFrame = expandArrowTargetFrame + ".";
		}
	}
	var imgObj=eval(expandArrowTargetFrame + "document.getElementById('" + fieldObj + "ArrowImg')");
	fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
	if (fieldObj.style.display=="none"){
		imgObj.src= getExpandArrowImgPath() + "arrow_red_down.gif";
		fieldObj.style.display="block";
	}
	else {
		imgObj.src= getExpandArrowImgPath() + "arrow_red_right.gif";
		fieldObj.style.display="none";
	}
}


function showExpandArrow(fieldObj,expandArrowTargetFrame){
	if ("" + expandArrowTargetFrame == "undefined"){
		expandArrowTargetFrame = "" + targetFrame;
	}
	else {
		newStr = "" + expandArrowTargetFrame;
		if (newStr.lastIndexOf(".") != newStr.length-1){
			expandArrowTargetFrame = expandArrowTargetFrame + ".";
		}
	}
	if (typeof(fieldObj)!='object'){		
		var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj + 'ArrowImg')");
		fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
	}
	else {
		var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj.id + 'ArrowImg')");
	}
	imgObj.src= getExpandArrowImgPath() + "arrow_red_down.gif";
	fieldObj.style.display="block";
}



function hideExpandArrow(fieldObj,expandArrowTargetFrame){
	if ("" + expandArrowTargetFrame == "undefined"){
		expandArrowTargetFrame = "" + targetFrame;
	}
	else {
		newStr = "" + expandArrowTargetFrame;
		if (newStr.lastIndexOf(".") != newStr.length-1){
			expandArrowTargetFrame = expandArrowTargetFrame + ".";
		}
	}
	if (typeof(fieldObj)!='object'){
		var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj + 'ArrowImg')");
		fieldObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj)");
	}
	else {
		var imgObj=eval(expandArrowTargetFrame + "document.getElementById(fieldObj.id + 'ArrowImg')");
	}
	imgObj.src= getExpandArrowImgPath() + "arrow_red_right.gif";
	fieldObj.style.display="none";
}



// Internal funktion for getting expandArrow image path
function getExpandArrowImgPath(){
	if (top.ishomepage){
		return	getGeneralImgPath() + "usfke1_" + glExpandArrowBrandPath.toLowerCase() + "/$File/";
	}
	else if (top.indhold){
		return	getGeneralImgPath() + glExpandArrowBrandPath + "/expandarrow/";
	}
	else if(top.appcontent){
		return getGeneralImgPath() + glExpandArrowBrandPath + "/expandarrow/";
	}
}



/*
	general functions for use in usfke1
*/


// General funktion for getting general image path
function getGeneralImgPath(){
	if (top.ishomepage){
		return location.protocol + "//" + top.domain_domino + "/image/"
	}
	else if (top.indhold){
		return	top.framesetpath + "images/";
	}
	else if(top.appcontent){
		return ImgPath;
	}
}


// General funktion for getting general image path
function getBlankImgPath(){
	if (top.ishomepage){
		return location.protocol + "//" + top.domain_domino + "/link/space/$File/";
	}
	else if (top.indhold){
		return	top.framesetpath + "images/";
	}
	else if(top.appcontent){
		return ImgPath;
	}
}



// Generel funktionality for getting unique ID in all browsers.

// Global variable for unique ID
var gsUniqueCounter=0; 

function getgsUniqueID(){
	gsUniqueCounter++;
	var gsUniqueID = "gsUniqueID" + gsUniqueCounter 
	return gsUniqueID;
}


/*
	markError

	Version		Date				Developer										Notes
	1.0	 		9. April 2002	  	Morten Schou Larsen (MLAR)						Initial version
	1.01		15. April 2003		Claus Witt-Jespersen (CWI)						Bugfixing and cleanup

fejlmarkeringsfunktion, kan markere om et felt er fejl udfyldt eller ej

to metoder kan kaldes :

markError()  markerer fejl, tager objektet som skal fejlmarkeres som parameter
unMarkError()  Fjerner fejlmarkering, tager objektet som skal have fjernet fejlmarkering som parameter

*/
function markError() {
  for(i=0;i<arguments.length;i++) {
    obj=arguments[i];
		if (obj.error) break;
    if(obj.tagName=="SELECT") {
    	obj.error=true;
      obj.style.position='absolute';
      obj.style.clip='rect(2px '+(obj.clientWidth-2)+'px '+(obj.clientHeight-2)+'px 2px)';
      oEle = document.createElement('<span class="error" style="font-size:'+obj.style.fontSize+'; width:'+(obj.clientWidth-2)+'px;height:'+(obj.clientHeight-2)+'px">');
      obj.insertAdjacentElement('afterEnd',oEle);
      oEle.style.position='relative';
      oEle.style.top='1px';
      obj.style.top=(oEle.offsetTop-1)+'px';
    } else if(obj.tagName=="INPUT"&&(obj.type=="text"||obj.type=="password")) {
    	obj.error="true";
			obj.oldClassName=obj.className;
      obj.className="error";
      if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight;
      if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth;
   	} else if(obj.tagName=="TEXTAREA") {
   		obj.error="true";
   		obj.oldClassName=obj.className;
      obj.className="error";
      if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight;
      if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth+13;
		}
	} //end for
} // end function


function unMarkError() {
  for(i=0;i<arguments.length;i++) {
    obj=arguments[i];
    if (!obj.error) break;
		obj.error=false;
		if(obj.tagName=="SELECT") {
     	obj.style.position="static";
      obj.nextSibling.removeNode();
    } else if(obj.tagName=="INPUT"&&(obj.type=="text"||obj.type=="password")) {
      obj.className=obj.oldClassName;
      if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight+6;
      if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth+6;
    } else if(obj.tagName=="TEXTAREA") {
      obj.className=obj.oldClassName;
      if(obj.currentStyle.height!="auto") obj.style.pixelHeight=obj.clientHeight+6;
      if(obj.currentStyle.width!="auto") obj.style.pixelWidth=obj.clientWidth+19;
		}
  } //end for
} // end function


