// Script by Thomas Stich
// http://www.stichpunkt.de/beitrag/popup.html
// use it if you like it
// 
// <a href="html-or.jpg" onclick="return popup(this,123,456)" title="..."
// or
// <a href="html-or.jpg" onclick="return popup(this)" title="..."

//POPUP
var pop = null;

function popdown() {
  if (pop && !pop.closed) pop.close();
}

function popup(obj,w,h) {
  var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
  if (!url) return true;
  w = (w) ? w += 20 : 150;  // 150px*150px is the default size
  h = (h) ? h += 25 : 150;
  var args = 'width='+w+',height='+h+',resizable,scrollbars=yes';
  popdown();
  pop = window.open(url,'',args);
  return (pop) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;


// ACCORDION


window.addEvent('domready', function(){
	
var stretchers = $$('div.accordion');
var togglers = $$('div.toggler');
stretchers.setStyles({'height': '0', 'overflow': 'hidden'});
			
	//initialization of togglers effects
		
	togglers.each(function(toggler, i){
		toggler.color = toggler.getStyle('background-color');
		toggler.$tmp.first = toggler.getFirst();
		toggler.$tmp.last = toggler.getLast();
		toggler.$tmp.fx = new Fx.Style(toggler, 'background-color', {'wait': false, 'transition': Fx.Transitions.Quart.easeOut});
		
	});
		
	//the accordion
		
	var myAccordion = new Accordion(togglers, stretchers, {

		'duration': 500, 
			
		'opacity': true,
		
		'start': false,
		
		 // 'transition': Fx.Transitions.cubicOut,			

		 'transition': Fx.Transitions.Quad.easeOut,

		 'alwaysHide': true,
			
		onActive: function(toggler){
			toggler.$tmp.fx.start('#fff');
			toggler.$tmp.first.setStyle('color', '#000');		
			toggler.$tmp.first.setStyle('width', '464px');			
			//toggler.$tmp.first.addEvent('mouseenter', function(){ toggler.$tmp.first.setStyle('color', '#000'); });
			//toggler.$tmp.first.addEvent('mouseenter', function(){ toggler.$tmp.first.setStyle('color', '#000'); });
			toggler.$tmp.last.setStyle('display', 'inline');
		},
		
		onBackground: function(toggler){
			toggler.$tmp.fx.stop();
			toggler.$tmp.first.setStyle('color', 'rgb(224,0,128)');
			toggler.$tmp.first.setStyle('width', '464px');		
			//toggler.$tmp.first.addEvent('mouseenter', function(){ toggler.$tmp.first.setStyle('color', '#000'); });
			//toggler.$tmp.first.addEvent('mouseleave', function(){ toggler.$tmp.first.setStyle('color', 'rgb('224','0','128')'); });
			toggler.$tmp.last.setStyle('display', 'none');
		}
	});
		
	//open the accordion section relative to the url
		
	var found = 0;
	$$('h3.toggler a').each(function(link, i){
		if (window.location.hash.test(link.hash)) found = i;
		
		
	});
	//myAccordion.display(found);
	
				
});

var display
function pink (elem) {
	if(display!=elem){
		$(elem).setStyle('color', 'rgb(224,0,128)'); 
	}
	
}
function schwarz (elem) {
	
	$(elem).setStyle('color', '#000'); 

}
function setaktiv (elem) {
	display=elem;
}


