// start info
if(typeof jsReport != 'undefined'){
	jsVersion = new Array(
	/*Name			=*/ 'Frame Synchronization',
	/*Version 		=*/ '1.4',
	/*Date 			=*/ 20020208,
	/*Author		=*/ 'Maurice van Creij',
	/*ProjectCode	=*/ 'l3_framesync',
	/*Summary		=*/ 'Navigation frames that adjust themselves to a content-document.',
	/*Dependencies	=*/ new Array('framesync_content.js','framesync_menu.js','framesync_frameset.js','urlfuncs.js','content_filter.js','browsercheck.js'),
	/*Browsers		=*/ new Array('NS','MO','IE','OP'),
	/*Changes		=*/ new Array(
						'1.4: Added frame-resizing functionality',
						'1.3: "framesync_frameset.js" will now also create the (DHTML) frameset',
						'1.21: Fixed the "chopped"-url in the guessDocID function',
						'1.2: The referring page will now also be taken into account when guessing the document\'s Id',
						'1.11: Added the internal parameter "localPaths=false" to "framesync_content.js" to help deal with local paths ("file://...")',
						'1.1: Frames can now be defined in a list outside the include, a redraw-command can be specified outside the include',
					  	'1.0: A modular version was compiled from code-scraps'
					  	),
	/*Usage			=*/ new Array(
						'this goes in the parent frameset',
						'	<script language="JavaScript" src="/~wmittens/includes/content_ini.js" type="text/javascript"></script>',
						'',
						'	//include this only if the content_ini.js is a mess',
						'	<script language="JavaScript" src="/~wmittens/includes/content_filter.js" type="text/javascript"></script> ',
						'	<script language="javascript">',
						'		// fixing irregularities in the DBarray[][]',
						'		DBarray=validateDBarray(DBarray,false)',
						'	</script>',					
						'',
						'	<script language="JavaScript" src="/~wmittens/includes/browsercheck.js" type="text/javascript"></script>',
						'	<script language="JavaScript" src="/~wmittens/includes/urlfuncs.js" type="text/javascript"></script>',
						'	<script language="javascript">',
						'	<!--',
						'		var arrFrames = new Array(0,',
						'					//new Array(intId,intParent,intFamily,strName,strUrl,strCols,strRows,strScrolling,booSync)',
						'						new Array(1,0,1,\'navigation\',		\'/~wmittensxp/navigation/navigation.htm\',		\'128,*\',		\'\',		\'no\',		true),',
						'						new Array(2,1,2,\'subnavigation\',	\'/~wmittensxp/navigation/subnavigation.htm\',	\'\',			\'64,*\',	\'no\',		true),',
						'						new Array(3,1,2,\'content\',			URLparam(\'url\',\'content.htm\'),			\'\',			\'64,*\',	\'auto\',	false)',
						'					)',
						'		var booGenerate = true',
						'		var intContentFrame = 3',
						'	//-->',
						'	</script>',
						'	<script language="JavaScript" src="/~wmittens/includes/framesync_frameset.js" type="text/javascript"></script>',
						'',
						'this goes in the content frame',
						'	<script language="javascript" type="text/javascript">',
						'	<!--',
						'	docID = -1 // -1 indicates automatic ID determination',
						'	//-->',
						'	</script>',
						'	<script language="JavaScript" src="/~wmittens/includes/urlfuncs.js" type="text/javascript"></script>',
						'	<script language="JavaScript" src="/~wmittens/includes/content_filter.js" type="text/javascript"></script>',
						'	<script language="JavaScript" src="/~wmittens/includes/framesync_content.js" type="text/javascript"></script>',
						'',
						'this goes in the menu frame',
						'	<head>',
						'	<script language="JavaScript" src="/~wmittens/includes/framesync_menu.js" type="text/javascript"></script>',
						'	</head>',
						'	<body>',
						'	// menu code here',
						'',
						'	<script language="JavaScript" type="text/javascript">',
						'	<!--',
						'	// configuration',
						'		hardRefresh = false				// reloads whole frame on change if true',
						'		detectRootChangesOnly = true 	//false | true; DBarray = parent.DBarray',
						'		redrawUpCommand = "" //			//sID is the root-item of setID, gID is the root-item of getID',
						'	// kick-start the menu',
						'		setproperties(setID)',
						'	//-->',
						'	</script>',
						'	</body>',
						'',
						'for resizing frames:',
						'	//resizeFrames(intId,strCols,strRows)',
						'	resizeFrames(1,\'256,*\',\'\');resetFrames()'
					  	)
	)
}else{
// end info

	
	//---------- send the active document's Id to all active frames ---------------------
	// constants/configuration
		var fcode = 'harabibi'
		var getID = 0
		var waitloop = 0
		/* defined inline
		var arrFrames = new Array(0,
						//new Array(intId,intParent,strName,strUrl,strCols,strRows,strScrolling,booSync)
							new Array(1,0,1,'navigation',		'/~wmittensxp/navigation/navigation.htm',		'128,*',	'',		'no',	true),
							new Array(2,1,2,'subnavigation',	'/~wmittensxp/navigation/subnavigation.htm',	'',			'64,*',	'no',	true),
							new Array(3,1,2,'content',			'/~wmittensxp/content/content.htm',				'',			'64,*',	'auto',	false)
						)
		var booGenerate = true
		var intContentFrame = 3
		*/
	
	
	// secondary functions - construction
		function restoreArrFrames(){
			// fetch settings from url
			strCols = URLparam('cols','')
			strRows = URLparam('rows','')
	
			// decode settings
			arrCols = strCols.split(';')
			arrRows = strRows.split(';')
			// re-fill arrFrames
			for(var intA=0; intA<arrCols.length; intA++){
				if(arrCols[intA]!='') arrFrames[intA+1][5] = arrCols[intA]
			}
			for(var intA=0; intA<arrRows.length; intA++){
				if(arrCols[intA]!='') arrFrames[intA+1][6] = arrRows[intA]
			}
		}
	
		var strFrames = '';	var intPreviousRecursion = -1; var intPreviousFamily
		function getFrames(intId,intRecursion){
			for(var intA=1; intA<arrFrames.length; intA++){
				intParent		= arrFrames[intA][1]
				if(intId==intParent){
					// look-up data
					intIndex		= arrFrames[intA][0]
					intFamily		= arrFrames[intA][2]
					strName			= arrFrames[intA][3]
					strUrl			= arrFrames[intA][4]
					strCols			= arrFrames[intA][5]
					strRows			= arrFrames[intA][6]
					strScrolling	= arrFrames[intA][7]
					strSpacing		= ''
					strSpacing2		= '   '
					
					// no rows, or no cols
					if(strCols!=''){
						strColRows = 'cols="'+strCols+'"'
					}
					if(strRows!=''){
						strColRows = 'rows="'+strRows+'"'
					}
					
					// neat HTML indent
					for(var intB=0; intB<intRecursion; intB++){
						strSpacing = strSpacing + '   '
						strSpacing2 = strSpacing2 + '   '
					}
					
					// close frameset
						if(intRecursion<intPreviousRecursion) strFrames = strFrames + strSpacing2 + '</frameset>\n'
					// interrrupt a frameset
						if(intRecursion==intPreviousRecursion&&intFamily>intPreviousFamily) strFrames = strFrames + strSpacing + '</frameset>\n'
					// make frameset
						if(intRecursion>intPreviousRecursion || intFamily>intPreviousFamily) strFrames = strFrames + strSpacing + '<frameset '+strColRows+' id="frmst'+intFamily+'" framespacing="0" frameborder="0" border="0">\n'
					// make frame
						strFrames = strFrames + strSpacing2 + '<frame src="'+strUrl+'" name="'+strName+'" id="'+strName+'" frameborder="0" scrolling="'+strScrolling+'" noresize marginwidth="0" marginheight="0">\n'
					
					// store the current recursion level
						intPreviousRecursion = intRecursion
						intPreviousFamily = intFamily
					// deeper frame
						getFrames(intIndex,intRecursion+1)
				}
			}
		}
		
		function setFrames(){
			// write all recursive frames
			getFrames(0,0)
			
			// close all open recursed framesets
			intDepth = intPreviousRecursion
			for(var intA=0; intA<=intPreviousRecursion; intA++){
				// neat HTML indent
				strSpacing = ''
				for(var intB=0; intB<intDepth; intB++){
					strSpacing = strSpacing + '   '
				}
				strFrames = strFrames + strSpacing + '</frameset>\n'
				intDepth = intDepth - 1
			}

			// write to canvas
			document.writeln(strFrames)
		}
			
	// ternary functions - control
		function syncFrames(setID){
			var retry=0;
			getID = setID;
			
			// test if all frames have been defined and loaded, then send the 'setID' to them.
			for(var tellerA=1; tellerA<arrFrames.length; tellerA++){
				if(arrFrames[tellerA][8]) eval("if("+arrFrames[tellerA][3]+"){ if("+arrFrames[tellerA][3]+".inits==1){"+arrFrames[tellerA][3]+".setproperties(setID);}else{retry=1;} }else{retry=1;}")
			}
		
			// put a neat little title in the title-bar
	//		if(setID>0){top.document.title = DBarray[setID][11]}
			
			//the retry-function seriously doesn't need to be start-up more than once at a time
			if(retry == 1 && waitloop == 0){
				retry = 0;
				waitloop = 1;
				setTimeout('waitloop=0;syncFrames(getID)',2048);
			}
		}
		
		function resizeFrames(intId,strCols,strRows){
			// store the new sizes
			arrFrames[intId][5] = strCols
			arrFrames[intId][6] = strRows
		}
		
		function resetFrames(){
			if(ie==1){ 	// dynamic resize for internet explorer
				// apply (changed) settings to all frames
				for(var intA=1; intA<arrFrames.length; intA++){
					intFamily = arrFrames[intA][2]
					strCols = arrFrames[intA][5]
					strRows = arrFrames[intA][6]
			
					eval('frmst'+intFamily+'.cols="'+strCols+'"')
					eval('frmst'+intFamily+'.rows="'+strRows+'"')
				}
			}else{ 		// refreshing resize for the other browsers
				// encode settings
				strCols = ''
				strRows = ''
				for(var intA=1; intA<arrFrames.length; intA++){
					strCols = strCols + ';' + arrFrames[intA][5]
					strRows = strRows + ';' + arrFrames[intA][6]
				}
				strCols = strCols.substring(1,strCols.length)
				strRows = strRows.substring(1,strRows.length)
				// construct new url
				strUrl = URLrip(-1)
				// reload new url
				strContentFrame = arrFrames[intContentFrame][3]
				objContentUrl = eval(strContentFrame+'.location.href')
				strContentUrl = URLstrip(objContentUrl)
				strContentUrl = URLencode(strContentUrl)
				document.location.replace(strUrl+"?strUrl="+strContentUrl+"&cols="+strCols+"&rows="+strRows)
			}
		}
		

		
	// executed inline
		if(booGenerate){
			restoreArrFrames()
			setFrames()
		}
	
	
}
