/* vim: set expandtab tabstop=4 shiftwidth=4: */

// +----------------------------------------------------------------------+
// | $Workfile: layers.js $
// +----------------------------------------------------------------------+
// | Javascript 1.5                                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2007 Bueche Studios                                    |
// +----------------------------------------------------------------------+
// | @Author: Michael Bueche <mbueche@satx.rr.com>				          |
// +----------------------------------------------------------------------+

// $Header: /Consulting/Diamante Homes/www.diamantehomes.com/www/html/js/layers.js 2     12/08/08 12:51a Engineer $

var $objTimer;

var $objImage = document.createElement( 'img' );
$objImage.src = '/images/dynMenuBullet-over.gif';

var $objImage2 = document.createElement( 'img' );
$objImage.src = '/images/dropdown_bkg.gif';

/**
* Shows the Dropdown navigation bars
*
* @param	void
* @return	void
*/
function fShowSubnav( $objCaller, $strName )
{
	var $box;
	fHideAllSubnavs( $strName );
	fClearTimeout();

	if ( $box = document.getElementById( $strName ) )
	{
		$box.style.display = '';

		if ( $objCaller  )
		{
			$objTd = fGetParent( $objCaller, 'td')
			var $intX = fGetXPosition( $objTd );
			$box.style.left = $intX;
		}
	}

}

/**
* Clears the SetTimeout
*
* @param	void
* @return	void
*/
function fClearTimeout()
{
	if ( $objTimer )
	{
		window.clearTimeout( $objTimer );
	}
}

/**
* Hides the Dwopdown navigation submenu
*
* @param	void
* @return	void
*/
function fHideSubnav( $strName )
{
	$objTimer = window.setTimeout( fHideAllSubnavs, 500 );
}

/**
*
*
* @param	void
* @return	void
*/
function fHideAllSubnavs( $strName )
{
	if ( $strName == 'dynMenuCommunities' )
	{
		_fHideMenu( 'dynMenuAboutUs' );
	}
	else if ( $strName -= 'dynMenuAboutUs' )
	{
		_fHideMenu( 'dynMenuCommunities' );
	}
	else
	{
		_fHideMenu( 'dynMenuAboutUs' );
		_fHideMenu( 'dynMenuCommunities' );
	}
}

/**
* hides a menu item
*
* @param	void
* @return	void
*/
function _fHideMenu( $strMenuName )
{
	document.getElementById( $strMenuName ).style.display = 'none';
	fSetCaption( $strMenuName, '', '' );
}

/**
* Sets the Caption Text
*
* @param	void
* @return	void
*/
function fSetCaption( $strMenuName, $strTitle, $strText )
{
	document.getElementById( $strMenuName + 'CaptionTitle' ).innerHTML = $strTitle;
	document.getElementById( $strMenuName + 'CaptionText'  ).innerHTML = $strText;
}