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);}});
	
	if($('stylearea')){
		$A($$('.style_switcher')).each(function(element,index){
			element.addEvent('click',function(event){
				var event = new Event(event);
				event.preventDefault();
				changeStyle(index+1);
			});
		});
		new SmoothScroll();
	}
	
	var com_h = ($('component')) ? $('component').getSize().size.y : 0;
	var inset_h = ($('inset')) ? $('inset').getSize().size.y : 0;
	var col_h = ($('right')) ? $('right').getSize().size.y : 0;
	
	if(com_h >= inset_h && com_h >= col_h){
		if($('inset')) $('inset').setStyle('height', com_h + "px");
		if($('right')) $('right').setStyle('height', com_h + "px");
	}
	else if(inset_h >= com_h && inset_h >= col_h){
		if($('component')) $('component').setStyle('height', inset_h + "px");
		if($('right')) $('right').setStyle('height', inset_h + "px");
	}
	else{
		if($('inset')) $('inset').setStyle('height', col_h + "px");
		if($('component')) $('component').setStyle('height', col_h + "px");
	}
});

function changeStyle(style){
	var file = template_path+'/css/style'+style+'.css';
	new Asset.css(file);
	
	new Cookie.set('gk13_style',style,{duration: 200,path: "/"});
	actual_style = style;
}

