// this script is based on TigraMenu V1.1 (http://www.softcomplex.com/products/tigra_menu_tree/)// well, not much left of original code,// but TigraMenu is a very good piece of code to start from ...// --// massive modifications 2004 - 03 - 10// by Nils Clark-Bernhard (nils@n-cb.de)// --var menu_item_depth = 5;          // how many parts has one menu item ???var root_closeable  = false;      // wether root is closeable or notvar all_images      = new Array(); // image preload arrayvar chefopened = false;function browser_detect(){  var Netscape, MSIE, Opera, Unknown;  var Win, Mac, Other;  var NetscapeVer, MSIEVer, OperaVer;  // detect browser    Netscape = navigator.appName == "Netscape";  MSIE = navigator.appName == "Microsoft Internet Explorer";  Opera = navigator.userAgent.indexOf("Opera") > -1;  Unknown = !(Netscape || MSIE || Opera);    // detect platform    Win = navigator.userAgent.indexOf("Win") > -1;  Mac = navigator.userAgent.indexOf("Mac") > -1;  Other = !(Win || Mac);    // now extract version numbers    if(Netscape) {    NetscapeVer = parseFloat(navigator.appVersion);  }  else if(MSIE) {    n = navigator.userAgent;    MSIEVer = n.substr(n.indexOf("MSIE ")+("MSIE ").length, 4);    MSIEVer = parseFloat(MSIEVer);     // converts it into a floatint point number        if(Opera) {      OperaVer = n.substr(n.indexOf("Opera ")+("Opera ").length, 4);      OperaVer = parseFloat(OperaVer);    }  }  // now do something!  	if(Mac && MSIE) {    	return true;  	} else {		return false;	}}function tree (a_items, a_template) {		this.a_tpl           = a_template;	this.a_config        = a_items;	this.object_root     = this;	this.a_index         = [];	this.object_selected = null;	this.node_depth      = -1;		// added	this.object_locked   = null;	this.clicked_object  = null;		var object_icone = new Image();	var object_iconl = new Image();		object_icone.src = a_template['icon_e'];	object_iconl.src = a_template['icon_l'];	a_template['im_e'] = object_icone;	a_template['im_l'] = object_iconl;		for (var i = 0; i < 64; i++)		if (a_template['icon_' + i]) {			var object_icon = new Image();			a_template['im_' + i] = object_icon;			object_icon.src = a_template['icon_' + i];		}		this.toggle = function (node_id) { 		var object_item = this.a_index[node_id]; 		object_item.open(object_item.b_opened) 		if(chefopened!=false&&chefopened<node_id)		{			this.a_index[chefopened].is_open=false;			document.images['i_img0_' + chefopened].src = this.a_index[chefopened].img_normal;			chefopened=false;		}	};	// added	this.close = function (node_id) { 		var object_item = this.a_index[node_id]; 		object_item.close() 	};		// added 	this.setmark = function (node_id) { 		var object_item = this.a_index[node_id]; 		object_item.setmark() 	};	// added 	this.item_reset = function (node_id) { 		var object_item = this.a_index[node_id]; 		object_item.item_reset() 	};				this.select = function (node_id) { 		return this.a_index[node_id].select(); 	};		// modified to trigger mouseout	this.mout   = function (node_id) { 		this.a_index[node_id].mouse_out('out');	};		// modified to trigger mouseover	this.mover  = function (node_id) { 		this.a_index[node_id].mouse_over();	};	this.a_children = [];	for (var i = 0; i < a_items.length; i++)		new tree_item(this, i);	this.node_id = trees.length;	trees[this.node_id] = this;		for (var i = 0; i < this.a_children.length; i++) {		document.write(this.a_children[i].init());		this.a_children[i].open();	}}function tree_item (object_parent, node_order) {	this.node_depth  = object_parent.node_depth + 1;	this.a_config = object_parent.a_config[node_order + (this.node_depth ? menu_item_depth : 0)];	if (!this.a_config) return;	this.object_root    = object_parent.object_root;	this.object_parent  = object_parent;	this.node_order     = node_order;		this.b_opened       = !this.node_depth;	this.node_id        = this.object_root.a_index.length;		this.object_root.a_index[this.node_id] = this;	object_parent.a_children[node_order]   = this;	this.a_children = [];	for (var i = 0; i < this.a_config.length - 2; i++)		new tree_item(this, i);	// -- this.get_icon   = item_get_icon;	this.open       = item_open;	this.select     = item_over;	this.init       = item_init;		// -- this.upstatus   = item_upstatus;		// added	this.is_open    = false;		this.is_last    = function () { 		return this.node_order == this.object_parent.a_children.length - 1;	};		// added 	this.close          = item_close;	this.setmark        = item_setmark;	this.get_node       = item_get_node;	this.item_reset	    = item_reset;		this.mouse_over     = item_over;	this.mouse_out      = item_over;		this.img_normal     = this.a_config[0];	this.img_over       = (this.a_config[1] 				? this.a_config[1] : this.a_config[0]);	this.img_selected   = (this.a_config[1] 				? this.a_config[1] : this.a_config[0]);	this.descr_title    = (this.a_config[2]				? this.a_config[2] : '');					is_mac_ie 			= browser_detect();	this.url            = (this.a_config[3] 			 	? this.a_config[3] : (this.a_children.length 					? (is_mac_ie == true 						? 'javascript: trees[' + (this.object_root.node_id ? this.object_root.node_id : 0) + '].toggle(' + this.node_id + ')' : '#') 					: null));	this.item_target    = (this.a_config[3] 				? this.object_root.a_tpl['target'] : '_self');					this.node_type      = this.a_config[4];		all_images[all_images.length++] = this.img_normal;	all_images[all_images.length++] = this.img_over;	all_images[all_images.length++] = this.img_selected;	}function item_open (b_close) {	// b_close is TRUE or FALSE	// trigger close olditem but prevent from retrigger recursively	var object_olditem = this.object_root.object_selected;	var object_locked  = this;	// allow root to be opened on start	if (this.node_id == 0 || this.is_open != true){		// don't close manually, don't execute close, if no children or if parent open		this.is_open = (!b_close && this.a_children.length) ? true : false;				if (object_olditem && object_locked && object_locked != object_olditem) {			// only close olditem, if current item			// has children itself and current open node is not 			// a parent node of this node			if (this.a_children.length && object_olditem != this.object_parent){								this.object_root.close(object_olditem.node_id)			}else if(this.a_children.length && object_olditem.node_id == 0){				// switch image but don't close				object_olditem.is_open = false;				this.object_root.close(object_olditem.node_id);			}else{				this.setmark(object_olditem.node_id);			}		}				var object_idiv = get_element('i_div' + this.object_root.node_id + '_' + this.node_id);		if (!object_idiv) return;				if (!object_idiv.innerHTML) {			var a_children = [];			for (var i = 0; i < this.a_children.length; i++)				a_children[i]= this.a_children[i].init();			object_idiv.innerHTML = a_children.join('');		}				if (this.node_id == 0) {			object_idiv.style.display = (root_closeable ? 'none' : 'block');		}else{			object_idiv.style.display = (b_close ? 'none' : 'block');		}		if(this.node_type == 'chef')		{			this.a_children[0].is_open=true;			document.images['i_img0_' + (this.node_id+1)].src = this.a_children[0].img_selected;			chefopened=(this.node_id+1);		}				this.b_opened = !b_close; // toggle TRUE or FALSE		var object_iicon = document.images['i_img' + this.object_root.node_id + '_' + this.node_id];		if (object_iicon) {			object_iicon.src = this.img_selected;		}		}	// set olditem to this	this.object_root.object_selected = this;			this.item_reset();	}// addedfunction item_close(){	if (this.is_open){ 		var object_idiv = get_element('i_div' + this.object_root.node_id + '_' + this.node_id);		if (!object_idiv) return;				if (!object_idiv.innerHTML) {			var a_children = [];			for (var i = 0; i < this.a_children.length; i++)				a_children[i]= this.a_children[i].init();			object_idiv.innerHTML = a_children.join('');		}				object_idiv.style.display = 'none';				var object_iicon = document.images['i_img' + this.object_root.node_id + '_' + this.node_id];		object_iicon.src = this.img_normal;				this.b_opened = false;		this.is_open  = false;		// close parent, if open and if not root		if (this.object_parent && this.object_parent.node_id != 0 && this.object_parent.is_open == true) this.object_root.close(this.object_parent.node_id);					}else{		// toggle image state		var object_iicon = document.images['i_img' + this.object_root.node_id + '_' + this.node_id];		object_iicon.src = this.img_normal;			}}function item_setmark(){	var object_iicon = document.images['i_img' + this.object_root.node_id + '_' + this.node_id];	if (object_iicon) {		object_iicon.src = this.img_selected;	}			this.item_reset();}function item_reset(){	var object_oldclicked = this.object_root.clicked_object;	this.object_root.clicked_object = this;		if (object_oldclicked && object_oldclicked != this && object_oldclicked != this.object_parent){		var object_oicon = document.images['i_img' + this.object_root.node_id + '_' + object_oldclicked.node_id];		if (object_oicon) object_oicon.src = object_oldclicked.img_normal;		}}function item_over (b_deselect) {	// always toggle back to the original image	var object_iicon = document.images['i_img' + this.object_root.node_id + '_' + this.node_id];	if (object_iicon) {	  if (b_deselect == 'out') {	    if (this.is_open || this.object_root.clicked_object == this) {	    	object_iicon.src = this.img_selected;	    }else{	    	object_iicon.src = this.img_normal;	    }	  }else{	    object_iicon.src = this.img_selected;	  }	}	get_element('i_txt' + this.object_root.node_id + '_' + this.node_id).style.fontWeight = b_deselect ? 'normal' : 'bold';		return Boolean(this.url);}function item_init () {	var a_offset = [],		object_current_item = this.object_parent;	// get code depending on node type	return this.get_node();} function item_get_node(){	switch (this.node_type){		case 'chef':		case 'standard':			return '<table cellpadding="0" cellspacing="0" border="0"><tr><td nowrap>' 				+ (this.url ? '<a href="' + this.url + '" target="' + this.item_target + '"  title="' + this.descr_title + '"' + (!this.b_opened || this.node_id == 0  ?  ' onclick="trees[' + this.object_root.node_id + '].toggle(' + this.node_id + '); this.blur()"' : ' onclick="trees[' + this.object_root.node_id + '].setmark(' + this.node_id + ')"; this.blur()' ) + '" onmouseover="trees[' + this.object_root.node_id + '].mover(' + this.node_id + ')" onmouseout="trees[' + this.object_root.node_id + '].mout(' + this.node_id + ')" id="i_txt' + this.object_root.node_id + '_' + this.node_id + '">' : '' )				+ '<img src="' + (this.b_opened ? this.img_selected : this.img_normal) + '" border="0" align="absbottom" name="i_img' + this.object_root.node_id + '_' + this.node_id + '">'				+ (this.url ? '</a>' : '' ) + '</td></tr></table>' + (this.a_children.length ? '<div id="i_div' + this.object_root.node_id + '_' + this.node_id + '" style="display:none"></div>' : '');			break;		case 'webcam':			return '<table width="180" border="0" cellspacing="0" cellpadding="12"><tr><td background="images/menu/n_webcam_x_01.gif" align="left" valign="top">'				+ (this.url ? '<a href="' + this.url + '" target="' + this.item_target + '"  title="' + this.descr_title + '" onClick="this.blur()">' : '')				+ '<img src="' + this.img_normal + '" border="0">'				+ (this.url ? '</a>' : '')				+ '</td></tr></table>';			break;		}}function img_preload(all_images){  var doc=document; if(doc.images){ if(!doc.image_preload) doc.image_preload=new Array();    var i,j=doc.image_preload.length,a=img_preload.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ doc.image_preload[j]=new Image; doc.image_preload[j++].src=a[i];}}}function run_image_preload(){	preload_string = all_images.join(",");	img_preload(preload_string);}var trees = [];get_element = document.all ?	function (s_id) { return document.all[s_id] } :	function (s_id) { return document.getElementById(s_id) };