function imageOver(imageName, oldSrc, newSrc){
	var imageIndex = imageFind(imageName);
	document.images[imageIndex].src = newSrc;
	document.currentImage = new Array(imageName, oldSrc);
}

document.imageSelected = Array();

function imageSelect()
{
	if(imageSelect.arguments[0])
	{
		if(document.imageSelected[0])
		{
			document.images[imageFind(document.imageSelected[0])].src = document.imageSelected[1];
		}
		document.currentImage = new Array(imageSelect.arguments[0], document.images[imageFind(imageSelect.arguments[0])].src);
		document.imageSelected = document.currentImage;
		imageSRC = document.images[imageFind(imageSelect.arguments[0])].src.split('.gif');
		document.images[imageFind(imageSelect.arguments[0])].src = imageSRC[0]+'_over.gif';
	}
	else
	{
		if(document.imageSelected.length > 0 && document.currentImage[0] != document.imageSelected[0]) document.images[imageFind(document.imageSelected[0])].src = document.imageSelected[1];
		document.imageSelected = document.currentImage;
	}
}

function imageReturn(){
	if(document.currentImage[0] != document.imageSelected[0])
	{
		var imageIndex = imageFind(document.currentImage[0]);
		document.images[imageIndex].src = document.currentImage[1];
	}
}

function imageFind(imageToFind){
	for(n=0; n<document.images.length; n++){
		if(document.images[n].name==imageToFind){
			return(n);
			break;
		}
	}
}

function scrollIt(var_start, var_ziel){
	var neu_x = 0;
	while(var_ziel-var_start>0.1 || var_ziel-var_start<-0.1){
		neu_x = var_start - (var_start - var_ziel) / 300;
		window.scrollTo(neu_x,0);
		status=Math.round(var_start);
		var_start = neu_x;
	}
}

function openWindow(url,id,w,h,features){
	windowNew = window.open(url,id,"width="+w+",height="+h+","+features+",status=yes");
}

ns = (document.layers)? true:false;
ie = (document.all)? true:false;
layerpos = 0;

function scrollUp(action){
	if(action==0){
		document.up=false;
	}
	if(action==1){
		document.up=true;
	}
	
	if(document.up==true && layerpos > -170){
		if(ns){
			document.container.document.content.top=--layerpos;
		} else {
			document.getElementById("content").style.top=--layerpos;
		}
	window.setTimeout("scrollUp(2)",20);
	}
}

function scrollDown(action){
	if(action==0){
		document.down=false;
	}
	if(action==1){
		document.down=true;
	}
	
	if(document.down==true && layerpos < 0){
		if(ns){
			document.container.document.content.top=++layerpos;
		} else {
			document.getElementById("content").style.top=++layerpos;
		}
	window.setTimeout("scrollDown(2)",20);
	}
}

diaMax = 3;
diaPath = "gfx/dia/";
diaPrefix = "dia";
diaExtension = ".jpg";
diaSpeed = 1.5;
function myDia(diaShow)
{
	if(diaShow > diaMax)
	{
		diaShow = 1;
	}
	diaString = diaPath+diaPrefix+"_"+diaShow+diaExtension;
	document.dia.src = diaPath+diaPrefix+"_"+diaShow+diaExtension;
	diaShow++;
	window.setTimeout("myDia("+diaShow+")",diaSpeed*1000);
}

function confirmIt()
{
	if(confirmIt.arguments[1]) confirmMessage = confirmIt.arguments[1]; else confirmMessage = 'Sind Sie sicher?';
	Check = confirm(confirmMessage);
	if(Check == true) document.location.href = confirmIt.arguments[0];
}

//checkt inputfelder nach inhalt die im hidden feld "required" im html doc aufgezaehlt sind
function checkFields(formName){
	requiredArray = document.forms[formName].required.value.split(",");
	var functionBreak = 0;
	for(n=0; n<document.forms[formName].elements.length; n++){
			if(functionBreak==1){
				break;
			}
			for(i=0; i<requiredArray.length; i++){
				if(document.forms[formName].elements[n].type=="select-one"){
					if(requiredArray[i]==document.forms[formName].elements[n].name&&document.forms[formName].elements[n].selectedIndex==0){
						alert("Füllen Sie bitte alle Mussfelder aus");
						functionBreak=1;
					}
				} else {
					if(requiredArray[i]==document.forms[formName].elements[n].name&&document.forms[formName].elements[n].value==""){
						alert("Füllen Sie bitte alle Mussfelder aus");
						functionBreak=1;
					}
				}
			}
	}
	if(functionBreak==0){
		return true;
	} else {
		return false;
	}		
}

/*function confirmIt()
{
	Check = confirm("Sind Sie sicher?");
	if(Check == true) document.location.href = confirmIt.arguments[0];
}*/