// This file is created to repaint some HTML elements on the screen
// when the page contains alpha images in Internet Explorer.
// Alpha images are generated differently in Netscape and don't need this workaround. 

if (ie4)
{
	window.onscroll = RefreshAllDropDownLists;
	window.onresize = RefreshAllAlphaImages;
}

function RefreshAllDropDownLists()
{
	RefreshDropDownLists(window);
}


function RefreshDropDownLists(container)
{
	// refresh the drop-down lists of current container
	var lists = container.document.getElementsByTagName("SELECT");
	// the getElementsByTagName() returns a collection, whether it contains any elements or not.
	// the length property always exists.
	if (lists.length > 0) {
		for (var i=0; i<lists.length; i++) {
			RefreshList(lists[i]);
		}
	}
	// process all child containers
	var frames = container.frames;
	if (frames.length > 0) {
		// multiple frames
		for (var i=0; i<frames.length; i++) {
			try {
				// some frames will generate access-denied error if not in the current domain
				RefreshDropDownLists(frames[i]);
			}
			catch(e) {}
		}
	}
	return true;
}

function RefreshList(list)
{
	list.style.visibility = "hidden";
	list.style.visibility = "visible";
	return true;
}

function RefreshAllAlphaImages()
{
	var imgs = document.getElementsByTagName("DIV");
	// the getElementsByTagName() returns a collection, whether it contains any elements or not.
	// the length property always exists.
	if (imgs.length > 0) {
		for (var i=0; i<imgs.length; i++) {
			var img = imgs[i];
			var imgHasFilter = (img.style.filter != "");
			// the imgVisible algorithm may need to be nehanced.
			// when the object is supposed to be visible but the parent container is not, what happens?
			var imgVisible = (img.style.display != "none" && img.style.visibility != "hidden");
			if (imgHasFilter && imgVisible) {RefreshAlphaImage(img);}
		}
	}
	return true;	
}

function RefreshAlphaImage(img)
{
	img.style.visibility = "hidden";
	img.style.visibility = "visible";
	return true;
}
