function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_hover = newImage("../images/layout/topnavi_home_hover.gif");
		news_hover = newImage("../images/layout/topnavi_news_hover.gif");
		ueberuns_hover = newImage("../images/layout/topnavi_ueberuns_hover.gif");
		gebrauchte_hover = newImage("../images/layout/topnavi_gebrauchte_hover.gif");
		daineseshop_hover = newImage("../images/layout/topnavi_daineseshop_hover.gif");		
		dynojet_hover = newImage("../images/layout/topnavi_dynojet_hover.gif");
		editions_hover = newImage("../images/layout/topnavi_editions_hover.gif");
		honda_hover = newImage("../images/layout/topnavi_honda_hover.gif");
		ducati_hover = newImage("../images/layout/topnavi_ducati_hover.gif");
		vermietung_hover = newImage("../images/layout/topnavi_vermietung_hover.gif");
		dainese2_hover = newImage("../images/layout/dainese_hover.gif");
		dynojet2_hover = newImage("../images/layout/dynojet_hover.gif");
		moto_hover = newImage("../images/layout/layout_02b.jpg");
		arrow_top_hover = newImage("../images/layout/arrow_top_hover.jpg");
		
		home_honda_hover = newImage("../images/layout/home_honda_hover.jpg");
		home_ducati_hover = newImage("../images/layout/home_ducati_hover.jpg");
		home_dynojet_hover = newImage("../images/layout/home_dynojet_hover.jpg");
		home_dainese_hover = newImage("../images/layout/home_dainese_hover.jpg");
		preloadFlag = true;
	}
}

var fadeimage_firma=new Array()
fadeimage_firma[0]=["../ftp/slideshow_firma/firma1.jpg", "", ""] 
fadeimage_firma[1]=["../ftp/slideshow_firma/firma2.jpg", "", ""] 
fadeimage_firma[2]=["../ftp/slideshow_firma/firma3.jpg", "", ""] 
fadeimage_firma[3]=["../ftp/slideshow_firma/firma4.jpg", "", ""]  
fadeimage_firma[4]=["../ftp/slideshow_firma/firma5.jpg", "", ""] 
fadeimage_firma[5]=["../ftp/slideshow_firma/firma6.jpg", "", ""] 
fadeimage_firma[6]=["../ftp/slideshow_firma/firma7.jpg", "", ""] 
fadeimage_firma[7]=["../ftp/slideshow_firma/firma8.jpg", "", ""] 
fadeimage_firma[8]=["../ftp/slideshow_firma/firma9.jpg", "", ""]
	
var fadeimage_dynojet=new Array()
fadeimage_dynojet[0]=["../ftp/slideshow_dynojet/dynojet1.jpg", "", ""] 
fadeimage_dynojet[1]=["../ftp/slideshow_dynojet/dynojet2.jpg", "", ""] 
fadeimage_dynojet[2]=["../ftp/slideshow_dynojet/dynojet3.jpg", "", ""] 
fadeimage_dynojet[3]=["../ftp/slideshow_dynojet/dynojet4.jpg", "", ""]  
fadeimage_dynojet[4]=["../ftp/slideshow_dynojet/dynojet5.jpg", "", ""] 
fadeimage_dynojet[5]=["../ftp/slideshow_dynojet/dynojet6.jpg", "", ""] 
fadeimage_dynojet[6]=["../ftp/slideshow_dynojet/dynojet7.jpg", "", ""] 
fadeimage_dynojet[7]=["../ftp/slideshow_dynojet/dynojet8.jpg", "", ""] 
fadeimage_dynojet[8]=["../ftp/slideshow_dynojet/dynojet9.jpg", "", ""]
fadeimage_dynojet[9]=["../ftp/slideshow_dynojet/dynojet10.jpg", "", ""]
fadeimage_dynojet[10]=["../ftp/slideshow_dynojet/dynojet11.jpg", "", ""]
fadeimage_dynojet[11]=["../ftp/slideshow_dynojet/dynojet12.jpg", "", ""]
fadeimage_dynojet[12]=["../ftp/slideshow_dynojet/dynojet13.jpg", "", ""]
fadeimage_dynojet[13]=["../ftp/slideshow_dynojet/dynojet14.jpg", "", ""]
fadeimage_dynojet[14]=["../ftp/slideshow_dynojet/dynojet15.jpg", "", ""]
fadeimage_dynojet[15]=["../ftp/slideshow_dynojet/dynojet16.jpg", "", ""]
fadeimage_dynojet[16]=["../ftp/slideshow_dynojet/dynojet17.jpg", "", ""]

var fadeimage_ducati=new Array()
fadeimage_ducati[0]=["../ftp/slideshow_ducati/ducati1.jpg", "", ""] 
fadeimage_ducati[1]=["../ftp/slideshow_ducati/ducati2.jpg", "", ""] 
fadeimage_ducati[2]=["../ftp/slideshow_ducati/ducati3.jpg", "", ""] 
fadeimage_ducati[3]=["../ftp/slideshow_ducati/ducati4.jpg", "", ""] 
fadeimage_ducati[4]=["../ftp/slideshow_ducati/ducati5.jpg", "", ""] 

var fadeimage_honda=new Array()
fadeimage_honda[0]=["../ftp/slideshow_honda/honda1.jpg", "", ""] 
fadeimage_honda[1]=["../ftp/slideshow_honda/honda2.jpg", "", ""]
fadeimage_honda[2]=["../ftp/slideshow_honda/honda3.jpg", "", ""]
fadeimage_honda[3]=["../ftp/slideshow_honda/honda4.jpg", "", ""]
fadeimage_honda[4]=["../ftp/slideshow_honda/honda5.jpg", "", ""]
fadeimage_honda[5]=["../ftp/slideshow_honda/honda6.jpg", "", ""]
fadeimage_honda[6]=["../ftp/slideshow_honda/honda7.jpg", "", ""]
fadeimage_honda[7]=["../ftp/slideshow_honda/honda8.jpg", "", ""]
fadeimage_honda[8]=["../ftp/slideshow_honda/honda9.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="border:0px; position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="border:0px;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="border:0px;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+'" border="0" style="border:0px;"></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+"])",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()
}




//Newsticker
//var newslist=new Array();
//var cnt= 0;
//var curr = "";
//var i=-1;

//newslist[0]=new Array('Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 Text1 ',"1.html")
//newslist[1]=new Array("Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 Text2 ","2.html")
//newslist[2]=new Array("Text3 Text3 Text3 Text3 Text3 Text3 Text3 Text3 Text3 Text3 Text3 ","3.html")
//newslist[3]=new Array("Text4 Text4 Text4 Text4 Text4 Text4 Text4 Text4 Text4 Text4 Text4 ","4.html")
//newslist[4]=new Array("Text5 Text5 Text5 Text5 Text5 Text5 Text5 Text5 Text5 Text5 Text5 ","5.html")

function newsticker(){

	if (i < newslist[cnt][0].length - 1)
	{
		i++;
		temp1 = newslist[cnt][0];	
		temp1 = temp1.split('');	
  		curr = curr+temp1[i];
		temp2 = newslist[cnt][1];	
  		document.getElementById('ticker').innerHTML = curr+" <a title='hier klicken für weitere Infos ...' href='"+temp2+"' >News lesen...</a>";
  		setTimeout('newsticker()',40) //Geschwindigkeit der Buchstabeneinblendung
		return;
	}

	i = -1; curr = "";
	if (cnt<newslist.length-1)
		cnt++;
	else
		cnt=0;
	setTimeout('newsticker()',6000) //Wechselintervall

}
