Fx.Morph = Fx.Styles.extend({

	start: function(className){
		
		var to = {};
		
		$each(document.styleSheets, function(style){
			var rules = style.rules || style.cssRules;
			$each(rules, function(rule){
				if (!rule.selectorText.test('\.' + className + '$')) return;
				Fx.CSS.Styles.each(function(style){
					if (!rule.style || !rule.style[style]) return;
					var ruleStyle = rule.style[style];
					to[style] = (style.test(/color/i) && ruleStyle.test(/^rgb/)) ? ruleStyle.rgbToHex() : ruleStyle;
				});
			});
		});
		return this.parent(to);
	}
	
});

Fx.CSS.Styles = ["backgroundColor", "backgroundPosition", "color", "width", "height", "left", "top", "bottom", "right", "fontSize", "letterSpacing", "lineHeight", "textIndent", "opacity"];
Fx.CSS.Styles.extend(Element.Styles.padding);
Fx.CSS.Styles.extend(Element.Styles.margin);
Element.Styles.border.each(function(border){
	['Width', 'Color'].each(function(property){
		Fx.CSS.Styles.push(border + property);
	});
});


function setupMenu() {
	$$('#navcontainer_side li').each(function(navli){
		navitem=navli.getElement('a');
		if (!((navitem.hasClass('current')) || (navitem.hasClass('currentAncestor')))) {
			navitem.addClass('morph1');
		
		var myMorph = new Fx.Morph(navitem, {wait: false, duration: 200});
		
			navitem.addEvent('mouseenter', function(e){
				//new Event(e).stop();
				myMorph.start('morph2');
				});

			navitem.addEvent('mouseleave', function(e){
				//new Event(e).stop();
				myMorph.start('morph1');
			});
			myMorph.start('morph1');
			}
	});	
	
}


window.addEvent('domready', function(){
	if(!window.ie) {
		setupMenu();
	}
});


