// start info
if(typeof jsReport != 'undefined'){
	jsVersion = new Array(
	/*Name			=*/ 'Content.INI brain-file',
	/*Version 		=*/ '1.34',
	/*Date 			=*/ 20021015,
	/*Author		=*/ 'Maurice van Creij',
	/*ProjectCode	=*/ 'l1_contentini',
	/*Summary		=*/ 'Store properties of a site\'s documents in a central XML brain-file, for reference by navigational functions.',
	/*Dependencies	=*/ new Array('content_filter.js','content_ini.js','content_ini.xml','content_ini.xsl','content_js2xml.htm','content_xml2js.htm','content_xml2js.asp','xml2htm.asp'),
	/*Browsers		=*/ new Array('NS','MO','IE','OP'),
	/*Changes		=*/ new Array(
						'1.34: Added "smartEval(strAddress)" to validate "evals" before executing them',
						'1.33: FindContent() now returns reliability scores for items found by comparison of strings',
						'1.32: TraceBranch now ignores bad entries, the reversing of arrays has been made into a seperate function.',
						'1.31: removed the, now obsolete, (de)crunching functions. Crunching is now a seperate library (decruncher.js).',
						'1.3: added "guessDocID()" for finding the ID for a given URL',
						'1.2: "DBarray=validateDBarray(DBdisarray,booVerbose)" was added to rescue mallformed, but otherwise correct, DBarrays',
						'1.11: Added isInArrayOrCSV() function for quick checks',
					  	'1.1: Support XML generation of the array',
					  	'1.0: Common document information is stored in a central file'
					  	),
	/*Usage			=*/ new Array(
						'<script language="JavaScript" src="/~wmittens/includes/content_filter.js" type="text/javascript"></script>',
						'<script language="JavaScript" type="text/javascript">',
						'<!'+'--',
						'DBarray = new Array(0,',
						'// 0,   1,       2,    3,     4,       5,     6,     7,    8,     9,     10,          11,           12',
						'//ID,childoff,"name","url","target","icon","xpos","ypos",order,"type","long name","description","terminator"',
						'new Array(1,0,"games","/~wmittens/content/games/index.htm","content","fold",0,0,-1,"folder","Games","Homepage for the games.",0),',
						'new Array(2,0,"gear","/~wmittens/content/gear/index.htm","content","fold",0,0,-1,"folder","Gear","Homepage for the merchandise.",0),',
						'new Array(3,0,"graphics","/~wmittens/content/graphics/gallery.htm?ID=3","content","fold",0,0,-1,"folder","Graphics","Homepage for the picture-galleries.",0),',
						'new Array(4,0,"documents","/~wmittens/content/documents/index.htm","content","fold",0,0,-1,"folder","Articles","Homepage for the tutorial documents.",0),',
						'new Array(5,0,"info","/~wmittens/content/info/index.htm","content","help",0,0,-1,"folder","Info","Homepage for the support and info pages.",0),',
						'new Array(6,5,"about","/~wmittens/content/info/about.htm","content","help",75,72,-1,"support","About","Help for problems with this site.",0),',
						'new Array(7,5,"contact","/~wmittens/content/info/contact.htm","content","help",0,0,-1,"support","Contact","Useful links to other sites.",0),',
						'new Array(8,5,"search","/~wmittens/content/info/search.htm","content","help",0,0,-1,"support","Search","Search this site.",0),',
						'new Array(9,5,"links","/~wmittens/content/info/links.htm","content","help",0,0,-1,"support","Links","Useful links to other sites.",0),',
						'new Array(10,5,"help","/~wmittens/content/info/help.htm","content","help",0,0,-1,"support","Help","Help for problems with this site.",0),',
						'new Array(11,5,"home","/~wmittens/content/index.htm","content","help",0,0,-1,"support","Home","Return to the homepage.",0),',
						'new Array(0)',
						');DBarray[0]=DBarray.length-1;DBarray.length=DBarray[0]',
						'',
						'arrayofNames = FilterContent(1,0,10)',
						'arrayofUrls = SearchContent(11,\'tutorial\',3)',
						'arrayofPeerindexes = peersOf(36)',
						'DBarray = decodeDBarray(strArchive) //used for decrunching an archived content_ini',
						'//'+'-->',
						'</script>'
					  	)
	)
}else{
// end info


	// data-filter for content_ini.js
		// sort through the content_ini for a complete string in a particular field and return the value from the field specified in (getfieldnr)
		function FilterContent(fieldnr,string,getfieldnr){ // useage rating: 18
			var aID = new Array(0);
			var tellerB = 0;
			for (var tellerA = 1;tellerA<DBarray.length;tellerA++){
				if (DBarray[tellerA][fieldnr]==string){
					aID[tellerB] = DBarray[tellerA][getfieldnr];
					tellerB++;
				}
			}
			return aID;
		}
		
		// sort through the content_ini for part of a string in a particular field and return the value from the field specified in (getfieldnr)
		function SearchContent(fieldnr,string,getfieldnr){ // useage rating: 5
			var aID = new Array();
			var tellerZ = 0;
			for (var tellerA = 1;tellerA<DBarray.length;tellerA++){
				dbString = DBarray[tellerA][fieldnr].toLowerCase();
				compString = string.toLowerCase();
				if (dbString.indexOf(compString) != -1){
					aID[tellerZ] = DBarray[tellerA][getfieldnr];
					tellerZ=tellerZ+1;
				}
			}
			if(aID.length==0){
				for (var tellerA = 1;tellerA<DBarray.length;tellerA++){
					dbString = DBarray[tellerA][fieldnr].toLowerCase();
					compString = string.toLowerCase();
					if (compString.indexOf(dbString) != -1){
						aID[tellerZ] = DBarray[tellerA][getfieldnr];
						tellerZ=tellerZ+1;
					}
				}		
			}
			return aID;
		}
		
		// check all fields for the searched string fragment
		function FindContent(fieldnr,string,getfieldnr){
			var aID = new Array();
			var bID = new Array();
			var fltComparison = 0;
			var fltHighest = 0;
			var strSearchLine = '';
			// prepare the search-word
			var strSearchWord = string.toLowerCase();
			// for all searchable lines
			for (var tellerA=DBarray.length-1;tellerA>=0;tellerA--){
				// prepare the search-line
				if(fieldnr>=0){
					strSearchLine = (DBarray[tellerA][fieldnr]+'').toLowerCase();
				}else{
					strSearchLine = (DBarray[tellerA]+'').toLowerCase();
				}
				// get compare score
				fltComparison = compareString(strSearchWord,strSearchLine,new Array(' ',',','/','?','#','&'));
				// store
				bID[bID.length] = new Array(fltComparison,tellerA);
			}
			// sort the scores
			bID = bID.sort(sortFirstSubArrayElement);
			// compile the requested data
			for(var tellerA=0;tellerA<bID.length;tellerA++){
				intFoundId = bID[tellerA][1];
				fltFoundScore = bID[tellerA][0];
				aID[tellerA] = new Array(DBarray[intFoundId][getfieldnr],fltFoundScore);
			}
			return aID
		}
		

	// hierarchy determination/manipulation
		// trace a path back across the parent items
		function TraceBranch(zID,booPure){
		aID = new Array();
		rID = new Array();
		var tellerA = 0;
		var tellerB = 0;
			// pure mode
			if(typeof booPure == 'undefined') booPure = false;
		
			// for valid instances of zID
			if(zID>-1 && zID<DBarray.length){
				rID[tellerA]=zID;
				// store all parents of the item zID in an array
				do{
					if(zID!=0){parentz = DBarray[zID][1]}else{parentz = 0}
					tellerA = tellerA + 1;
					rID[tellerA] = parentz;
					zID = parentz;
				}while(parentz>0 && tellerA<10);
				// reverse the array for further use
				aID = rID.reverse();
			}else{
				aID = new Array(0,0);
			}
			
			// fix the array for 'pure' mode
			if(booPure){
				if(aID[1]==0) aID.length=1;
			};
			
		return aID;
		}
		
		function hasChild(cID){
			arrChilds = FilterContent(1,cID,0);
			gotChild = arrChilds.length;
		return gotChild;
		}

		function childrenOf(parent){
			var children = FilterContent(1,parent,0);
			return children;
		}
		
		function parentOf(child){
			var parentz = DBarray[child][1];
			return parentz;
		}
		
		function peersOf(item){
			var parentz = DBarray[item][1];
			peerIndex = FilterContent(1,parentz,0);
			return peerIndex;
		}

	
	
}
