/****************************************************************************   

DHTML library from DHTMLCentral.com

*   Copyright (C) 2001 Thomas Brattli 2001

*   This script was released at DHTMLCentral.com

*   Visit for more great scripts!

*   This may be used and changed freely as long as this msg is intact!

*   We will also appreciate any links you could give us.

*

*   Made by Thomas Brattli 2001

***************************************************************************/

//Browsercheck (needed) ***************

function lib_bwcheck(){ 

  this.ver=navigator.appVersion

  this.agent=navigator.userAgent

  this.dom=document.getElementById?1:0

  this.opera5=this.agent.indexOf("Opera 5")>-1

  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 

  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;

  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;

  this.ie=this.ie4||this.ie5||this.ie6

  this.mac=this.agent.indexOf("Mac")>-1

  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 

  this.ns4=(document.layers && !this.dom)?1:0;

  this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5)

  return this

}

bw=new lib_bwcheck() //Browsercheck object



//Debug function ******************

function lib_message(txt){alert(txt); return false}



//Lib objects  ********************

function lib_obj(obj,nest){ 

  if(!bw.bw) return lib_message('Old browser')

  nest=(!nest) ? "":'document.'+nest+'.'

  this.evnt=bw.dom? document.getElementById(obj):

    bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;	

  if(!this.evnt) return lib_message('The layer does not exist ('+obj+')' 

    +'- \nIf your using Netscape please check the nesting of your tags!')

  this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; 

  this.ref=bw.dom||bw.ie4?document:this.css.document;

  this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0;

  this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0

  this.w=this.evnt.offsetWidth||this.css.clip.width||

  this.ref.width||this.css.pixelWidth||0; 

  this.h=this.evnt.offsetHeight||this.css.clip.height||

    this.ref.height||this.css.pixelHeight||0

  this.c=0 //Clip values

  if((bw.dom || bw.ie4) && this.css.clip) {

  this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 

  this.c=this.c.split(' ');

  for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}

  }

  this.ct=this.css.clip.top||this.c[0]||0; 

  this.cr=this.css.clip.right||this.c[1]||this.w||0

  this.cb=this.css.clip.bottom||this.c[2]||this.h||0; 

  this.cl=this.css.clip.left||this.c[3]||0

  this.obj = obj + "Object"; eval(this.obj + "=this");

  //eigene eigenschaften

  this.objektart ='';

  this.id = '';

  this.nam = obj;

  //texteigenschaften

  this.text = '';

  return this

}







//Moving object to **************

lib_obj.prototype.moveIt = function(x,y){

  this.x=x;this.y=y; this.css.left=x;this.css.top=y

}





//Moving object by ***************

lib_obj.prototype.moveBy = function(x,y){

  this.css.left=this.x+=x; this.css.top=this.y+=y

}



//Showing object ************

lib_obj.prototype.showIt = function(){

this.css.visibility="visible"

}



//Hiding object **********

lib_obj.prototype.hideIt = function(){this.css.visibility="hidden"}



//lib_obj.prototype.menue_nach_vorne = function(){this.css.z-index:100000000}



////aktivieren mit hintergrundfarbe

//lib_obj.prototype.aktivieren1 = function(){ 

//	var color= '#FFCC99';

//	if(bw.opera) this.css.background=color  

//	else if(bw.dom || bw.ie4) this.css.backgroundColor=color

//	else if(bw.ns4) this.css.bgColor=color  

//}





//Writing content to object ***

lib_obj.prototype.writeIt = function(text,startHTML,endHTML){

	this.text = text;

	if(bw.ns4){

    if(!startHTML){startHTML=""; endHTML=""}

	  this.ref.open("text/html"); 

    this.ref.write(startHTML+text+endHTML); 

    this.ref.close()

	}else this.evnt.innerHTML=text

}



//Clipping object to ******

lib_obj.prototype.clipTo = function(t,r,b,l,setwidth){ 

  this.ct=t; this.cr=r; this.cb=b; this.cl=l

  if(bw.ns4){

    this.css.clip.top=t;this.css.clip.right=r

    this.css.clip.bottom=b;this.css.clip.left=l

  }else{

    if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0

    this.css.clip="rect("+t+","+r+","+b+","+l+")";

    if(setwidth){this.css.pixelWidth=this.css.width=r; 

    this.css.pixelHeight=this.css.height=b}

  }

}



//Clipping object by ******

lib_obj.prototype.clipBy = function(t,r,b,l,setwidth){ 

  this.clipTo(this.ct+t,this.cr+r,this.cb+b,this.cl+l,setwidth)

}



//Document size object ********

function lib_doc_size(){ 

  this.x=0;this.x2=bw.ie && document.body.offsetWidth-20||innerWidth||0;

  this.y=0;this.y2=bw.ie && document.body.offsetHeight-5||innerHeight||0;

  if(!this.x2||!this.y2) return message('Document has no width or height') 

  this.x50=this.x2/2;this.y50=this.y2/2;

  return this;

}

//Slide animation ***********

lib_obj.prototype.slideTheintro = function(endx,endy,inc,speed,fn,wh,nach){

if (navigator.platform == 'MacPPC'){

inc=inc+20;

}

  if(!this.slideactive){

    var distx = endx - this.x;

    var disty = endy - this.y

    var num = Math.sqrt(Math.pow(distx,2)+Math.pow(disty,2))/inc

    var dx = distx/num; var dy = disty/num

    this.slideactive = 1; 

   	if(!wh) wh=0; if(!fn) fn=0

    this.slideintro(dx,dy,endx,endy,speed,fn,wh,nach)

	

	 }

	

}

lib_obj.prototype.slideintro = function(dx,dy,endx,endy,speed,fn,wh,nach) {

  if(this.slideactive&&

  (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x))|| 

    Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))){



    this.moveBy(dx,dy);



    if(wh) eval(wh)

    setTimeout(this.obj+".slideintro("+dx+","+dy+","+endx+","+endy+","+speed+",'"

    +fn+"','"+wh+"','"+nach+"')",speed)

  }else{

    this.slideactive = 0;

	if (nach<16){

		if (nach==13){

		obj[16].showIt();
		logo.showIt();

		 obj[13].slideTheintro(400,60,8,1,0,0,14);

		 obj[16].slideIt(750,190,5,1,0,0);

	}

	if (nach==14){

	obj[14].showIt();



	 obj[14].slideTheintro(585,60,8,1,0,0,15);

	}

	if (nach==15){

	decker.hideIt();


	decku.slideIt(0,800,8,1,0,0);

	obj[17].showIt();

	obj[17].slideIt(400,60,8,1,0,0);

	obj[13].hideIt();

	farbe.showIt();

	}

	}	

    this.moveIt(endx,endy);

    if(fn) eval(fn)

  }

}





lib_obj.prototype.slideIt = function(endx,endy,inc,speed,fn,wh,nach){

if (navigator.platform == 'MacPPC'){

inc=inc+20;

}

  if(!this.slideactive){

    var distx = endx - this.x;

    var disty = endy - this.y

    var num = Math.sqrt(Math.pow(distx,2)+Math.pow(disty,2))/inc

    var dx = distx/num; var dy = disty/num

    this.slideactive = 1; 

   	if(!wh) wh=0; if(!fn) fn=0

    this.slide(dx,dy,endx,endy,speed,fn,wh,nach)

	

	 }

	

}



lib_obj.prototype.slide = function(dx,dy,endx,endy,speed,fn,wh,nach) {

  if(this.slideactive&&

  (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x))|| 

    Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))){



    this.moveBy(dx,dy);



    if(wh) eval(wh)

    setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+speed+",'"

    +fn+"','"+wh+"','"+nach+"')",speed)

  }else{

    this.slideactive = 0; 

    this.moveIt(endx,endy);

    if(fn) eval(fn)

  }



}



lib_obj.prototype.austausch1 = function(endx,endy,inc,speed,fn,wh,nach,text,ueberschrift){

if (navigator.platform == 'MacPPC'){

inc=inc+20;

}

  if(!this.slideactive){

    var distx = endx - this.x;

    var disty = endy - this.y

    var num = Math.sqrt(Math.pow(distx,2)+Math.pow(disty,2))/inc

    var dx = distx/num; var dy = disty/num

    this.slideactive = 1; 

   	if(!wh) wh=0; if(!fn) fn=0

    this.austausch2(dx,dy,endx,endy,speed,fn,wh,nach,text,ueberschrift)

	

	 }

	

}

lib_obj.prototype.austausch2 = function(dx,dy,endx,endy,speed,fn,wh,nach,text,ueberschrift) {

  if(this.slideactive&&

  (Math.floor(Math.abs(dx))<Math.floor(Math.abs(endx-this.x))|| 

    Math.floor(Math.abs(dy))<Math.floor(Math.abs(endy-this.y)))){



    this.moveBy(dx,dy);



    if(wh) eval(wh)

    setTimeout(this.obj+".austausch2("+dx+","+dy+","+endx+","+endy+","+speed+",'"

    +fn+"','"+wh+"','"+nach+"','"+text+"','"+ueberschrift+"')",speed)

  }else{    

  	this.slideactive = 0;

  	

	if (nach=='schreiben'){

	farbe.writeIt(text);

	

	obj[18].writeIt(ueberschrift);



	obj[17].slideIt(410,60,10,1,0,0);

	obj[18].slideIt(755,140,15,1,0,0);

	str1.slideIt(0,60,3,1,0,0);

	str2.slideIt(600,60,3,1,0,0);

	farbe.austausch1(110,70,8,1,0,0,'aus',text);

}



    this.moveIt(endx,endy);

    if(fn) eval(fn)



  }

}










