document.mehrCount = 2;
function mehr() {
	if(document.mehrCount <= 5) {
		document.all.fieldNew.outerHTML = '<input type="file" name="file'+document.mehrCount+'"><br><span id="fieldNew"></span>';
		document.mehrCount ++;
	}
}

function logoFactory(imageName, imageURL){
	var imageIndex = imageFind(imageName);
	document.images[imageIndex].src = imageURL;
}

function imageOver(imageName, oldSrc, newSrc){
	var imageIndex = imageFind(imageName);
	document.images[imageIndex].src = newSrc;
	document.currentImage = new Array(imageName, oldSrc);
}

function imageReturn(){
	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 openWindow(url,id,w,h,features){
	windowNew = window.open(url,id,"width="+w+",height="+h+","+features+",status=yes");
}

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;
	}		
}