<!--
	/*
		get_value.js include file.
		Written			: 20031022 by James Austin.
		Last Updated	: 20031030

		Current Version	: 1.0
		
		Purpose:
		To return any property of a given element. NOTE: for DIV properties, if the property has not been previously set either in javascript or via the "style" attribute prior to the call to this function, the result will be an empty string.

		Dependants:
		DHTML_main.js	*** HOWEVER THIS IS NOT REQUIRED IF USAGE IS LIMITED TO IMAGES ***
	*/

	function getValue(testElement,testProperty) {
		/*
			PARAMETERS:
			testElement		= The name of the object/element you wish to find a property of, passed as a string.
			testProperty	= The name of the property you wish to find, passed as a string.
		*/
		
		if (typeof testElement == 'string' && typeof testProperty == 'string' && testElement != null && testElement != '' && testProperty != null && testProperty != '') {
		
			// Define internal variables used to return the result
			var sResult;	// holds the result as a string
			var iResult;	// if part or all of the sResult can be converted using parseInt(), this integer is returned instead.
							// e.g. if the result is "30px", we just want to return 30 as an integer etc.

			// Test to see what type of object the testElement is, (have to use eval as the object is passed as a string in the parameter list
			if (eval('document.images.' + testElement)) {

				var obj = eval('document.images.' + testElement);

				// The testElement is an image
				// Now find out what property the user requires
				if (testProperty == 'x' || testProperty == 'y') {
					
					var x = 0;
					var y = 0;

					if (document.getElementById || document.all) {
						for (var tempObj = obj; tempObj != null; tempObj = tempObj.offsetParent) {
							x += tempObj.offsetLeft;
							y += tempObj.offsetTop;
						}
					}
					else if (document.layers) {
						x = obj.x;
						y = obj.y;
					}

					// return now as the result is definitely an integer
					if (testProperty == 'x') {
						return x;
					}
					else {
						return y;
					}

				}
				else {
					sResult = eval('obj.' + testProperty);
				}
				
			}
			else {

				// The test element is not an image, therefore treat as an object referenced by the DOM.
				sResult = eval(strLeft + testElement + strRight + testProperty);

				// We need to do some jiggery pokery if the property requested is "visibility" and we are running on NS4 to return consistent values
				if (testProperty == 'visibility' && document.layers) {
					if (sResult == 'show') {
						sResult = 'visible';
					}
					else if (sResult == 'hide') {
						sResult = 'hidden';						
					}
				}

			}

			// If we have reached this point we have a value in sResult. Parse this into iResult using parseInt() to determine if we return a string or an integer value
			iResult = parseInt(sResult);

			if (isNaN(iResult)) {
				return sResult;
			}
			else {
				return iResult;
			}

		}

	}
//-->