// Menu code Notes.
// 4 Sections, Menu contents, Styles of menu bars, Src Code and Boot Code
// each section separated by /**************/ bar
//



/******************************************* Styles & Positions *****************************************/


/* --- geometry and timing of the menu --- */
var MENU_POS2 = {
	// item sizes for different levels of menu
	'width': [99, 250, 250],
	'height': [20, 20, 20],
	// menu block offset from the origin:
	//	for root level origin is upper left corner of the page
	//	for other levels origin is upper left corner of parent item
	'block_top': [111, 20, 20],
	'block_left': [7, 0, 0],
	// offsets between items of the same level
	'top': [0, 20, 20],
	'left': [100, 0, 0],
	// time in milliseconds before menu is hidden after cursor has gone out
	// of any items
	'hide_delay': [200, 200, 200]
};
	
/* --- dynamic menu styles ---
note: you can add as many style properties as you wish but be not all browsers
are able to render them correctly. The only relatively safe properties are
'color' and 'background'.
*/
var MENU_STYLES2 = {
	// default item state when it is visible but doesn't have mouse over
	'onmouseout': [
		'color', ['#00007f', '#00007f', '#00007f'], 
		'background', ['#e0f0ff', '#e0f0ff', '#e0f0ff'],
	],
	// state when item has mouse over it
	'onmouseover': [
		'color', ['#ff0000', '#ff0000', '#ff0000'], 
		'background', ['#cccccc', '#cccccc', '#cccccc'],
	],
	'onmousedown': [
		'color', ['#ffffff', '#ffffff', '#ffffff'], 
		'background', ['#ff0000', '#ff0000', '#ff0000'],
	]
};



/******************************************* Code *********************************************/

// Title: tigra menu
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_menu/
// Version: 1.0
// Date: 01-09-2002 (mm-dd-yyyy)
// Contact: feedback@softcomplex.com (specify product title in the subject)
// Notes: Registration needed to use this script on your web site.
// 	Registration for this version (1.0) is free of charge.
//	See official site for details

var menus = [];

//////////////////////////////////////////////////////////////////////////////////////
// Email Form preload and process Util functions
//
//

// Preload our email form intelligently
function MailFormPreLoad()
{
   var strthisurl = window.location.href;
   var newtitle, lang_subdirstr = ""; 

    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("spanish") != -1) {
       lang_subdirstr = "spanish/";
   }
   if (strthisurl.indexOf("french") != -1) {
       lang_subdirstr = "french/";
   }
    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("german") != -1) {
       lang_subdirstr = "german/";
   }
   // choose approp full path to jump to
    next_url = menu_get_path("");

// If this form blows up here - its because frontpage has added an extra /FORM tag to your html upon saving
// remove it with notepad and resave - microsoft idiots!!!!

    EdsContactForm.redirect.value = next_url + lang_subdirstr + "email_done.htm";
//debug        alert (EdsContactForm.redirect.value);

   // choose the mail option for the email
   if ( strthisurl.indexOf("support") != -1) {
      EdsContactForm.subject.options[1].selected = true; 
      EdsContactForm.message.value = "I would like to receive support on the following issue(s):"; 
   }
   if ( strthisurl.indexOf("updates") != -1) {
      EdsContactForm.subject.options[3].selected = true; 
      EdsContactForm.message.value = "I would like to receive instructions on obtaining or downloading software updates"; 
   }
   if ( strthisurl.indexOf("info") != -1) {
      EdsContactForm.subject.options[2].selected = true; 
      EdsContactForm.message.value = "I would like to receive information as follows:"; 
   }
   if ( strthisurl.indexOf("sales") != -1) {
      EdsContactForm.subject.options[0].selected = true; 
      EdsContactForm.message.value = "I would like to receive SALES information as follows:"; 
   }
   if ( strthisurl.indexOf("_ems") != -1) {
      EdsContactForm.subject.options[4].selected = true; 
      EdsContactForm.message.value = "I would like to receive EMS service information as follows:"; 
   }
   if ( strthisurl.indexOf("_trn") != -1) {
      EdsContactForm.subject.options[5].selected = true; 
      EdsContactForm.message.value = "I would like to receive Training Course information for <10> persons for <Elecdes/Paneldes/Instrument Manager> as follows:"; 
   }
   if ( strthisurl.indexOf("_lgcy") != -1) {
      EdsContactForm.subject.options[6].selected = true; 
      EdsContactForm.message.value = "I would like to receive legacy drawing conversion information for my drawings which number <1000> <A1> sheets."; 
   }
   if ( strthisurl.indexOf("_cust") != -1) {
      EdsContactForm.subject.options[7].selected = true; 
      EdsContactForm.message.value = "I would like to receive EDS Customisation information related to <Custom Programs / Custom Library> development as follows:"; 
   }
   if ( strthisurl.indexOf("_ie") != -1) {
      EdsContactForm.subject.options[8].selected = true; 
      EdsContactForm.message.value = "I would like to get information about the cost and delivery time for an Electrical Drafting project. The details are:"; 
   }
   if ( strthisurl.indexOf("_sm") != -1) {
      EdsContactForm.subject.options[9].selected = true; 
      EdsContactForm.message.value = "I would like to get some sample Electrical Diagrams produced by Elecdes Manpower. My region and industry are:"; 
   }
   if ( strthisurl.indexOf("_plc") != -1) {
      EdsContactForm.subject.options[10].selected = true; 
      EdsContactForm.message.value = "I would like to get pricing for a PLC-DCS Programming project. The details are:"; 
   }
   if ( strthisurl.indexOf("_scada") != -1) { //nb need underscores to avoid picking up strings in rest of path 
      EdsContactForm.subject.options[11].selected = true; 
      EdsContactForm.message.value = "I would like to get pricing for a SCADA project. The details are:"; 
   }
}

// ensure all bits of our  email form message are included
function MailFormAssembleMessage()
{
    EdsContactForm.name.value =      EdsContactForm.realname.value;
    EdsContactForm.textemail.value = EdsContactForm.email.value;

    // into downloader box for sales enquiries (other 4 go to "info@elecdes.com"
    if (EdsContactForm.subject.value.indexOf("Sales") != -1) {
        EdsContactForm.recipient.value = "downloader@elecdes.com";
	}
	//alert (EdsContactForm.recipient.value);
}


//////////////////////////////////////////////////////////////////////////////////////
// Demo Form preload and process Util functions
//
//
// Preload our demo form intelligently
function DemoFormPreLoad()
{
   var strthisurl = window.location.href;
   var newtitle,lang_subdirstr = ""; 

    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("spanish") != -1) {
       lang_subdirstr = "spanish/";
   }
   if (strthisurl.indexOf("french") != -1) {
       lang_subdirstr = "french/";
   }
    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("german") != -1) {
       lang_subdirstr = "german/";
   }

   // choose approp full path to jump to
   next_url = menu_get_path("");

// If this form blows up here - its because frontpage has added an extra /FORM tag to your html upon saving
// remove it with notepad and resave - microsoft idiots!!!!

   // default redirect
   EdsDemoForm.redirect.value = next_url + lang_subdirstr + "demo_done_cd.htm";
   EdsDemoForm.Request[0].checked = true; 

   // choose the mail option for the email
   if ( strthisurl.indexOf("?CD") != -1) {
      EdsDemoForm.Request[0].checked = true; 
   }
   if ( strthisurl.indexOf("?WD") != -1) {
      EdsDemoForm.Request[1].checked = true; 
   }
   if ( strthisurl.indexOf("?PJ") != -1) {
      EdsDemoForm.Request[2].checked = true; 
   }
   if ( strthisurl.indexOf("?MV") != -1) {
      EdsDemoForm.Request[3].checked = true; 
   }
}

// ensure all bits of aour message are included
function DemoFormAssembleMessage()
{    
    var subjstr, str, lang_subdirstr = ""; 
	var strthisurl = window.location.href;

    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("spanish") != -1) {
       lang_subdirstr = "spanish/";
   }
   if (strthisurl.indexOf("french") != -1) {
       lang_subdirstr = "french/";
   }
    //redirect may be into a langauge subdir
   if (strthisurl.indexOf("german") != -1) {
       lang_subdirstr = "german/";
   }
    
	EdsDemoForm.name.value =      EdsDemoForm.realname.value;
    EdsDemoForm.textemail.value = EdsDemoForm.email.value;
	
	
   if (EdsDemoForm.Request[0].checked == true) {
       subjstr= "Hi-I-Want-A-CD!!";
       // prior to submitting form force the address item to be required
       str = "" + EdsDemoForm.required.value +",address";
       EdsDemoForm.required.value = str;
       EdsDemoForm.redirect.value = next_url +lang_subdirstr+ "demo_done_cd.htm";
    }
    if (EdsDemoForm.Request[1].checked == true) {
       subjstr= "Hi-I-Want-A-Web-Demo";
      EdsDemoForm.redirect.value = next_url +lang_subdirstr+  "demo_done_webdemo.htm";
    }
    if (EdsDemoForm.Request[2].checked == true) {
       subjstr= "Hi-I-Want-to-evaluate-A-Sample-Project!!";
       EdsDemoForm.redirect.value = next_url +lang_subdirstr+  "demo_done_samples.htm";
    }
    if (EdsDemoForm.Request[3].checked == true) {
       subjstr= "Hi-Im-a-WebSiteMovieDownLoader!!";
      EdsDemoForm.redirect.value = next_url +lang_subdirstr+  "demo_done_movie.htm";
    }
   

   // load the  subject and message string
   EdsDemoForm.subject.value = subjstr;
   EdsDemoForm.message.value = subjstr;
   
   // take care of "nothing selected" choice in cad pakg and numb users 
   // this will cause form to re-ask for data
	if (EdsDemoForm.CadPackage.value == "Nothing Selected") {
		EdsDemoForm.CadPackage.value = "";
	}
	if (EdsDemoForm.ElectCadUsers.value == "Nothing Selected") {
		EdsDemoForm.ElectCadUsers.value = "";
	}
}


//////////////////////////////////////////////////////////////////////////////////////
// Util function to see if we are in one of the langauge subdirectories
//
//
function menu_get_path( subdirtoadd ) 
{
    var strThisUrl = window.location.href;   // this items URL
	var index;
	var pathfound;
	var slashtoadd = "";

	if (subdirtoadd != "") {
		slashtoadd = "/";
	}

    // see where we are hosting frontpage
    index = strThisUrl.indexOf ("temp");
    if (index != -1) {   
	   pathfound = "http://david/scada2003/" +  subdirtoadd + slashtoadd;                
	   return pathfound;
	}

	// try the 2003 development
    index = strThisUrl.indexOf ("scada2003");
    if (index != -1) {   
	   pathfound = "http://david/scada2003/" +  subdirtoadd + slashtoadd;              
	   return pathfound;
	}
	// try the nz server
    index = strThisUrl.indexOf ("david"); 
    if (index != -1) {                   
	   pathfound = "http://david/" +  subdirtoadd + slashtoadd;               
	   return pathfound;
	}
    // else its elecdes.com
   pathfound = "http://www.elecdes.com/" +  subdirtoadd + slashtoadd;                
   return pathfound;
}

//////////////////////////////////////////////////////////////////////////////////////
// Util function Change the image when rolled over or released
//
//

function menu_change_named_image(imagename, new_image_path) 
{
//	alert ( 'B4 flags[i].src ' + flags[i].src + '; i is ' + i +' \nimagename is ' 
//	+ imagename + '\n document.images[imagename].src is now,' + document.images[imagename].src 
//	+ '\ngeorge.src is ' + george.src  );

	if (document.images) document.images[imagename].src = new_image_path;

}


/////////////////////////////////////////////////////////////////////////////////////
// Globals for slideshow speed

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 3


//////////////////////////////////////////////////////////////////////////////////////
// Util function to click over a slide 
//
//


function menu_slide_change(imagename, slide_number) 
{
    var new_image_path;
    
    // number requested directly
    if (slide_number >= 0) {
	  this.slide_show.currentslide = slide_number;
	} else { 
	   // else incremented
       this.slide_show.currentslide++; // else increment
	}
    
	// limit requested / incremented number
	if (this.slide_show.currentslide >=  this.slide_show.count) {
	   this.slide_show.currentslide = 0; // save current slide num
	}

    // Demand load version 
	// set up slide only as required
	if (this.slide_show.szfilenamepath[this.slide_show.currentslide] != "") {
        window.status = "Loading " +  this.slide_show.szfilenamepath[this.slide_show.currentslide] + "  ...";
	    this.slide_show.SlideImages[this.slide_show.currentslide].src = this.slide_show.szfilenamepath[this.slide_show.currentslide];
		this.slide_show.szfilenamepath[this.slide_show.currentslide] = "";
        window.status = "Done";
	}

    // build string
    new_image_path = "" + this.slide_show.SlideImages[  this.slide_show.currentslide  ].src +"";

    // enable cross fade if browser is compatible
	// NB: uses our selected image
	if (document.all)
	{
         document.images[imagename].style.filter="blendTrans(duration=2)"
         document.images[imagename].style.filter="blendTrans(duration=crossFadeDuration)"
         document.images[imagename].filters.blendTrans.Apply()      
    }

    //display it in aour intital image box
	if (document.images) document.images[imagename].src = new_image_path;

    // Run cross fade if browser is compatible
	// NB: uses our selected image
    if (document.all){
      document.images[imagename].filters.blendTrans.Play()
    }


}

//////////////////////////////////////////////////////////////////////////////////////
// Global timeout function for clicking over slides - nb not part of class 
// (couldnt supply hook to outr class as callback, so used global menus[])
//


function global_timeout( imagename, menu_id ) 
{
	menus[menu_id].slide_change(imagename, -1) ;
}


//////////////////////////////////////////////////////////////////////////////////////
// Setup Large Changing graphic on left of page for each page
//

function slide_show( container, container_id, numberofslides, slidefileprefix, ssW, ssH) 
{

    // Check for a count before doing anything
	if (numberofslides < 1) return;
    
	var str;
	var i;

	// Initialise
    this.parent_id = container_id; 
    this.parent    = container; 
    this.xpos = 0;
    this.ypos = 160;
    this.w =    ssW;
    this.h =    ssH;
    this.name = slidefileprefix; 
    this.alt_string = 'EDS slideshow';
	this.SlideImages = [];
	this.count = numberofslides;
	this.slidefilepathandprefix = "";
    this.slidefilesuffix = ".gif";
    this.szfilenamepath = []; 
    
	// set current slide to the first one.
	this.currentslide = 0;

    // build up the filenames, first the path and prefix, requires number AND .gif
   	str = "" + this.parent.get_path("images") + slidefileprefix + "";
	this.slidefilepathandprefix = str;
    
	// now the full filenames are built and the images made
    for (i = 0; i < this.count; i++ ) {
       this.SlideImages[i] = new Image();
	   str = "" + this.slidefilepathandprefix + i + this.slidefilesuffix + "";
//       this.SlideImages[i].src = str;
// Demand load version 
		 this.szfilenamepath[i] = str;
	}

    // Demand load version 
	// set up slide 0 only
	if (this.szfilenamepath[0] != "") {
       	   
       window.status = "Loading " +  this.szfilenamepath[0] + "  ...";
       this.SlideImages[0].src = this.szfilenamepath[0];
       this.szfilenamepath[0] = "";
	   window.status = "Done";
	}
   
    // make the first image appear as a static item and 
  	document.write (
		'<a class = "slide_show"'
			+' style="position: absolute; top: ' + this.ypos + 'px;left: ' + this.xpos + 'px;"'
			+' onClick =   "menus[' + this.parent_id + '].slide_change(\''+this.name+'\', -1 );"'   // change to start on click
			+' ondClick =   "menus[' + this.parent_id + '].slide_change(\''+this.name+'\', 0 );"'   // change to start on click
			+' >'
			+' <img src="'+ this.SlideImages[0].src +'"'
			+' alt=   "'+   this.alt_string   +'"'
			+' width = "'+  this.w            +'"'
			+' height = "'+ this.h            +'"'
			+' name = "' +  this.name         + '"></a>\n'

	);

    // Automatic cycler set to 3 seconds
    setInterval('global_timeout("' + this.name + '",'+ this.parent_id + ')', slideShowSpeed); // default is 5000ms

}

//////////////////////////////////////////////////////////////////////////////////////
// Setup Menu Title Class from html title (displayed in red text on right side of the page)
//
//
function title_bar ( container ) 
{

    this.container = container; 
    this.xpos = 607;
    this.ypos = 131;
    this.w =    196
    this.h =    20;
    this.title =   document.title;

	document.write (
		'<a id=     "Title_Bar"'                   // title for this item
		    +'class="mtitle_bar"'                   // Define our class
			+'style="position: absolute; top: ' + this.ypos + 'px;left: ' + this.xpos + 'px; width: '
			+ this.w + 'px; height: ' + this.h + 'px; z-index: 4;'
			+'" >'
			+'<div class="mtitle_bar" name="title_bar"> '+ this.title+' </div></a>\n'

	);

}



//////////////////////////////////////////////////////////////////////////////////////
// Setup 4 language flags in this class and thier rollovers
// also a language flag item class
//
function lang_flags_item( container , grandparent, grandparent_id, name, href,  up_image, dn_image, alt_string, xpos, ypos) 
{
	var up_src_string;
	var dn_src_string;
	var href_string;
	var index;

    this.w =    24
    this.h =    16;
    this.xpos = xpos;
    this.ypos = ypos;
	this.name = name;
    this.up_image = new Image();
    this.dn_image = new Image();
	this.container = container;
    this.grandparent = grandparent;
	this.grandparent_id = grandparent_id;
	this.alt_string = alt_string;
	this.bkgrd = "#ffffef";

   	up_src_string = "" + grandparent.get_path("images") + up_image + "";
    this.up_image.src = up_src_string;
	dn_src_string = "" + grandparent.get_path("images") + dn_image + "";
    this.dn_image.src = dn_src_string;

    // is the url relative?
    href_string = "" + href + "";
    index = href_string.indexOf ("http");
    if (index == -1) {   // yes its relative
   	    href_string = "" + grandparent.get_path("") + href + "";
	} // ...else ... no its a full path use as is

	this.href = href_string;


  	document.write (
		'<a class = "lang_flags_item" href="'+ this.href +'"'
			+' style="position: absolute; top: ' + this.ypos + 'px;left: ' + this.xpos + 'px;background: ' + this.bkgrd + ';'
			+' width = '+ this.w +';height = '+this.h+';color: white;"'
			+' onMouseOut= "menus[' + grandparent_id + '].change_named_image(\''+this.name+'\',\''+ this.up_image.src +'\');"'
			+' onMouseOver="menus[' + grandparent_id + '].change_named_image(\''+this.name+'\',\''+ this.dn_image.src +'\');"'
			+' >'
			+' <img src="'+ this.up_image.src +'"'
			+' alt=   "'+   this.alt_string   +'"'
			+' width = "'+  this.w            +'"'
			+' height = "'+ this.h            +'"'
			+' name = "' +  this.name         + '"></a>\n'

	);

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Flags container class
//

function lang_flags (container, container_id ) 
{
    // load container class
    this.container =    container;
	this.container_id = container_id; 
    this.xpos =        [0,30,60,90,120];
    this.ypos =        [136,136,136,136,136];
	this.hrefs =       ['elecdes.htm', 'french/elecdes.htm', 'spanish/elecdes.htm','german/elecdes.htm','http://www.ad-design.co.jp/products.htm'];
	this.up_images =   ['flag-e.gif', 'flag-f.gif', 'flag-s.gif','flag-g.gif', 'flag-j.gif'];
	this.dn_images =   ['flag-edown.gif', 'flag-fdown.gif', 'flag-sdown.gif','flag-gdown.gif', 'flag-jdown.gif'];
	this.altstrings =  ['English Language - Home Page','Francais - Home Page','Espanol - Home Page','Deutche - Home Page', 'Visit Japanses Distributor Site AD-DESIGN INC'];
	this.names =       ['flage','flagf','flags','flagg', 'flagj'];
	this.lang_flags_items = [];

	var i;

    // make individual flag classes 
	for (i = 0; i < 5; i++) {
	   this.lang_flags_items[i] = new lang_flags_item    (this, container, container_id, 
	                                                     this.names[i], this.hrefs[i],
                                                         this.up_images[i], this.dn_images[i],this.altstrings[i],
														 this.xpos[i], this.ypos[i]
	                                                     );

	}

}




/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Menu container class  holds all other classes
//
//
function menu (item_struct, pos, styles, numberofslides, slidefileprefix, ssSpeed, ssFade, ssW, ssH) 
{

    // Set global slideShowSpeed (milliseconds)
    slideShowSpeed = ssSpeed;

    // Set global Duration of crossfade (seconds)
    crossFadeDuration = ssFade;

	// browser check
	this.item_struct = item_struct;
	this.pos = pos;
	this.styles = styles;
	this.id = menus.length;
	this.items = [];
	this.children = [];
	
	this.add_item = menu_add_item;
	this.hide = menu_hide;
	
	this.onclick = menu_onclick;
	this.onmouseout = menu_onmouseout;
	this.onmouseover = menu_onmouseover;
	this.onmousedown = menu_onmousedown;
	
	var i;
	for (i = 0; i < this.item_struct.length; i++)
		new menu_item(i, this, this);
	for (i = 0; i < this.children.length; i++)
		this.children[i].visibility(true);
	menus[this.id] = this;

    // 
    // Hook utility functions to our main class
	//
	this.get_path =           menu_get_path;                // hook the path generator function
	this.change_named_image = menu_change_named_image;      // hook the image changer function
    this.slide_change =       menu_slide_change;            // hook the timer function
    

    // 
    // Make subclass items inour main class
	//
	this.title    =       new title_bar ( this );            // make the title bar

    this.lang_flags     = new lang_flags ( this, this.id);   // make new language flag bar items

    this.slide_show =    new slide_show ( this, this.id, numberofslides, slidefileprefix, ssW, ssH); // make new slideshow

  
}
function menu_add_item (item) {
	var id = this.items.length;
	this.items[id] = item;
	return (id);
}
function menu_hide () {
	for (var i = 0; i < this.items.length; i++) {
		this.items[i].visibility(false);
		this.items[i].switch_style('onmouseout');
	}
}
function menu_onclick (id) {
	var item = this.items[id];
	return (item.fields[1] ? true : false);
}
function menu_onmouseout (id) {
	this.hide_timer = setTimeout('menus['+ this.id +'].hide();',
		this.pos['hide_delay'][this.active_item.depth]);
	if (this.active_item.id == id)
		this.active_item = null;
}
function menu_onmouseover (id) {
	this.active_item = this.items[id];
	clearTimeout(this.hide_timer);
	var curr_item, visib;
	for (var i = 0; i < this.items.length; i++) {
		curr_item = this.items[i];
		visib = (curr_item.arrpath.slice(0, curr_item.depth).join('_') ==
			this.active_item.arrpath.slice(0, curr_item.depth).join('_'));
		if (visib)
			curr_item.switch_style (
				curr_item == this.active_item ? 'onmouseover' : 'onmouseout');
		curr_item.visibility(visib);
	}
}
function menu_onmousedown (id) {
	this.items[id].switch_style('onmousedown');
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Menu item class  the bars of the menu
//
//
function menu_item (path, parent, container) {
	this.path = new String (path);
	this.parent = parent;
	this.container = container;
	this.arrpath = this.path.split('_');
	this.depth = this.arrpath.length - 1;
	// get pointer to item's data in the structure
	var struct_path = '', i;
	for (i = 0; i <= this.depth; i++)
		struct_path += '[' + (Number(this.arrpath[i]) + (i ? 2 : 0)) + ']';
	eval('this.fields = this.container.item_struct' + struct_path);
	if (!this.fields) return;
	
	// assign methods	
	this.get_x = mitem_get_x;
	this.get_y = mitem_get_y;
	// these methods may be different for different browsers (i.e. non DOM compatible)
	this.init = mitem_init;
	this.visibility = mitem_visibility;
	this.switch_style = mitem_switch_style;
	
	// register in the collections
	this.id = this.container.add_item(this);
	parent.children[parent.children.length] = this;
	
	// init recursively
	this.init();
	this.children = [];
	var child_count = this.fields.length - 2;
	for (i = 0; i < child_count; i++)
		new menu_item (this.path + '_' + i, this, this.container);
	this.switch_style('onmouseout');
}
function mitem_init() {
	document.write (
		'<a id="mi_' + this.container.id + '_'
			+ this.id +'" class="m' + this.container.id + 'l' + this.depth 
			+'o" href="' + this.fields[1] + '" style="position: absolute; top: '
			+ this.get_y() + 'px; left: '	+ this.get_x() + 'px; width: '
			+ this.container.pos['width'][this.depth] + 'px; height: '
			+ this.container.pos['height'][this.depth] + 'px; visibility: hidden;'
			+' background: black; color: white; z-index: ' + this.depth + ';" '
			+ 'onclick="return menus[' + this.container.id + '].onclick('
			+ this.id + ');" onmouseout="menus[' + this.container.id + '].onmouseout('
			+ this.id + ');" onmouseover="menus[' + this.container.id + '].onmouseover('
			+ this.id + ');" onmousedown="menus[' + this.container.id + '].onmousedown('
			+ this.id + ');"><div class="m'  + this.container.id + 'l' + this.depth + 'i">'
			+ this.fields[0] + "</div></a>\n"
		);
	this.element = document.getElementById('mi_' + this.container.id + '_' + this.id);
}
function mitem_visibility(make_visible) {
	if (make_visible != null) {
		if (this.visible == make_visible) return;
		this.visible = make_visible;
		if (make_visible)
			this.element.style.visibility = 'visible';
		else if (this.depth)
			this.element.style.visibility = 'hidden';
	}
	return (this.visible);
}
function mitem_get_x() {
	var value = 0;
	for (var i = 0; i <= this.depth; i++)
		value += this.container.pos['block_left'][i]
		+ this.arrpath[i] * this.container.pos['left'][i];
	return (value);
}
function mitem_get_y() {
	var value = 0;
	for (var i = 0; i <= this.depth; i++)
		value += this.container.pos['block_top'][i]
		+ this.arrpath[i] * this.container.pos['top'][i];
	return (value);
}
function mitem_switch_style(state) {
	if (this.state == state) return;
	this.state = state;
	var style = this.container.styles[state];
	for (var i = 0; i < style.length; i += 2)
		if (style[i] && style[i+1])
			eval('this.element.style.' + style[i] + "='" 
			+ style[i+1][this.depth] + "';");
}

/**************************************** Boot Code Copy *****************************************/

//
// this is to adjust menu order for CSS file. never mind - use demo from distribution package.

// >>>>>>>>>>>>>>> menus[0] = '-';

// each menu gets three parameters (see demo files)
// 1. items structure
// 2. geometry structure
// 3. dynamic styles structure

// >>>>>>>>>>>>> new menu (MENU_ITEMS, MENU_POS2, MENU_STYLES2);

// also take a look at stylesheets loaded in header in order to set static styles
//

	
