Shadowbox.init({
	skipSetup: false,
	adapter: 'base',
	language: CURRENT_LANG,
	overlayColor: '#000000',
	overlayOpacity: '0.7',
	handleOversize: 'resize',
	players: ["img", "swf", "html", "ajax", "iframe", "flv", "qt", "wmp"]
});

function fixpng(){
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ((version >= 5.5) && (document.body.filters) && (version < 7)){
		var png_images = $$('.pngfix');	
		png_images.each(function(element) {
			if(!$(element).hasClass('pngfixed')){
				$(element).addClass('pngfixed');
				var img = $(element);
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.getProperty('width') + "px; height:" + img.getProperty('height') + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML					
			}
		});
	} else {
		$$('.pngfix').addClass('pngfixed');
	}
}

function toggle_active(in_this, in_selector, in_class){
	$(in_this).getParent().getElements(in_selector).removeClass(in_class);
	$(in_this).addClass(in_class);
}

function init(){
	fix();
	fixpng();
	
	//	collapsable blocks
	$$('.block.collapsable h2').each(function(el,i){
		el.addEvent('click', function(){
			var block = this.getParent('div.block')
			var container = this.getParent('div.block').getFirst('div.container');
			if(block.hasClass('open')){
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ block.removeClass('open'); block.addClass('closed'); }}).start('height', container.getSize().y, 0);
			} else {
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ block.removeClass('closed'); block.addClass('open'); }}).start('height', container.getSize().y, container.getScrollSize().y);
			}	
		});
	});
	
	//	collapsable listlinks
	$$('.block ul li .collapsable').each(function(el,i){
		el.addEvent('click', function(){
			var list = this.getParent('li')
			var container = this.getParent('li').getFirst('ul');
			if(list.hasClass('open')){
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ list.removeClass('open'); list.addClass('closed'); }}).start('height', container.getSize().y, 0);
			} else {
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ list.removeClass('closed'); list.addClass('open'); }}).start('height', container.getSize().y, container.getScrollSize().y);
			}	
	});
	});
	
	//	collapsable listitems
	$$('.block ul li.collapsable').each(function(el,i){
		el.addEvent('click', function(){
			var list = this;
			var container = this.getFirst('ul');
			if(list.hasClass('open')){
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ list.removeClass('open'); list.addClass('closed'); }}).start('height', container.getSize().y, 0);
			} else {
				if(this.fx) el.fx.cancel();
				this.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ list.removeClass('closed'); list.addClass('open'); container.setStyle('height', 'auto'); }}).start('height', container.getSize().y, container.getScrollSize().y);
			}	
		});
	});
	$$('.block ul li.collapsable a').each(function(el,i){
		el.addEvent('click', function(e){
			if (e) new Event(e).stop();
			location.href = this.get('href');	
		});
	});
	
	//	collapsable listitems
	$$('.block ul li.collapsable a.twostage').each(function(el,i){
		el.addEvent('click', function(){
			var list = this.getParent();
			var container = list.getFirst('ul');
			if(list.fx) el.fx.cancel();
			list.fx = new Fx.Tween(container, {duration: 500, onComplete: function(){ list.removeClass('closed'); list.addClass('open'); }}).start('height', container.getSize().y, container.getScrollSize().y);
			this.setStyle('display', 'none');	
		});
	});
	
	//	focus dots
	$$('a').addEvent('focus', function(){ this.blur(); });
	
}

function fix(){
	
}

window.addEvent('load', init);
window.addEvent('resize', fix);
