// JavaScript Document

// Slider Variablen
var slideranz = 8; // Wieviel werden angezeigt
var sliderall = 0; // Wieviel sind es
var slideactiv = 0; // Welcher Sliderstep ist gerade aktiv
var slidestepsallow = 0; // Weiviel Slidersteps sind erlaubt


// Slider
function initslider(){
	var z=0;
  	var elem=document.getElementsByTagName("img");
 	for(var i=0;i<elem.length;i++)if(elem[i].id.indexOf("product_")!=-1)z++;
 	sliderall = z;
	//alert(z);
	// Pfeile initial
	document.getElementById('slidenext').style.display = "block";
	document.getElementById('slideprev').style.display = "block";
	if(sliderall <= 8){
		document.getElementById('slidenextoff').style.display = "block";
		document.getElementById('slideprevoff').style.display = "block";
	}
	if(slideactiv == 0){
		document.getElementById('slideprevoff').style.display = "block";
	}
	// Slidesteps allow
	slidestepsallow = Math.round((sliderall-slideranz)/2);
	//alert(slidestepsallow);
}
function slidenext(){
	if(slideactive == 0){
		slideactive = 1;
		if(slideactiv < slidestepsallow){
			fadestop();
			slideactiv++;
			flvFSL1('slider',218,0,20,0,1);
			checkslidebuttons();
		}
	}
}
function slideprev(){
	if(slideactive == 0){
		slideactive = 1;
		if(slideactiv > 0){
			fadestop();
			slideactiv--;
			flvFSL1('slider',218,0,20,0,2);
			checkslidebuttons();
		}
	}
}
function checkslidebuttons(){
	if(slideactiv == slidestepsallow){
		document.getElementById('slidenextoff').style.display = "block";
	}else{
		document.getElementById('slidenextoff').style.display = "none";
	}
	if(slideactiv == 0){
		document.getElementById('slideprevoff').style.display = "block";
	}else{
		document.getElementById('slideprevoff').style.display = "none";
	}
}

function flvFSL1(){//v2.3
// Copyright 2002-2004, Marja Ribbers-de Vroed, FlevOOware (www.flevooware.nl/dreamweaver/)
var v1=arguments,v2=v1[0],v3=MM_findObj(v2),v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20=window,v21=navigator;if (v3){v4=parseInt(v1[1]);v5=parseInt(v1[2]);v6=parseInt(v1[3]);v7=(v1.length>4)?parseInt(v1[4]):0;v8=(v1.length>5)?parseInt(v1[5]):0;v9=10;v10=document.layers?v3:v3.style;if (v3.SL1!=null){clearTimeout(v3.SL1);}v11=isNaN(parseInt(v10.left))?v3.offsetLeft:parseInt(v10.left);v12=isNaN(parseInt(v10.top))?v3.offsetTop:parseInt(v10.top);if (v8!=0){if (v8==1){v4=v11-v4;v5=v12;}else if (v8==2){v4=v11+v4;v5=v12;}else if (v8==3){v5=v12-v5;v4=v11;}else {v5=v12+v5;v4=v11;}}v13=v4;v14=v5;if ((v11!=v4)||(v12!=v5)){if (v7>0){v9=v6;v15=v7;v16=v7,v17=Math.abs(v11-v4),v18=Math.abs(v12-v5);if (v17<v18){v16=(v17!=0)?((v18/v17)*v7):v7;}else {v15=(v18!=0)?((v17/v18)*v7):v7;}if (v15>=v17){v15=Math.min(Math.ceil(v15),v7);}if (v16>=v18){v16=Math.min(Math.ceil(v16),v7);}if ((v11<v4)&&(v11+v15<v4)){v4=v11+v15;}if ((v11>v4)&&(v11-v15>v4)){v4=v11-v15;}if ((v12<v5)&&(v12+v16<v5)){v5=v12+v16;}if ((v12>v5)&&(v12-v16>v5)){v5=v12-v16;}}else {v17=((v4-v11)/v6);v18=((v5-v12)/v6);v17=(v17>0)?Math.ceil(v17):Math.floor(v17);v4=v11+v17;v18=(v18>0)?Math.ceil(v18):Math.floor(v18);v5=v12+v18;}v19=(document.layers||window.opera)?"":"px";if (v17!=0){v10.left=v4+v19;}if (v18!=0){v10.top=v5+v19;}var v22="flvFSL1('"+v2+"',"+v13+","+v14+","+v6+","+v7+",0)";v3.SL1=setTimeout(v22,v9);}else {/*alert('slider fertsch');*/slideoff();if (v20.onSlideEnd){onSlideEnd(v2);}}}}

function fadestop(){
	if(varimagetype == 'home'){
		window.clearInterval(aktivinterval);
		if(varfadego == 0){
			setTimeout('fadego()', 3000);
		}
		varfadego = 1;
	}
}
function fadego(){
	if(varimagetype == 'home'){
		aktivinterval = window.setInterval ('shineout()', intervaltime);
		varfadego = 0;
	}
}

function slideoff(){ // Wenn sliden fertig ist
	slideactive = 0;	
}