/*
 * MMT Some fixes to make mootools v1.11 scripts work with mootools v1.2
 * This is on top of the official mootools-compat-core.js and
 * mootools-compat.more.js scripts which miss these items.
 *
 */
Fx.Transitions.expoIn = Fx.Transitions.Expo.easeIn;
Fx.Transitions.expoOut = Fx.Transitions.Expo.easeOut;

// The version of this method in mootools v1.2 doesn't calling as a none method
var $extend = function(){
	var args = arguments;
	if (!args[1]) args = [this, args[0]];
	for (var property in args[1]) args[0][property] = args[1][property];
	return args[0];
};

// The version of this method in mootools v1.2 doesn't support strings
Element.implement({
	setStyles: function(styles) {
		switch($type(styles)){
			case 'object': for (var style in styles) this.setStyle(style, styles[style]); break;
			case 'string': this.style.cssText = styles; break;
	
		}
		return this;
	}
});

// The version of this method in mootools v1.2 is wrong
Scroller.implement({
	scroll: function(){
		var size = this.element.getSize(), scroll = this.element.getScroll(), scrollSize = this.element.getScrollSize(), pos = this.element.getOffsets(), change = {'x': 0, 'y': 0};
		for (var z in this.page){
			if (this.page[z] < (this.options.area + pos[z]) && scroll[z] != 0)
				change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity;
		 	else if (this.page[z] + this.options.area > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z])
				change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity;
			
		}
		if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
	}
});

