/*-------------------------------------------------------------------------------
$Archive: /TraneDotCom/Redesign/PSCDEV/Includes/BuildLookAndFeel.asp $
$Author: Dbrewer $
$Date: 6/24/02 3:59p $
$Revision: 24 $
$NoKeywords: $
-------------------------------------------------------------------------------*/


/*-------------------------------------------------------------------------------
Include:    Navigation.js
Documented: 17 June 2002 By David Brewer
Purpose:    Contains all of the javascript functions used in conjunction with
            the site navigation.
-------------------------------------------------------------------------------*/



/*-------------------------------------------------------------------------------
Function:   preloadImages
Documented: 25 June 2002 By Brian Payne
Purpose:    Preloads images for mouseover image swaps. The images that are 
            preloaded have the same name for every site, but the root folder
            name is based on the site name.
            differs.            
Parameters: strSite - the name of the site the page is in
Returns:    none
Note:       The preloaded image objects must be created at the document level
            in order for them to be accessible from the swapImage function.
-------------------------------------------------------------------------------*/
if (document.images)
{
	var objHoverArrow = new Image(12, 11); 
	var objDefaultArrow = new Image(12, 11); 
}

function preloadImages(strSite)
{
	// make sure the object was created
	if (objDefaultArrow)
	{
		// now actually set the src value
		//objDefaultArrow.src = "http://65.83.240.70/" + strSite + "/Images/LeftnavArrow.gif";
		objDefaultArrow.src = "/" + strSite + "/Images/LeftnavArrow.gif";
	}
  
	// make sure the object was created
	if (objHoverArrow)
	{	
		// netscape 4 requires a different hover image
		var strHoverArrow = "/" + strSite + "/Images/LeftnavArrowHover.gif";		
			
		if (navigator.appName && navigator.appVersion)
		{
			if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4)
			{
				strHoverArrow = "/" + strSite + "/Images/LeftnavArrowHoverNS4.gif";
			}
		}				
		// now actually set the src value
		//objHoverArrow.src = "http://65.83.240.70" + strHoverArrow;
		objHoverArrow.src = "" + strHoverArrow;
	}
  init();
}

function init() {}

/*-------------------------------------------------------------------------------
Function:   swapImage
Documented: 25 June 2002 By Brian Payne
Purpose:    Generic image swapping function.
Parameters: strElement - the name of the html image element being changed
Returns:    objImage - the image object the element is being changed to
Note:       * Currently this only being used to change out the arrow when a 
            section is moused over in the left hand navigation.
            * For an image to be used in a swap it must be preloaded by creating
            a new image object at the document level and setting its src value
            in the preloadImages function.
-------------------------------------------------------------------------------*/
function swapImage(strElement, objImage) 
{
	// check if the objects exists to prevent errors
	if (document.images && objImage) 
	{
		if (document.images[strElement]) 
		{
			document.images[strElement].src = objImage.src
		}
	}
}



/*-------------------------------------------------------------------------------
Function:   openWindow
Documented: 27 June 2002 By Brian Payne
Purpose:    Generic function used to open a new browser window.
Parameters: strURL - the url of the page to display
            strName - the name of the window
            strFeatures - list of window features (width, height, etc.)
Returns:    none
-------------------------------------------------------------------------------*/
function openWindow(strURL, strName, strFeatures) 
{
  var objNewWindow = window.open(strURL, strName, strFeatures);
	if (objNewWindow)
	{
		objNewWindow.focus()
	}
}



/*-------------------------------------------------------------------------------
Function:   openGlossaryWindow
Documented: 27 June 2002 By Brian Payne
Purpose:    Opens the glossary page in small pop-up window. If a word is 
            specifed the page jumps to that word.
Parameters: strWord - the selected word
Returns:    none
-------------------------------------------------------------------------------*/
function openGlossaryWindow(strWord)
{
	openWindow("/Residential/NewSystem/Glossary/GlossaryPopup.asp#" + strWord, "winGlossary", "scrollbars=yes,resizable=yes,width=200,height=300")
}





