	function detectsaveddiv()
	{
		if(document.getElementById('saveddiv'))
		{
			fadecounter = 100;
			setTimeout("fadeoutprogress()",2500);
		}
	}
	
	function fadeoutprogress()
	{
		
		var object = document.getElementById('saveddiv');	
	
		object.style.filter = "alpha(opacity = " + fadecounter*1 + ")";
		object.style.opacity = fadecounter*0.01;
		
		fadecounter -= 1;
		
		if (fadecounter > 0)
		{
			t = setTimeout("fadeoutprogress()", 10);
		}
		else
		{
			object.parentNode.removeChild(object);
		}
	}





// EVENHEIGHTS FUNCTION

function evenheights()
{
	sidebar = document.getElementById('sidebardiv');	
	main = document.getElementById('maindiv');
	
	if (navigator.appName.indexOf("Microsoft") >= 0)
	{
		heightsidebar = sidebar.getAttribute('offsetHeight');
		heightmain = main.getAttribute('offsetHeight');
		
	}
	else
	{
		heightsidebar = document.defaultView.getComputedStyle(sidebar,"").getPropertyValue("height");
		heightmain = document.defaultView.getComputedStyle(main,"").getPropertyValue("height");
		
		heightmain = heightmain.replace("px","");
		heightmain = parseInt(heightmain) + 10;
		heightmain = heightmain + "px";
	}
	
	if (parseInt(heightsidebar) < parseInt(heightmain))
	{
		sidebar.style.height = heightmain;
	}
}

imagemenu = new Image();
imagemenu.src = "../menubackgroundblue2.jpg";



var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
var menubaroverrideflag = 0;

// open hidden layer
function mopen(id)
{	
	menubaroverrideflag = 1; // This disables the featured image squares.

	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	menubaroverrideflag = 0; // This re-enabled the featured image squares.
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 



function getRef(id) 
{
	return document.getElementById(id);
}

function getSty(id)
{
	return getRef(id).style;
}



function getRef(id) 
{
	return document.getElementById(id);
}

function getSty(id)
{
	return getRef(id).style;
}

// Hide timeout
var PopTimer = 0;

// Array showing highlighted menu items.
var HighlightedTitles = new Array();


//////////////////////////////////////////////////
//                                              //
//  PopOver Function                            //
//                                              //
//////////////////////////////////////////////////

function popOver(menuNum, itemNum) 
{
	// Clear the Last PopOut Timer
	clearTimeout(PopTimer);
	
	// Hide All Menus Besides This Menu
	HideAllMenusBesides(menuNum);
	
	// Find the Path of All Menu Items that Should Be Highlighted
	HighlightedTitles = GetPathToRoot(menuNum, itemNum);
	
	// Change the Color of All Appropriate Menu Items
	ChangeColor(HighlightedTitles, true);
	
	// Find the Target Menu of This Menu Item
	TargetNum = menu[menuNum][itemNum].target;
	
	if (TargetNum > 0) 
	{
		thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
		thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
		
		with (menu[TargetNum][0].ref) 
		{
			left = parseInt(thisX + menu[TargetNum][0].x) +"px";
			top = parseInt(thisY + menu[TargetNum][0].y) +"px";
			visibility = 'visible';
      		}
   	}
}


//////////////////////////////////////////////////
//                                              //
//  PopOut Function                             //
//                                              //
//////////////////////////////////////////////////

function popOut(menuNum, itemNum) 
{
	// If This is a Header Label With No Target Menu....
	if ((menuNum == 0) && !menu[menuNum][itemNum].target)
	{
		// Hide All Submenus Immediately
		HideAllMenusBesides(0);
	}
	else
	{
		// Hide All Submenus After a Time Delay
		PopTimer = setTimeout('HideAllMenusBesides(0)', 100);
	}
}



//////////////////////////////////////////////////
//                                              //
//  GetTree Function                            //
//                                              //
//////////////////////////////////////////////////

function GetPathToRoot(menuNum, itemNum) 
{
	// Array index is the menu number. The contents are null (if that menu is not a parent)
	// or the item number in that menu that is an ancestor (to light it up).
	
	itemArray = new Array(menu.length);

	while(1) 
	{
		itemArray[menuNum] = itemNum;

		// If we've reached the top of the hierarchy, return.
		if (menuNum == 0)
		{
			return itemArray;
		}
		
		itemNum = menu[menuNum][0].parentItem;
		menuNum = menu[menuNum][0].parentMenu;
   	}
}


//////////////////////////////////////////////////
//                                              //
//  ChangeColor Function                        //
//                                              //
//////////////////////////////////////////////////

// Pass an array and a boolean to specify color change, true = over color.
function ChangeColor(ChangeArray, isOver) 
{
	for (menuCount = 0; menuCount < ChangeArray.length; menuCount++) 
	{	
		if (ChangeArray[menuCount]) 
		{
			NewColor = isOver ? menu[menuCount][0].OverColor : menu[menuCount][0].BackColor;

			// Change the colors of the div background

			with (menu[menuCount][ChangeArray[menuCount]].ref)
			{
				backgroundColor = NewColor;	
         		}
      		}	
   	}
}


//////////////////////////////////////////////////
//                                              //
//  HideAllMenusBesides Function                //
//                                              //
//////////////////////////////////////////////////

function HideAllMenusBesides(menuNum)
{
	var keepMenus = GetPathToRoot(menuNum, 1);
	
	for (count = 0; count < menu.length; count++)
	{
		if (!keepMenus[count])
		{
			menu[count][0].ref.visibility = 'hidden';
			ChangeColor(HighlightedTitles, false);
		}
	}	
}



//////////////////////////////////////////////////
//                                              //
//  Menu Constructor                            //
//                                              //
//////////////////////////////////////////////////

function Menu(isVert, popInd, x, y, width, OverColor, BackColor, borderClass, textClass)
{
	// Vertical Menu or Not
	this.isVert = isVert;
	
	// PopUp Indicator
	this.popInd = popInd
	
	// Position and Size Settings
	this.x = x;
	this.y = y;
	this.width = width;

	// Color of Menu and Items
	this.OverColor = OverColor;
	this.BackColor = BackColor;

	// Stylesheet for Item Borders and Item Text
	this.borderClass = borderClass;
	this.textClass = textClass;

	// Parent Menu and Parent Item
	this.parentMenu = null;
	this.parentItem = null;

	// Reference to the Objects Style 
	this.ref = null;
}



//////////////////////////////////////////////////
//                                              //
//  Item Constructor                            //
//                                              //
//////////////////////////////////////////////////

function Item(text, href, frame, length, spacing, target)
{
	this.text = text;
	this.href = href;
	this.frame = frame;
	this.length = length;
	this.spacing = spacing;
	this.target = target;

	// Reference to the Objects Style Properties
	this.ref = null;
}




//////////////////////////////////////////////////
//                                              //
//  WriteMenus Function                         //
//                                              //
//////////////////////////////////////////////////

function writeMenus2() 
{
}

function writeMenus() 
{

	return;

	for (CurrentMenu = 0; CurrentMenu < menu.length; CurrentMenu++) with (menu[CurrentMenu][0])
	{
	
		var str = '';
		var itemX = 0;
		var itemY = 0;

	
		for (CurrentItem = 1; CurrentItem < menu[CurrentMenu].length; CurrentItem++) with (menu[CurrentMenu][CurrentItem])
		{
			var itemID = 'menu' + CurrentMenu + 'item' + CurrentItem;

			var w = (isVert ? width : length);
			var h = (isVert ? length : width);

			str += '<div id="' + itemID + '" style="margin: 0px; padding: 0px; position: absolute; left:' + itemX + 'px; top: ' + itemY + 'px; width: ' + w + 'px; height: ' + h + 'px; visibility: inherit; ';
			

			if (BackColor)
			{
				str += 'background-color: ' + BackColor + '; ';
			}
	
			str += '" ';

			if ((CurrentMenu != 0) || (CurrentItem !=1))
			{
				if (borderClass) 
				{
					str += 'class="' + borderClass + '" ';
				}
			}
	
			// Add mouseover handlers and finish DIV
			str += 'onMouseOver="popOver(' + CurrentMenu + ',' + CurrentItem + ')" onMouseOut="popOut(' + CurrentMenu + ',' + CurrentItem + ')">';

			// Add contents of item 
			str += '<a class="' + textClass + '" style="display: block; float: left; padding-left: 10px; margin-top: 3px;" href="' + href + '"' + (frame ? ' target="' + frame + '">' : '>') + text + '</a>';
		
			if (target > 0)
			{

				// Set target's parents to this menu item.
				menu[target][0].parentMenu = CurrentMenu;
				menu[target][0].parentItem = CurrentItem;

				// Add a popout indicator.
				if (popInd)
				{
					str += '<a class="' + textClass + '" style="display: block; float: left; padding-left: 5px; margin-top: 3px;">' + popInd + '</a>';
				}
			}
		
			str += '</div>';

			if (isVert)
			{
				itemY += length + spacing;
			}
			else 
			{
				itemX += length + spacing;
			}
		}
	

		var newDiv = document.createElement('div');
		document.getElementsByTagName('body').item(0).appendChild(newDiv);
		//document.getElementById('headerdiv').appendChild(newDiv);
		
		ref = newDiv.style;
		ref.position = 'absolute';
		ref.visibility = 'hidden';
		newDiv.innerHTML = str;


		for (CurrentItem = 1; CurrentItem < menu[CurrentMenu].length; CurrentItem++) 
		{
			itemName = 'menu' + CurrentMenu + 'item' + CurrentItem;
			menu[CurrentMenu][CurrentItem].ref = getSty(itemName);

   		}


	menu[CurrentMenu][0].ref.left = menu[CurrentMenu][0].x + "px";
	menu[CurrentMenu][0].ref.top = menu[CurrentMenu][0].y + "px";

	}

	menu[0][0].ref.visibility = 'visible';

	document.write("<div></div>");

}


var menu = new Array();

var defOver = '#669999';
var defBack = '#7373EE';

// Default 'length' of menu items - item height if menu is vertical, width if horizontal
var defLength = 23;

// Menu 0 is the special, 'root' menu from which everything else arises
menu[0] = new Array();
menu[0][0] = new Menu(false, '', 16, 112, 21, '#669999', '#7373EE', 'menuclass', 'itemText');
menu[0][1] = new Item('Home', 'http://fineartamerica.com/index.html', '', 50, 0, 0);
menu[0][2] = new Item('Login', 'http://fineartamerica.com/loginchoosetype.php', '', 45, 0, 1);
menu[0][3] = new Item('Artwork', 'http://fineartamerica.com/artdirectory.html', '', 55, 0, 2);
menu[0][4] = new Item('Artists', 'http://fineartamerica.com/artistdirectory.html', '', 50, 0, 3);
menu[0][5] = new Item('Galleries', 'http://fineartamerica.com/gallerydirectory.html', '', 65, 0, 0);
menu[0][6] = new Item('Events', 'http://fineartamerica.com/upcomingevents.html', '', 50, 0, 0);
menu[0][7] = new Item('Jobs', 'http://fineartamerica.com/jobopenings.html', '', 40, 0, 0);
menu[0][8] = new Item('Groups', 'http://fineartamerica.com/groups.html', '', 55, 0, 0);
menu[0][9] = new Item('Discussions', 'http://fineartamerica.com/discussions.html', '', 75, 0, 0);
menu[0][10] = new Item('Blogs', 'http://fineartamerica.com/blogs.html', '', 45, 0, 0);
menu[0][11] = new Item('News', 'http://fineartamerica.com/pressreleasedirectory.html', '', 50, 0, 0);
menu[0][12] = new Item('Chat', 'http://fineartamerica.com/chat.html', '', 40, 0, 0);
menu[0][13] = new Item('About', 'http://fineartamerica.com/aboutthissite.html', '', 50, 0, 4);

// LOGIN MENU
menu[1] = new Array();
menu[1][0] = new Menu(true, '>', 0, 25, 125, defOver, defBack, 'menuclass', 'itemText');
menu[1][1] = new Item('Artists', 'http://fineartamerica.com/artists/index.php', '', defLength, 0, 0);
menu[1][2] = new Item('Art Galleries', 'http://fineartamerica.com/galleries/index.php', '', defLength, 0, 0);
menu[1][3] = new Item('Art Collectors', 'http://fineartamerica.com/collectors/collectorprofile.php', '', defLength, 0, 0);


// ARTWORK MENU
menu[2] = new Array();
menu[2][0] = new Menu(true, '>', 0, 25, 135, defOver, defBack, 'menuclass', 'itemText');
menu[2][1] = new Item('All Artwork', 'http://fineartamerica.com/artdirectory.html', '', defLength, 0, 0);
menu[2][2] = new Item("Today's New Artwork", 'http://fineartamerica.com/newartwork.html', '', defLength, 0, 0);
menu[2][3] = new Item("Today's New Comments", 'http://fineartamerica.com/newcomments.html', '', defLength, 0, 0);
menu[2][4] = new Item("Find Artwork by Medium", 'http://fineartamerica.com/artdirectory.html', '', defLength, 0, 0);
menu[2][5] = new Item("Find Artwork by Color", 'http://fineartamerica.com/artworkbycolor.html', '', defLength, 0, 0);
menu[2][6] = new Item("Find Artwork by Subject", 'http://fineartamerica.com/artworksubjects.html', '', defLength, 0, 0);
menu[2][7] = new Item("Find Artwork by Tags", 'http://fineartamerica.com/artworktags.html', '', defLength, 0, 0);
menu[2][8] = new Item("Recently Sold Prints", 'http://fineartamerica.com/recentprintsales.html', '', defLength, 0, 0);
menu[2][9] = new Item("Search", 'http://fineartamerica.com/artworksubjects.html', '', defLength, 0, 0);


// ARTIST MENU
menu[3] = new Array();
menu[3][0] = new Menu(true, '>', 0, 25, 125, defOver, defBack, 'menuclass', 'itemText');
menu[3][1] = new Item('All Artists', 'http://fineartamerica.com/artistdirectory.html', '', defLength, 0, 0);
menu[3][2] = new Item("Today's New Artists", 'http://fineartamerica.com/newartists.html', '', defLength, 0, 0);
menu[3][3] = new Item("Search", 'http://fineartamerica.com/artistdirectory.html', '', defLength, 0, 0);


// ABOUT THIS SITE MENU
menu[4] = new Array();
menu[4][0] = new Menu(true, '>', 0, 25, 130, defOver, defBack, 'menuclass', 'itemText');
menu[4][1] = new Item('About This Site', 'http://fineartamerica.com/aboutthissite.html', '', defLength, 0, 0);
menu[4][2] = new Item('FAQ', 'http://fineartamerica.com/frequentlyaskedquestions.html', '', defLength, 0, 0);
menu[4][3] = new Item('Take a Tour - Artists', 'http://fineartamerica.com/tourartists.html', '', defLength, 0, 0);
menu[4][4] = new Item('Take a Tour - Collectors', 'http://fineartamerica.com/index.html', '', defLength, 0, 0);
menu[4][5] = new Item('Take a Tour - Galleries', 'http://fineartamerica.com/tourgalleries.html', '', defLength, 0, 0);
menu[4][6] = new Item('Custom Frames', 'http://fineartamerica.com/customframes.html', '', defLength, 0, 0);
menu[4][7] = new Item('Fine Art Prints', 'http://fineartamerica.com/fineartprints.html', '', defLength, 0, 0);
menu[4][8] = new Item('Stretched Canvas', 'http://fineartamerica.com/fineartcanvasprints.html', '', defLength, 0, 0);
menu[4][9] = new Item('Sample Kits', 'http://fineartamerica.com/artprintondemandsamplekits.html', '', defLength, 0, 0);
menu[4][10] = new Item('Paper / Canvas Prices', 'http://fineartamerica.com/printprices.html', '', defLength, 0, 0);
menu[4][11] = new Item('Contact Us', '../contactus.html', '', defLength, 0, 0);
//menu[4][7] = new Item('FAQ', 'http://fineartamerica.com/index.html', '', defLength, 0, 0);