//IE6 Background Color
var ie6BGColor = '#f3c108';

var DHTMLSlides = {
	navmenu: function(){
		$$('.Menu').each( function(button, i) {
			if($defined($('Sub' + button.id))) {
				
				$('Sub' + button.id).parentNode.style.top = '25px';
				
				if(window.ie6){
					$(button.id + 'a').style.background = ie6BGColor;
				
					if(button.id == 8){
						$('Sub' + button.id).parentNode.style.width = '175px';
						$('Sub' + button.id).parentNode.style.left = $(button.id).getPosition().x - $('test').getPosition().x - 76  + 'px';	
					}else{
						$('Sub' + button.id).parentNode.style.width = '175px';
						$('Sub' + button.id).parentNode.style.left = $(button.id).getPosition().x - $('test').getPosition().x - 0  + 'px';	
					}
				}else{				
					var width 	   = 18;
					var widthRight = 17;
					
					for(c = 0;c < i; c++){
						if(c != i){
							width = width + $$('.Menu')[c].getChildren()[0].width;
						}
					}
					
					// Adjusts the alignment of the last top menu button for rightside position instead of leftside.
					if(button.id == 8){					
						$('Sub' + button.id).getParent().setStyle('right', widthRight + 'px');
					}else{
						$('Sub' + button.id).getParent().setStyle('left', width + 'px');
					}
				}
				
				//Original Line - $('Sub' + button.id).getParent().setStyle('left', width + 'px'); 
				
				var myFx = new Fx.Slide($('Sub' + button.id), {duration: 400}).hide();			
				$('Sub' + button.id).onmouseover = function(){
					myFx.stop();
					myFx.slideIn();
				}
			
				$('Sub' + button.id).onmouseout = function(){
					myFx.stop();
					myFx.slideOut();
				}
				
				button.onmouseover = function(){
					myFx.stop();
					myFx.slideIn();	
				}
					
				button.onmouseout = function(){
					myFx.stop();
					myFx.slideOut();	
				}
			}
		});
	}
}
window.addEvent('domready',function() {
	DHTMLSlides.navmenu();
});