﻿/***************************************************** 
	Programmierer 			: (c) Thomas Spanner
	Begonnen am 			: 28.10.07
	Zuletzt geändert am		: 01.11.07
******************************************************/

// globale Variabelen für Javaerkennung

var ie;
var netscp;
var w3c;
var browsertype = 0; /* 0= unknown 1=IExplorer 2=Netscape 3=w3c-compatible*/
var window_w = 0;
var window_h =0;
var maxZIndex=1000;
var maxWind=1;

// globale Variabelen für Animationen


var imgWidth=216, imgHeight=216;
var xStart=Math.floor(imgWidth/2), yStart=Math.floor(imgHeight/2);
var clipWidth=(imgWidth-2*xStart), clipHeight=(imgHeight-2*yStart);

var functionRef;
var objref;
var richtungX = true;
var delta = 5;
var posx = -140;

// diverse Animationsfunktionen
function do_visible(element){
	if (browsertype == 1)
		document.all(element).style.visibility='visible';
	else if (browsertype == 3)
		document.getElementById(element).style.visibility='visible';
}

function do_hidden(element){
	if (browsertype == 1)
		document.all(element).style.visibility='hidden';
	else if (browsertype == 3)
		document.getElementById(element).style.visibility='hidden';
}

function showlines(zaehler){
	if (zaehler <= 3) {
		if (zaehler == 0) do_visible('coaching');
		if (zaehler == 1) do_visible('mediation');
		if (zaehler == 2) do_visible('consulting');
		if (zaehler == 3) do_visible('startseite');
		zaehler++;
		functionRef = "showlines('"+zaehler+"')";
		setTimeout(functionRef,500);
	}
}

function show(img, counter) {
	do_hidden('coaching');
	do_hidden('mediation');
	do_hidden('consulting');
	do_hidden('startseite');
	if (browsertype == 1)
		document.all(img).style.clip="rect("+yStart+" "+(xStart+clipWidth)+" "+(yStart+clipHeight)+" "+xStart+")";
	else if (browsertype == 3)
		document.getElementById(img).style.clip="rect("+yStart+" "+(xStart+clipWidth)+" "+(yStart+clipHeight)+" "+xStart+")";
	xStart-=1;
	clipWidth+=2;
	yStart-=1;
	clipHeight+=2;
	functionRef = "show('"+img+"',"+counter+")";
	if(xStart>=0||yStart>=0){
		setTimeout(functionRef,counter);
	}
	else {
		showlines(-2);
	}
}

function schub(){
if (richtungX){
		posx+=delta;
		if (posx>210) richtungX=false;
	}
	objref.style.left=posx+"px";
}


function start_from_left(element){
	if (browsertype == 1)
		objref = document.all(element);
	else if (browsertype == 3)
		objref = document.getElementById(element);
	setInterval("schub()",10);
}
 

//Funktionen für Browsererkennung

// Funktion Nr. 1
function init_browser(){
	ie = document.all;
	netscp = document.layers;
	w3c = document.documentElement;
	if (ie)
		browsertype = 1;
	else if (netscp)
		browsertype = 2;
	else if (w3c)
		browsertype = 3;
	else
		browsertype = 0;
return browsertype;
}


// Funktion Nr. 2
function get_window_size(){
	var wert;
	wert = false;
	if (browsertype == 1){
		window_w=document.body.clientWidth;
		window_h=document.body.clientHeight;
	}
	else if (browsertype == 3){
		window_w=window.innerWidth;
		window_h=window.innerHeight;
	}
	if ((window_w != 0) & (window_h != 0)){
		wert = true;}
	return wert;
}


// Funktion Nr. 3
function init_all(){
	if ((init_browser() != 0) && (init_browser() != 2)){
			if (!get_window_size())
				alert("Fehler bei der Identifikation der Fenstereigenschaften! Diese Seite ist für iExplorer, Opera oder Mozilla Firefox konzipiert.");
		}
		else alert("Fehler bei der Identifikation des Browsers! Diese Seite ist für iExplorer, Opera oder Mozilla Firefox konzipiert.");
}


