var fx = Fx;

function $S(){
var els = [];
$A(arguments).each(function(sel){
if ($type(sel) == 'string') els.extend(document.getElementsBySelector(sel));
else if ($type(sel) == 'element') els.push($(sel));
});
return $$(els);
};

Element.implement({
getElementsByClassName: function(className){
return this.getElements('.'+className);
}
});


Element.extend({
effect: function(property, options){
return new Fx.Style(this, property, options);
},

effects: function(property, options){
return new Fx.Styles(this, property, options);
},

phase: function(options){
return new Fx.Color(this, options);
}

});

Fx.Styles.implement({    
    move: function(el, topTo, leftTo){
        this.custom({'top': [el.getStyle('top', true), topTo], 'left': [el.getStyle('left', true), leftTo]});
    } 
      
});


Element.extend({

cumulativeOffset: function() {
element= this;
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop  || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return [valueL, valueT];
}

 /*
	Property: getDimensions
      Returns the Element's dimensions (width and height)

   Example:
		(start code)
		var myDimensions = $('myElement').getDimensions();
		(end)

	Returns:
		(start code)
		{
			width: 200,
			height: 300
		}
		(end)
  */
, getDimensions: function(){
	var obj = {
		'width': this.offsetWidth,
		'height': this.offsetHeight
	};
	return obj;
}

/*, bind: function(bind){
	return this.bindWithEvent(bind, arguments);
}*/

});

Fx.Scroll = Fx.Base.extend({

initialize: function(options) {
this.setOptions(options);
},

scrollTo: function(el){
var desty = $(el).cumulativeOffset();
var dest = desty[1];
var client = window.innerHeight || document.documentElement.clientHeight;
var full = document.documentElement.scrollHeight;
var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
if (dest+client > full) this.custom(top, dest - client + (full-dest));
else this.custom(top, dest);
},

increase: function(){
window.scrollTo(0, this.now);
}
});


String.extend({

isEmpty:function(){
return (this.length > 0 ? 'false':'true');
},

isString:function(){
return (this.test('[0-9]','ig') ? 'false':'true');
},

isSingleWord:function(){
return (this.test(' ','ig') ? 'false':'true');
},

isEmail:function(){
return (this.test('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$','ig') ? 'true':'false');
}
});