// Default values:
var def = {
	mark: 1,				// Level of discriminating part of path
	sync: [parent.nav_left]	// Array of frames to synchronize
};

function framesync(par) {
	// Handle parameters:
	if (typeof par == 'undefined') {
		par = def;
	}
	var sync = (typeof par.sync == 'undefined') ? def.sync : par.sync;
	var mark = (typeof par.mark == 'undefined') ? def.mark : par.mark;

	// Shift path level to corresponding index in URL split on '/'
	mark += 2;

	// Get discriminating part of path in current document:
	var cont = (typeof par.pretend == 'undefined') ? document.location.href.split('/')[mark] : par.pretend;

	for (i = 0; i < sync.length; i++) {

		if (typeof sync[i] == 'undefined') continue;
		// Get discriminating part of URL in frame:
		var menu = sync[i].location.href.split('/');

		// Check if discriminating parts differ:
		if (menu[mark] != cont) {

			// Rebuild URL for frame using discriminating part of current document:
			var menu_uri = document.location.protocol + "//" + document.location.host;
			for (var j = 3; j < menu.length; j++) {
				menu_uri += '/' + ((j == mark) ? cont : menu[j]);
			}

			// Load the URL in the frame:
			// Use eval to avoid bug in IE4.0, where location.replace can't be
			// tested for undefinedness...
			if (!eval(sync[i].location.replace(menu_uri)) ) {
				sync[i].location.href = menu_uri;
			}
		}
	}
}

