//
//  zentralmaschine.js
//
//  Created by Niels Hoffmann on 2007-01-26.
//  Copyright (c) 2007 zentralmaschine. All rights reserved.
//

// global rules
var rules = {
	'.head h2' : function(el){
		el.onclick = function(){
			var content = el.parentNode.nextSibling.nextSibling;
			hideAllExceptOne(content);
			myHeight = new Effect.toggle(content, 'appear', {duration:.5});	
		}
	}/*,
	'.img' : function(el){
		el.onclick = function(){
			var layer = $('layer');
			layer.innerHTML = buildSlideshow();
			displayOn = new Effect.Appear(layer, {duration:0.8});
			Behaviour.apply();
		};
	},
	'#slideshow' : function(el){
		el.onclick = function(){
			Element.hide(el.parentNode);
		}
	}*/
};


function hideAllExceptOne(el)
	{
	var contents = document.getElementsByClassName('content');

	for (var i = 0; i<contents.length; i++){
		if(contents[i] !== el){
			Element.hide(contents[i]);
		}
	}
}

function buildSlideshow(){
	
	var html = '<div style="position:absolute; width:100%; height:100%;';
	html += 'left: 0px; top:0px; background:url(img/alpha_black_bg.png);" ';
	html += 'id="slideshow">';
	html += '<div style="margin:140px auto auto 200px;">';
	html += '<img src="content/shotshop/img/l_screen_shotshop.jpg" alt="" />';
	html += '</div>';
	html += '</div>';
	
	return html;
}

Behaviour.register(rules);

