/*function testing (myArray) {
		for (var i = 0; i < myArray.length; i++) {
			document.write(myArray[i]);
		}
}

var testArray = new Array ('foo', 'bert', 'now');
testing (testArray);
*/  

function getElement(idName) {
	var main = document.getElementById(idName);
	var feedback = document.createElement("p");
	var text = document.createTextNode(main.tagName);
	feedback.appendChild(text);
	main.appendChild(feedback);
}

function sameHeight (myArray) {
	if (myArray.length != 0) {
		if (document.getElementById) {
			var maxHeight = 0;
			for (var i = 0; i < myArray.length; i++) {
				// Let's determine the maximum height out of all columns specified
				var col = document.getElementById(myArray[i]);
				if (col.offsetHeight > maxHeight) maxHeight = col.offsetHeight;
			}
			for (var i = 0; i < myArray.length; i++) {
				var col = document.getElementById(myArray[i]);
				col.style.height = maxHeight + 'px';
				// Now, if the browser's in standards-compliant mode, the height property
				// sets the height excluding padding, so we figure the padding out by subtracting the
				// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
				if (col.offsetHeight > maxHeight) {
					col.style.height = (maxHeight - (col.offsetHeight - maxHeight)) + 'px';
				}
			}
		}
	}
}

function clearDivs (myDiv, myArray) {
	if(myArray.length != 0) {
		// Get height of div
		var div = document.getElementById(myDiv);
		var divHeight = div.offsetHeight;
		var clearHeight = 0;
		for (var i = 0; i < myArray.length; i++) {
			//alert(myArray[i]);
			var clearDiv = document.getElementById(myArray[i]);
			clearHeight  = (clearDiv.offsetHeight > clearHeight) ? clearDiv.offsetHeight : clearHeight;
		}
		if (divHeight < clearHeight) { div.style.height = clearHeight + 'px'; }
	}
}

function wideExample () {
	// Get example divs
	var divs = document.getElementsByTagName("div");
	for (var i = 0; i < divs.length; i++) {
		// only use example divs
		if (divs[i].className == "example") {
			// See if it contains a table
			tables = divs[i].getElementsByTagName("table");
			// See if it contains an image
			images = divs[i].getElementsByTagName("img");
			//find the widest one
			var tableWidth = 0;
			var imgWidth = 0;
			// Get the widest table
			if (tables.length != 0 ) {
				for (var j = 0; j < tables.length; j++) {
					if (tables[j].offsetWidth > tableWidth) tableWidth = tables[j].offsetWidth;
				}
			}
			// Get the widest image
			if (images.length != 0) {
				for (var j = 0; j < images.length; j++) {
					if (images[j].offsetWidth > imgWidth) imgWidth = images[j].offsetWidth;
				}
			}
			if (imgWidth <= tableWidth) {
				// now that have the widest one, make the div wider if necessary
				if (divs[i].offsetWidth < (tableWidth + 22)) {
					// Make it wider
					divs[i].style.width = tableWidth + 'px';
				} 
			} else if  (divs[i].offsetWidth < (imgWidth + 22)) {
				divs[i].style.width = imgWidth + 'px';
			}
		}
	}
}