// start info
if(typeof jsReport != 'undefined'){
	jsVersion = new Array(
	/*Name			=*/ 'Dropdown Light',
	/*Version 		=*/ '0.96',
	/*Date 			=*/ 20030521,
	/*Author		=*/ 'Maurice van Creij',
	/*ProjectCode	=*/ 'l2_dropdownmenu',
	/*Summary		=*/ 'A simpler frameless dropdown-menu, running exclusively on DOM compliant browsers.',
	/*Dependencies	=*/ new Array('dropdown_css.js','dropdown_css_0.css','browsercheck.js','content_filter.js','easystyles.js','stringfuncs.js'),
	/*Browsers		=*/ new Array('MO','IE'),
	/*Changes		=*/ new Array(
						'0.96: A bug was fixed in the highlight function. The wrong style was picked onload, but not on-click.',
						'0.95: Changed the tree elements to quad-state instead of tri-state. closed&passive, closed&active, open&passive, open&active',
						'0.94: IE5 doesn\'t redraw properly, so I force the issue with "redrawAll();"',
					  	'0.93: Added an option to exclusively open branches.',
					  	'0.92: Fixed non-initial state of the toggle indicators.',
					  	'0.91: Initial state now at integrated in first build.',
					  	'0.9: Mostly functional'
					  	),
	/*Usage			=*/ new Array(
						'<link rel="StyleSheet" href="/resources/styles_dropdown.css" type="text/css">',
						'<script language="javascript" src="/resources/dropdown_css.js"></script>',
						'',
						'Getter: setDropdownId(intId,booMultiOpen); Setter: getDropdownId();'
					  	)
	)
}else{
// end info




	// constants/configuration
		// configuration
		if(typeof(fltFade)=='undefined')				var fltFade = 0.0; 							// fading speed in fraction of second
		if(typeof(csvOpenTree)=='undefined')			var csvOpenTree = ''; 						// default open items
		if(typeof(intStyleDistribution)=='undefined')	var intStyleDistribution = 0; 				// 0:per recursion. 1:per item (strType;DBarray[][9]), 2:all the same, 3: based on parentage
		if(typeof(strPixel)=='undefined')				var strPixel = '/images/spacing.gif';	//one transparant pixel
		if(typeof(booToggleExclusive)=='undefined')		var booToggleExclusive = true;				// close everyting else before opening (or closing) a new branch
		if(typeof(arrInclTermRange)=='undefined')		var arrInclTermRange = new Array(0,10);		// the height of field 12 of the DBarray[][] will indicate, if the item is to be ignored; ignored<arrInclTermRange[0]<used<arrInclTermRange[1]<ignored
		// constants
			// checklist of all addressable items
			if(typeof(csvDropCheckList)=='undefined')		var csvDropCheckList		= '';
			// styles that get changed when an item is opened
			if(typeof(arrOpenStyleIdNames)=='undefined')	var arrOpenStyleIdNames		= new Array(0,'dd0td0id','dd0tr1id');
			// styles that get changed when an item is moused
			if(typeof(arrLiteStyleIdNames)=='undefined')	var arrLiteStyleIdNames		= new Array(0,'dd0td0id','dd0tgl0id','dd0ico0id');
			if(typeof(arrLiteStyleClasses)=='undefined')	var arrLiteStyleClasses		= new Array();
			if(typeof(arrDropToggles)=='undefined')			var arrDropToggles			= new Array();

	// primary functions - functionality
		// check for the item on the checklist
		function validateDropItem(strFind){
			strList = ',' + csvDropCheckList + ',';
			strFind = ',' + strFind + ',';
			if(strList.indexOf(strFind)>-1){
				return true;
			}else{
				return false;
			}
		}
		
		// csvManipulation
		function editCsv(csvEdit,strEdit,booAdd){
			var arrEdit = new Array();
			// prepare the csv for replaces
			csvEdit = ',' + csvEdit + ',';
			// add or remove
			if(booAdd){
				// add to CSV
				csvEdit += strEdit + ',';
			}else{
				// split the csv using the replace string as a seperator
				csvEdit = csvEdit.split(','+strEdit+',')+'';
			}
			// trim the limits
			csvEdit = csvEdit.substr(1,csvEdit.length-2);
			// return the new csv
			return csvEdit;
		}

		// modifies the last digit of every listed class for a given item's Id
		function changeClasses(intId,arrIdNames,intState){
			// for all listed styles
			for(var intA=1; intA<arrIdNames.length; intA++){
				// get the Id to change
				strId = arrIdNames[intA] + intId;
				// if it exists
				if(validateDropItem(strId)){
					// get current classname
					strOldClass = getClassName(strId);
					// strip off the last digit
					strOldClass = strOldClass.substring(0,strOldClass.length-1);
					// add the new digit
					strNewClass = strOldClass + intState;
					// change it's state
					setClassName(strId,strNewClass,fltFade);
				}
			}
		}
		
		function getRecursionStyle(intIndex,intStyleDistribution,intRecursion){
			var strRecursionStyle = '';
			// choose display style
			if(intStyleDistribution==1){
				strRecursionStyle = DBarray[intIndex][9];
			}else if(intStyleDistribution==2){
				strRecursionStyle = '0';
			}else if(intStyleDistribution==3){
				strRecursionStyle = (hasChild(intIndex,arrInclTermRange)>0) ? intRecursion+'p' : intRecursion+'c';
			}else{
				strRecursionStyle = intRecursion;
			}
			//return display style
			return strRecursionStyle;
		}
		

	// secondary function - construction
		// construct a complete tree
		var strTree = '';
		function buildDropdown(intParent,intRecursion){
			// filter the items of this branch' recursion
			var arrIndex = FilterContent(1,intParent,0);
			// header
			strTree += '<table cellspacing="0" cellpadding="0" border="0" id="dd0tb' + intRecursion + '" class="dd0tb' + intRecursion + '" onmouseout="liteReset()">\n'
			// for all filtered items
			for(var intA=0; intA<arrIndex.length; intA++){
				// gather data of the item
				var intIndex 		= arrIndex[intA];
				var strUrl			= DBarray[intIndex][3];
				var strTarget		= DBarray[intIndex][4];
				var strIcon			= DBarray[intIndex][5];
				var strType			= DBarray[intIndex][9];
				var strTitle		= DBarray[intIndex][10];
				var intExcludeVal	= DBarray[intIndex][12];
				// exclude unwanted items
				if(intExcludeVal>=arrInclTermRange[0] && intExcludeVal<=arrInclTermRange[1]){
					// initial state of the button
					var intInitialState = (isInArrayOrCSV(intIndex,csvOpenTree)) ? 1 : 0 ;
					// recursion specific
					var booParent	= hasChild(intIndex,arrInclTermRange)>0;
					var strToggle	= (booParent) ? intInitialState : 2;
					var intRecursId = getRecursionStyle(intIndex,intStyleDistribution,intRecursion);
					// empty links should be toggle buttons
					if(strUrl==''||strUrl=='javascript:{}') strUrl="javascript:{toggleDropDown(" + intIndex + ")}";
					// set the actual state for the toggle function
					arrDropToggles[intIndex] = strToggle;
					// write branch
					strTree += ''
							+'<tr class="dd0tr0st0" id="dd0tr0id' + intIndex + '">\n'
								+'<td class="dd0td0rc' + intRecursId + 'st' + (intInitialState*2) + '" id="dd0td0id' + intIndex + '" onmouseover="liteDropDown(' + intIndex + ')" nowrap>\n'
									+'<img border="0" alt="" src="' + strPixel + '" class="dd0rc' + intRecursId + 'spc0" align="left" hspace="0" vspace="0">\n'
									+'<img border="0" alt="" src="' + strPixel + '" class="dd0tgl' + strToggle + 'st0" id="dd0tgl0id' + intIndex + '" align="left" hspace="0" vspace="0" onclick="toggleDropDown(' + intIndex + ')">\n'
									+'<img border="0" alt="" src="' + strPixel + '" class="dd0ico' + strIcon + 'st0" id="dd0ico0id' + intIndex + '" align="left" hspace="0" vspace="0">\n'
									+'<a href="' + strUrl + '" target="' + strTarget + '" class="dd0a0">' + strTitle + '</a><br>\n'
								+'</td>\n'
							+'</tr>\n';
					// recurse to a deeper level of the branch
					if(booParent){
						// make TR for new sub-items
						strTree += ''
							+'<tr class="dd0tr1st' + intInitialState + '" id="dd0tr1id' + intIndex + '">\n'
								+'<td>\n';
						// call the function again for a new recursion
						buildDropdown(intIndex,intRecursion+1);
						// close TR for new sub-items
						strTree += ''
								+'</td>\n'
							+'</tr>\n';
						// register all addressable id's
						csvDropCheckList += 'dd0tr1id' + intIndex + ',';
					}
					// register all addressable id's
					csvDropCheckList += ''
								+'dd0tr0id' + intIndex + ','
								+'dd0td0id' + intIndex + ','
								+'dd0tgl0id' + intIndex + ','
								+'dd0ico0id' + intIndex + ',';
				}
			}
			// footer
			strTree += '</table>\n';
		}
		
		function getDropdown(intStartId,intStartRecursion){
			strTree = '';
			// trace the branch of the active item back to the root
			arrRoot = TraceBranch(intStartId);
			// add the starting point and it's branch back to the root to the list of open items
			csvOpenTree += ',' + arrRoot;
			// request the initial tree starting at the requested recursion
			buildDropdown(arrRoot[intStartRecursion],intStartRecursion);
			// pass it back
			return strTree;
		}
		
		function writeDropdown(intStartId,intStartRecursion,csvTreeOpen){
			// add the given open items to the list
			csvOpenTree += ',' + csvTreeOpen;
			// request the building of the initial tree
			strWrite = getDropdown(intStartId,intStartRecursion);
			// write it to the document
			document.writeln(strWrite);
		}
		

	// ternary function - operation 
		// toggles the last digits of all listed classes of a given item's Id between 1 and 0
		function toggleDropDown(intId){
			// optionally close all other items
			if(booToggleExclusive){
				setDropdownId(intId,false);
			// or just toggle the current
			}else{
				// retrieve the actual state
				intOldState = arrDropToggles[intId];
				// if the item is a toggle at all
				if(intOldState<2){
					// toggle the state	
					intNewState = -1 * (intOldState - 1);
					// execute the new state
					openDropDown(intId,intNewState);
					// store new state
					arrDropToggles[intId] = intNewState;
				}
			}
		}

		// modifies an item to resemble a given dropdown state
		function openDropDown(intId,intState){
			// undo the highlight
			liteDropDown(-1)
			// change the class for the toggle-pickle
			intTglState	= (hasChild(intId,arrInclTermRange)>0) ? intState : 2 ;
			if(validateDropItem('dd0tr0id'+intId) && validateDropItem('dd0tgl0id'+intId)) setClassName('dd0tgl0id'+intId,'dd0tgl'+intTglState+'st0');
			// Make all classes the active state
			changeClasses(intId,arrOpenStyleIdNames,intState*2);
			// add/remove it to the list of open item Id's
			if(intState>0){csvOpenTree=editCsv(csvOpenTree,intId,true)}else{csvOpenTree=editCsv(csvOpenTree,intId,false)}
		}
		
		// resets the dropdowns onmouseover on onmouseout
		var intLiteReset;
		function liteReset(){
			clearTimeout(intLiteReset);
			intLiteReset = setTimeout('liteDropDown(-1)',512);
		}
		
		// modifies an item to resemble a given mouseover state
		function liteDropDown(intId){
			// cancel global reset
			clearTimeout(intLiteReset);
			// handle highlight
			if(intId!=arrLiteStyleClasses[0]){
				// retore the previous item's classes
				for(var intA=1; intA<arrLiteStyleClasses.length; intA++){
					strPrevId		= arrLiteStyleIdNames[intA] + arrLiteStyleClasses[0];
					strPrevClass	= arrLiteStyleClasses[intA];
					if(validateDropItem(strPrevId)) setClassName(strPrevId,strPrevClass,fltFade);
				}
				// if a new item is to be activated in the progress
				if(intId>0){
					// store the current classes of the item's Id's
					arrLiteStyleClasses[0] = intId;
					for(var intA=1; intA<arrLiteStyleIdNames.length; intA++){
						strCurId					= arrLiteStyleIdNames[intA] + intId;
						if(validateDropItem(strCurId)){
							arrLiteStyleClasses[intA]	= getClassName(strCurId);
						}
					}
					// update them to the mouseover state
					if(isInArrayOrCSV(intId,csvOpenTree)){
						changeClasses(intId,arrLiteStyleIdNames,3);
					}else{
						changeClasses(intId,arrLiteStyleIdNames,1);
					}
				}else{
					// reset previous classes buffer
					arrLiteStyleClasses = new Array();
					arrLiteStyleClasses[0] = intId;
				}
			}
		}
		
		// opens all members of an Id branch back to the root
		function setDropdownId(intId,booMultiOpen){
			if(typeof booMultiOpen=='undefined') booMultiOpen=true;
			// close all previous branches (optional)
			if(!booMultiOpen){
				arrOpenTree = csvOpenTree.split(',');
				for(var intA=0; intA<arrOpenTree.length; intA++){
					if(arrOpenTree[intA]!='') openDropDown(arrOpenTree[intA],0);
				}
			}
			// open new branches if needed
			if(intId>0){
				// trace the root of the current branch
				arrBranch = TraceBranch(intId);
				// open all members of the new branch
				for(var intA=1; intA<arrBranch.length; intA++){
					openDropDown(arrBranch[intA],1);
				}
				// store the active item
				intDropdownId = intId;
			}
		}
		
		// emergency redraw for IE5.0
		function redrawAll(){
			setDisplay('dd0tb0',false,0);
			setDisplay('dd0tb0',true,0);
		}
		
		// return the active item
		var intDropdownId = 0;
		function getDropdownId(){
			return intDropdownId;
		}
		
	// executed inline
		//writeDropdown(getId(),0,'');
		writeDropdown(0,0, keuzeid);
		if(ie&&v5) onload = redrawAll;

}