/*This is a nasty hack designed to fix a bug in IE 6 which stops it displaying images correctly. Without this code, the images come out stretched vertically instead of in the proper scaling. It doesn't seem to be a problem with IE7 or Firefox. */

ief= {
	init:function() {
		// first set the style for the main elements.
		if (! navigator.userAgent.match(/MSIE 6/)) return; // only apply the fix to IE version 6.
		var mainBlock=document.getElementById("mainblock");
		mainBlock.style.width="700px";
		mainBlock.style.minWidth="0px";
		var logoImg=document.getElementById("logoimg");
		logoImg.style.width="700px";
		// now go through all the images and scale them to a fixed width.
		var uls=document.getElementsByTagName('div');
		for (var u=0; u<uls.length; u++) {
			var div=uls[u];
			if (div.className.search(/\bimage\b/) ==-1 ) continue;
			var img=div.getElementsByTagName('img')[0];
			var newWidth="300px";
			if (div.className.match(/\bvertical\b/) ) newWidth="225px";
			div.style.width=newWidth;
			img.style.width=newWidth;
			}
		},
		
	addEvent: function(elm, evType, fn, useCapture) {
		// cross-browser event handling for IE5+, NS6 and Mozilla
		// by Scott Andrew
		if (elm.addEventListener) {
			elm.addEventListener(evType,fn,useCapture) ;
			return true;
			}
		else if (elm.attachEvent) {
			var r=elm.attachEvent('on'+evType,fn);
			EventCache.add(elm,evType,fn);
			return r;
			}
		else {
			elm['on'+evType]=fn;
			}
		}
	};

ief.addEvent(window, 'load', ief.init, false);
ief.addEvent(window, 'unload', EventCache.flush, false);