var menuDef =
[
	[
		 [ 35, 180 ]
		,[]
	],

	[
		 [ 162, 150 ]
		,[]
	],
	
	[
		 [ 282, 210 ]
		,[ 'town & shore listings', 'property_list.php' ]
		,[ 'luxury portfolio', 'luxury.php' ]
		,[ 'significant solds', 'property_sold.php' ]
		,[ 'other maine listings', 'property_idx.php' ]
	],
	
	[
		 [ 386, 150 ]
		,[]
	],
	
	[
		 [ 526, 150 ]
		,[]
	],

	[
		 [ 633, 150 ]
		,[]
	]
];


function initialize_menus( ) {
	var menuDiv = getObj( 'uvMenu' );
	var img;
	for( var ii = 0; img = getObj( 'nav' + (ii + 1) ); ii++ ) {
		if( typeof(menuDef[ ii ][1][0]) == 'undefined' )
			continue;
		
		img.N			= (ii + 1);
		img.divParent	= menuDiv;
		img.eventN		= 0;

		img.onmouseover = function( e ) {
//			this.src = AURI + 'image/nav' + this.N + 'on.gif';
			this.showMenu();
			}
			
		img.onmouseout = function( e ) {
//			this.src = AURI + 'image/nav' + this.N + '.gif';
			this.hideMenu();
			}

		img.showMenu = function( e ) {
			var img;
			for( var ii = 0; img = getObj( 'nav' + (ii + 1) ); ii++ ) {
				if( img.drop ) {
					if( (ii+1) == this.N ) {
						img.drop.style.display = '';
						}
					else {
						img.drop.style.display = 'none';
						}
					}
				img.eventN++;
				}
			}
			
		img.keepMenu = function( e ) {
			this.eventN++;
			}
		
		img.hideMenu = function( e ) {
			var q = this;
			var z = this.eventN;
			
			setTimeout( function( ){ q.closeMenu( z ); }, 500 );
			}
			
		img.closeMenu = function( i ) {
			if( i == this.eventN ) {
				this.drop.style.display = 'none';
				}
			}

		if( menuDef[ ii ] ) {
			var dropPane = document.createElement( 'div' );
				dropPane.className		= 'menuDrop';
				dropPane.style.left		=
					(isIE()
						? menuDef[ii][0][0] - 35
						: menuDef[ii][0][0])
					+ 'px';
				dropPane.style.width	= parseInt(menuDef[ii][0][1]/15) + 'em';
				dropPane.style.display	= 'none';
			
			var r, d, a;
			for( var kk = 1; kk < menuDef[ ii ].length; kk++ ) {
				a = document.createElement( 'div' );
				a.parentImg = img;
					a.path = menuDef[ ii ][ kk ][1];
					a.onclick = function( e ) {
						window.location = AURI + this.path;
						}

					a.onmouseover = function( e ) {
						this.className = 'uvActive';
						this.parentImg.keepMenu();
						}

					a.onmouseout = function( e ) {
						this.className = '';
						this.parentImg.hideMenu();
						}

					setText( a, menuDef[ ii ][ kk ][0] );
				dropPane.appendChild( a );
				}

			menuDiv.appendChild( dropPane );
			img.drop = dropPane;
			}
		}
	}

