
function gotoIndex(menu){
	window.location.href = "index.php?menu="+menu+"&psid="+sessionID();
}

function sessionID(){
	return location.href.substr(location.href.indexOf("psid=")+5,32);
}


function gotoIndex(menu){
	window.location.href = "index.php?id=4294&menu="+menu;
}

function view_change(){
	gotoIndex($('#view_select').val());

}


function event_detail(event_id){
	$.nyroModalManual({
	  url: 'login/event_detail.php?event_id='+event_id,
	  forceType: 'iframe',
	  titleFromIframe: true,
	  width: 700
	});
}


function book(eventID){
	if(confirm("Diese Veranstaltung wird verbindlich gebucht, die Buchung kann nicht zurückgenommen werden.")){
		$.post("book.php",{psid: psid, event_id: eventID},bookCallback);	
	}
}

function bookCallback(data, textStatus, http_request){
	if ( http_request.readyState == 4 ){
		if (http_request.status != 200){
			alert("Verbindungsfehler beim Buchungsvorgang: " + http_request.status);
		}
		else{
			if(data=="booked"){
				location.reload();
			}else if(data=="error"){
				alert("Die Veranstaltung kann nicht gebucht werden. Evtl. ist sie bereits gebucht worden.");
				location.reload();
			}else{
				alert(data);
			}
		}
	}
}
