
window.addEvent('domready', function() {
	//COLOR START 	//COLOR BUTTON START
	Element.Events.extend({
		'wheelup': {
			type: Element.Events.mousewheel.type,
			map: function(event){
				event = new Event(event);
				if (event.wheel >= 0) this.fireEvent('wheelup', event)
			}
		},
	 
		'wheeldown': {
			type: Element.Events.mousewheel.type,
			map: function(event){
				event = new Event(event);
				if (event.wheel <= 0) this.fireEvent('wheeldown', event)
			}
		}
	});


var background = $('wide_banner').getStyle('background-color');
var color = new Color(background).hsb;
 
	$('wide_banner').addEvents({
		'wheelup': function(e) {
			e = new Event(e).stop();
	 
			var hue = color[0] + 5;
			if (hue > 360) {
				hue = 0;
			}
			color[0] = hue;
			$('wide_banner').setStyle('background-color', color.hsbToRgb().rgbToHex());
			$('logo').setStyle('background-color', color.hsbToRgb().rgbToHex());
		},
	 
		'wheeldown': function(e) {
			e = new Event(e).stop();
	 
			var hue = color[0] - 5;
			if (hue < 0) {
				hue = 360;
			}
			color[0] = hue;
			$('wide_banner').setStyle('background-color', color.hsbToRgb().rgbToHex());
			$('logo').setStyle('background-color', color.hsbToRgb().rgbToHex());
		}
	});
 
	$('header_contain').addEvents({
		'wheelup': function(e) {
			e = new Event(e).stop();
	 
			var hue = color[0] + 5;
			if (hue > 360) {
				hue = 0;
			}
			color[0] = hue;
			$('wide_banner').setStyle('background-color', color.hsbToRgb().rgbToHex());
			$('logo').setStyle('background-color', color.hsbToRgb().rgbToHex());
		},
	 
		'wheeldown': function(e) {
			e = new Event(e).stop();
	 
			var hue = color[0] - 5;
			if (hue < 0) {
				hue = 360;
			}
			color[0] = hue;
			$('wide_banner').setStyle('background-color', color.hsbToRgb().rgbToHex());
			$('logo').setStyle('background-color', color.hsbToRgb().rgbToHex());
		}
	});

var co_buttons = $('body_buttons').getChildren();	
	co_buttons.each(function(element){
		if (element.hasClass('co_but')){
			var newcol = new Color("#"+element.getProperty('id'))
			element.addEvent('mouseup', function(){
				$('wide_banner').setStyle('background-color', newcol);
				$('logo').setStyle('background-color', newcol);
				color = newcol.rgbToHsb();
			});
		} else {
		return false;
		}
	});

	
	
	//GLASS SLIDER START
var goingDown = 0;
var leftglass = $('fl_left').getChildren();
var lg_width = ((100-10)/ leftglass.length)+"%";
leftglass.each(function(element, index, array){element.setStyle('width', lg_width);});
var target1 = $('lg_1');
var fx1 = new Fx.Styles(target1, {duration: 2000, transition: Fx.Transitions.Expo.easeOut, wait: false});
var target2 = $('lg_2');
var fx2 = new Fx.Styles(target2, {duration: 2000, transition: Fx.Transitions.Expo.easeOut, wait: false});
var target3 = $('rg_1');
var fx3 = new Fx.Styles(target3, {duration: 2000, transition: Fx.Transitions.Expo.easeOut, wait: false});
var box = $('cube_button');

	box.addEvent('mouseup', function(){
		if (goingDown == 1){
			goingDown = 0;
			fx1.start({
				'top': 183
			});
			fx2.start({
				'top': 183
			});
			fx3.start({
				'top': 183
			});
		} else {
			goingDown = 1;
			fx1.start({
				'top': 0
			});
			fx2.start({
				'top': 0
			});
			fx3.start({
				'top': 0
			});
		}
		
		
	});
});
