window.addEvent('domready', function() {

	$$('.mainMenu li')[0].addClass('home');
	count = 0;
	$$('.mainMenu li').each( function(el) {
	  if(el.getParent().getProperty('class') == "mainMenu")
		{
			anc = el.getElement('a');
			anc.setProperty('id', 'anc'+count);
			span = anc.getElement('span');
			span.setProperty('id', 'span'+count);
			
		
			if (!isIE6)
			{
				if(el.getChildren('div').length == 0	)
				{
					document.getElementById(span.id).style.backgroundImage = "none";
					document.getElementById(span.id).style.width = "10px";
				}
			}
			if (isIE6)
			{
				if(el.getElement('.subMenuLeft') == null	)
				{
					document.getElementById(span.id).style.backgroundImage = "none";
					document.getElementById(span.id).style.width = "10px";
				}
				if( $chk(el.getElement('.ieHelper')))
				{
					el.getElement('.ieHelper').setProperty('id', 'sub'+count); 
				}
			}
			count++;
		}
	});
  if (isIE6)
	{
			$$('.mainMenu li a').each( function(a) {
	   	  a.addEvent('mouseover', function(e) {
						pid = a.getProperty('id').substring(3);
  					ShowMenu('sub'+pid);
			  });
			  a.addEvent('mouseout', function(e) {
						pid = a.getProperty('id').substring(3);
  					HideMenu('sub'+pid);
			 });
		});			
	}
});
function ShowMenu(menu) {
	var thisMenu = document.getElementById(menu);
	if (thisMenu != null) {
		thisMenu.style.display="block";
	}
}
function HideMenu(menu) {
	var thisMenu = document.getElementById(menu);
	if (thisMenu != null) {
	thisMenu.style.display="none";
	}
}
function checkIsIE(ver) {
	var userAgent = navigator.userAgent.toLowerCase();
	if (/msie[\/\s](\d+\.\d+)/.test(userAgent)) {
		var ieversion = new Number(RegExp.$1);
		return (ieversion < (ver+1));
	} else {
		return false;
	}
}
isIE6 = checkIsIE(6);	
isIE7 = checkIsIE(7);
