<!--
/*
  -------------------------------------------------------------------------------
 |  The content of this file constitutes Licensed Code.                          |
 |  Copyright (C) 2005-2007 Azalea Technology, LLC. All rights reserved.         |
 |-------------------------------------------------------------------------------|
 |  Unauthorized removal of this notice is considered a violation of the         |
 |  license agreement under which this Code may be used. This work is protected  |
 |  under United States copyright law and the similar law(s) of other countries  |
 |  under which such as work is afforded legal protection, and upon conviction   |
 |  of such a violation in a court of applicable jurisdiction, such person(s)    |
 |  may be subject to the maximum allowable penalty as permitted under such law. |
 |-------------------------------------------------------------------------------|
 |  You acknowledge and agree that information presented to you through this     |
 |  site (the "Web Site") is protected by all applicable copyrights, trademarks, |
 |  service marks, patents or other proprietary rights and laws, and by virtue   |
 |  of accessing the Web Site, except as expressly authorized by the Azalea      |
 |  Technology, LLC., you agree not to modify, rent, lease, loan, sell,          |
 |  distribute, store, or create derivative works based on the Web Site, in      |
 |  whole or in part.                                                            |
 |-------------------------------------------------------------------------------|
 |  Decrypting or otherwise decoding the following programming language code is  |
 |  strictly prohibited except as expressly authorized by Azalea Technology,     |
 |  LLC. Upon conviction of such a violation in a court of applicable            |
 |  jurisdiction, such person(s) may be subject to the maximum allowable penalty |
 |  as permitted under such law.                                                 |
  -------------------------------------------------------------------------------
         Purpose: DOM window function library
      Programmer: Benjamin Roberts
                  Azalea Technology, LLC.
                  P.O. Box 131150
                  Tyler, TX 75713-1150
  -------------------------------------------------------------------------------
*/

// Create generic object
var dom_window = new Object();

// Implementations array (containing the various "inner height" implementations) as a property
// of the "dom_window" function object; declared in this fashion to keep out of global scope yet
// persist across invocations
dom_window._inner_height_implementations = [
	function(){ return window.innerHeight; },
	function(){ return document.body.clientHeight; },
	function(){ return document.documentElement.clientHeight; }
];

// Initialize variable (property of the "dom_window" function object) to store client-supported
// implementation
dom_window._inner_height_implementation = null;

// Function to detect, select and save (in document scope) the appropriate client-side
// implementation; future calls in the same scope will use the saved implementation and
// not perform the detection and selection process again
dom_window.inner_height = function(){

	// Check to see if the implementation has already been detected and, if so, return
	// the previously detected implementation (function exection stops)
	if(dom_window._inner_height_implementation != null){
		return dom_window._inner_height_implementation();
	}

	// Detect and select appropriate implementation
	for(var i = 0; i < dom_window._inner_height_implementations.length; i++){
		try{
			var implementation = dom_window._inner_height_implementations[i];
			var _height = implementation();

			if(_height != undefined){
				dom_window._inner_height_implementation = implementation;
				return _height;
			}
			else{
				throw new Error("undefined property");
			}
		}
		catch(e){
			continue;
		}

		// If this point is reached, none of the implementations were
		// supported, so throw an exception for all future invocations
		dom_window._inner_height_implementation = function(){
			throw new Error("inner height is not supported.");
		};

		// Throw the error now
		dom_window._inner_height_implementation();
	}
};

//-->