document.observe("dom:loaded", function() {
	var bodyClass	= $$('body').first().className; if(bodyClass=='home') bodyClass = 'purple' ;
	var navigationClass = $('navigation').className;
	var buttons = $$('#navigation li a');
    var menu   = $('navigationwrapper');
    
	buttons.each(function(item){
	    var img = new Element('img');
        
        switch(item.id) {
            case 'm1'       :
                img.setStyle({
                    width: '55px',
                    height: '24px'
                });            
            break;
            
            case 'm2'       :
                img.setStyle({
                    width: '92px',
                    height: '29px'
                });            
            break;
            
            case 'm3'       :
                img.setStyle({
                    width: '142px',
                    height: '29px'
                });
            break;            
            
            case 'm4'       :
                img.setStyle({
                    width: '64px',
                    height: '26px'
                });            
            break;
            
            case 'm5'       :
                img.setStyle({
                    width: '94px',
                    height: '25px'
                });            
            break;
            
            case 'm6'       :
                img.setStyle({
                    width: '177px',
                    height: '31px'
                });            
            break;
            
            case 'm7'       :
                img.setStyle({
                    width: '150px',
                    height: '30px'
                });            
            break;
            
            case 'm8'       :
                img.setStyle({
                    width: '86px',
                    height: '26px'
                });                                              
            break;
            
            case 'm9'       :
                img.setStyle({
                    width: '91px',
                    height: '24px'
                });                        
            break;
        }
        
		var active = (item.parentNode.className=='active');
		if(!active) {
			img.src = 'img/menu/'+item.id+'_white.png';
		} else {          
            switch(item.id) {
                 case 'm2'  :
                    img.src = 'img/menu/'+item.id+'_green.png'; 
                 break;
                 
                 case 'm4'  :
                    img.src = 'img/menu/'+item.id+'_yellow.png';           
                 break;
                 
                 case 'm5'  :
                    img.src = 'img/menu/'+item.id+'_blue.png';
                 break;
                 
                 default    :
                    img.src = 'img/menu/'+item.id+'_purple.png';
                 break;
            }
        }
		
		if(!active) {
            switch(item.id) {
                 case 'm2'  :
                    img.onmouseover = function() { this.src = 'img/menu/'+item.id+'_green.png'; }
                    img.onmouseout = function() { this.src = 'img/menu/'+item.id+'_white.png'; }                    
                 break;
                 
                 case 'm4'  :
                    img.onmouseover = function() { this.src = 'img/menu/'+item.id+'_yellow.png'; } 
                    img.onmouseout = function() { this.src = 'img/menu/'+item.id+'_white.png'; }   
                 break;
                 
                 case 'm5'  :
                    img.onmouseover = function() { this.src = 'img/menu/'+item.id+'_blue.png'; }
                    img.onmouseout = function() { this.src = 'img/menu/'+item.id+'_white.png'; }   
                 break;
                 
                 default    :
                    img.onmouseover = function() { this.src = 'img/menu/'+item.id+'_purple.png'; }
                    img.onmouseout = function() { this.src = 'img/menu/'+item.id+'_white.png'; }   
                 break;
            }
		}
		
		item.innerHTML = '';
		item.insert(img);
		

	});
    
    var logos = $$('#logos a');
    
    if(logos) {    
        logos.each(function(item) {
        item.target = '_blank'; 
       });
    }
    
    if($('powered')) {
        $('powered').target = '_blank';
    }

});