//IE6 Background Color
var ie6BGColor = '#cccccc';
var rightAlignLastMenu = true;

var DHTMLSlides = {
	navmenu: function(){
		$$('.Menu').each( function(button, i) {
			if($defined($('Sub' + button.id))) {
				
				$('Sub' + button.get('id')).parentNode.style.top = '133px';
				if(Browser.Engine.trident4){
					$('Sub' + button.get('id')).parentNode.style.width = "175px"
				}
				
				var width = 266;
				
				for(c = 0;c < i; c++){
					if(c != i){
						width = width + $$('.Menu')[c].getChildren()[0].getWidth();
					}
				}
				if (rightAlignLastMenu){
					if($$('.Menu').length == i + 1){
						width = width - ($('Sub' + button.get('id')).getWidth() - $$('.Menu')[i].getChildren()[0].getWidth());
					}
				}
				if(Browser.Engine.trident4){
					width = width - 925;
				}
				
				$('Sub' + button.get('id')).getParent().setStyle('left', width + 'px');
				
				var myFx = new Fx.Slide($('Sub' + button.get('id')), {duration: 400}).hide();			
				
				
				$('Sub' + button.get('id')).addEvent('mouseover', function(){
					myFx.cancel();
					myFx.slideIn();
				});
			
				$('Sub' + button.get('id')).addEvent('mouseout', function(){
					myFx.cancel();
					myFx.slideOut();
				});
				
				button.addEvent('mouseover', function(){
					myFx.cancel();
					myFx.slideIn();	
				});
					
				button.addEvent('mouseout', function(){
					myFx.cancel();
					myFx.slideOut();	
				});
			}
		});
	}
}
var MainMenu = {
	topmenu: function(){
		$$('.Menu').each( function(menu) {
			if(!menu.get('class').contains('Off')){
				var myEffects = new Fx.Morph(menu.getFirst(), {duration: 200, transition: Fx.Transitions.linear});
 				menu.addEvent('mouseover', function(){
					myEffects.cancel();
					myEffects.start({'opacity': .1});
				});
				menu.addEvent('mouseout', function(){
					myEffects.cancel();
					myEffects.start({'opacity': 1.0});
				});
			}
		});
	}
}
window.addEvent('domready',function() {
	MainMenu.topmenu();
	DHTMLSlides.navmenu();
});
