window.addEvent('domready', function() {
	dropdown_menu();
	
	$$('.slideshow').each(function (elm) {
		new SlideShow(elm);
	});
	formcheck = new FormCheck('formular_input');
	
	//new Tips($$('a.tip'));
	
	if ($('faq')) {
		var myAccordion = new Accordion($$('.faq_question'), $$('.faq_item'), { display: null , alwaysHide: true });
	}
	
});

function open_light_box(page){
	
	$('lightbox').set('load', {data : 'page=site/light_box/'+page+'.php'}).load('ajax.php');
	$('dialoggray').setStyles({ display: ''});
	$('lightbox').setStyles({ display: ''});
	$('html').setStyles({ overflow: 'hidden'}); 
	
	var myFx = new Fx.Scroll('html', {wheelStops : false}).toTop();
}

function close_light_box(){
	$('dialoggray').setStyles({ display: 'none'});
	$('lightbox').setStyles({ display: 'none'});
	$('html').setStyles({ overflow: 'auto'}); 
}

function dropdown_menu() {
	$$('.has-sub-menu').addEvents({
		'mouseenter': function(){
			this
				.set('tween', {
					transition: Fx.Transitions.Bounce.easeOut ,
					duration: 200 * ( this.getElement('.submenu').getElements('a').length )
				})
				.tween('height', 28 + this.getElement('.submenu').getSize()['y']);
		},
		'mouseleave': function(){
			this.set('tween', { duration: 200 } ).tween('height', 28);
		}
	});
}
