if(document.attachEvent!=null) {
	makeEventListener=function(elem,evt,func){elem.attachEvent(('on'+evt),function(){func.apply(elem)})};
} else {
	makeEventListener=function(elem,evt,func){elem.addEventListener(evt,func,false);};
}
DOMWaiter={
	ih:null,
	functions:[],
	addFunction:function(func){
		this.functions[this.functions.length]=func;
	},
	onDOMReady:function(){
		for(var i=0;i<this.functions.length;i++) this.functions[i]();
	},
	waiter:function(){
		if(document.body!=null){
			clearInterval(this.ih);
			this.ih=null;
			this.onDOMReady();
		}
	}
}
DOMWaiter.ih=setInterval(function(){DOMWaiter.waiter()},100);	
DOMWaiter.addFunction(function(){
	var topMenuItems=document.getElementById('topMenu').getElementsByTagName('LI'),n=topMenuItems.length;
	for(var i=0;i<n;i++){
		makeEventListener(topMenuItems[i],'mouseover',function(){this.className+=' hover'});
		makeEventListener(topMenuItems[i],'mouseout',function(){this.className=this.className.replace(/\shover/,'')});
		makeEventListener(topMenuItems[i],'click',function(){this.className=this.className.replace(/\shover/,'')});
	}
});
function ie6menuFix(){
	var topMenuItems=document.getElementById('topMenu').getElementsByTagName('LI'),n=topMenuItems.length;
	if(navigator.userAgent.match(/MSIE 6/)){
		var w,h,elem;
		for(var i=0;i<n;i++){
			elem=topMenuItems[i].getElementsByTagName('IMG')[0];
			w=elem.width;
			h=elem.height;
			elem.src="/images/0.gif";
			elem.width=w;
			elem.height=h;
			elem.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/topmenu-item-"+i+".png', sizingMethod='crop')";
		}		
	}
}

