
function doit(id,url,pars) {
	
	pleaseWait();

	var MyAjax = new Ajax.Updater(id, url, {method: 'get', parameters: pars, onComplete: stopWaiting});
	
	return false;
}
function pleaseWait() {
	setBG();
	
	var width = document.body.clientWidth;
	var left = Math.round((width-735)/2)
	
	
	
	$('popupFG').style.left = left + "px";
		
	$('popupFG').style.filter = "Alpha(opacity=80)";
	$('popupFG').style.opacity = ".8";
	$('popupFG').style.backgroundColor = "#333";
	
	$('popupFG').innerHTML = "<p><img class='icon' src='media/loading.gif' /></p>";
	$('popupFG').style.display = "block";
	return true;
}
function stopWaiting() {
	$('popupBG').style.display = "none";
	$('popupFG').style.display = "none";
	return true;
}
function setBG() {
	
	var width = document.body.clientWidth;
	var left = Math.round((width-742)/2)
	
	
	
	$('popupBG').style.width = '760px';
	$('popupBG').style.height = $('page').getStyle('height');
	$('popupBG').style.left = left + "px";
		
	$('popupBG').style.filter = "Alpha(opacity=90)";
	$('popupBG').style.opacity = ".9";
	
	$('popupBG').style.display = "block";
	

}
	
function openImage(imageurl,height) {
	
	pleaseWait();
	
	if(height != 0)
		$('popupFG').style.top = height + "px";
	else
		$('popupFG').style.top = '250px';
		
	
	//$('popupBG').style.width = width + "px";

	//$('popupFG').style.width = width + "px";
	//$('popupFG').style.top = 160 + offsetY + "px";

	//if(offsetY > 0) height = offsetY + height;
	
	var url = 'image.php';
	var pars=  "media/"+imageurl;
	
	$('popupFG').innerHTML = "<img onclick='closeImage();return false;' src='" + pars + "' alt='hier klicken zum schliessen'><br clear='all' /><a href='#' onclick='closeImage();return false;'>schliessen</a>";
	
}
function closeImage() {
	
	 
	$('popupFG').style.display ="none";
	$('popupBG').style.display = "none";
	$('popupFG').innerHTML = "<p><img class='icon' src='media/loading.gif' /></p>";
}

function openS(sec) {
	setBG();
	var ins;
	
	if(sec == 0) setWidth('bledesBild');
	
	$('popupS').style.filter = "Alpha(opacity="+sec+")";
	
	if(sec < 10) {
		ins = ".0"+sec;
	}
	else if(sec < 100 && sec >=10) ins = "."+sec;
	else if(sec >= 100) ins = 1;
	
	
	$('popupS').style.opacity = ins;
	$('popupS').style.display = "block";
	
	if(sec >= 100) { return false;}
	else {
		sec +=7;
		window.setTimeout("openS("+sec+")",0);
	}
	
}
function closeS() {
	$('popupS').style.display = "none";
	stopWaiting();
}


/*function highlight(myElement) {
	var myEffects = new Fx.Styles('myElement', {duration: 1000, transition: Fx.Transitions.linear});
 
	//height from 10 to 100 and width from 900 to 300
	myEffects.start({
		'height': [10, 100],
		'width': [900, 300]
	});
}*/

function menuOnMouseOver(id) {
	$(id).src = 'media/menu/'+id+'_hover.gif';
	$(id+'_hint').style.display = "block";
}
function menuOnMouseOut(id) {
	$(id).src = 'media/menu/'+id+'.gif';
	$(id+'_hint').style.display = "none";	
}

function switchIt(id) {
	if($(id).style.display == 'block') $(id).style.display = 'none';
	else $(id).style.display = 'block';
	return false;
}


