$(document).ready(function() {	
	setTimeout('activate ()', 500);
	
});

function activate() {
	document.getElementById("body").className='home activate';
	slideMenu.build('home_menu',448,5,8,0);
}

//## HOVER-Buttons ######################################################################

function bgr_hover (obj,img) {
	obj.style.backgroundImage = "url(img/navi_bg_"+img+".jpg)";
}

function bgr_out (obj,img) {
	obj.style.backgroundImage = "url(img/navi_bg_"+img+".jpg)";
}

function slidestart($mode){
	//setTimeout('runslide ()', 1000);
	///if($mode){
		///alert($mode);
		///if($mode=='home'){
		if(!$mode){
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_13.jpg)';
		}
		
		if($mode){
			a = 1 + 12*(Math.random());
			a = Math.round(a);
			//document.write (a);
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_'+a+'.jpg)';
		}
		
		/*
		if($mode=='50'){//Firmenprofil
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_2.jpg)';
		}
		if($mode=='120'){//zertifikate
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_3.jpg)';
		}
		if($mode=='77'){//kontakt
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_4.jpg)';
		}
		if($mode=='117'){//anfahrt
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_5.jpg)';
		}
		if($mode=='76'){//impressum
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_6.jpg)';
		}
		if($mode=='119'){//hinweise
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_7.jpg)';
		}
		if($mode=='121'){//sonstige
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_1.jpg)';
		}
		if($mode=='referenzen'){
			document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_8.jpg)';
		}
		*/
	///}
	///if(!$mode){
	///	document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_1.jpg)';
	///}
	
	//if($mode=='home'){
	//	document.body.style.backgroundImage='url(../ftp/slideshow/slide1280_1.jpg)';
	//}
	//alert($mode);
	

	//if (!$mode) {
		//bgr1 = newImage("../ftp/slideshow/slide1280_1.jpg");
		/*bgr2 = newImage("../ftp/slideshow/slide1280_2.jpg");
		bgr3 = newImage("../ftp/slideshow/slide1280_3.jpg");
		bgr4 = newImage("../ftp/slideshow/slide1280_4.jpg");
		preloadFlag = true;*/
		/*BilderVorladen(
		'../ftp/slideshow/slide1280_1.jpg',
		'../ftp/slideshow/slide1280_2.jpg',
		'../ftp/slideshow/slide1280_3.jpg',
		'../ftp/slideshow/slide1280_4.jpg',
		'../ftp/slideshow/slide1280_5.jpg',
		'../ftp/slideshow/slide1280_6.jpg',
		'../ftp/slideshow/slide1280_7.jpg',
		'../ftp/slideshow/slide1280_8.jpg');
		*/
		
		/*	
		var BildArray = new Array();
	
		BildArray[0] = "../ftp/slideshow/slide1280_1.jpg";
		BildArray[1] = "../ftp/slideshow/slide1280_2.jpg";
		BildArray[2] = "../ftp/slideshow/slide1280_3.jpg";
		BildArray[3] = "../ftp/slideshow/slide1280_4.jpg";
		BildArray[4] = "../ftp/slideshow/slide1280_5.jpg";
		BildArray[5] = "../ftp/slideshow/slide1280_6.jpg";
		BildArray[6] = "../ftp/slideshow/slide1280_7.jpg";
		BildArray[7] = "../ftp/slideshow/slide1280_8.jpg";
		
		for (i=0; i < BildArray.length; i++) {
			document.getElementById('test_div').innerHTML = i;
    		var Bild = new Image();
    		Bild.src = BildArray[i];
  		}
  		*/
	//}
	
}

/*
function BilderVorladen()
{
    document.Vorladen = new Array();

    if(document.images)
    {
        for(var i = 0; i < BilderVorladen.arguments.length; i++){
            document.Vorladen[i] = new Image();
            document.Vorladen[i].src = BilderVorladen.arguments[i];
            document.getElementById('test_div').innerHTML = i;
        }
    }
}
*/

//## Slideshow ######################################################################
/*
function slide(){
	var fadeimage=new Array()
	fadeimage[0]=["../ftp/slideshow/slide1.jpg", "", ""] 
	fadeimage[1]=["../ftp/slideshow/slide2.jpg", "", ""] 
	
	var a = 1 + 1*(Math.random());
	a = Math.round(a);
	var p = 10;
	
	for($i=0;$i<22;$i++){
		var p = 10*$i;
		//alert(p);
		setTimeout('slidetop ('+p+')', 1000); 
	}
	
	
	
	document.body.style.backgroundImage='url(../ftp/slideshow/slide'+a+'.jpg)';
	slideshow();
}

function slideshow(){
	setTimeout('slide ()', 10000); 
}

function slidetop(p){
	var top_a = '-'+p+'px';
	alert(top_a);
	document.body.style.top=top_a;
}
*/

/*
var fensterbreite = screen.width;

if(fensterbreite=="800"){	
	var fadeimage=new Array()	
	fadeimage[0]=["../ftp/slideshow/slide800_1.jpg", "", ""] 
	fadeimage[1]=["../ftp/slideshow/slide800_2.jpg", "", ""] 
}

if(fensterbreite=="1024"){	
	var fadeimage=new Array()	
	fadeimage[0]=["../ftp/slideshow/slide1024_1.jpg", "", ""] 
	fadeimage[1]=["../ftp/slideshow/slide1024_2.jpg", "", ""] 
}

if(fensterbreite=="1280"){		
	var fadeimage=new Array()
	fadeimage[0]=["../ftp/slideshow/slide1280_1.jpg", "", ""] 
	//fadeimage[1]=["../ftp/slideshow/slide1280_2.jpg", "", ""] 
	//fadeimage[2]=["../ftp/slideshow/slide1280_3.jpg", "", ""] 
	//fadeimage[3]=["../ftp/slideshow/slide1280_4.jpg", "", ""] 
}

var fadebgcolor="black"

var fadearray=new Array()
var fadeclear=new Array() 
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){

var fensterbreite2 = screen.width;
	
if(fensterbreite2=="800"){		
	if (document.all) { //IE
		fadewidth = 780;
	}
	else { //Mozilla
		fadewidth = 784;
	}
	fadeheight = 132;
}

if(fensterbreite2=="1024"){		
		if (document.all) { //IE
		fadewidth = 1004;
	}
	else { //Mozilla
		fadewidth = 1008;
	}
	fadeheight = 169;
}

if(fensterbreite2=="1280"){	
		if (document.all) { //IE
		fadewidth = 1260;
	}
	else { //Mozilla
		fadewidth = 1264;
	}
	//fadeheight = 210;
	fadeheight = 500;
}

this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2

 
if (iebrowser&&dom||dom) {//if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="border:0px solid red;position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;z-index:-100; top: 0px;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
}
//document.write('<div id="master'+this.slideshowid+'" style="position:absolute;width:'+fensterbreite+'px;height:'+fensterhoehe+'px;overflow:hidden;z-index:-100; top: -164px;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fensterbreite+'px;height:'+fensterhoehe+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fensterbreite+'px;height:'+fensterhoehe+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" style="border: 0px solid #000000;">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 200)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}


function load_end () {
	//document.getElementById('body').style.backgroundColor = '#202020'
	//fade(document.getElementById('preloader'), 1.0, 0);
}

//Fader
function fade (element, from, to, current) {
		
  if (typeof current == 'undefined') {
    current = from;
  }
  if (typeof element.style.opacity != 'undefined') {
    element.style.opacity = current;
  }
  else if (typeof element.style.filter != 'undefined') {
    element.style.filter =
'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (current * 100) +
')';
  }
  if (from > to) {
    current -= 0.1;
    current = Math.round(current * 100) / 100;
    if (current >= to) {
      setTimeout(function () { fade(element, from, to, current); },100);
    }
  }
  else {
    current += 0.1;
    current = Math.round(current * 100) / 100;
    if (current <= to) {
      setTimeout(function () { fade(element, from, to, current); },100);
    }
  }
  
 if(current == 0){
	//document.getElementById('preloader').style.display = 'none';
 }
} 
*/
	

function table_height(){
	/*
	var fensterbreite3 = screen.width;
	if(fensterbreite3=="1280"){		
		document.getElementById('layout_table').style.marginTop='64px';
	}
	if(fensterbreite3=="1024"){		
		document.getElementById('layout_table').style.marginTop='133px';
	}
	if(fensterbreite3=="800"){		
		document.getElementById('layout_table').style.marginTop='86px';
	}
	*/
}


var fadeimage1=new Array()
fadeimage1[0]=["../ftp/slideshow/s1.jpg", "", ""] 
fadeimage1[1]=["../ftp/slideshow/s2.jpg", "", ""]
fadeimage1[2]=["../ftp/slideshow/s3.jpg", "", ""]
fadeimage1[3]=["../ftp/slideshow/s4.jpg", "", ""]
fadeimage1[4]=["../ftp/slideshow/s5.jpg", "", ""]
fadeimage1[5]=["../ftp/slideshow/s6.jpg", "", ""]
fadeimage1[6]=["../ftp/slideshow/s7.jpg", "", ""]

var fadebgcolor="black"

var fadearray=new Array()
var fadeclear=new Array() 
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" style="border: 0px solid #2c3132;">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",120)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

