 /********************Variables********************/
//colors
var g_leftMenuItemTextColor					= "F0E68C";
var g_leftMenuItemRolloverTextColor			= "FFFFFF";
var g_leftMenuItemSelectedTextColor			= "FFFFFF";
var g_leftMenuItemTextWeight				= "normal";
var g_leftMenuItemRolloverTextWeight		= "bold";
var g_leftMenuItemSelectedTextWeight		= "bold";

var g_bottomMenuItemTextColor				= "00224c";
var g_bottomMenuItemRolloverTextColor		= "00224c";
var g_bottomMenuItemSelectedTextColor		= "837c04";
var g_bottomMenuItemTextWeight				= "normal";
var g_bottomMenuItemRolloverTextWeight		= "bold";
var g_bottomMenuItemSelectedTextWeight		= "bold";

var g_rightMenuItemTextColor				= "FFFFFF";
var g_rightMenuItemRolloverTextColor		= "FFFFFF";
var g_rightMenuItemSelectedTextColor		= "FFFFFF";
var g_rightMenuItemTextWeight				= "normal";
var g_rightMenuItemRolloverTextWeight		= "bold";
var g_rightMenuItemSelectedTextWeight		= "bold";

//Objects
var g_menuItemArray                        	= new Array();
var g_selectedMenuDisplay					= null;
var g_defaultMenuDisplay					= null;
var g_activePortfolio						= null;
var g_rightCornerImage						= null;
var g_cachedImageArray						= new Array();
var g_defaultMenuCaption					= "";
var g_leftMenuIDList						= new Array();
var g_bottomMenuIDList						= new Array();
var g_rightMenuIDList						= new Array();

//constants
var g_menuItemTag                   		= "MENU_ITEM";
var g_menuDisplayTag						= "MENU_DISPLAY_ITEM";
var g_menuDisplayId							= "menu_display";
var g_menuDisplayDefaultId					= "default_menu";
var g_menuSuffix							= "_menu";
var g_menuCaptionDataSuffix					= "_caption_data";
var g_menuDisplayDataSuffix					= "_display_data";
var g_portfolioCaptionSuffix				= "_portfolio_caption";
var g_portfolioContentSuffix				= "_portfolio_content";
var g_portfolioPhotoSuffix					= "_portfolio_photo";

//Elements
var g_menuDisplayElement					= null;

//Variables
var g_lastClickedMenuId						= "";

//Enhanced prototypes
String.prototype.endsWith = function( subStr )
{
	return subStr == this.slice( this.length - subStr.length );
}

//Methods
function setDefaultMenuCaption( caption )
{
	g_defaultMenuCaption = caption;
}

function initPage()
{
	g_menuDisplayElement = document.getElementById( g_menuDisplayId );

	var anchorElements = document.getElementsByTagName( "a" );
	var menuCounter = 0;
	for( var x = 0; x < anchorElements.length; x++ )
	{
		if( anchorElements[ x ].id && anchorElements[ x ].id.endsWith( g_menuSuffix ) )
		{
			g_menuItemArray[ menuCounter ] = new menuItem( anchorElements[ x ].id, menuCounter );
			menuCounter++;
		}
	}
	
	g_rightCornerImage = document.getElementById( "right_corner_img" );
	
	var defaultElement = getMenuItemByID( "default_menu" );
	
	if( defaultElement )
	{
		g_menuDisplayElement.innerHTML = defaultElement.childMenuDisplay.displayHTML;
		setDefaultMenuCaption( defaultElement.childMenuDisplay.displayHTML );
	}

	backToHome();
	
	document.body.style.display = "block";
}

function cacheImage( url )
{
	var img = new Image();
	img.src = url;
	g_cachedImageArray[ g_cachedImageArray.length ] = img;
}

/*****************************Menu Item Class***************************/
//constructor
function menuItem( menuID, sequence )
{
    if( menuID )
    {
        this.id     				= menuID;
        this.element				= document.getElementById( menuID );
        this.parentElement			= document.getElementById( menuID + "_frame" );
        this.sequence				= sequence;
        this.isActive				= false;
        this.isSelected				= false;
        this.imgIndex				= g_menuItemArray.length;
        this.isLeftMenu				= false;
        this.isBottomMenu			= false;
        this.isRightMenu			= false;
        this.imgIndex				= 0;
	
		if( this.element )
        {
	        this.baseStyle		= this.element.style;
	        this.text   		= this.element.data;
        }
        else
        {
        	alert( "Error in menuItem constructor.  No element defined." );
        }
        
        this.childMenuDisplay		= new menuDisplay( this );
        
        for( var x = 0; x < g_leftMenuIDList.length; x++ )
        {
			if( g_leftMenuIDList[ x ] == this.id )
			{
				this.isLeftMenu = true;
				this.imgIndex = x + 1;
				if( this.element )
				{
					this.element.style.color = g_leftMenuItemTextColor;
				}
				break;
			}
        }
        
        if( !this.isLeftMenu )
        {
			for( x = 0; x < g_bottomMenuIDList.length; x++ )
			{
				if( g_bottomMenuIDList[ x ] == this.id )
				{
					this.isBottomMenu = true;
					if( this.element )
					{
						this.element.style.color = g_bottomMenuItemTextColor;
					}
					break;
				}			
			}
        }
        
        if( !this.isLeftMenu && !this.isBottomMenu )
        {
			for( x = 0; x < g_rightMenuIDList.length; x++ )
			{
				if( g_rightMenuIDList[ x ] == this.id )
				{
					this.isRightMenu = true;
					if( this.element )
					{
						this.element.style.color = g_rightMenuItemTextColor;
					}
					break;
				}			
			}        
        }
    }
    else
    {
    		alert( "Error in menuItem constructor.  No parent menu ID." );
    }
}

menuItem.prototype.id = function()
{
    return this.id;
}

menuItem.prototype.element = function()
{
    return this.element;
}

menuItem.prototype.parentElement = function()
{
	return this.parentElement;
}

menuItem.prototype.sequence = function()
{
	return this.sequence;
}

menuItem.prototype.isActive = function()
{
	return this.isActive;
}

menuItem.prototype.isSelected = function()
{
	return this.isSelected;
}

menuItem.prototype.imgIndex = function()
{
	return this.imgIndex;
}

menuItem.prototype.baseStyle = function()
{
	return this.baseStyle;
}

menuItem.prototype.text = function()
{
	return this.text;
}

menuItem.prototype.childMenuDisplay = function()
{
	return this.childMenuDisplay;
}

menuItem.prototype.isLeftMenu = function()
{
	return this.isLeftMenu;
}

menuItem.prototype.isBottomMenu = function()
{
	return this.isBottomMenu;
}

menuItem.prototype.isRightMenu = function()
{
	return this.isRightMenu;
}

menuItem.prototype.imgIndex = function()
{
	return this.imgIndex;
}

function menuDisplay( parentMenu )
{
    if( parentMenu == null )
    {
        alert( "Error in menuDisplay constructor.  Null menu parent." );
    }
    else
    {
		this.parent 					= parentMenu;
		
		var captionElement = document.getElementById( parentMenu.id + g_menuCaptionDataSuffix );
		var displayElement = document.getElementById( parentMenu.id + g_menuDisplayDataSuffix );

		if( captionElement )
        {
	        	this.captionHTML			= captionElement.innerHTML;
	        	this.baseCaptionStyle		= captionElement.style;        	
        }
        else
        {
	        	this.captionHTML			= "";
	        	this.baseCaptionStyle	= "";
	        	alert( "Error in menuDisplay constructor.  No caption element found." );
        }

		if( displayElement )
        {
	        	this.displayHTML			= displayElement.innerHTML;
	        	this.baseDisplayStyle		= displayElement.style;
        }
        else
        {
	        	this.displayHTML			= "";
	        	this.baseDisplayStyle		= "";        	
	        	alert( "Error in menuDisplay constructor.  No display element found." );
        }

	    if( parentMenu.id == g_menuDisplayDefaultId )
        {
        		g_selectedMenuDisplay = this;
        		g_defaultMenuDisplay  = this;
        }
    }
}

menuDisplay.prototype.parent = function()
{
    return this.parent ;
}

menuDisplay.prototype.captionHTML = function()
{
    return this.captionHTML;
}

menuDisplay.prototype.baseCaptionStyle = function()
{
    return this.baseCaptionStyle;
}

menuDisplay.prototype.displayHTML = function()
{
    return this.displayHTML;
}

menuDisplay.prototype.baseDisplayStyle = function()
{
    return this.baseDisplayStyle;
}

function findMenuItem( menuOption )
{
	if( menuOption && g_menuItemArray )
	{
		for( var x = 0; x < g_menuItemArray.length; x++ )
		{
			var menuItem = g_menuItemArray[ x ];
			if( menuItem && menuItem.id == menuOption )
			{
				return menuItem;
			}
		}
	}
	
	return null;
}

function findActiveMenu()
{
	if( g_menuItemArray )
	{
		for( var x = 0; x < g_menuItemArray.length; x++ )
		{
			var menuItem = g_menuItemArray[ x ];
			if( menuItem && menuItem.isActive == true )
			{
				return menuItem;
			}
		}
	}
	
	return null;
}

function deselectLeftMenus()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isLeftMenu )
		{
			menuItem.element.style.color		= g_leftMenuItemTextColor;
			menuItem.element.style.fontWeight	= g_leftMenuItemTextWeight;
			menuItem.isActive = false;
		}
	}
}

function deselectBottomMenus()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isBottomMenu )
		{
			menuItem.element.style.color		= g_bottomMenuItemTextColor;
			menuItem.element.style.fontWeight	= g_bottomMenuItemTextWeight;
			menuItem.isActive = false;
		}
	}
}

function deselectActiveMenus( deactivateMenu )
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isActive == true )
		{
			menuItem.isActive = false;
		}
		
		if( menuItem.isLeftMenu == true )
		{
			menuItem.element.style.color		= g_leftMenuItemTextColor;
			menuItem.element.style.fontWeight	= g_leftMenuItemTextWeight;
		}
		else if( menuItem.isBottomMenu == true )
		{
			menuItem.element.style.color		= g_bottomMenuItemTextColor;
			menuItem.element.style.fontWeight	= g_bottomMenuItemTextWeight;		
		}
		else if( menuItem.isRightMenu == true )
		{
			menuItem.element.style.color		= g_rightMenuItemTextColor;
			menuItem.element.style.fontWeight	= g_rightMenuItemTextWeight;		
		}
	}
}

function getMenuItemByID( menuID )
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		if( g_menuItemArray[ x ].id == menuID )
		{
			return g_menuItemArray[ x ];
		}
	}
	
	return null;
}

function registerLeftMenu( menuID )
{
	var menuItem = getMenuItemByID( menuID );
	if( menuItem )
	{
		menuItem.isLeftMenu = true;
		
		menuItem.baseStyle.color = g_leftMenuItemTextColor;
	}
	else
	{
		g_leftMenuIDList[ g_leftMenuIDList.length ] = menuID;
	}
}

function registerBottomMenu( menuID )
{
	var menuItem = getMenuItemByID( menuID );
	if( menuItem )
	{
		menuItem.isBottomMenu = true;
		
		menuItem.baseStyle.color = g_bottomMenuItemTextColor;
	}
	else
	{
		g_bottomMenuIDList[ g_bottomMenuIDList.length ] = menuID;
	}
}

function registerRightMenu( menuID )
{
	var menuItem = getMenuItemByID( menuID );
	if( menuItem )
	{
		menuItem.isRightMenu = true;
		
		menuItem.baseStyle.color = g_rightMenuItemTextColor;
	}
	else
	{
		g_rightMenuIDList[ g_rightMenuIDList.length ] = menuID;
	}
}

function rolloverLeftMenu( menuID )
{
	//var activeMenu	= findActiveLeftMenu();
	var activeMenu	= findActiveMenu();
	
	var menuItem = getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{		
				changeMenu( menuItem, g_leftMenuItemRolloverTextColor, g_leftMenuItemRolloverTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_leftMenuItemRolloverTextColor, g_leftMenuItemRolloverTextWeight, menuItem.childMenuDisplay.captionHTML );
		}
	}
}

function rolloverBottomMenu( menuID )
{
	//var activeMenu	= findActiveBottomMenu();
	var activeMenu		= findActiveMenu();
	var menuItem = getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{
				changeMenu( menuItem, g_bottomMenuItemRolloverTextColor, g_bottomMenuItemRolloverTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_bottomMenuItemRolloverTextColor, g_bottomMenuItemRolloverTextWeight, menuItem.childMenuDisplay.captionHTML );
		}
	}	
}

function rolloverRightMenu( menuID )
{
	//var activeMenu	= findActiveRightMenu();
	var activeMenu		= findActiveMenu();
	var menuItem = getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{
				changeMenu( menuItem, g_rightMenuItemRolloverTextColor, g_rightMenuItemRolloverTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_rightMenuItemRolloverTextColor, g_rightMenuItemRolloverTextWeight, menuItem.childMenuDisplay.captionHTML );
		}
	}	
}

function findActiveMenu()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isActive == true )
		{
			return menuItem;
		}
	}
	
	return null;
}

function findActiveLeftMenu()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isLeftMenu == true && menuItem.isActive == true )
		{
			return menuItem;
		}
	}
	
	return null;
}

function findActiveBottomMenu()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isBottomMenu == true && menuItem.isActive == true )
		{
			return menuItem;
		}
	}
	
	return null;
}

function findActiveRightMenu()
{
	for( var x = 0; x < g_menuItemArray.length; x++ )
	{
		var menuItem = g_menuItemArray[ x ];
		if( menuItem.isRightMenu == true && menuItem.isActive == true )
		{
			return menuItem;
		}
	}
	
	return null;
}

function rolloutLeftMenu( menuID )
{
	var activeMenu	= findActiveMenu();
	var menuItem	= getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{
				//don't change the caption after a menu has been selected...
				changeMenu( menuItem, g_leftMenuItemTextColor, g_leftMenuItemTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_leftMenuItemTextColor, g_leftMenuItemTextWeight, g_defaultMenuCaption );
		}
	}
}

function rolloutBottomMenu( menuID )
{
	var activeMenu	= findActiveMenu();
	var menuItem	= getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{
				//don't change the caption after a menu has been selected...
				changeMenu( menuItem, g_bottomMenuItemTextColor, g_bottomMenuItemTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_bottomMenuItemTextColor, g_bottomMenuItemTextWeight, g_defaultMenuCaption );
		}
	}
}

function rolloutRightMenu( menuID )
{
	var activeMenu	= findActiveMenu();
	var menuItem	= getMenuItemByID( menuID );
	
	if( menuItem )
	{
		if( activeMenu )
		{
			if( activeMenu.id != menuID )
			{
				//don't change the caption after a menu has been selected...
				changeMenu( menuItem, g_rightMenuItemTextColor, g_rightMenuItemTextWeight, "" );
			}
		}
		else
		{
			changeMenu( menuItem, g_rightMenuItemTextColor, g_rightMenuItemTextWeight, g_defaultMenuCaption );
		}
	}
}

function changeMenu( menuItem, menuTextColor, menuTextWeight, menuTextCaption )
{
	if( menuItem )
	{
		if( menuItem.element )
		{
			menuItem.element.style.color		= menuTextColor;
			menuItem.element.style.fontWeight	= menuTextWeight;
		}
		
		if( g_menuDisplayElement && menuTextCaption )
		{
			g_menuDisplayElement.innerHTML = menuTextCaption;
		}
	}
}

function clickLeftMenu( menuID )
{
	deselectBottomMenus();

	var menuItem	= getMenuItemByID( menuID );
	var activeMenu	= findActiveLeftMenu();
	
	if( menuItem )
	{
		menuItem.isActive = true;
		
		if( activeMenu && activeMenu.id != menuItem.id )
		{
			activeMenu.isActive = false;
			changeMenu( activeMenu, g_leftMenuItemTextColor, g_leftMenuItemTextWeight, "" );
		}
		
		changeMenu( menuItem, g_leftMenuItemSelectedTextColor, g_leftMenuItemSelectedTextWeight, menuItem.childMenuDisplay.displayHTML );
		
		if( g_rightCornerImage && menuItem.imgIndex > 0 && menuItem.imgIndex < g_cachedImageArray.length )
		{
			g_rightCornerImage.style.display = "block";
			g_rightCornerImage.src = g_cachedImageArray[ menuItem.imgIndex ].src;
		}
		else if( g_rightCornerImage )
		{
			g_rightCornerImage.style.display = "none";
		}		
	}
}

function clickBottomMenu( menuID )
{
	deselectLeftMenus();

	var menuItem	= getMenuItemByID( menuID );
	var activeMenu	= findActiveBottomMenu();
	
	if( menuItem )
	{
		menuItem.isActive = true;
		
		if( activeMenu && activeMenu.id != menuItem.id )
		{
			activeMenu.isActive = false;
			changeMenu( activeMenu, g_bottomMenuItemTextColor, g_leftMenuItemTextWeight, "" );
		}
		
		changeMenu( menuItem, g_bottomMenuItemSelectedTextColor, g_leftMenuItemSelectedTextWeight, menuItem.childMenuDisplay.displayHTML );
	}
}

function clickMenu( menuItem, menuTextColor, menuTextWeight, menuTextCaption )
{
	selectServiceNone();

	var activeMenu = findActiveMenu();

	if( activeMenu != null )
	{
		if( activeMenu.id == menuItem.id )
		{
			return;
		}
		
		deselectActiveMenus( false );
				
		activeMenu.isSelected = true;
		g_selectedMenuDisplay = activeMenu.childMenuDisplay;

		if( activeMenu.imgIndex >= 0 )
		{
			if( g_rightCornerImage && activeMenu.imgIndex < g_cachedImageArray.length )
			{
				g_rightCornerImage.style.display = "block";
				g_rightCornerImage.src = g_cachedImageArray[ activeMenu.imgIndex ].src;
			}
			else if( g_rightCornerImage )
			{
				g_rightCornerImage.style.display = "none";
			}
		}
		
		changeMenu( menuItem, menuTextColor, menuTextWeight, menuTextCaption );

		g_lastClickedMenuId = menuId;
	}
}

function backToHome()
{
	deselectActiveMenus( true );
	
	g_rightCornerImage.src = g_cachedImageArray[ 0 ].src;
	
	if( g_menuDisplayElement )
	{
		g_menuDisplayElement.innerHTML = g_defaultMenuCaption;
	}	
}

function selectServiceNone()
{
	var serviceDisplayOurServices 		= document.getElementById( "our_services" );
	//var serviceBenefitsOfService 		= document.getElementById( "our_portfolio" );
	var serviceDisplayTypesOfService 	= document.getElementById( "types_of_service" );
	var serviceDisplayLevelsOfService 	= document.getElementById( "levels_of_service" );

	//var serviceBenefitsOfServiceLabel	= document.getElementById( "our_portfolio_label" );
	var serviceDisplayTypesOfServiceLabel	= document.getElementById( "types_of_service_label" );
	var serviceDisplayLevelsOfServiceLabel 	= document.getElementById( "levels_of_service_label" );

	//serviceBenefitsOfServiceLabel.style.fontWeight = "normal";
	serviceDisplayTypesOfServiceLabel.style.fontWeight = "normal";
	serviceDisplayLevelsOfServiceLabel.style.fontWeight = "normal";

	serviceDisplayOurServices.style.display 	= "block";
	//serviceBenefitsOfService.style.display	= "none";
	serviceDisplayTypesOfService.style.display 	= "none";
	serviceDisplayLevelsOfService.style.display	= "none";
}

function selectServiceOurPortfolio( serviceItem )
{
	var serviceDisplayOurServices 		= document.getElementById( "our_services" );
	//var serviceBenefitsOfService 		= document.getElementById( "our_portfolio" );
	var serviceDisplayTypesOfService 	= document.getElementById( "types_of_service" );
	var serviceDisplayLevelsOfService 	= document.getElementById( "levels_of_service" );

	//var serviceBenefitsOfServiceLabel	= document.getElementById( "our_portfolio_label" );
	var serviceDisplayTypesOfServiceLabel	= document.getElementById( "types_of_service_label" );
	var serviceDisplayLevelsOfServiceLabel 	= document.getElementById( "levels_of_service_label" );

	//serviceBenefitsOfServiceLabel.style.fontWeight = "bold";
	serviceDisplayTypesOfServiceLabel.style.fontWeight = "normal";
	serviceDisplayLevelsOfServiceLabel.style.fontWeight = "normal";

	serviceDisplayOurServices.style.display 	= "none";
	//serviceBenefitsOfService.style.display	= "block";
	serviceDisplayTypesOfService.style.display 	= "none";
	serviceDisplayLevelsOfService.style.display	= "none";
}

function selectServiceTypesOfService()
{
	var serviceBenefitsOfService 		= document.getElementById( "benefits_of_service" );
	var serviceDisplayTypesOfService 	= document.getElementById( "types_of_service" );
	var serviceDisplayLevelsOfService 	= document.getElementById( "levels_of_service" );

	var serviceBenefitsOfServiceLabel	= document.getElementById( "benefits_of_service_label" );
	var serviceDisplayTypesOfServiceLabel	= document.getElementById( "types_of_service_label" );
	var serviceDisplayLevelsOfServiceLabel 	= document.getElementById( "levels_of_service_label" );

	serviceBenefitsOfServiceLabel.isSelected = 0;
	serviceDisplayTypesOfServiceLabel.isSelected = 1;
	serviceDisplayLevelsOfServiceLabel.isSelected = 0;

	serviceBenefitsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceBenefitsOfServiceLabel.style.color = g_bottomMenuItemTextColor;
	serviceDisplayTypesOfServiceLabel.style.fontWeight = g_bottomMenuItemSelectedTextWeight;
	serviceDisplayTypesOfServiceLabel.style.color = g_bottomMenuItemSelectedTextColor;
	serviceDisplayLevelsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceDisplayLevelsOfServiceLabel.style.color = g_bottomMenuItemTextColor;

	serviceBenefitsOfService.style.display 	= "none";
	serviceDisplayTypesOfService.style.display 	= "block";
	serviceDisplayLevelsOfService.style.display	= "none";
}

function selectServiceLevelsOfService( serviceItem )
{
	var serviceBenefitsOfService 		= document.getElementById( "benefits_of_service" );
	var serviceTypesOfService 	= document.getElementById( "types_of_service" );
	var serviceLevelsOfService 	= document.getElementById( "levels_of_service" );

	var serviceBenefitsOfServiceLabel		= document.getElementById( "benefits_of_service_label" );
	var serviceTypesOfServiceLabel	= document.getElementById( "types_of_service_label" );
	var serviceLevelsOfServiceLabel 	= document.getElementById( "levels_of_service_label" );
	
	serviceBenefitsOfServiceLabel.isSelected = 0;
	serviceTypesOfServiceLabel.isSelected = 0;
	serviceLevelsOfServiceLabel.isSelected = 1;

	serviceBenefitsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceBenefitsOfServiceLabel.style.color = g_bottomMenuItemTextColor;
	serviceTypesOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceTypesOfServiceLabel.style.color = g_bottomMenuItemTextColor;
	serviceLevelsOfServiceLabel.style.fontWeight = g_bottomMenuItemSelectedTextWeight;
	serviceLevelsOfServiceLabel.style.color = g_bottomMenuItemSelectedTextColor;

	serviceBenefitsOfService.style.display 	= "none";
	serviceTypesOfService.style.display 	= "none";
	serviceLevelsOfService.style.display	= "block";
}

function selectServiceBenefitsOfService( serviceItem )
{
	var serviceBenefitsOfService 		= document.getElementById( "benefits_of_service" );
	var serviceTypesOfService 		= document.getElementById( "types_of_service" );
	var serviceLevelsOfService 		= document.getElementById( "levels_of_service" );

	var serviceBenefitsOfServiceLabel	= document.getElementById( "benefits_of_service_label" );
	var serviceTypesOfServiceLabel		= document.getElementById( "types_of_service_label" );
	var serviceLevelsOfServiceLabel 	= document.getElementById( "levels_of_service_label" );

	serviceBenefitsOfServiceLabel.isSelected = 1;
	serviceTypesOfServiceLabel.isSelected = 0;
	serviceLevelsOfServiceLabel.isSelected = 0;

	serviceBenefitsOfServiceLabel.style.fontWeight = g_bottomMenuItemSelectedTextWeight;
	serviceBenefitsOfServiceLabel.style.color = g_bottomMenuItemSelectedTextColor;
	serviceTypesOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceTypesOfServiceLabel.style.color = g_bottomMenuItemTextColor;
	serviceLevelsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
	serviceLevelsOfServiceLabel.style.color = g_bottomMenuItemTextColor;

	serviceBenefitsOfService.style.display 	= "block";
	serviceTypesOfService.style.display 	= "none";
	serviceLevelsOfService.style.display	= "none";
}

function highlightServiceItem( serviceItem, unHighlight )
{
	if( serviceItem )
	{
		var serviceBenefitsOfServiceLabel		= document.getElementById( "benefits_of_service_label" );
		var serviceTypesOfServiceLabel			= document.getElementById( "types_of_service_label" );
		var serviceLevelsOfServiceLabel 		= document.getElementById( "levels_of_service_label" );

		if( serviceItem.id == "benefits_of_service_label" && 
			!serviceLevelsOfServiceLabel.isSelected &&
			!serviceTypesOfServiceLabel.isSelected )
		{
			serviceTypesOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceTypesOfServiceLabel.style.color = g_bottomMenuItemTextColor;		
			serviceLevelsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceLevelsOfServiceLabel.style.color = g_bottomMenuItemTextColor;
		}
		else if( serviceItem.id == "types_of_service_label" &&
			!serviceBenefitsOfServiceLabel.isSelected &&
			!serviceLevelsOfServiceLabel.isSelected )
		{
			serviceBenefitsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceBenefitsOfServiceLabel.style.color = g_bottomMenuItemTextColor;		
			serviceLevelsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceLevelsOfServiceLabel.style.color = g_bottomMenuItemTextColor;
		}
		else if( serviceItem.id == "levels_of_service_label" &&
				 !serviceBenefitsOfServiceLabel.isSelected &&
				 !serviceTypesOfServiceLabel.isSelected )
		{
			serviceBenefitsOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceBenefitsOfServiceLabel.style.color = g_bottomMenuItemTextColor;				
			serviceTypesOfServiceLabel.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceTypesOfServiceLabel.style.color = g_bottomMenuItemTextColor;
		}

		if( unHighlight == true && serviceItem.isSelected != 1 )
		{
			serviceItem.style.fontWeight = g_bottomMenuItemTextWeight;
			serviceItem.style.color = g_bottomMenuItemTextColor;
		}
		else if( serviceItem.isSelected != 1 )
		{
			serviceItem.style.color = g_bottomMenuItemRolloverTextColor
			serviceItem.style.fontWeight = g_bottomMenuItemRolloverTextWeight;
		}
	}
}

function selectOurPortfolio( dropList )
{
	if( dropList != null )
	{
		var index = dropList.selectedIndex;
		var selectionID = dropList.options[ index ].id;

		//first deselect any active content
		if( g_activePortfolio )
		{
			var activeCaption	= document.getElementById( g_activePortfolio + g_portfolioCaptionSuffix );
			var activeContent	= document.getElementById( g_activePortfolio + g_portfolioContentSuffix );
			//var activePhoto		= document.getElementById( g_activePortfolio + g_portfolioPhotoSuffix	);

			if( activeCaption )
			{
				activeCaption.style.display = "none";
			}

			if( activeContent )
			{
				activeContent.style.display = "none";
			}

			//if( activePhoto )
			//{
			//	activePhoto.style.display = "none";
			//}
			
			g_activePortfolio = "";
		}
		
		//now select the new portfolio
		if( selectionID )
		{
			g_activePortfolio = selectionID;
			
			var newCaption	= document.getElementById( g_activePortfolio + g_portfolioCaptionSuffix );
			var newContent	= document.getElementById( g_activePortfolio + g_portfolioContentSuffix );
			//var newPhoto	= document.getElementById( g_activePortfolio + g_portfolioPhotoSuffix	);
			
			if( newCaption )
			{
				newCaption.style.display = "block";
			}
			
			if( newContent )
			{
				newContent.style.display = "block";
			}
			
			//if( newPhoto )
			//{
			//	newPhoto.style.display = "block";
			//}
		}
	}
}

function selectContactUsNone()
{
	var contactUsContactUsDefault		= document.getElementById( "contact_us_default" );
	var contactUsRequestEstimate 		= document.getElementById( "request_estimate" );
	var contactUsSeeFAQ 				= document.getElementById( "see_faq" );

	var contactUsRequestEstimateLabel	= document.getElementById( "request_estimate_label" );
	var contactUsSeeFAQLabel 			= document.getElementById( "see_faq_label" );

	contactUsRequestEstimateLabel.style.fontWeight = "normal";
	contactUsSeeFAQLabel.style.fontWeight = "normal";

	contactUsContactUsDefault.style.display = "block";
	contactUsRequestEstimate.style.display 	= "none";
	contactUsSeeFAQ.style.display			= "none";
}

function selectContactUsRequestEstimate()
{
	/*var contactUsContactUsDefault		= document.getElementById( "contact_us_default" );
	var contactUsRequestEstimate 		= document.getElementById( "request_estimate" );
	var contactUsSeeFAQ 				= document.getElementById( "see_faq" );

	var contactUsRequestEstimateLabel	= document.getElementById( "request_estimate_label" );
	var contactUsSeeFAQLabel 			= document.getElementById( "see_faq_label" );

	contactUsRequestEstimateLabel.style.fontWeight = "bold";
	contactUsSeeFAQLabel.style.fontWeight = "normal";

	contactUsContactUsDefault.style.display = "none";
	contactUsRequestEstimate.style.display 	= "block";
	contactUsSeeFAQ.style.display			= "none";*/
	window.navigate( "Default.asp?action=request_estimate" );
}

function selectContactUsSeeFAQ()
{
	var contactUsContactUsDefault		= document.getElementById( "contact_us_default" );
//	var contactUsRequestEstimate 		= document.getElementById( "request_estimate" );
	var contactUsSeeFAQ 				= document.getElementById( "see_faq" );

//	var contactUsRequestEstimateLabel	= document.getElementById( "request_estimate_label" );
	var contactUsSeeFAQLabel 			= document.getElementById( "see_faq_label" );

//	contactUsRequestEstimateLabel.style.fontWeight = "normal";
	contactUsSeeFAQLabel.style.fontWeight = "bold";

	contactUsContactUsDefault.style.display = "none";
//	contactUsRequestEstimate.style.display 	= "none";
	contactUsSeeFAQ.style.display			= "block";
}

function onMouseOverRequestEstimate()
{
	var requestEstimate = document.getElementById( "request_estimate_label" );
	if( requestEstimate )
	{
		requestEstimate.style.fontWeight = g_rightMenuItemRolloverTextWeight;
	}	
}

function onMouseOutRequestEstimate()
{
	var requestEstimate = document.getElementById( "request_estimate_label" );
	if( requestEstimate )
	{
		requestEstimate.style.fontWeight = g_rightMenuItemTextWeight;
	}	
}

/******************************UNUSED FUNCTIONS***********************************/
/*****************************XML Utility*********************************/
/*function loadXML(url, handler, optional)
{
    // Use the standard DOM Level 2 technique, if it is supported
    if (document.implementation && document.implementation.createDocument)
    {
        // Create a new Document object
        var xmlDoc = document.implementation.createDocument("", "", null);
        // Specify what should happen when it finishes loading
        xmlDoc.onload = function() { handler(xmlDoc, url); }
        // And tell it what URL to load
        xmlDoc.load(url);
    }
    // Otherwise use Microsoft's proprietary API for Internet Explorer
    else if (window.ActiveXObject)
    {
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");   // Create doc.
        xmlDoc.onreadystatechange = function()                // Specify onload
        {
            if (xmlDoc.readyState == 4)
            {
                handler(xmlDoc, url, optional)
            }
        }
        xmlDoc.load(url);                                     // Start loading!
    }
}*/



var g_activeMenu = null;
var g_HTMLTextTable = {};
var g_menuDisplayElement = null;
var g_defaultMenuDisplay = null;
var g_stopCaptions = false;

function selectLeftMenu(menuOption, bSelect, bShowCaption)
{
	if( g_menuDisplayElement == null || g_defaultMenuDisplay == null )
	{
		g_menuDisplayElement = document.getElementById( "menu_display" );
		g_defaultMenuDisplay = document.getElementById( "default_menu_display" );
	}

	if( menuOption )
	{
		var link = document.getElementById( menuOption.id + "_link" );
	
		if( bSelect )
		{
			menuOption.className = "selected_left_menu_frame";
			if( link )
			{
				link.className = "selected_left_menu_link";
			}
		}
		else
		{
			menuOption.className = "left_menu_frame";
			if( link )
			{
				link.className = "left_menu_link";
			}
		}
		
		if( bShowCaption )
		{
			if( g_menuDisplayElement != null )
			{
				var vCaptionElem = g_HTMLTextTable[ menuOption.id + "_caption" ];
				
				if( vCaptionElem == null )
				{
					vCaptionElem = document.getElementById(menuOption.id + "_caption");
					g_HTMLTextTable[ menuOption.id + "_caption" ] = vCaptionElem;
				}

				if( vCaptionElem != null && g_menuDisplayElement )
				{
					if( bSelect )
					{
						g_menuDisplayElement.innerHTML = vCaptionElem.innerHTML;
					}
					else if( g_defaultMenuDisplay != null )
					{
						g_menuDisplayElement.innerHTML = g_defaultMenuDisplay.innerHTML;
					}
				}		
			}
		}
	}
	else if( bShowCaption )
	{
		if( g_menuDisplayElement != null && g_defaultMenuDisplay != null )
		{
			g_menuDisplayElement.innerHTML = g_defaultMenuDisplay.innerHTML;
		}	
	}
}

function initPage()
{
	selectLeftMenu(null, false, true);
}

function selectMenu(sTag)
{
	document.MainForm.elements["MenuSelection"].value = sTag;
	document.MainForm.submit();
}

function SubmitQuickQuote()
{
	var sErrMsg = "";
	if (document.MainForm.elements["email"].value == "")
	{
		sErrMsg += "Please include your email address.\n";
	}
	
	if (document.MainForm.elements["project_deadline"].value == "")
	{
		sErrMsg += "Please include a project deadline.";
	}
		
	if (sErrMsg == "")
	{
		document.MainForm.elements["validated"].value = "1";
		document.MainForm.submit();
		return true;
	}
	else
	{
		alert(sErrMsg);
	}
		
	return false;
}

function rolloverQuickQuote(quickQuote, bShowCaption)
{
	quickQuote.className='quick_quote_button_rollover';
	
	if (bShowCaption)
	{
		var vCaptionElem = g_HTMLTextTable[ "quick_quote_caption" ];
		
		if (!vCaptionElem)
		{
			vCaptionElem = document.getElementById("quick_quote_caption");
			g_HTMLTextTable[ "quick_quote_caption" ];
		}
		
		g_menuDisplayElement.innerHTML = vCaptionElem.innerHTML;
	}
}

function rolloutQuickQuote(quickQuote, bShowCaption)
{
	quickQuote.className='quick_quote_button';
	 
	if( bShowCaption && g_menuDisplayElement != null && g_defaultMenuDisplay != null )
	{
		g_menuDisplayElement.innerHTML = g_defaultMenuDisplay.innerHTML;
	}	
}

function OnCancel()
{
		document.MainForm.elements["validated"].value = "-1";
		document.MainForm.submit();
		return true;
}