/**************************************************************************************************
 *Collect all the supporting function in a single place for use by the various
 **************************************************************************************************/

/**************************************************************************************************
 *Purpose: The findObject method is a support function used to return the object reference for the
 *  object identified by the passed in name parameter. We use the findObject method to make sure
 *  that we can always retrieve an object reference regardless of browser. 
 *
 *	For most browsers we will use the getElementById method of the document object to retrieve the
 *  object reference. However, for older IE browsers we use the depreciated document.all function.
 *
 *Parameter: The name that identifies the object for which tor retrieve the reference
 *
 *Date: 02/28/07
 **************************************************************************************************/
function findObject(name) {

	var obj;
	
	if(document.all && !document.getElementById){
	    // this line is for old IE browsers
		obj=document.all(name);
	} else {
		// most browser will return the object this way
	    obj=document.getElementById(name);
	}

	return obj;   
}

/**************************************************************************************************
 *Purpose: The setStatus method is a support function that wraps the window.status method inside a
 *  simple to use function.
 *
 *Parameter: The message to be assigned to the status bar.
 *
 *Date: 03/01/07
 **************************************************************************************************/
function setStatus(statusMsg){

	window.status=statusMsg;

	return true
}


/**************************************************************************************************
 *Purpose: The addToFavorites method is a support function that is used to help users bookmark the
 *   current page
 *
 *Parameters: 
 *   - url: The url of the page to be bookmarked
 *   - title: The title to be given to the bookmark
 *
 *Date: 03/01/07
 **************************************************************************************************/
function addToFavorites(url, title) {

   if (window.external) {
      window.external.AddFavorite(url, title);
      
   } else if (navigator.appName == "Netscape") {
      window.sidebar.addPanel(title, url, "");
      
   } else {
      alert('Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark');
      
   }
   
}


/**************************************************************************************************
 *Purpose: The displayPrint method is used to open the specified page in a new window and display
 *   the print dialog form after the page has been opened
 *
 *Parameters: 
 *   - pageName: The name of the web page to be opened
 *   - pageParameters: The query string collection parameters 
 *
 *Date: 05/02/07
 **************************************************************************************************/
function displayPrint(pageName, pageParameters) {

	var targetOptions='location=no,scrollbars=yes,status=no,resizable=yes,menubar=yes';
	var targetUrl=pageName + '?' + pageParameters;
	
	try {
		var printWindow=window.open(targetUrl,'_blank',targetOptions);
		
		return false;
		
	} catch (error) {
		return true;
	}
	
}
