var move;
var limitRight;
var limitLeft;
var hasBeenRated=0;
var maxRatingElements;

function startDivMove(direction,elements,divID){
	move=true;		
	if(direction=='left'){
		divMoveLeft(divID);
	} else if(direction=='right'){
		divMoveRight(divID);
	}
	limitRight=0;
	limitLeft=(-137*elements)+470;
}

function stopDivMove(){
	move=false;
}

function divMoveLeft(divID) {
 	var elem=document.getElementById(divID);
 	var posLeft=parseInt(elem.style.left);
 	if(move && posLeft>limitLeft){
	 	elem.style.left=posLeft-5+'px';
 		setTimeout("divMoveLeft('"+divID+"')", 20);
 	}	 
}

function divMoveRight(divID) {
 	var elem=document.getElementById(divID);
 	var posLeft=parseInt(elem.style.left);
 	if(move && posLeft<limitRight){
	 	elem.style.left=posLeft+5+'px';
 		setTimeout("divMoveRight('"+divID+"')", 20);
 	}	 
}

function changeDisplayStatus(divID){
	var div=document.getElementById(divID)
	if(div.style.display=='block'){
		div.style.display='none';
	} else {
		div.style.display='block';
	}
}

function ratingMouseON(ratingElement, ratingElements){
	maxRatingElements = ratingElements;
	if(hasBeenRated==0){
		ratingElementNR = ratingElement.id.replace("ratingElementNR_", '')
		for(i=1; i<=maxRatingElements; i++){		
			if(i<=ratingElementNR){
				document.getElementById("ratingElementNR_"+i).className = "on";
			}else{
				document.getElementById("ratingElementNR_"+i).className = "off";
			}
		}
	}
}

function ratingMouseOFF(ratingElementNR,ratingAktuell){
	if(hasBeenRated==0){	
		for(i=1; i<=maxRatingElements; i++){
			if(ratingAktuell>=i){
				document.getElementById("ratingElementNR_"+i).className = "on";
			} else {
				if(ratingAktuell>i-0.25){
					document.getElementById("ratingElementNR_"+i).className = "on";
				} else if(ratingAktuell>i-0.75){
					document.getElementById("ratingElementNR_"+i).className = "half";
				} else {
					document.getElementById("ratingElementNR_"+i).className = "off";
				}
			}
		}
	}
}
function changeButton(button,newSource){
	button.src=newSource;
} 
function faktenChangeLinkText(){
	var laenge = document.getElementById("toggleFakten").firstChild.nodeValue.length;
	if(document.getElementById("toggleFakten").firstChild.nodeValue=='mehr lesen'){
		var newText= 'schließen';
	} else{
		var newText= 'mehr lesen';
	}
	document.getElementById("toggleFakten").firstChild.replaceData(0, laenge, newText);
}
 



function markFields(ids, className)
{
	var idArray = ids.split("¶");
	for(var i = 0; i < idArray.length; i++)
	{
		document.getElementById(idArray[i]).className = className;
	} // for(var i = 0; i < idArray.length; i ++)
} // function markFields()



function openPopUp(url,width,height) {
 popupFenster = window.open(url, "popup1", "width="+width+",height="+height+",status=no,scrollbars=yes,resizable=yes");
 popupFenster.focus();
}






