String.implement({
	isEmpty: function() {
		if (this == null || this.length == 0)
			return true;
		return !/\S/.test(this);
	},
	isEmail: function() {
		if (this.isEmpty()) {
			return false;
		} else {
			return /^[A-Z0-9._%+-]+@([A-Z0-9.-]+\.[A-Z]{2,6})$/i.test(this);
		}
	},
	isntAlphaNummeric: function() {
		if (this == null || this.length == 0) {
			return true;
		} else {
			return !/^[\w.]+$/.test(this);
		}
	}
});
Element.implement({
	curvy: function(options) {
		var st_options = { tl: 20, tr: 20, bl: 20, br: 20 };
		st_options = $merge(st_options,options);
		if (Browser.Engine.webkit525 || Browser.Engine.webkit420) {
        	this.setStyles({'-webkit-border-top-left-radius':st_options.tl+'px', '-webkit-border-top-right-radius':st_options.tr+'px','-webkit-border-bottom-left-radius':st_options.bl+'px','-webkit-border-bottom-right-radius':st_options.br+'px'});
        } else if (Browser.Engine.gecko19) {
        	this.setStyles({'-moz-border-radius-topleft':st_options.tl+'px','-moz-border-radius-topright':st_options.tr+'px','-moz-border-radius-bottomleft':st_options.bl+'px','-moz-border-radius-bottomright':st_options.br+'px'});
        } else {
        	if ($type(this.curvyobject)!='object') {
        		new Asset.javascript('/js/curvycorners.js');
        		this.curvyobject = new CurvyObject(this,options);
				this.curvyobject.applyCorners();
        	}
        }
		return this;
	}
});
Elements.implement({
	curvy: function(options) {
		var st_options = { tl: 20, tr: 20, bl: 20, br: 20 };
		st_options = $merge(st_options,options);
		if (Browser.Engine.webkit525 || Browser.Engine.webkit420) {
        	this.setStyles({'-webkit-border-top-left-radius':st_options.tl+'px', '-webkit-border-top-right-radius':st_options.tr+'px','-webkit-border-bottom-left-radius':st_options.bl+'px','-webkit-border-bottom-right-radius':st_options.br+'px'});
        } else if (Browser.Engine.gecko19) {
        	this.setStyles({'-moz-border-radius-topleft':st_options.tl+'px','-moz-border-radius-topright':st_options.tr+'px','-moz-border-radius-bottomleft':st_options.bl+'px','-moz-border-radius-bottomright':st_options.br+'px'});
        } else {
        	if ($type(this.curvyobject)!='object') {
        		new Asset.javascript('/js/curvycorners.js', {onComplete:(function() {
        			this.curvyobject = new CurvyObject(this,options);
					this.curvyobject.applyCorners();
        		}).bind(this)});
        	}
        }
		return this;
	}
});
window.addEvent('domready',function() {
	$$('.curvy').curvy({tl:10,tr:10,bl:10,br:10});
	$$('.curvy-top').curvy({tl:10,tr:10,bl:0,br:0});
	$$('.curvy-bottom').curvy({tl:0,tr:0,bl:10,br:10});
	
	$$('.banner').addEvents({
		'click': function(e) {
			window.location = this.getElement('a').get('href');
		},
		'mouseenter': function(e) {
			this.tween('padding','40px 0');
		},
		'mouseleave': function(e) {
			this.tween('padding','25px 0');
		}
	});
	
	$$('.banner').each(function(item) {
		var link = item.getElement('a').get('href');
		item.addEvent('click',function(e) {
			window.location = link;
		});
	});
});