var standardImage = "marcus.jpg";


function changeBgColor( eventM, color, row , col ){
		row = row.slice(1, row.indexOf("_"));
		test = "";
	if(eventM == "over"){
		for(n=1; n <= col ;n++){
			document.getElementById("r" + row + "_c" + n).style.backgroundColor = "#" + color;
		}
	}else{
		for(n=1; n <= col ;n++){
			document.getElementById("r" + row + "_c" + n).style.backgroundColor = "transparent";
		}		
	}
}

function changeImage(eventM, nextImage){

	try{
		window.clearTimeout(change);
	}catch(e){

	}

	document.images["changePic"].src = "upload/images/" + nextImage;
	change = window.setTimeout("document.images['changePic'].src = 'upload/images/' + standardImage", 5000);

}

/****************************
	Formularüberprüfung
****************************/

function checkNumericField( field, caption, checkLength, minValue, maxValue ){
	if( checkLength ){
		checkFieldLength( field, caption, minValue, maxValue );
	}
	if( isNaN(document.getElementById(field).value) ){
		meldung += "Das Feld " + caption + " enthält keinen Zahlenwert.\n"
		ok = false;
	}
}
function checkTextField( field, caption, checkLength ){
	if( checkLength ){
		checkFieldLength( field, caption );
	}
}
function checkEmailField( field, caption, checkLength ){
	if( checkLength ){
		checkFieldLength( field, caption );
	}
	eMail = document.getElementById(field).value
	if( eMail != "" && (eMail.indexOf("@") == -1 ||
		eMail.slice(eMail.indexOf("@"), eMail.length).indexOf(".") == -1 ||
		eMail.slice(eMail.lastIndexOf(".") + 1 , eMail.length).length < 2 )
		){
		meldung += "\"" + eMail + "\" ist keine gültige E-Mail-Adresse.\n"
		ok = false;
	}
}

function checkDropdownBox( field, caption ){
	if( document.getElementById(field).selectedIndex == 0 ){
		meldung += "Das Feld " + caption + " ist ein Pflichtfeld.\n"
		ok = false;
	}
}
function checkCheckbox( field, caption ){
	if( !document.getElementById(field).checked ){
		meldung += caption + " \n"
		ok = false;
	}
}
function checkTextarea( field, caption, checkLength ){
	if( document.getElementById(field).value == ""){
		meldung += caption;
		ok = false;
	}
}
function checkDateField( field, caption, checkLength ){
	if( checkLength ){
		checkFieldLength( field, caption );
	}
	dateField = document.getElementById(field).value
	if( dateField != "" && ( dateField.length < 10 || dateField.split(".").length <= 2 )){
		meldung += caption + " ist kein gültiges Datum (TT.MM.JJJJ) \n"
	}
}
function checkFieldLength( field, caption, minValue, maxValue ){
	if( document.getElementById(field).value == ""){
		meldung += "Das Feld " + caption + " ist ein Pflichtfeld.\n"
		ok = false;
	}
	if( document.getElementById(field).value != "" && minValue != "" ){
		if( (document.getElementById(field).value).length < minValue || (document.getElementById(field).value).length > maxValue){
			meldung += "Die " + caption + " darf nur " + minValue + " bis " + maxValue + " Zahlen enthalten!\n";
			ok = false;
		}
	}
}
function openEnlarge( what ){
	window.open("cmsadmin/includes/enlarge.php?image=" + what,"enlarge","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=220")
}