// custom js functions

var pages = new Array('news', 'program', 'booking', 'sponsor', 'cds', 'contact', 'history', 'impressum');

function SlideShow() {
	
	Effect.Fade(slides[i], { duration:1, from:1.0, to:0.0 }); 
	i++;
	 if (i == 9) i = 0; 
	Effect.Appear(slides[i], { duration:1, from:0.0, to:1.0 });
	

 } 

// the onload event handler that starts the fading. 
function start_slideshow() {
		 setInterval('SlideShow()',wait);
	 }

function show(element) {
		
		$(element).style.display = 'block';
}

function hide(element) {
		
		$(element).style.display = 'none';
}

function showLoad () {
	show('load');
}

function hideLoad() {
	hide('load');
}

function fixmenu(page) {
	for (var index = 0; index < pages.length; ++index) { 
		var p = pages[index]; 
			if(p==page) {
				$(p).className = "menu down";
			} else {
				$(p).className = "menu";
			}
		} 
}

//content loader
function request_content(page,lang) {
	
	var url = 'backend.php?action=load_content&page='+page+'&lang='+lang;
	var myAjax = new Ajax.Request( url, {method: 'get', onComplete: load_content} );
	fixmenu(page);
}

function load_content(originalRequests) {
	$('content').innerHTML = originalRequests.responseText;
	hideLoad();
}

function submit_reservation(f) {
		showLoad();
		var url = 'submit_form.php';
		var myAjax = new Ajax.Request( url, {method: 'post',  parameters: $('res').serialize(true) ,  onComplete: load_content} );

}