// JavaScript Document

var button = null;
var Button = Class.create();
Object.extend(Button.prototype, {
	bnode: null,
	initialize: function() {
		this.bnode = document.createElement('img');
		this.bnode.setAttribute('id', 'button_img');
		this.bnode.setAttribute('src', 'fileadmin/template/wnhbase/images/button_full.jpg');
		this.bnode.style.width = '803px';
		this.bnode.style.height = '420px';
		this.bnode.style.position = 'absolute';
		this.bnode.style.top = '0px';
		this.bnode.style.left = '0px';
		this.bnode.style.zIndex = 1000;
		this.bnode.style.visibility = 'visible';
	},
	buttomize: function(url) {
		this.jump(url);
		return;
		$('content_pane').replaceChild(this.bnode, $('content'));
		$('content_pane').style.backgroundColor = 'white';
		new Effect.Morph(this.bnode, {duration: 1, style: 'width: 160px; height: 80px; left: 0px; top: 340px;', queue: {position: 'end', scope: 'jumper'}, afterFinish: this.jump(url)});
	},
	jump: function(url) {
		window.location.href = url;
	}
});

function init() {
	button = new Button();
	initPart('gesundheit_img');
	initPart('schoenheit_img');
	initPart('kinder_img');
	initPart('sexualitaet_img');
	initPart('wohlbefinden_img');
	initPart('box0');	
	initPart('box1');	
	initPart('box2');	
	initPart('box3');	
	initPart('box4');	
	initPart('box5');	
}

function introAnimation() {
	window.setTimeout("animateColumn('gesundheit_img')", 0);
	window.setTimeout("animateColumn('schoenheit_img')", 1000);
	window.setTimeout("animateColumn('kinder_img')", 2000);
	window.setTimeout("animateColumn('sexualitaet_img')", 3000);
	window.setTimeout("animateColumn('wohlbefinden_img')", 4000);
	window.setTimeout("animateBox('box0')", 5000);
	window.setTimeout("animateBox('box1')", 5100);
	window.setTimeout("animateBox('box2')", 5200);
	window.setTimeout("animateBox('box3')", 5300);
	window.setTimeout("animateBox('box4')", 5400);
	window.setTimeout("animateBox('box5')", 5500);
}

function fadeIn(element) {
	new Effect.Opacity(element, {duration:0.25, from:0.7, to:1.0, queue: {position: 'end', scope: element.id}});return false;
}

function fadeOut(element) {
	new Effect.Opacity(element, {duration:0.25, from:1.0, to:0.7, queue: {position: 'end', scope: element.id}});return false;
}

function initPart(partname) {
	part = $(partname);
	part.setOpacity(0);
	part.style.visibility = 'visible';
}

function animateColumn(column_name) {
	column = $(column_name);
	new Effect.Opacity(column, {duration:1.0, from: 0.0, to:0.7, beforeStart: show(column), queue: {position: 'end', scope: column_name}});
}

function animateBox(column_name) {
	column = $(column_name);
	new Effect.Opacity(column, {duration:1.0, from: 0.0, to:1.0, beforeStart: show(column), queue: {position: 'end', scope: column_name}});
}

function show(column) {
	column.style.visibility = 'visible';	
}

function buttomize(element, url) {
	button.buttomize(url);
}

Event.observe(window, 'load', function() {
	init();
	introAnimation();
});
