window.addEvent("domready",function(){

	Fx.Height = Fx.Style.extend({initialize: function(el, options){this.parent(el, 'height', options);this.element.setStyle('overflow', 'hidden');},toggle: function(){return (this.element.offsetHeight > 0) ? this.custom(this.element.offsetHeight, 0) : this.custom(0, this.element.scrollHeight);},show: function(){return this.set(this.element.scrollHeight);}});

	Fx.Opacity = Fx.Style.extend({initialize: function(el, options){this.now = 1;this.parent(el, 'opacity', options);},toggle: function(){return (this.now > 0) ? this.start(1, 0) : this.start(0, 1);},show: function(){return this.set(1);}});

	if($('scart') && $$('.vmCartModule').length > 0){
		$('scart').addEvent("click", function(e){
			new Event(e).stop();
			if(!$('hiddenarea1').hasClass('scart_visible')){
				$('hiddenarea1').toggleClass('scart_visible');
				$('hiddenarea1').setStyle('display', 'block');
				$('hiddenarea1').setOpacity(0);
				new Fx.Opacity('hiddenarea1',{duration: 300}).start(0,1);
				new Fx.Height('hiddenarea1',{duration: 300}).start(0,$('hiddenarea1').getSize().size.y);
				new Fx.Width('hiddenarea1',{duration: 300}).start(0,$('hiddenarea1').getSize().size.x);
				new Fx.Style('hiddenarea1', 'margin-left',{duration: 300}).start(750, 412);
				(function(){$('hiddenarea1').setStyle('overflow', 'visible');}).delay(500);
			}
		});

		$('close_button1').addEvent("click", function(){
			new Fx.Opacity('hiddenarea1').start(0);
			(function(){
				$('hiddenarea1').setStyle('display', 'none');
				$('hiddenarea1').removeClass('scart_visible');
			}).delay(500);
		});
	}

	if($('login_btn') && $('form-login')){
		$('login_btn').addEvent("click", function(e){
			new Event(e).stop();
			if(!$('hiddenarea2').hasClass('login_visible')){
				$('hiddenarea2').toggleClass('login_visible');
				$('hiddenarea2').setStyle('display', 'block');
				$('hiddenarea2').setOpacity(0);
				new Fx.Opacity('hiddenarea2',{duration: 300}).start(0,1);
				new Fx.Height('hiddenarea2',{duration: 300}).start(0,$('hiddenarea2').getSize().size.y);
				new Fx.Width('hiddenarea2',{duration: 300}).start(0,$('hiddenarea2').getSize().size.x);
				new Fx.Style('hiddenarea2', 'margin-left',{duration: 300}).start(850, 412);
			}
		});

		$('close_button2').addEvent("click", function(){
			new Fx.Opacity('hiddenarea2').start(0);
			(function(){
				$('hiddenarea2').setStyle('display', 'none');
				$('hiddenarea2').removeClass('login_visible');
			}).delay(500);
		});
	}

	if($('product_tabs')){
		$$('#product_tabs li').each(function(el, i){
			el.addEvent("click", function(e){
				$$('.product_tab').setStyle('display', 'none');
				$('product_tab_'+(i+1)).setStyle('display', 'block');
				$$('#product_tabs li').setProperty('class', '');
				$$('#product_tabs li')[i].setProperty('class', 'product_tab_active');
			});
		});
	}
});
