
/* funktion für sound steuerung */
function soundcontrol() {
	/* schon mal das bildchen ändern ;) */
	if (document.images) {
		var bildpfad = document.images['sound'].src;
		if (bildpfad.indexOf("top_sound_an.gif") > 1) {
        	document.images['sound'].src = 'pic/top_sound_aus.gif';
			gamemobmusik.tellFlash("stopFlash");
		} else {
			openSoundWindow();
			document.images['sound'].src = 'pic/top_sound_an.gif';
			gamemobmusik.tellFlash("startFlash");		
		}
	}
}

/* sound image auf der hauptseite */
function imageSet(status) {
	if (status == "imageAus") {
		document.images['sound'].src = 'pic/top_sound_aus.gif';
	}	
	if (status == "imageAn") {
		document.images['sound'].src = 'pic/top_sound_an.gif';
	}	
}

/* sound fenster öffnen */
function openSoundWindow() {
	if (window.screen) {
		x = screen.width-310;
		y = screen.height/2-200;
		features='height=300,width=300,screenX=' + x + ',screenY=' + y + ',top=' + y + ',left=' + x; 
	} else {
		features='"height=300,width=300,screenX=1,screenY=1,top=1,left=1';
	}
	if (parseInt(navigator.appVersion) <= 4 && navigator.appVersion.indexOf('MSIE') == -1) {
		//alert(navigator.appVersion + " netscape4? int: " + parseInt(navigator.appVersion));
		gamemobmusik = window.open("musik.php","musik",features);
	} else {
		//alert(navigator.appVersion + " klappt? int: " + parseInt(navigator.appVersion));
		gamemobmusik = window.open("","musik",features);
		if (gamemobmusik.location && gamemobmusik.location.href.indexOf('musik.html') == -1) {
			gamemobmusik.location.href = 'musik.php';
		}
	}
	/*gamemobmusik = window.open("musik.html","musik","height=300,width=300,screenX=1,screenY=1");*/
	if (gamemobmusik.opener == null) gamemobmusik.opener = self;
	/* check ob sound im popup an und gif im main ändern */
	if (gamemobmusik.location && gamemobmusik.location.href.indexOf('musik.php') > 0) {
		if (gamemobmusik.document.images['popupmusic'].src.indexOf("pic/popup_music_an.gif") > 0) {
			document.images['sound'].src = 'pic/top_sound_an.gif';
		} else {
			document.images['sound'].src = 'pic/top_sound_aus.gif';
		}
	}
	gamemobmusik.focus();
}

function gotouserinfo(object) {
    window.location.href = object.options[object.selectedIndex].value;
}

function openQuiz(formular) {
	fenstername = 'quizpop';
    w = 300;
    h = 210+(document.quizform.anzahl.value*30);
    props = 'width='+w+',height='+h+',status=no,menubar=no,resizable=no';
	if (!window.focus)return true;
    window.open('',fenstername,props);
	formular.target=fenstername;
	return true;
}

function popupOpen(seitenurl,width,height) {
	if (window.screen) {
		x = (screen.width - width)/2;
		y = (screen.height - height)/3;
		properties = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",screenX=" + x + ",screenY=" + y + ",status=no,menubar=no,resizable=no";
	} else {
		properties = "width=" + width + ",height=" + height + ",top=10,left=10,screenX=10,screenY=10,status=no,menubar=no,resizable=no";
	}
	popupfenster = window.open("","universalpopup",properties);
    popupfenster.location.href = seitenurl;
    if (!popupfenster.opener) popupfenster.opener = self;
	popupfenster.focus();
}

/* clear gif preload für sauberes rendering? */
if (document.images) {
    imgclear = new Image();
    imgclear.src = 'pic/clear.gif';
}

/* Funktion für dynamische Berechung der Dauer (Terminkalender) */
function dauerSelect(x,gewaehlt) {

// Berechnung der Stundenanzahl anhand Anfangs- und Endzeit

if(document.termineintragen.uhrzeit.value == "auswahl")	{ 
	document.termineintragen.dauer.options.length = 0;	
	option0 = new Option("Bitte erst Uhrzeit auswählen",0) 
	document.termineintragen.dauer.options[0] = option0
	return;
} else {	
	//alert(x);	
	var teilen = x.split(",");
	//alert(teilen+" - "+gewaehlt);
	
	// Die ausgewählte Uhrzeit (Bspw.: 20 Uhr)
	var u = teilen[0];
	// Die dazugehörige Dauer (Bspw.: 2 Stunden)
	var d = teilen[1];
	var i = 0;
	var s = 1;
	
	// alert(d);
	
	document.termineintragen.dauer.options.length = 0;
	
	while (i<d) {
	  var einsetzen = "option" + i;
	  if (s == 1)
	  { einsetzen = new Option(s + " Stunde",i) }
	  else
	  { einsetzen = new Option(s + " Stunden",i) }
	  document.termineintragen.dauer.options[i] = einsetzen;
	  i++;
	  s++;
	  }
	  document.termineintragen.dauer.options[gewaehlt-1].selected = true;
	  return; 
	}
}

/* Funktion für Editierung der Dauer (Terminkalender) */
function dauerEditieren(x, y, a, b) {

alert("Mit dem Editieren eines bereits festgelegten Termins gibst du deine Reservierung auf!");

// Berechnung der Stundenanzahl anhand Anfangs- und Endzeit

if(document.termineditieren.uhrzeit.value == "auswahl")	{ 
	document.termineditieren.dauer.options.length = 0;	
	option0 = new Option("Bitte erst Uhrzeit auswählen",0) 
	document.termineditieren.dauer.options[0] = option0
	return;
}

else {
var uhrzeit_min = parseFloat(x);
var uhrzeit_max = parseFloat(y);

if (uhrzeit_min <= uhrzeit_max)
{	var Zahl = uhrzeit_max-uhrzeit_min;		}
if (uhrzeit_min > uhrzeit_max)
{	var Zahl = 24-uhrzeit_min+uhrzeit_max;	}
		
document.termineditieren.dauer.options.length = 0;

var i = 0;
var s = 1;
while (i<Zahl) {
  var einsetzen = "option" + i;
  if (s == 1)
  { einsetzen = new Option(s + " Stunde",i) }
  else
  { einsetzen = new Option(s + " Stunden",i) }
  document.termineditieren.dauer.options[i] = einsetzen
  i++;
  s++;
  }
  return; 
}
}