
// Accordion effect //

var myAccordion;
var isOpen=new Array(false, false, false, false);


function toggle(index){
	var idx = index - 1;
	isOpen[idx] = !isOpen[idx];
		for (var i = 0; i < isOpen.length; i++) {
			if (i != idx)
				isOpen[i] = false;
			if (isOpen[i])
				document.getElementById("img" + (i + 1)).src = "/images/nav/arrow_down.gif";
			else
				document.getElementById("img" + (i + 1)).src = "/images/nav/arrow_up.gif";
		}
	}

window.onload = function() {

		var toggles = document.getElementsByClassName('events_toggle');
		var expander = document.getElementsByClassName('events_expander');

		myAccordion = new fx.Accordion(toggles, expander, {opacity: false, duration: 400});

        // myAccordion.showThisHideOpen(myStretcher[10]);
        
        document.getElementById('loader').style.display = "none"; 
		document.getElementById('content_main').style.display = "block";

	}
	
	function getRaumschiff(raumschiff_id){
	var raumschiff_id = raumschiff_id;

// AJAX request. calls a file in the ajax dir called project.php
	new Effect.Fade($('raumschiffContainerRight'));
	new Ajax.Updater('raumschiff_updater','ajax/raumschiff.php?raumschiff_id='+raumschiff_id, {asynchronous:true, evalScripts:true});
// this cycles through the other links and "toggles" the bold off of them
	var links = $$('a');
	for(var i=0; i<links.length; i++){
		var link = links[i];
		var this_id = link.getAttribute('id');
		if(this_id != null && this_id != raumschiff_id){
			$(this_id).style.fontWeight = 'normal';
			$(this_id).style.color = '#666666';			
		}
	}

// this "toggles" the bold on to the selected link
	$('raumschiff_link_'+raumschiff_id).style.fontWeight = 'bold';
	$('raumschiff_link_'+raumschiff_id).style.color = 'AA2A03';
	
	return false;
}

//center pop-up window
var win=null;
	function NewWindow(mypage,myname,w,h,scroll,pos){
		if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

var win=null;
	function NewWindowScroll(mypage,myname,w,h,scroll,pos){
		if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}