/*
	mapb_menu
	Copyright Miquel Angel Pintanel/imaginatic 2000-2003
	Last Update 06/Jan/2003
	Version 0.9

	http://www.imaginatic.com/dhtml/index.html      mapbdhtml@wanadoo.es

	This script and his components are free, but must be
	maintained this text and the copyright to use it.

	Version 0.2 Added autoHide feature
	Version 0.3 Fixed bug in stylesheet
	Version 0.4 Added compatibility NS6

    Version 0.6 Support frames (first public release)
      Update 0.6.1 Fixed a bug
      Update 0.6.2 Previous fixed a bug makes a new bug
    Version 0.7 Added You are here feature
      Update 0.7.1 First level Items can be links now and can change color as other levels
      Update 0.7.2 Fixed a bug of last update now works fine in horizontal
      Update 0.7.3 Fixed bug in internal links
      Update 0.7.4 Fixed bug in frames and added frames sample
      Update 0.7.5 Minor bugs fixed
    Version 0.8 Added background images. Menu can do pop-up. Colors and backgrounds only
                defined in menu definition, no duplicated in CSS. Changed behaviour of links,
                now like other elements
      Update 0.8.1 Fixed bug in pop-up
      Update 0.8.2 Cursor change on links, fixed empty cells, fixed YouAreHere bug in first level items, decoration and weight in links returns
      Update 0.8.3 New approach to change cursor on links. Added 'onclick' mXtra.
      Update 0.8.4 Another new approach to change cursor on links. Arranged freeze in Netscape 4.7
      Update 0.8.5 Menus can open to left or right
      Update 0.8.6 Added manual adjust of position
	  Update 0.8.7 Auto hide minor than one second. Mouseover/mouseout events.
	  Update 0.8.8 Fixed a bug in Netspae 6+
	Version 0.9. Added relative positioned menus, arrow highlighting
		Update 0.9.1 Fixed bug
 */

var NN = (document.layers ? true : false);
var hideName = (NN ? 'hide' : 'hidden');
var showName = (NN ? 'show' : 'visible');
var open_sm = new Array ();
var to_load = new Array ();
var imgs_url = new Array ();
var imgs_loaded = new Array ();
var positioned_array = new Array ();

var autoHide_pass = 1;
var autoHide_on = false;
var autoHide_var = null;
var autoHide_activate = true;
var autoHide_seconds = 5;					// Zeit in Sekunden, bis das ausgeklappte Menue verschwindet
											// bei erneuten Aufruf aus dem Menue geht es unerfindlicher Weise
											// schneller als beim ersten Mal

var idYouarehere = '';
var tempX;
var tempY;

function Menu (idMenu,m_left,m_top)
	{
	// preferences
	this.m_left  = 120;					// Position von links
	this.m_top  = 0;					// Position von oben

	this.m_vertical  = false;				// true = Vertikales Menue

	this.sm_width  = 180;					// BREITE der Submenue-Punkte
	this.sm_height  = 25;					// HÖHE der Submenue-Punkte

	this.sm_border = 0;

	this.h_offset  = 0;						// Horizontaler Abstand in Bezug auf das vorhergehende Menue
	this.v_offset  = 0;						// Vertikaler Abstand in Bezug auf das vorhergehende Menue

	this.m_align = 'left';				// Hauptmenue-Punkt (oberer Frame) Textplazierung

	this.sm_align = 'left';
		
	this.l_m_color  = 'none'; // If sm_border > 0 border color of initial menu
	this.l_sm_color  = 'none'; // If sm_border > 0 border color of submenus

	this.m_color  = 'none'; //  Color of initial menu
	this.m_a_color  = 'none';

	this.m_txt_color  = '#000000';
	this.m_txt_a_color  = '#F55219';

	this.m_txt_weight = 900;
	this.m_txt_link_weight = 900;

	this.m_txt_decoration = 'none';
	this.m_txt_link_decoration = 'none';

	this.sm_color  = '#ffffff';				// FARBE des SUBMENUES
	this.sm_a_color  = '#ffffff';			// FARBE des SUBMENUES wenn mouseOver

	this.txt_color  = '#000000';				// TEXTFARBE der SUBMENUES
	this.txt_a_color  = '#F55219';			// TEXTFARBE der SUBMENUES wenn mouseOver

	this.txt_i_color  = 'none'; // Item color of inactive items

	this.txt_weight = 700;
	this.txt_link_weight = 700;

	this.txt_decoration = 'none';			// none = alle Submenuepunkte ohne underline, underline = mit underline
	this.txt_link_decoration = 'none';		// none = Links ohne underline, underline = mit underline

	this.m_bottom_decor = 'none';	// MENUE-TRENNLINIEN-FARBE (unten) für Hauptmenuepunkt, z.B. [2,'solid','red']
	this.sm_bottom_decor = 'none';		// MENUE-TRENNLINIEN-FARBE
													// probieren: this.m_bottom_decor = '';


	this.default_cursor = 'default';		// Coursorbild, hier könnte auch statt 'default' 'hand' stehen
	this.link_cursor = 'default';			// Coursorbild für Links, hier könnte auch statt 'default' 'hand' stehen

	this.m_dec = ''; // Right decoration of menu
	this.m_a_dec = '';

	this.sm_sep = (NN)? '----------' : 'url(images/trans.gif)';			// Abstands Pixel

	this.sm_arrow = 'none';
	this.sm_a_arrow = 'none';

	this.sm_left_arrow = 'url(pics/button.gif)';					// SUBMENUE LINKS-PFEIL image
	this.sm_a_left_arrow = 'url(pics/button.gif)';				// SUBMENUE LINKS-PFEIL image bei mouseOver
	
	this.sm_current = 'url(pics/button.gif)';	// Current Image
	this.menu_back_st = (NN)?'NNmenuBackSt':'menuBackSt';				// css-style Variablen der Schrift im Hauptmenue
	this.submenu_back_st = (NN)?'NNsubmenuBackSt':'submenuBackSt';		// css-style Variablen der Schrift im Submenue
	this.menu_st = 'menuSt';											// mapb_menu_style.css
	this.submenu_st = 'submenuSt';
	this.submenu_st_inactive = 'submenuStInactive';
	this.zIndx = 100;
	this.iconYouarehere = '';
	this.iconYouarenothere = '';
	this.activeYouarehere = false;
	this.sm_direction = 'right'; // textausrichtung
	this.vertical_adjust = 2;
	this.horizontal_adjust = -20;
	this.positioning = 'absolute';				// Positionierung des Hauptmenue-Punktes

	this.frameMenu = 'noFrames';
	this.frameSubMenu = 'noFrames';
	frameMenu = this.frameMenu;
	
	// private variables
	this.idMenu = idMenu;
	this.lev = 0;
	this.pre_sm = this.idMenu + 'm';
	this.pre_td = 'td';
	this.suf_sm_a = this.idMenu + 'a';
	this.pre_l = this.idMenu + 'l';
	this.num_sm = -1;
	this.sm = new Array ();
	this.sm[0] = new Array();
	this.c_a = new Array ();
	this.c_a[this.lev] = [0,0,0,false,0,'',0];
	this.c_l = new Array ();
	this.c_l[this.lev] = [this.m_left,this.m_top];
	this.mn = new Array();
	this.idYouarehere = idYouarehere;
	this.nextChangeDir = false;
	
	// functions
	this.addItem = addItem;
	this.doMenu = doMenu;
	this.genL = genL;
	this.endL = endL;
	this.hideL = hideL;
	this.showL = showL;
	this.refL = refL;
	this.hideMenus = hideMenus;
	this.onOut_sm = onOut_sm;
	this.onOver_sm = onOver_sm;
	this.youAreHere = youAreHere
	this.openHere = openHere;
	this.open_l = open_l;
	this.findPosY = findPosY;
	
	return this;
	}

function genL (positioned,sName, sLeft, sTop,sWdh, sHgt, sVis,sColor,copy,handlers)
	{
	if (NN)
		{
		tWidth = (!sWdh)? '' : ' width="' + sWdh + '"';
		tHeight = (!sHgt)? '' : ' height="' + sHgt + '"';
		tHandlers = (!handlers)? '' : handlers;
		
		var s = '<layer name="' + sName + '" left="' + sLeft;
		
		s += '" top="' + sTop + '"';
		s += tWidth;
		s += tHeight;
		s += ' visibility="' + sVis + '"';
		s += ' z-Index="' + (++this.zIndx) + '" ';
		
		if (typeof (sColor) == 'number')
			{
		    s += ' background="' + to_load[sColor] + '"';
			}
			
		else
			{
			s +=' bgcolor="' + sColor + '"';
			}
		
		s += tHandlers + '>\n' + copy;
		return s;
		}
	else
		{
		tWidth = (!sWdh)? '' : ' width: ' + sWdh + 'px;';
		tHeight = (!sHgt)? '' : ' height: ' + sHgt + 'px;';
		tHandlers = (!handlers)? '' : handlers;
		
		var s = '<div id="' + sName + '" style="position: '+positioned+';';
		
		s += ' left: ' + sLeft + 'px;';
		s += ' top: ' + sTop + 'px;';
		s += tWidth;
		s += tHeight;
		s += ' visibility:' + sVis + '; z-Index:' + (++this.zIndx) + '; background:';
		s += (typeof (sColor) == 'number'? imgs_url[sColor] : sColor);
		s += '"' + tHandlers + '>\n' + copy;
		return s;
		}
	}

function endL ()
	{
	if (NN)
		return '</layer>\n';
	else
		return '</div>\n';
	}

function hideL(name,alayer,theFrame)
	{if (NN){refL(name,alayer,theFrame).visibility = hideName;} else {refL(name,alayer,theFrame).style.visibility = hideName;}}

function showL(name,alayer,theFrame)
	{if (NN){refL(name,alayer,theFrame).visibility = showName;} else {refL(name,alayer,theFrame).style.visibility = showName};}

function refL(aLayer,aLayout,theFrame)
	{
    theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
	
    if (document.getElementById)
		{
	    return theDoc.getElementById(aLayer);
    	}
		
	else if (document.layers)
		{
	    if (aLayout != '')
			{
		    return theDoc.layers[aLayout].document.layers[aLayer];
	    	}
		else
			{
		    return theDoc.layers[aLayer];
	    	}
    	}
		
	else if (document.all)
		{
	    return eval('theDoc.all.' + aLayer);
    	}
	}

function refLcomplet (aLayer,aLayout,theFrame)
	{
    theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
    this.theName = aLayer;
	
    if (document.getElementById)
		{
		this.myRef = theDoc.getElementById (aLayer);
		this.theTop = parseInt(this.myRef.style.top);
		this.theLeft = parseInt(this.myRef.style.left);
		this.theHeight = parseInt(this.myRef.style.height);
		this.theWidth = parseInt(this.myRef.style.width);
		this.inHeight = parseInt(this.myRef.offsetHeight);
		this.inWidth = parseInt(this.myRef.offsetWidth);
		this.theRight = parseInt(this.myRef.style.left) + parseInt(this.myRef.style.width);
		this.theBottom = parseInt(this.myRef.style.top) + parseInt(this.myRef.style.height);
    	}
	else if (document.layers)
		{
		if (aLayout != '')
			this.myRef = theDoc.layers[aLayout].document.layers[aLayer];
		else
			this.myRef = theDoc.layers[aLayer];
			
		this.theTop = this.myRef.y;
		this.theLeft = this.myRef.x;
		this.theHeight = this.myRef.height || this.myRef.clip.height;
		this.theWidth = this.myRef.width || this.myRef.clip.width;
		this.theRight = this.myRef.x + this.theWidth;
		this.inHeight = this.theHeight;
		this.inWidth = this.theWidth;
		this.theBottom = this.myRef.y + this.theHeight;
    	}
	else if (document.all)
		{
		this.myRef = eval('theDoc.all.' + aLayer);
		this.theTop = parseInt(this.myRef.style.top);
		this.theLeft = parseInt(this.myRef.style.left);
		this.theHeight = parseInt(this.myRef.style.height);
		this.theWidth = parseInt(this.myRef.style.width);
		this.theRight = parseInt(this.myRef.style.left) + parseInt(this.myRef.style.width);
		this.inHeight = parseInt(this.myRef.offsetHeight);
		this.inWidth = parseInt(this.myRef.offsetWidth);
		this.theBottom = parseInt(this.myRef.style.top) + parseInt(this.myRef.style.height);
    	}
	}

function searchL (searchedL,anarray)
	{
	thearray = (anarray)? anarray : open_sm;
    var isMatch = false;
	
    for (i = 0;i < thearray.length;i++)
		{
		if (thearray[i][0] == searchedL)
			{
			isMatch = true;
			break;
			}
    	}
		
    theMatch = (isMatch)? i : -1;
    return theMatch;
	}

/*
Example of
mXtras: {'url':'a.html','target':'atarget','background':'acolororimg','backgroundA':'otherColororImg',
	'txtcolor':'acolor','txtacolor':'yetanotherColor','width': number,'height':number,
	'winOptions':'status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=auto','onclick':anAction,
         'nextOpenDir':'left or right','onmouseover':'action','onmouseout':'action'}
*/

function addItem (mText,mXtras,isLast)
	{
    var suf = '',idLayout,theText,theDecor,is_active;
	var addedStyle = '';
    var clickAction = '';
    var prevWidth = 0;
    var prevDiff = 0;
    mXtras = (typeof (mXtras) == 'string')? {'url':mXtras}: mXtras;
	default_align = (this.sm_direction == 'left')? 'right': 'left';
	theAlign = mXtras['align'] || this.sm_align || default_align;
    theColor = mXtras['Mnbackground'] || mXtras['background'] || this.sm_color;
    theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.sm_a_color;
    txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.txt_color;
    txtAcolor =  mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.txt_a_color;
    theWidth = mXtras['theWidth'] || mXtras['width'] || this.sm_width;
    theHeight = mXtras['theHeight'] || mXtras['height'] ||this.sm_height;
    winOpts = mXtras['winOptions'] || '';
    theDir = mXtras['nextOpenDir'] || '';
	overAction = mXtras['onmouseover'] || '';
	overAction = (overAction > '')? escape (overAction): '';
	outAction = mXtras['onmouseout'] || '';
	outAction = (outAction > '')? escape (outAction): '';
	offImage = (theDir == 'right' || this.sm_direction == 'right')? mXtras['image'] || this.sm_arrow : mXtras['image'] || this.sm_left_arrow;
	onImage = (theDir == 'right' || this.sm_direction == 'right')? mXtras['imageA'] || this.sm_a_arrow : mXtras['imageA'] || this.sm_a_left_arrow;
    
	for (i=0;i <= this.lev; i++)
		{
		suf += '_';
		suf += this.c_a[i][0];
   		}
		
	if (!isLast && this.sm_bottom_decor[0] && this.lev > 0)
		{
		addedStyle = ';border-bottom: '+ this.sm_bottom_decor[0] +'px '+this.sm_bottom_decor[1]+' '+this.sm_bottom_decor[2]+';';
		}
		else if (!isLast && this.m_bottom_decor[0] && this.lev == 0){
		addedStyle = ';border-bottom: '+ this.m_bottom_decor[0] +'px '+this.m_bottom_decor[1]+' '+this.m_bottom_decor[2]+';';
		}
		
    if (this.c_a[this.lev][0] == 0)
		{
		this.num_sm++;
		this.sm[this.num_sm] = new Array ();
		this.c_a[this.lev][4] = this.num_sm;
		
		if ((this.sm_direction == 'left' && !this.nextChangeDir) || (this.nextChangeDir && this.sm_direction != 'left'))
			{
			this.c_l[this.lev][0] -= ((this.lev > 1 && !this.m_vertical) || (this.lev > 0 && this.m_vertical))? theWidth : 0;
			this.nextChangeDir = false;
			}
		else if (this.sm_direction == 'left' && this.nextChangeDir)
			{
			this.nextChangeDir = false;
			}
			
		this.mn[this.c_a[this.lev][4]] = new Array(this.c_l[this.lev][0],this.c_l[this.lev][1]);
		this.c_a[this.lev][5] = suf;
		}
		
	if (mXtras['url'] == '')
		{
		this.c_a[this.lev][6] = theWidth;
	    var s = '';
	    prevWidth = theWidth;
	    clickAction = mXtras['onclick'] || '';
		
	    if (this.lev == 0)
			{
			idLayer = this.pre_l + suf;
			idLayout = this.c_a[this.lev][5];
			theClass = this.menu_st;
			theText = mText;
			
			if (String (this.m_dec).indexOf ('src=') > -1 || String (this.m_dec).indexOf ('url(') > -1)
				{
				decImg = new addToLoad (String (this.m_dec));
				theDecor = decImg.indx;
				offImage = decImg.indx;
				}
			else
				{
				offImage = -1;
				theDecor = this.m_dec;
				}
				
			if (String (this.m_a_dec).indexOf('src=') > -1 || String (this.m_a_dec).indexOf('url(') > -1)
				{
				decaImg = new addToLoad (String (this.m_a_dec));
				onImage = decaImg.indx;
				}
			else
				{
				onImage = -1;
				}
				
			is_active = true;
			theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color;
			theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color;
			txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.m_txt_color;
			txtAcolor = mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.m_txt_a_color;
			theAlign = mXtras['align'] || this.m_align || default_align;
	    	}
			
		else
			{
			idLayer = this.pre_l + suf;
			idLayout = this.c_a[this.lev][5];
			theClass = this.submenu_st;
			theText = mText;
			
			if (offImage.indexOf ('url(') > -1 || offImage.indexOf ('src=') > -1)
				{
				arrImg = new addToLoad (offImage);
				offImage = arrImg.indx;
				}
			theDecor = offImage;
			
			if (onImage.indexOf ('src=') > -1 || onImage.indexOf ('url(') > -1)
				{
				activeArr = new addToLoad (onImage);
				onImage = activeArr.indx
				}
			is_active = true;
	    	}
			
	    if (theColor.indexOf ('url') > -1)
			{
			offImg = new addToLoad (theColor);
			theColor = offImg.indx
	   		}
			
	    if (theaColor.indexOf ('url') > -1)
			{
			activeImg = new addToLoad (theaColor);
			theaColor = activeImg.indx
	   		}
			
	    this.sm[this.c_a[this.lev][4]][this.c_a[this.lev][0]] = new Array (suf,idLayer,idLayout,theClass,theText,
									       theDecor,is_active,this.c_a[this.lev][1],
									       this.c_a[this.lev][2],
									       [theColor,theaColor,txtcolor,txtAcolor,
									       theWidth,theHeight,overAction,outAction,offImage,onImage],mXtras['url'],mText,null,
									       clickAction,prevWidth,prevDiff,addedStyle,theAlign);
	    
		if (isLast)
			{
			if (this.m_vertical || this.lev > 0)
				{
				this.mn[this.c_a[this.lev][4]][3] = this.c_a[this.lev][2] + theHeight;
				this.mn[this.c_a[this.lev][4]][2] = theWidth;
				}
			else
				{
				this.mn[this.c_a[this.lev][4]][3] = theHeight;
				this.mn[this.c_a[this.lev][4]][2] = this.c_a[this.lev][1] + theWidth;		    
				}
			this.c_a[this.lev][3] = true;
	   		}
			
		else
			{
			this.c_a[this.lev][3] = false;
	   		}
			
	    this.lev++;
		
	    if (this.lev == 1 && !this.m_vertical)
			{
			if (this.frameMenu == 'noFrames')
				{
		   		this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+this.c_a[this.lev-1][1] + this.horizontal_adjust,this.c_l[this.lev-1][1] + theHeight + this.vertical_adjust);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
			else
				{
		    	this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+this.c_a[this.lev-1][1] + this.horizontal_adjust,this.c_l[this.lev-1][1] + this.vertical_adjust);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
	    	}
			
		else if (this.lev == 1 && this.m_vertical)
			{
			if (this.frameMenu == 'noFrames')
				{
		    	toSum = (this.sm_direction == 'left')? 0 : theWidth;
		   		this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+toSum,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2]+this.vertical_adjust);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,null,0);
				}
			else
				{
		    	this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0],this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2]+this.vertical_adjust);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
	    	}
			
		else
			{
			if (this.sm_direction == 'left')
				{
		    	this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]-this.h_offset,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2] + this.v_offset);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
			else
				{
		    	this.c_l[this.lev] = new Array(this.c_l[this.lev-1][0]+theWidth+this.h_offset,this.c_l[this.lev-1][1]+this.c_a[this.lev-1][2] + this.v_offset);
		    	this.c_a[this.lev] = new Array(0,0,0,false,this.num_sm,'',0);
				}
	    	}
			
	    if (this.sm_direction == 'left' &&  theDir == 'right')
			{
			this.c_l[this.lev][0] = this.c_l[this.lev-1][0] + theWidth;
			this.nextChangeDir = true;
	    	}
			
		else if (this.sm_direction == 'right' &&  theDir == 'left')
			{
			this.c_l[this.lev][0] = this.c_l[this.lev-1][0];
			this.nextChangeDir = true;
	   		}
			
	    if ((this.lev - 1) == 0)
			{
		    if (this.m_vertical){
			this.c_a[this.lev-1][2] += theHeight;
			this.c_a[this.lev-1][1] = 0;
		    }
		else
			{
			this.c_a[this.lev-1][1] += theWidth;
			this.c_a[this.lev-1][2] = 0;
		    }
	    }
		
	else
		{
		this.c_a[this.lev-1][2] += theHeight;
		this.c_a[this.lev-1][1] = 0
	    }
    }
	
	else
		{
	    var s;
		offImage = -1;
		onImage = -1;
		
	    if (this.lev == 0)
			{
			theClass = this.menu_st;
			is_active = true;
			theDecor = mXtras['image'] || '';
			theColor = mXtras['Mnbackground'] || mXtras['background'] || this.m_color;
			theaColor = mXtras['MnAbackground'] || mXtras['backgroundA'] || this.m_a_color;
			txtcolor = mXtras['Mntxtcolor'] || mXtras['txtcolor'] || this.m_txt_color;
			txtAcolor = mXtras['Mntxtacolor'] || mXtras['txtacolor'] || this.m_txt_a_color;
			theAlign = mXtras['align'] || this.m_align || default_align;
	    	}
		else
			{
			theClass = this.submenu_st;
			is_active = true;
			theDecor = mXtras['image'] || '';
	    	}
			
	    if (mText == '-')
			{
			idLayout = this.c_a[this.lev][5];
			
			if (this.sm_sep.indexOf ('url(') > -1)
				{
				sepImg = new addToLoad (this.sm_sep);
				this.sm_sep = '<img src="'+parent.to_load[sepImg.indx]+'" border="0">';
				}
			theText = this.sm_sep;
			is_active = false;
			theDecor = mXtras['image'] || '';
	    	}
		else
			{
		    idLayer = '';
		    idLayout = this.c_a[this.lev][5];
			
		    if (mXtras['url'] == 'v')
				{
				theDecor = this.sm_current;
				onImage = -1
		    	}
			else if (mXtras['url'] == 'x')
				{
				theClass = this.submenu_st_inactive;
				txtColor  = this.txt_i_color;
				txtAcolor  = this.txt_i_color;
				is_active = false;
		    	}
			else if (mXtras['url'] == 'a')
				{
				clickAction = mXtras['onclick'];
		    	}
			else
				{
				theTarget = (mXtras['target'])? mXtras['target'] : '' ;
				preAct = (this.frameMenu == 'noFrames')? '': 'parent.';
				
				if (theTarget.indexOf ('parent') > -1 && theTarget.length <= 7)
					{
					clickAction = 'parent.location.href = \'' + mXtras['url'] + '\'';
					}
				else if (theTarget.indexOf ('top') > -1 && theTarget.length <= 4)
					{
					clickAction = 'top.location.href = \'' + mXtras['url'] + '\'';
					}
				else if (theTarget == '')
					{
					clickAction = 'window.location.href = \'' + mXtras['url'] + '\'';
					}
				else if (theTarget.indexOf ('blank') > -1 && theTarget.length <= 6)
					{
					postNW = String(Math.random ());
					postNWin = (postNW.length > 1)? postNW.substr (2) : postNW;
					clickAction = preAct + 'mapb_openBrWindow (\'' + mXtras['url'] + '\',\'mapbNewWin' + postNWin + '\',\'' + winOpts +'\')';
					}
				else if (parent.frames[theTarget])
					{
					clickAction = 'parent.frames[\''+ theTarget +'\'].location.href = \'' + mXtras['url'] + '\'';
					}
				else
					{
					clickAction = preAct + 'mapb_openBrWindow (\'' + mXtras['url'] + '\',\''+ theTarget +'\',\''+ winOpts +'\')';
					}
		    	}
		    theText = mText;
	    	}
			
	    if (theColor.indexOf ('url') > -1)
			{
			smoffImg = new top.addToLoad (theColor);
			theColor = smoffImg.indx;
	    	}
	    if (theaColor.indexOf ('url') > -1)
			{
			smactiveImg = new top.addToLoad (theaColor);
			theaColor = smactiveImg.indx;
	    	}
	    if (theDecor.indexOf ('url') > -1)
			{
			decorImg = new top.addToLoad (theDecor);
			theDecor = decorImg.indx;
			offImage = decorImg.indx;
	    	}
		if (mXtras['imageA'])
			{
			if (mXtras['imageA'].indexOf ('url(') > -1)
				{
				activeArr = new addToLoad (mXtras['imageA']);
				onImage = activeArr.indx;
				}
			}
			
		this.sm[this.c_a[this.lev][4]][this.c_a[this.lev][0]] = new Array (suf,idLayer,idLayout,theClass,
									       theText,theDecor,is_active,
									       this.c_a[this.lev][1],this.c_a[this.lev][2],
									       [theColor,theaColor,txtcolor,txtAcolor,
									       theWidth,theHeight,overAction,outAction,offImage,onImage],mXtras['url'],mText,null,
									       clickAction,prevWidth,prevDiff,addedStyle,theAlign);
										   
	    this.c_a[this.lev][2] += theHeight;
		
	    if (this.lev == 0)
			{
			if (!this.m_vertical)
				{
		    	this.c_a[this.lev][2] = 0;
		    	this.c_a[this.lev][1] = this.c_a[this.lev][1] + theWidth;
				}
	    	}
			
	    this.c_a[this.lev][0]++;
		
	    if (isLast)
			{
		    this.c_a[this.lev][0] = 0;
		    this.c_a[this.lev][3] = true;
			
		    if (!this.m_vertical && this.lev == 0)
				{
				this.mn[this.c_a[this.lev][4]][2] = this.c_a[this.lev][1];
				this.mn[this.c_a[this.lev][4]][3] = theHeight;
		   		}
			else
				{
				this.mn[this.c_a[this.lev][4]][2] = theWidth;
				this.mn[this.c_a[this.lev][4]][3] = this.c_a[this.lev][2];
		    	}
				
		    if (this.lev > 0)
				{
				this.lev--;
		    	}
		    if (this.lev >= 0)
				{
				this.c_a[this.lev][0]++;
		    	}
				
		    while (this.c_a[this.lev][3] == true)
				{
			    this.c_a[this.lev][0] = 0;
			    this.lev--;
				
			    if (this.lev >= 0)
					{
				    this.c_a[this.lev][0]++;
				    }
			    if (this.lev <= 0)
					{
				    break;
			    	}
		    	}
	    	}
		else
			{
			this.c_a[this.lev][3] = false;
	    	}
    	}
	}
	

function doMenu (theWindow){
    var theL = '';
    for (var i=0;i < this.sm.length;i++){
		var m;
		if (i == 0){
			if (!this.m_vertical){
				theClass = this.menu_back_st;
				h = ' class="' + theClass + '"';
				m = '<table border="0" cellpadding="0" cellspacing="0" width="'+ this.mn[i][2] +'" height="' + this.mn[i][3] + '">\n';
				m += '<tr><td>\n';
			} else {
				theClass = this.menu_back_st;
				h = ' class="' + theClass + '"';
				m = '<table border="0" cellpadding="0" cellspacing="0" width="' + this.mn[i][2] + '" height="' + this.mn[i][3] + '">';
				m += '<tr><td>\n';
			}
			theL += this.genL (this.positioning,this.pre_l + this.sm[i][0][0],this.mn[i][0],this.mn[i][1],this.mn[i][2],false,showName,this.l_m_color,m,h);
		} else {
			h = ' class="' + this.submenu_back_st + '"';
			m = '<table border="0" cellpadding="0" cellspacing="0" width="'+ this.mn[i][2] +'" height="' + this.mn[i][3] + '">';
			m += '<tr><td>';
			theL += this.genL ('absolute',this.pre_l + this.sm[i][0][0],this.mn[i][0],this.mn[i][1],this.mn[i][2],false,hideName,this.l_sm_color,m,h);
		}
		for (j=0;j < this.sm[i].length;j++){
			f = (this.sm[i][j][3] == this.menu_st)? this.frameMenu : this.frameSubMenu;
			txtWeight = (this.sm[i][j][3] == this.menu_st)? this.m_txt_weight : this.txt_weight;
			txtDec = (this.sm[i][j][3] == this.menu_st)? this.m_txt_decoration : this.txt_decoration;
			t = (this.frameMenu == 'noFrames')? '': 'parent.';
			visibleText = this.sm[i][j][4];
			if (typeof (this.sm[i][j][5]) != 'string'){
				decoration = '<img src="'+parent.to_load[this.sm[i][j][5]]+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
			} else {
				decoration = this.sm[i][j][5];
			}
			acType = (NN)? 'onFocus':  'onclick';
			actOnClick = (this.sm[i][j][13] > '')? ' ' + acType + '="' + this.sm[i][j][13] + '"' : '';
			if (theWindow == this.frameSubMenu){
				if(top.frames[this.frameSubMenu].location.href.indexOf(this.sm[i][j][10]) > -1 && this.sm[i][j][10].indexOf('#') == -1 && this.sm[i][j][10].length > 1){
					visibleText = this.sm[i][j][11];
					if (this.iconYouarehere.indexOf ('url(') > -1){
						startStr = this.iconYouarehere.indexOf ('(') + 1;
						endStr = this.iconYouarehere.length - startStr - 1;
						this.iconYouarehere = '<img src="'+this.iconYouarehere.substr(startStr,endStr)+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
					}										
					decoration = this.iconYouarehere;
					this.Iamhere = this.sm[i][j][2];
					this.idYouarehere = this.sm[i][j][2];
					actOnClick = '';
				}
			} else {
				if(location.href.indexOf(this.sm[i][j][10]) > -1 && this.sm[i][j][10].indexOf('#') == -1 && this.sm[i][j][10].length > 1){
					visibleText = this.sm[i][j][11];
					if (this.iconYouarehere.indexOf ('url(') > -1){
						startStr = this.iconYouarehere.indexOf ('(') + 1;
						endStr = this.iconYouarehere.length - startStr - 1;
						this.iconYouarehere = '<img src="'+this.iconYouarehere.substr(startStr,endStr)+'" border="0" id="img_'+ this.pre_sm +this.sm[i][j][0]+'" name="img_'+ this.pre_sm + this.sm[i][j][0]+'">';
					}										
					decoration = this.iconYouarehere;
					this.Iamhere = this.sm[i][j][2];
					this.idYouarehere = this.sm[i][j][2];
					actOnClick = '';
				}
			}
			xTras ='';
			for (lm in this.sm[i][j][9]){
				xTras += (typeof(this.sm[i][j][9][lm]) == 'string'? ',\'' + this.sm[i][j][9][lm] + '\'' : ',' + this.sm[i][j][9][lm]);
			}
			hasLink = (actOnClick.length > 1)? 1 : 0;
			cursorST = (actOnClick.length > 1)? this.link_cursor : this.default_cursor;
			tdStyle = ' style="color: '+ this.sm[i][j][9][2] +';font-weight:'+ txtWeight +';text-decoration:'+ txtDec;
			h = ' onMouseOver="' + t + this.idMenu + '.onOver_sm(\''+ this.sm[i][j][3] + '\',' + hasLink + ',\'' + this.pre_sm + this.sm[i][j][0] +'\',\'';
			h += this.sm[i][j][1] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
			h += xTras + ')"';
			h += actOnClick;		
			h += ' onMouseOut="' + t + this.idMenu + '.onOut_sm(\''+ this.sm[i][j][3] + '\','+ hasLink +',\'' + this.pre_sm + this.sm[i][j][0] + '\',\'' + this.pre_l + this.sm[i][j][2] + '\',' + this.sm[i][j][6] + ',\''+ f + '\'';
			h += xTras + ')"';
			m = '<table border="0" cellspacing="0" cellpadding="3">\n';
			m += '<tr>';
			theAlign = this.sm[i][j][17];
			if (NN){
				longTD = '<td class="' + this.sm[i][j][3] + '" width="' + this.sm[i][j][9][4] + '" height="' + this.sm[i][j][9][5] + '"' + ' align="' + theAlign + '"'
				longTD += ' id="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"';
				longTD += ' name="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"><font color="'+ this.sm[i][j][9][2] +'">' + visibleText + '</font></td>\n';
				shortTD = (decoration > '')?'<td align="right" class="' + this.sm[i][j][3] + '"><font color="'+ this.sm[i][j][9][2] +'">' + decoration + '</font></td>\n':'';
			} else {
				longTD = '<td class="' + this.sm[i][j][3] + '" width="' + this.sm[i][j][9][4] + '" height="' + this.sm[i][j][9][5] + '"' + ' align="' + theAlign + '"'
				longTD += ' style="cursor: '+ cursorST + this.sm[i][j][16] + '"';
				longTD += '><span';
				longTD += ' id="' + this.pre_td + this.pre_sm + this.sm[i][j][0] + '"';
				longTD += tdStyle + '"';
				longTD += '>' + visibleText + '</span></td>\n';
				shortTD = (decoration > '')? '<td class="' + this.sm[i][j][3] + '"' + tdStyle + this.sm[i][j][16] +'">' + decoration + '</td>\n':'';
			}
			m += (this.sm_direction == 'left')? shortTD + longTD : longTD + shortTD;
			m += '</tr></table>\n';	    
			layerName = this.pre_sm + this.sm[i][j][0];
			theposition = (this.sm[i][j][3] == this.menu_st)? this.positioning:'absolute';
			theL += this.genL (theposition,layerName,this.sm[i][j][7],this.sm[i][j][8],this.sm[i][j][9][4],this.sm[i][j][9][5],'inherit',this.sm[i][j][9][0],m,h);
			theL += endL();
		}
		theL += '</td></tr>\n';
		theL += '</table>\n';
		theL += endL() + '\n';
		if (this.frameMenu == 'noFrames'){
			document.writeln(theL);
			//document.forms[0].elements[0].value += theL;
		} else {
			if (this.sm[i][0][3] == this.menu_st && theWindow == this.frameMenu){
				top.frames[this.frameMenu].document.writeln(theL);
			} else if (this.sm[i][0][3] == this.submenu_st && theWindow == this.frameSubMenu){
				top.frames[this.frameSubMenu].document.writeln(theL);
			}
		}
		theL = '';
    }
}

function hideMenus () {
	for (var i = 0;i < open_sm.length;i++){
	    if (open_sm[i][1] != 'noFrames'){
			if (document.all){
				refL(open_sm[i][0],'',open_sm[i][1]).style.pixelTop = open_sm[i][2];
				refL(open_sm[i][0],'',open_sm[i][1]).style.pixelLeft = open_sm[i][3]
			} else if (NN){
				refL(open_sm[i][0],'',open_sm[i][1]).top = open_sm[i][2];
				refL(open_sm[i][0],'',open_sm[i][1]).left = open_sm[i][3]
			}
	    } else {
			if (open_sm[i][2] != null){
				if (NN){
					refL(open_sm[i][0],'',open_sm[i][1]).top = open_sm[i][2];
					refL(open_sm[i][0],'',open_sm[i][1]).left = open_sm[i][3];
				} else {
					refL(open_sm[i][0],'',open_sm[i][1]).style.top = open_sm[i][2] + 'px';
					refL(open_sm[i][0],'',open_sm[i][1]).style.left = open_sm[i][3] + 'px';
				}
			}
		}
	    hideL(open_sm[i][0],'',open_sm[i][1]);
	}
	clearInterval (autoHide_var);
	open_sm = new Array ();
	autoHide_on = false;
}

function onOver_sm (classLment,isaURL,what_sm,what_l,parentL,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage) {
    clearInterval (autoHide_var);
	autoHide_pass = 1;
	if (sm_active){
		if (NN){
			if (typeof (smaColor) == 'number'){
				refL(what_sm,parentL,theFrame).background.src = to_load[smaColor];
			} else {
				refL(what_sm,parentL,theFrame).bgColor = (smaColor > '')? smaColor : this.sm_a_color;
			}
		} else {
			if (typeof (smaColor) == 'number'){
				refL(what_sm,'',theFrame).style.background = imgs_url[smaColor];
			} else {
				refL(what_sm,'',theFrame).style.background = (smaColor > '')? smaColor : this.sm_a_color;
			}
			refL(this.pre_td + what_sm,'',theFrame).style.color =  (txtAcolor > '')? txtAcolor : this.txt_a_color;
			if (isaURL > 0){
				refL(this.pre_td + what_sm,'',theFrame).style.fontWeight = (classLment == this.menu_st)? this.m_txt_link_weight : this.txt_link_weight;
				refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (classLment == this.menu_st)? this.m_txt_link_decoration :  this.txt_link_decoration;
			}
			if (onimage != -1){
				thename = 'img_' + what_sm;
				if (theFrame == 'noFrames'){
					document.images[thename].src = parent.to_load[onimage];
				} else {
					parent.frames[theFrame].document.images[thename].src = parent.to_load[onimage];
				}
			}
		}
		if (overaction > ''){
			foo = window.setTimeout (unescape(overaction),10);
		}
    }
	this.open_l (what_sm,what_l);
}


function onOut_sm (classLment,isaURL,what_sm,what_l,sm_active,theFrame,smColor,smaColor,txtcolor,txtAcolor,thewidth,theheight,overaction,outaction,offimage,onimage)
	{
	autoHide_var = setInterval ("autoHide ()",10);
	
    if (sm_active)
		{
		if (NN)
			{
			if (typeof (smColor) == 'number')
				{
				refL(what_sm,what_l,theFrame).background.src = to_load[smColor];
				}
			else
				{
				refL(what_sm,what_l,theFrame).background.src = null;
				refL(what_sm,what_l,theFrame).bgColor = (smColor > '')? smColor : this.sm_color;
				}
			}
		else
			{
			if (typeof (smColor) == 'number')
				{
				refL(what_sm,'',theFrame).style.background = imgs_url[smColor];
				}
			else
				{
				refL(what_sm,'',theFrame).style.background = (smColor > '')? smColor : this.sm_color;
				}
				
			refL(this.pre_td + what_sm,'',theFrame).style.color = (txtcolor > '')? txtcolor : this.txt_color;
			
			if (isaURL > 0)
				{
				refL(this.pre_td + what_sm,'',theFrame).style.fontWeight = (classLment == this.menu_st)? this.m_txt_weight : this.txt_weight;
				refL(this.pre_td + what_sm,'',theFrame).style.textDecoration = (classLment == this.menu_st)? this.m_txt_decoration : this.txt_decoration;
				}
			if (offimage != -1)
				{
				thename = 'img_' + what_sm;
				
				if (theFrame == 'noFrames')
					{
					document.images[thename].src = parent.to_load[offimage];
					}
				else
					{
					parent.frames[theFrame].document.images[thename].src = parent.to_load[offimage];
					}
				}
			}
			
		if (outaction > '')
			{
			foo = window.setTimeout (unescape(outaction),10);
			}
    	}
	}


function open_l (what_sm,what_l)
	{
    if (what_l != '')
		{
		var initialY,initialX;
		
		if (this.frameMenu != 'noFrames')
			{
			if (document.all)
				{
				tempY = eval(this.frameSubMenu + '.document.body.scrollTop');
				tempX = eval(this.frameSubMenu + '.document.body.scrollLeft');
				thePos = searchL (what_l+'_0');
				
				if (thePos > -1)
					{
					initialY = open_sm[thePos][2];
					initialX = open_sm[thePos][3];
					}
				else
					{
					initialY = refL(what_l+'_0','',this.frameSubMenu).style.pixelTop;
					initialX = refL(what_l+'_0','',this.frameSubMenu).style.pixelLeft;
					}
					
				refL(what_l+'_0','',this.frameSubMenu).style.pixelTop = initialY + tempY;
				refL(what_l+'_0','',this.frameSubMenu).style.pixelLeft = initialX + tempX
				}
				
			else if (NN || document.getElementById)
				{
				tempY = eval(this.frameSubMenu + '.pageYOffset');
				tempX = eval(this.frameSubMenu + '.pageXOffset');
				thePos = searchL (what_l+'_0');
				
				if (thePos > -1)
					{
					initialY = open_sm[thePos][2];
					initialX = open_sm[thePos][3];
					}
				else
					{
					initialY = (NN)? refL(what_l+'_0','',this.frameSubMenu).top : parseInt(refL(what_l+'_0','',this.frameSubMenu).style.top);
					initialX = (NN)? refL(what_l+'_0','',this.frameSubMenu).left : parseInt(refL(what_l+'_0','',this.frameSubMenu).style.left);
					}
					
				if (NN)
					{
					refL(what_l+'_0','',this.frameSubMenu).top = initialY + tempY;
					refL(what_l+'_0','',this.frameSubMenu).left = initialX + tempX;
					}
				else
					{
					refL(what_l+'_0','',this.frameSubMenu).style.top = (initialY + tempY) + 'px';
					refL(what_l+'_0','',this.frameSubMenu).style.left = (initialX + tempX) + 'px';
					}
				}
			}
		else
			{
			if (this.positioning == 'relative')
				{
				thePos = searchL (what_l+'_0',positioned_array);
				
				if (thePos > -1)
					{
					initialY = positioned_array[thePos][1];
					initialX = positioned_array[thePos][2];
					}
				else
					{
					oldpos = this.findPosY (what_l+'_0','',this.frameSubMenu);
					newpos = this.findPosY (this.idMenu + '_ref','',this.frameSubMenu);
					initialY = oldpos[1];
					initialX = oldpos[0];
					positioned_array[positioned_array.length] = new Array (what_l+'_0',initialY,initialX);
					}
					
				if (NN)
					{
					refL(what_l+'_0','',this.frameSubMenu).top = (initialY + newpos[1]);
					refL(what_l+'_0','',this.frameSubMenu).left = (initialX + newpos[0]);
					}
				else
					{
					refL(what_l+'_0','',this.frameSubMenu).style.top = (initialY + newpos[1]) + 'px';
					refL(what_l+'_0','',this.frameSubMenu).style.left = (initialX + newpos[0]) + 'px';
					}
				}
			}
		theLength = open_sm.length;
		position = searchL (what_l+'_0');
		
		if (position == -1)
			{
			open_sm[theLength] = new Array (what_l+'_0',this.frameSubMenu,initialY,initialX);
			}
		else
			{
			open_sm[position][2] = initialY;
			open_sm[position][3] = initialX;
			}
			
		if (theLength > 1)
			{
			patata = new calculWinDim (this.frameSubMenu);
			}
		showL (what_l+'_0','',this.frameSubMenu);
    	}
		
    var tempA = new Array ();
	
    for (this.i = 0;this.i < open_sm.length;this.i++)
		{
	    if (open_sm[this.i][0].indexOf(this.idMenu) == -1 || (open_sm[this.i][0].length > what_sm.length && open_sm[this.i][0].indexOf(this.pre_l + what_sm.substr(this.pre_sm.length)) == -1))
			{
			hideL (open_sm[this.i][0],'',this.frameSubMenu);
			
			if (this.frameMenu != 'noFrames')
				{
				if (document.all)
					{
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.pixelTop = open_sm[this.i][2];
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.pixelLeft = open_sm[this.i][3]
					}
				else if (NN)
					{
					refL(open_sm[this.i][0],'',this.frameSubMenu).top = open_sm[this.i][2];
					refL(open_sm[this.i][0],'',this.frameSubMenu).left = open_sm[this.i][3]
					}
				else if ( document.getElementById)
					{
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.top = open_sm[this.i][2] + 'px';
					refL(open_sm[this.i][0],'',this.frameSubMenu).style.left = open_sm[this.i][3] + 'px'
					}
				}
			else
				{
				if (open_sm[this.i][2] != null)
					{
					if (NN)
						{
						refL(open_sm[this.i][0],'',this.frameSubMenu).top = open_sm[this.i][2];
						refL(open_sm[this.i][0],'',this.frameSubMenu).left = open_sm[this.i][3];
						}
					else
						{
						refL(open_sm[this.i][0],'',this.frameSubMenu).style.top = open_sm[this.i][2] + 'px';
						refL(open_sm[this.i][0],'',this.frameSubMenu).style.left = open_sm[this.i][3] + 'px';
						}
					}
				}
	    	}
			
		else
			{
			tempA[tempA.length] = open_sm[this.i];
	    	}
    	}
    	open_sm = tempA;
	}


function autoHide ()
	{
	autoHide_time = ((autoHide_seconds * 100) > 1)? autoHide_seconds * 100 : 1;
	
	if (autoHide_pass > autoHide_time)
		{
	    hideMenus ();
		}
	else
		{
	    autoHide_pass++;
		}
	}


function youAreHere (myname,my_left, my_top, my_width, my_height,theText,my_color,my_image)
	{
	theonimage = (my_image)? my_image : this.iconYouarehere;
	
	if (theonimage.indexOf ('url(') > -1)
		{}
	else if (this.iconYouarehere.indexOf ('src') > -1)
		{
		firstposoff = theonimage.indexOf ('src="') + 5;
		endposoff = theonimage.indexOf ('"',firstposoff);
		theonimage = theonimage.substring (firstposoff,endposoff);
		}
		
	theonimage = '<img src="'+theonimage+'" border="0">';
	startStr = this.iconYouarenothere.indexOf ('(') + 1;
	endStr = this.iconYouarenothere.length - startStr - 1;
	theoffimage = this.iconYouarenothere.substr(startStr,endStr);
	theoffimage = '<img src="'+theoffimage+'" border="0">';
	
	if(this.frameSubMenu == 'noFrames')
		{
	    if (this.idYouarehere == '')
			{
			my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
			my_aText += theoffimage;
			my_aText += '</td><td align="left"><span style="color: gray; font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
			aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText);
			aText +=  endL();
	    	} 
		else
			{
			my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
			my_aText += theonimage;
			my_aText += '</td><td align="left"><span style="font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
			aHand = ' onMouseOver="' + this.idMenu + '.openHere ()" onMouseOut="' + this.idMenu + '.hideMenus ()"';
			aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText,aHand);
			aText +=  endL();
	    	}
	    document.writeln (aText)
		}
		
	else
		{
	    if (this.idYouarehere == '')
			{
			my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
			my_aText += theoffimage;
			my_aText += '</td><td align="left"><span  style="color: gray; font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
			aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText);
			aText +=  endL();
	    	}
		else
			{
			my_aText = '<table border="0" cellspacing="0" width="' + my_width + '"><tr><td align="right">';
			my_aText += theonimage;
			my_aText += '</td><td align="left"><span style="font-size: 11px;font-family: sans-serif; cursor: default">'+ theText +'</span></td></tr></table>';
			aHand = ' onMouseOver="parent.' + this.idMenu + '.openHere ()" onMouseOut="parent.' + this.idMenu + '.hideMenus ()"';
			aText = genL('absolute',myname,my_left,my_top,my_width,my_height,showName,my_color,my_aText,aHand);
			aText +=  endL();
	    	}
	    top.frames[this.frameSubMenu].document.writeln (aText)
		}
	}


function openHere ()
	{
    if (this.idYouarehere.length > 2)
		{
		hideMenus ();
		aLength = this.idYouarehere.length - 2;
		sinceOpen = this.pre_sm + this.idYouarehere;
		
		for (u = 2; u <= aLength; u += 2)
			{
			whatOpen = this.pre_l + this.idYouarehere.substr(0,u);
			this.open_l (sinceOpen,whatOpen);
			}
    	}
	}


function addToLoad (searchedString)
	{
	extractURL = '';
	
	if (searchedString.indexOf ('url(') > -1)
		{
		startStr = searchedString.indexOf ('(') + 1;
		endStr = searchedString.length - startStr - 1;
		extractURL = searchedString.substr(startStr,endStr);
		}
	else if (searchedString.indexOf ('src') > -1)
		{
		firstposoff = searchedString.indexOf ('src="') + 5;
		endposoff = searchedString.indexOf ('"',firstposoff);
		extractURL = searchedString.substring (firstposoff,endposoff);
		searchedString = 'url('+extractURL+')';
		}
    i = 0;
    isMatch = false;
	
    if (to_load.length > 0)
		{
		for (i = 0;i < to_load.length;i++)
			{
			if (to_load[i] == extractURL)
				{
				isMatch = true;
				break;
				}
			}
			
		if (!isMatch)
			{
	   		oldLength = to_load.length;
	    	to_load[self.to_load.length] = extractURL;
	    	imgs_url[self.imgs_url.length] = searchedString;
	    	addNewImg (extractURL);
			}
			
		this.indx = i;
    	}
	else
		{
		to_load[0] = extractURL;
		imgs_url[0] = searchedString;
		addNewImg (extractURL);
		this.indx = 0;
    	}
    return this;
	}
	

function addNewImg (asrc)
	{
	var newimage = new Image ();
	newimage.src = asrc;
	}


function mapb_openBrWindow (theURL,winName,features)
	{
    var finestra;
	
    if (features > '')
		{
		finestra = window.open('',winName,features);
    	}
	else
		{
		finestra = window.open('',winName,'status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=auto');
   		}
		
    finestra.document.title = 'Loading...';
    finestra.location.href = theURL;
    finestra.focus ()
	}


function findPosY(name,layer,frame)
	{
	obj = refL(name,layer,frame);
	var curtop = 0;
	var curleft = 0;
	
	if (document.getElementById || document.all)
		{
		while (obj.offsetParent)
			{
			curtop += obj.offsetTop;
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
			}
		}
	else if (document.layers)
		{
		curtop += obj.y;
		curleft += obj.x;
		}
	atornar = new Array (curleft,curtop);
	return atornar;
	}
	

function calculWinDim (theFrame)
	{
	if(window.innerWidth)
		{
		theDoc = (theFrame == 'noFrames')? window : top.frames[theFrame];
		this.page_width = theDoc.innerWidth;
		this.page_height = theDoc.innerHeight;
		}
	else if(theDoc.body.clientWidth)
		{
		theDoc = (theFrame == 'noFrames')? document : top.frames[theFrame].document;
		this.page_width = theDoc.body.clientWidth;
		this.page_height = theDoc.body.clientHeight;
		}
	return this;
	}
