// Title: Tigra Menu GOLD// URL: http://www.softcomplex.com/products/tigra_menu_gold/// Version: 2.4// Date: 05-22-2003 (mm-dd-yyyy)// Technical Support: support@softcomplex.com (specify product title and order ID)// Notes: Registration needed to use this script legally.// Visit official site for details.// A path to Tigra Menu GOLD files from the PAGE containinig Menuvar TMenu_path_to_files = 'http://www.oregon.gov/menu_files/';// Please, don't change below this line// ----------------------------------------------------------------------------------var menus = [], o_doc, actions = ['click', 'mouseout', 'mouseover', 'mousedown'];function doc_load (myfunc) {		var s = window[this.s_onload] ? new String(window[this.s_onload]) : '', pos;	if ((pos = s.indexOf("{")) > -1) s = s.substring(pos + 1, s.lastIndexOf("}") - 1) + ';';	window.onload = Function(s + myfunc);}function doc_redraw () {	for (var i in menus) {		menus[i].redraw();		menus[i].active = true;	}}function doc_update () {	var n_value, b_refresh;// verify if any environment paramenters changed	if (this.width != (n_value = this.f_width(window))) {		this.width = n_value;		b_refresh = true;	}	if (this.height != (n_value = this.f_height(window))) {		this.height = n_value;		b_refresh = true;	}	if (this.xscroll != (n_value = this.f_xscroll(window))) {		this.xscroll = n_value;		b_refresh = true;	}	if (this.yscroll != (n_value = this.f_yscroll(window))) {		this.yscroll = n_value;		b_refresh = true;	}	if (b_refresh) this.redraw()	window.setTimeout('o_doc.update()', 500);}// --------------------------------------------------------------------------------// menu class constructor// --------------------------------------------------------------------------------function menu (item_struct, o_cfg, a_frames, s_key, a_forms) {	this.is_master = Boolean(a_frames);	this.a_forms = a_forms ? a_forms : [];	this.item_struct = item_struct;	this.o_cfg = o_cfg;	this.o_cfg_cust = [];	this.items       = [];	this.a_kids    = [];	this.over_items  = 0;		this.exec        = menu_exec;	this.hide        = menu_hide;	this.on = [];	this.onclick     = menu_onclick;	this.onmouseout  = menu_onmouseout;	this.onmouseover = menu_onmouseover;	this.onmousedown = menu_onmousedown;	this.redraw      = menu_redraw;	this.build       = menu_build;	this.selectsHide = TMGSelectsHide;		this.o_cfg_def = {		'width'      : 100,		'height'     : 20,		'block_top'  : 20,		'block_left' : 20,		'vertical'   : false,		'expd_delay' : 0,		'hide_delay' : 100,		'table'      : [0, 0, 0],		'css' : {			'table' : '',			'inner' : '',			'outer' : ''		}	};		this.getProp = function (s_key) {		return this.o_cfg_def[s_key];	};	// prepare environment object	if (!o_doc) {		o_doc = new doc();		o_doc.b_Gecko = navigator.userAgent.indexOf('Gecko') > -1;		o_doc.pix = TMenu_path_to_files + 'pixel.gif';		if (!o_doc.s_onload) o_doc.s_onload = 'onload';		o_doc.f_width   = window.innerWidth != null ? 			function (w) { return w.innerWidth } : function (w) { return w.document.body.offsetWidth }		o_doc.f_height  = window.innerHeight != null ?			function (w) { return w.innerHeight } : function (w) { return w.document.body.offsetHeight }		o_doc.f_xscroll = window.pageXOffset != null ? 			function (w) { return w.pageXOffset } : function (w) { return w.document.body.scrollLeft }		o_doc.f_yscroll = window.pageYOffset != null ?			function (w) { return w.pageYOffset } : function (w) { return w.document.body.scrollTop }		o_doc.onload = doc_load;		o_doc.redraw = doc_redraw;		o_doc.update = doc_update;	}	// register in global menus collection	this.id = s_key != null ? s_key : menus.length;	menus[this.id] = this;	this.subling = window;	this.subHTML = [];	this.child_count = this.item_struct.length;	for (var i = 0; i < this.child_count; i++)		new menu_item(i, this, this, i);	// calculate menu sizes	this.build(this.a_kids[0].getProp('table'))	for (i = 0; i < this.child_count; i++) this.a_kids[i].links();		if (top != window) {		if (!top.TMenu) top.TMenu = [];		if (!top.TMenu[this.id]) top.TMenu[this.id] = { 'frames' : [] }		this.sync = top.TMenu[this.id];		if (this.is_master) {			this.sync.win = window;				this.a_frames = [];			for (i in a_frames) {				this.a_frames[i] = [];				for (var j in a_frames[i])					this.a_frames[i][j] = eval('top.' + a_frames[i][j]);			} 		}		this.sync.frames[window.name] = window;		o_doc.onload ("o_doc.update()")	}	else o_doc.onload ("o_doc.redraw()")}// --------------------------------------------------------------------------------// menu event handlers// --------------------------------------------------------------------------------function menu_redraw () {	if (this.sync) {			if (typeof(this.a_frames) != 'object') {			if (!this.sync.main) return setTimeout('menus["' + this.id + '"].redraw()', 100);			this.a_frames = this.sync.win.menus[this.id].a_frames		}		if (this.is_master) {			var me, y_shift = 0, x_shift;						if (!this.sync.matrix) this.sync.matrix = []			for (i in this.a_frames) {				x_shift = 0;				for (j in this.a_frames[i]) {					this.sync.matrix[this.a_frames[i][j].name] = {						'x' : x_shift,						'y' : y_shift					}					if (o_doc.isIE)						if (!this.a_frames[i][j].document.body) 							return setTimeout('menus["' + this.id + '"].redraw()', 100);					x_shift += o_doc.f_width(this.a_frames[i][j]);				}				y_shift += o_doc.f_height(this.a_frames[i][j]);			}							this.sync.main = o_doc.getOffs(this.main, 				this.sync.matrix[window.name].x - o_doc.f_xscroll(window), 				this.sync.matrix[window.name].y - o_doc.f_yscroll(window))			for (var i in this.sync.frames) 				if (this.sync.frames[i] != window) this.sync.frames[i].o_doc.redraw()		}		else			o_doc.divMove(this.main, {				'x' : this.sync.main.x - this.sync.matrix[window.name].x + o_doc.f_xscroll(window), 				'y' : this.sync.main.y - this.sync.matrix[window.name].y + o_doc.f_yscroll(window)				}			)	}	if (document.layers) {		for (var n_i = 0; n_i < this.child_count; n_i++) this.a_kids[n_i].set_state(0);	}	else if (b_notDOM)		for (var n_i = 0; n_i < this.child_count; n_i++) this.a_kids[n_i].pos();}function menu_exec (id, action) {	if (!this.active) return;	if (this.sync && action)		for (var i in this.sync.frames) 			this.sync.frames[i].menus[this.id]['on' + actions[action]](id);	else if (this.sync && !this.is_master) 		return this.sync.win.menus[this.id]['on' + actions[action]](id);	else		return menus[this.id]['on' + actions[action]](id);}function menu_hide () {	if (this.last_item) this.last_item.collapse(0);	if (!this.t_hide || /*this.over_items || */!this.last_item)	return;	this.last_item = null;	if (!o_doc.isIE6 && !o_doc.b_Gecko) this.selectsHide(true);}function menu_onclick (id) {	var b_go = Boolean(this.items[id].fields[1]);	if (b_go && this.sync)		for (var i in this.sync.frames) 			this.sync.frames[i].menus[this.id].last_item.collapse(0);		return b_go;}function menu_onmouseout (id) {	this.items[id].set_state(0);//	this.over_items--;	if (this.t_expd) clearTimeout(this.t_expd);	this.t_hide = setTimeout('menus["'+ this.id +'"].hide()',	this.items[id].getProp('hide_delay'));	if (this.items[id].o_cfg_cust.sb != null) top.status = '';}function menu_onmouseover (id) {		for (var o_item = this.items[id]; o_item.elements; o_item = o_item.o_parent) o_item.set_state(1);	var o_item = this.items[id];	clearTimeout(this.t_hide);	this.t_hide = null;		// set status bar message	if (o_item.o_cfg_cust.sb != null) 		setTimeout('menus["'+ this.id + '"].items['+ id + '].set_status()', 10);		// item can not be unhighlighted	this.o_hovered = o_item;	// expand the item	if (o_item.o_parent.a_kids[0].n_delay_expd)		this.t_expd = setTimeout('menus["'+ this.id +'"].items['+ id +'].expand()', o_item.o_parent.a_kids[0].n_delay_expd);	else o_item.expand();}function menu_onmousedown (id) {	this.items[id].set_state(2);}// --------------------------------------------------------------------------------// menu item class constructor// --------------------------------------------------------------------------------function menu_item (path, o_parent, o_root, n_index) {	this.path = new String (path);	this.o_parent = o_parent; this.o_root = o_root;	this.arrpath = this.path.split('_');	this.depth = this.arrpath.length - 1;	// get reference to item's data in the structure	var struct_path = '';	for (var i = 0; i <= this.depth; i++)		struct_path += '[' + (Number(this.arrpath[i]) + (i ? 3 : 0)) + ']';	eval('this.fields = this.o_root.item_struct' + struct_path);	if (!this.fields) return;	this.o_cfg_cust = this.fields[2] ? this.fields[2] : [];	// register self in the collections	this.id = this.o_root.items.length;	this.o_root.items[this.id] = this;	o_parent.a_kids[o_parent.a_kids.length] = this;	this.set_state = mitem_state;	this.set_status = mitem_status;	this.pos = mitem_position;	this.build = mitem_build;	this.buildSub = mitem_buildSub;	this.getProp = mitem_getprop;	this.getCSS  = mitem_getstyle;	this.links = mitem_links;	this.collapse = mitem_collapse;	this.expand = mitem_expand;	// initializing parameters needed for the first item only	if (!n_index) {		if (o_doc.b_Gecko)		{			this.n_block_top  = this.o_parent.o_cfg_cust.bt 				? this.o_parent.o_cfg_cust.bt 				: this.getProp('block_top_netscape');			this.n_block_left = this.o_parent.o_cfg_cust.bl 				? this.o_parent.o_cfg_cust.bl 				: this.getProp('block_left_netscape');		}		else		{			this.n_block_top  = this.o_parent.o_cfg_cust.bt 				? this.o_parent.o_cfg_cust.bt 				: this.getProp('block_top');			this.n_block_left = this.o_parent.o_cfg_cust.bl 				? this.o_parent.o_cfg_cust.bl 				: this.getProp('block_left');		}		this.b_expd_top   = this.getProp('top') < 0;		this.b_expd_left  = this.getProp('left') < 0;		this.n_width  = this.getProp('width'); 		this.n_height = this.getProp('height');		this.b_vertical   = this.getProp('vertical');		this.n_wise_pos   = this.getProp('wise_pos');		this.o_shadow     = this.getProp('shadow');		this.n_delay_expd = this.getProp('expd_delay');	}		// calculating sizes	var n_w = this.o_parent.a_kids[0].n_width, n_h = this.o_parent.a_kids[0].n_height;	if (this.o_parent.a_kids[0].b_vertical) {		if (this.o_parent.o_cfg_cust.bw != null) n_w = this.o_parent.o_cfg_cust.bw;		if (this.o_cfg_cust.sh != null) n_h = this.o_cfg_cust.sh;	}	else {		if (this.o_parent.o_cfg_cust.bh != null) n_h = this.o_parent.o_cfg_cust.bh;		if (this.o_cfg_cust.sw != null) n_w = this.o_cfg_cust.sw;	}		// building HTML instanse	this.o_parent.subHTML[n_index] = this.build(n_w, n_h);	this.child_count = this.fields.length - 3;	if (this.child_count > 0) {		this.a_kids = [];		this.f_born_kids = mitem_born_kids;		if (b_notDOM && !document.layers) {			this.f_born_kids(1);			document.write (this.subHTML.join(''));			this.subling = o_doc.getElem('m' + this.o_root.id + 'c' + this.id);			if (o_doc.b_Gecko) {				var o_t = o_doc.getElem('m' + this.o_root.id + 't' + this.id);				this.subling.style.width = o_t.offsetWidth;			}			for (i in this.a_kids) this.a_kids[i].links();		}	}}// --------------------------------------------------------------------------------// menu item handlers// --------------------------------------------------------------------------------function mitem_born_kids (b_no_links) {	this.subHTML = [];	for (var i = 0; i < this.child_count; i++) 		new menu_item (this.path + '_' + i, this, this.o_root, i);	this.buildSub();	if (!b_no_links) for (i in this.a_kids) this.a_kids[i].links();}function mitem_status () {	top.status = this.o_cfg_cust.sb;}// --------------------------------------------------------------------------------// reads property from template file, inherits from o_parent level if not found// ------------------------------------------------------------------------------------------function mitem_getprop (s_key) {	// check if value is defined for current level	var s_value = null, 		a_level = this.o_root.o_cfg[this.depth];	// return value if explicitly defined	if (a_level)		s_value = a_level[s_key];	// request recursively from o_parent levels if not defined	return (s_value == null ? this.o_parent.getProp(s_key) : s_value);}// --------------------------------------------------------------------------------// reads property from template file, inherits from parent level if not found// ------------------------------------------------------------------------------------------function mitem_getstyle (s_pos, n_state) {	var a_css = this.getProp('css'),		a_oclass = a_css[s_pos];	// same class for all states		if (typeof(a_oclass) == 'string')		return a_oclass;	// inherit class from previous state if not explicitly defined	for (var n_currst = n_state; n_currst >= 0; n_currst--)		if (a_oclass[n_currst])			return a_oclass[n_currst];}// sets item's position on the pagefunction mitem_position (coord, value) {	if (this.child_count > 0) {			var o_kid = this.a_kids[0],			o_pos = o_doc.getOffs(this.elements[0], 			this.o_cfg_cust.bl ? this.o_cfg_cust.bl : o_kid.n_block_left, 			this.o_cfg_cust.bt ? this.o_cfg_cust.bt : o_kid.n_block_top);		if (o_kid.b_expd_left) 			o_pos.x -= o_doc.divSize(this.subling);		if (o_kid.b_expd_top) 			o_pos.y -= o_doc.divSize(this.subling, 1);		if (o_kid.n_wise_pos && !this.o_root.sync) {			var wise = o_kid.n_wise_pos,			w_div = o_doc.divSize(this.subling, 0), h_div = o_doc.divSize(this.subling, 1),			w_win = o_doc.f_width(window), h_win = o_doc.f_height(window),			w_scr = o_doc.f_xscroll(window), h_scr = o_doc.f_yscroll(window);			if (o_pos.x + w_div > w_win + w_scr) 				o_pos.x = (wise == 1 ? w_win + w_scr : o_pos.x) - w_div;			if (o_pos.y + h_div > h_win + h_scr) 				o_pos.y = (wise == 1 ? h_win + w_scr : o_pos.y) - h_div;			if (o_pos.x < w_scr) o_pos.x = w_scr;			if (o_pos.y < h_scr) o_pos.y = h_scr;		}		o_doc.divMove(this.subling, o_pos)//		if (!this.depth) alert(o_pos.x)		if (this.sublingBack) o_doc.divMove(this.sublingBack, o_pos);		if (this.sublingShad) 			o_doc.divMove(this.sublingShad, {				'x' : o_pos.x + o_kid.o_shadow.offX, 				'y' : o_pos.y + o_kid.o_shadow.offY			}		);		if (b_notDOM && !document.layers)			for (var n_i = 0; n_i < this.child_count; n_i++) this.a_kids[n_i].pos();	}}// Linkingvar b_notDOM = navigator.appVersion.indexOf('MSIE') == -1 || (navigator.appVersion.indexOf('Mac') > -1 && navigator.appVersion.indexOf('MSIE') > -1) || navigator.userAgent.indexOf('Konqueror') > -1;document.write ('<scr' + 'ipt language="JavaScript" src="' + TMenu_path_to_files + 'menu.' 	+ (document.layers ? 'lay' : b_notDOM ? 'opr' : 'dom') + '.js"></scr' + 'ipt>')