function chkPGForm(frmname){
	var frm = eval('document.'+frmname);
	var testval;
	var errormsg = unescape("Na, da hast Du irgendwas vergessen - schau doch noch mal nach!");
		
	if(frmname=="prittpg_form"){
		var fields = new Array("contributiontitle","realname","email");
		if(frm.uploadvideo){
			frm2 = eval('document.'+'videoupload');
			if(frm.uploadvideo.value=="" && frm.videourl.value=="" && frm.image.value==""){
				alert(unescape("Bitte%20lade%20einen%20Film%20hoch%2C%20gib%20eine%20Url%20f%FCr%20Deinen%20Film%20an%20oder%20w%E4hl%20ein%20Foto%20aus."));
				highlight(frm2.file_1);
				highlight(frm.videourl);
				highlight(frm.image);
				return false;
			}
			else{
				removeHighlight(frm.videourl);
				removeHighlight(frm.image);
				removeHighlight(frm2.file_1);
			}
		}
		else{
			if(frm.videourl.value=="" && frm.image.value==""){
				alert(unescape("Bitte%20gib%20eine%20URL%20f%FCr%20Deinen%20Film%20an%20oder%20w%E4hl%20ein%20Foto%20aus."));
				highlight(frm.videourl);
				highlight(frm.image);
				return false;
			}
			else{
				removeHighlight(frm.videourl);
				removeHighlight(frm.image);
			}
		}
		if(frm.videourl.value!="" && frm.image.value!=""){
			alert("Bitte entscheide Dich, ob Du ein Video oder ein Bild hochladen willst. Beides auf einmal geht nicht.")
			highlight(frm.videourl);
			highlight(frm.image);
			frm.videourl.value="";
			frm.image.value="";
			return false;
		}
		else{
			removeHighlight(frm.videourl);
			removeHighlight(frm.image);
		}
		
	}
	else if(frmname=="prittpg_schoolform"){
		var fields = new Array("contributiontitle","schoolname","classname","firstname","lastname","email");
		errormsg = unescape("Bitte%20pr%FCfen%20Sie%2C%20ob%20Sie%20alle%20Pflichtfelder%20ausgef%FCllt%20haben.");
		if(frm.uploadvideo){
			frm2 = eval('document.'+'videoupload');
			if(frm.uploadvideo.value=="" && frm.videourl.value==""){
				alert(errormsg);
				highlight(frm2.file_1);
				highlight(frm.videourl);
				return false;
			}
			else{
				removeHighlight(frm.videourl);
				removeHighlight(frm2.file_1);
			}
		}
	}
	else var fields = new Array("email","name","entry");



	if(frm.name){
		if(frm.name.value != ""){
			testval = frm.name.value;
			if(testval){
				var satz_array = testval.split(" ");
				testval = satz_array.join("");
				testval = testval.toUpperCase();
				if(testval == "COMMUNITYMANAGER"){
					alert("Bitte verwende einen anderen Namen");
					frm.name.value = "";
					highlight(frm.name)
					return false;
				}
			}
		}
	}

	for (var i = 0; i < fields.length; ++i){
		if(eval("frm."+fields[i])){
			if (eval("frm."+fields[i]).value == "") {
				alert(errormsg);
				highlight(eval("frm."+fields[i]));
				return false;
			}
			else{
				if(fields[i]=='email' && !frm.email.value.match(emailregexp)) {
					alert(errormsg);
					highlight(eval("frm."+fields[i]));
					return false;
				}
				else removeHighlight(eval("frm."+fields[i]));
			}
		}
	}
	
	if(frm.termsofuse){
		if(!frm.termsofuse.checked) {
			alert(errormsg);
			document.getElementById('divtermsofuse').style.border = '1px solid #D90204';
			return false;
		}else document.getElementById('divtermsofuse').style.border = 'none';
	}

	if(frm.dataprotection){
		if(!frm.dataprotection.checked) {
			alert(errormsg);
			document.getElementById('divdataprotect').style.border = '1px solid #D90204';
			return false;
		}else document.getElementById('divdataprotect').style.border = 'none';
	}
	if(document.getElementById("message") && frm.image && frm.image.value!=""){
		if(document.getElementById("error")){
			if(document.getElementById("error").innerHTML != ""){
				document.getElementById("message").style.top = '2100px';
			}
		}
		document.getElementById("message").style.visibility = 'visible';
	}
	return true;
}

function checkTextLength(field){
	var maxl=255;
	textinhalt=field.value;
	if (textinhalt.length >= maxl){
		field.value=textinhalt.substring(0,maxl-1);
		field.blur();
	}
}

function removeHighlight(el){
	if(el){
	el.style.background = '#ffffff';
	el.style.color = '#000000';
	if(isIE) el.style.border = '1px solid #7F9DB9';
	if(document.getElementById('p'+el.name))
	document.getElementById('p'+el.name).style.color = '#666666';
	}
}

function highlight(el){
	el.focus();
	el.style.background = '#D90204';
	el.style.color = '#ffffff';
	if(document.getElementById('p'+el.name))
	document.getElementById('p'+el.name).style.color = '#D90204';
}

function deactivate(frmname){
	var frm = eval('document.'+frmname);
	if(frmname=="prittpg_form"){
		frm.videourl.value = "";
		frm.image.value = "";
		frm.videourl.disabled = true;
		frm.image.disabled = true;
	}
	if(frmname=="prittpg_schoolform"){
		frm.videourl.value = "";
		frm.videourl.disabled = true;
	}
}
 


