function bild_zeigen(resource) {
  var F = window.open(resource,'Einzelbild','top=0,left=0,width=800,height=600,dependent=yes,location=no,menubar=no,resizable=yes,status=no,toolbar=no');
  F.moveTo(screen.width/2 - 400, screen.height/2 - 300);
  F.focus();
}

function ap_assistenz_datecheck(){


	//if (document.au_bd_daten.bd_bis_tag.value < document.au_bd_daten.bd_von_tag.value)
	//{
	//	if (document.au_bd_daten.bd_bis_monat.value <= document.au_bd_daten.bd_von_monat.value)
	//	{
	//		if (document.au_bd_daten.bd_bis_monat.value <= 11)
	//		{
	//		    document.au_bd_daten.bd_bis_monat.value = document.au_bd_daten.bd_von_monat.value + 1;
	//		}
	//		else {
	//			document.au_bd_daten.bd_bis_jahr.value = document.au_bd_daten.bd_von_jahr.value + 1;
	//		}
	//	}
	//}

	//if (document.au_bd_daten.bd_bis_monat.value < document.au_bd_daten.bd_von_monat.value)
	//{
	//	if (document.au_bd_daten.bd_bis_jahr.value <= document.au_bd_daten.bd_von_jahr.value)
	//	{
	//	    document.au_bd_daten.bd_bis_jahr.value = document.au_bd_daten.bd_von_jahr.value + 1;
	//	}
	//}

	

	if (document.au_bd_daten.bd_bis_jahr.value < document.au_bd_daten.bd_von_jahr.value) 
		document.au_bd_daten.bd_bis_jahr.value = document.au_bd_daten.bd_von_jahr.value;
		
	if (document.au_bd_daten.bd_bis_jahr.value == document.au_bd_daten.bd_von_jahr.value) 
		if (document.au_bd_daten.bd_bis_monat.value < document.au_bd_daten.bd_von_monat.value) 
			document.au_bd_daten.bd_bis_monat.value = document.au_bd_daten.bd_von_monat.value;
			
	if (document.au_bd_daten.bd_bis_jahr.value == document.au_bd_daten.bd_von_jahr.value) 
		if (document.au_bd_daten.bd_bis_monat.value == document.au_bd_daten.bd_von_monat.value) 
			if (document.au_bd_daten.bd_bis_tag.value < document.au_bd_daten.bd_von_tag.value) 
				document.au_bd_daten.bd_bis_tag.value = document.au_bd_daten.bd_von_tag.value;
				
	//alert(document.au_bd_daten.bd_bis_jahr.value);
}

function oa_assistenz(){
	if (document.p_daten.abg_studium.checked==true || document.p_daten.bv_mitglied.checked==true || document.p_daten.bbk_mitglied.checked==true || document.p_daten.einzel_ausstellung.checked==true){
		document.p_daten.b_pk_checkbox.checked=true;
		document.p_daten.b_pk.value=1;
	}
	else{
		document.p_daten.b_pk_checkbox.checked=false;
		document.p_daten.b_pk.value="0";
	}
}
	
function add_days(days, datum) {
	var milPerDay = 24 * 60 * 60 * 1000;
	if (datum == null || datum == ''){
		datum = new Date();
	}
	else{
		part = datum.split(".");
		datum = new Date(part[2], part[1]-1, part[0]);
	}
	mil = milPerDay * days;
	var newdate = new Date((Date.parse(datum) + mil));
	return (((newdate.getDate())<10?"0":"") +newdate.getDate()
            + "." + ((newdate.getMonth()+1)<10?"0":"") +(newdate.getMonth()+1)
            + "." + newdate.getFullYear());
}

function check_date(von, bis) {
	var milPerDay = 24 * 60 * 60 * 1000;
	if (von == null || von == ''){
		von = new Date();
	}
	else{
		part = von.split(".");
		von = new Date(part[2], part[1]-1, part[0]);
	}
	if (bis == null || bis == ''){
		bis = new Date();
	}
	else{
		part = bis.split(".");
		bis = new Date(part[2], part[1]-1, part[0]);
	}
    if (bis < von){
        bis = von;
    }
    return (((bis.getDate())<10?"0":"") +bis.getDate()
            + "." + ((bis.getMonth()+1)<10?"0":"") +(bis.getMonth()+1)
            + "." + bis.getFullYear());;
}

function get_screenWidth(){
	var screenW = 640;
	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
	}
	else if (navigator.appName == "Netscape"
	    && parseInt(navigator.appVersion)==3
	    && navigator.javaEnabled()) {
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
	}
	document.write(screenW);
}

function header_link_highlight(ElemName){
	document.getElementById(ElemName).style.backgroundColor="#dd0000";	
}

function header_alter(ElemName, ElemClass){
	if (ElemClass == "header_highlight"){
		document.getElementById(ElemName).style.backgroundColor="#cccccc";			
		document.getElementById(ElemName).style.font="10pt Arial, Helvetica";
		document.getElementById(ElemName).style.fontWeight="bold";
		document.getElementById(ElemName).style.color="black";							
	}
	if (ElemClass == "header_aktiv_ie" || ElemClass == "header_aktiv_ff"){
		document.getElementById(ElemName).style.backgroundColor="#cccccc";		
		document.getElementById(ElemName).style.font="10pt Arial, Helvetica";
		document.getElementById(ElemName).style.fontWeight="bold";
		document.getElementById(ElemName).style.color="black"; /*"#505050";*/
		if(ElemClass == "header_aktiv_ie") document.getElementById(ElemName).style.border="1px groove #ffffff";
		if(ElemClass == "header_aktiv_ff") document.getElementById(ElemName).style.border="2px groove #ffffff";
		
	}
	if (ElemClass == "header_inaktiv_ie" || ElemClass == "header_inaktiv_ff"){
		document.getElementById(ElemName).style.backgroundColor="#eeeeee";	
		document.getElementById(ElemName).style.font="10pt Arial, Helvetica";
		document.getElementById(ElemName).style.fontWeight="bold";
		document.getElementById(ElemName).style.color="#505050";
		if(ElemClass == "header_aktiv_ie") document.getElementById(ElemName).style.border="1px solid #eeeeee";
		if(ElemClass == "header_aktiv_ff") document.getElementById(ElemName).style.border="2px solid #eeeeee";
	}
}

function get_screenHeight(){
	var screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
		screenH = screen.height;
	}
	else if (navigator.appName == "Netscape"
	    && parseInt(navigator.appVersion)==3
	    && navigator.javaEnabled()) {
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
		var jScreenSize = jToolkit.getScreenSize();
		screenH = jScreenSize.height;
	}
	return screenH;
}

function PopupPic(sPicURL, title,w,h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0'
	window.open("picturedetail.html?"+sPicURL+"&"+title+"", "", winprops)
}

function printit(){
    if (NS) {
        window.print() ;
    } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        	WebBrowser1.ExecWB(6,0);

    }
}

function showWaitDlg(){
// nur wenn Ausgabe NICHT Datei (letzter Eintrag in dem Select)
    try
    {
//        if(document.getElementById("outputtarget").selectedIndex != document.getElementById("outputtarget").length-1)
            document.getElementById("wait").style.visibility = "visible";
    }
    catch(exception){;}
}

function fx_disable()
{
/*    try
    {
    //				if(document.getElementById("outputtarget").selectedIndex != document.getElementById("outputtarget").length-1)
    //				{
    //					document.getElementById("upload_btn").disabled=true;
    	//alert("Disabled = "+document.getElementById("da_btn").disabled);
    	//document.getElementById("upload").innerHTML='<input type="hidden" name="b_next" value="any"/>';
    	//document.getElementById("fx_form").submit();
    //				}
    }
    catch(exception){;}
*/    return true;
}

function fx_enable()
{
    if (document.getElementById("upload_btn"))
        document.getElementById("upload_btn").disabled=false;
    if (document.getElementById("wait"))
        document.getElementById("wait").style.visibility="hidden";
        //alert("Disabled = "+document.getElementById("da_btn").disabled);
        return true;
}

function get_imagesize(image)
{
    var oas = new ActiveXObject("Scripting.FileSystemObject");
    var d = image;
    var e = oas.getFile(d);
    var f = e.size;
    alert(e.height);
    return f;
}

function check_image(image, maxsize)
{
    showWaitDlg();fx_disable();
    return true;
/*
    if (get_imagesize(image) > maxsize){
        alert('Datei ist zu Groß! Max. ' + maxsize/1024 + 'kb');
        return false;
    }
    else{
        showWaitDlg();fx_disable();
        return true;
    }
*/
}

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
    if (ns6||ie){
        if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
        if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
        tipobj.innerHTML=thetext
        enabletip=true
        return false
    }
}

function positiontip(e){
    if (enabletip){
        var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
        var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
        //Find out how close the mouse is to the corner of the window
        var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
        var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

        var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

        //if the horizontal distance isn't enough to accomodate the width of the context menu
        if (rightedge<tipobj.offsetWidth)
        //move the horizontal position of the menu to the left by it's width
            tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
        else if (curX<leftedge)
            tipobj.style.left="5px"
        else
        //position the horizontal position of the menu where the mouse is positioned
            tipobj.style.left=curX+offsetxpoint+"px"

        //same concept with the vertical position
        if (bottomedge<tipobj.offsetHeight)
            tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
        else
            tipobj.style.top=curY+offsetypoint+"px"
        tipobj.style.visibility="visible"
    }
}

function hideddrivetip(){
    if (ns6||ie){
        enabletip=false
        tipobj.style.visibility="hidden"
        tipobj.style.left="-1000px"
        tipobj.style.backgroundColor=''
        tipobj.style.width=''
    }
}

var maxSize = 10;
  // width to resize large images to
var maxWidth=1280;
  // height to resize large images to
var maxHeight=1024;
  // valid file types
var fileTypes=["gif","png","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="";

function check_bild(bildsrc){
  var source=bildsrc.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  if (i>=fileTypes.length) {
    alert("Datei \""+source+"\" hat ein ungültiges Format\nZulässige Bildformate: \n\n"+fileTypes.join(", "));
    return false;
  }
  return true;

  if (i<fileTypes.length) globalPic.src=source;
  else {
    globalPic.src=defaultPic;
    alert("Datei \""+source+"\" hat ein ungültiges Format\nZulässige Bildformate: \n\n"+fileTypes.join(", "));
    return false;
  }
/*  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x > maxWidth || y > maxHeight) {
    globalPic.src=defaultPic;
    alert("Maximale Dateigröße: \n\n"+maxWidth+"x"+maxHeight);
    return false;
  }
*/
  return true;
}

var bDirty = false;
var bS3WorkAround = false;
function setDirty(bState){
    bDirty = bState;
}
function isDirty(){
    return bDirty;
}

function checkState(oButton, oInputS, strInputSValue){
    var ret = false;
    if (bDirty){
        ret=window.confirm("Daten wurden geändert. Möchten Sie die Daten"
            +" speichern, bevor Sie weitermachen?");
    }
    
    if (document.getElementById("bb_copy_text") != null)
			if (checkCopyright() == false)
				return false;
			        
    if (ret || bS3WorkAround){
	    //window.alert("force submit");
      oInputS.value = strInputSValue;
      oButton.click();        
      return false;
    }            
    return !ret;
}

function setFilter(sFilter){
	window.location.href="./feuilleton.php?dn=1014&filter="+sFilter;	
}

function StrListOnMouseOver(oStrList){	
	document.getElementById("ofa_list").options[0].style.color = "#000000";
		
	oStrList.style.color = "#0000ff";	
}

function StrListOnMouseOut(oStrList){
	oStrList.style.color = "#000000";	
}

function StrListMouseMove(oStrList){	
	for (var i=0; i<oStrList.length; i++)
		if (oStrList.options[i].style.color == "#0000ff") 
			oStrList.options[i].style.color="#000000";
	
	var optHeight = oStrList.options[0].style.height;
	optHeight = optHeight.substr(0, optHeight.length-2);

	i = Math.floor(window.event.offsetY / optHeight);
	oStrList.options[i].style.color="#0000ff";	
}

function setCookie(strName, strValue){
	var cookieTTL = new Date();
	var expiryDate = cookieTTL.getTime() + (365 * 24 * 60 * 60 * 1000);
	cookieTTL.setTime(expiryDate);
	
	document.cookie = strName+"="+strValue+"; expires="+cookieTTL.toGMTString();
}

function PageReload(){		
	if (CheckValidSearch()){
		document.getElementById("refreshPlz").value     = document.getElementById("suchen_plz").value;
		document.getElementById("refreshUmkreis").value = document.getElementById("suchen_umkreis").value;
		document.getElementById("refreshLand").value    = document.getElementById("suchen_land").value;

		document.forms["refresh_data"].submit();
	}
}

function ClickRegionalSwitch(oHref){
	if (CheckValidSearch() == false){
		alert("Regionale Anzeige nur bei Angabe einer vollständiger PLZ mit Umkreis möglich.");	
		return false;
	}
	else
		return true;
}

function CheckValidSearch(){
	var plz  = document.getElementById("suchen_plz");
	var umk  = document.getElementById("suchen_umkreis");
	var land = document.getElementById("suchen_land");
	var isValidSearch = false;	
	
	if  (land.options[land.selectedIndex].value == 0 && plz.value.length == 5 && umk.options[umk.selectedIndex].value != "" && umk.options[umk.selectedIndex].value != "--")
		isValidSearch = true;	
	if  (land.options[land.selectedIndex].value == 1 && plz.value.length == 4 && umk.options[umk.selectedIndex].value != "" && umk.options[umk.selectedIndex].value != "--")
		isValidSearch = true;	
	if  (land.options[land.selectedIndex].value == 2 && plz.value.length == 4 && umk.options[umk.selectedIndex].value != "" && umk.options[umk.selectedIndex].value != "--")
		isValidSearch = true;	
		
	return isValidSearch;	
}

function searchArray(aArray, sValue){
	var result = -1;
	
	for (var i=0; i<aArray.length; i++)
		if (aArray[i] == sValue)
			result = i;
	
	return result;
}

var bildEntfernen = false;
var bildSpeichern = false;
function checkCopyright(){
	aIgnoredFormParams = new Array("flag", "au_upload_bild", "s", "bb_nummer", "au_bild_daten_speichern", "au_delnr", "bb_werk_check", "bb_kat1", "bb_copy_text", "au_bild_daten_speichern_go");
	var bild = document.getElementById("bild_preview");
		
	//Bild hochgeladen, aber kein Copyright eingegeben?		
	if (bild.src.search(/dummy.+/) == -1 && bildEntfernen == false && bildSpeichern == false){	
		if (document.getElementById("bb_copy_text").value == "" || document.getElementById("bb_copy_text").value == "Bitte eintragen"){
			alert("Copyright-Angabe erforderlich!");
			return false;
		}
	}	
	
	//Bilddaten eingegeben, aber kein Bild hochgeladen?
	if (bild.src.search(/dummy.+/) != -1 && bildEntfernen == false && bildSpeichern == false)
		for(var i=0; i<document.forms["bild"].elements.length; i++)
			if (searchArray(aIgnoredFormParams, document.forms["bild"].elements[i].name) == -1){
				if (document.forms["bild"].elements[i].value != "")	
					return confirm("Es wurde kein Bild hochgeladen. Wenn Sie fortfahren, gehen die eingegebenen Daten verloren.");
			}
	
	return true;
}

function clearInput(){
	return true;
	
	var plz  = document.getElementById("suchen_plz");
	var umk  = document.getElementById("suchen_umkreis");
	
	if (umk.options[umk.selectedIndex].value == "" || plz.value == ""){
		document.getElementById("suchen_umkreis").value = "";
		document.getElementById("suchen_plz").value = "";
	}
	else
		document.getElementById("suchen_main_ap").value = "";
	
	return true;
}

function AssistentCheckKuenstlernameDoubles(){
	var strName		  	=	document.getElementById("s5_new_kuenstler_name").value;
	var strVorname  	=	document.getElementById("s5_new_kuenstler_vorname").value;
	var strFullname   = strName+', '+strVorname;
	var aktuelleListe = document.getElementById("s5_select2");
	
	for (var i=0; i<aktuelleListe.options.length;i++){
		if (aktuelleListe.options[i].text.toLowerCase() == strFullname.toLowerCase()){
			alert("Ein Künstler dieses Namens wurde der Ausstellung bereits hinzugefügt.");
			return false;
		}
	}
	
	return true;
}

function getBrowserType(){	
	if (document.getElementById("isExternalReference").value == "true"){		
		if (navigator.userAgent.search(/Safari.+/) != -1 || navigator.userAgent.search(/Chrome.+/) != -1 || navigator.userAgent.search(/Konqueror.+/) != -1)
			alert('Diese Seite wurde für Microsoft IE 6.0 oder höher, bzw. Firefox 3.0 oder höher entwickelt. Bitte verwenden Sie einen dieser Browser, um eine fehlerhafte Anzeige der Seite zu vermeiden.');		
	}
	return true;
}

function isDatum(strDatum){
	//einziges akzeptiertes Format: dd.mm.yyyy
	
	var i = 0;
	arrDatum = strDatum.split('.');
	if (arrDatum.length != 3)
		return false;
	
	tag 	= arrDatum[0];
	monat = arrDatum[1];
	jahr 	= arrDatum[2];	
	bIsValidTag 	= false;
	bIsValidMonat = false;
	bIsValidJahr	= false;
	
	//TAG pruefen
	for (i=1; i<32; i++){		
		if (i<10){
			//fuehrende null anfuegen beim test!
			if (String(tag) == String(0)+String(i) || String(tag) == String(i))
				bIsValidTag = true;
		}
		else{
			if (String(tag) == String(i))
				bIsValidTag = true;
		}
	}
	//MONAT pruefen
	for (i=1; i<13; i++){
		if (i<10){
			//fuehrende null anfuegen beim test!
			if (String(monat)== String(0)+String(i) || String(monat) == String(i))
				bIsValidMonat = true;
		}
		else{
			if (String(monat) == String(i))
				bIsValidMonat = true;
		}
	}
	//JAHR pruefen
	for (i=1970; i<2050; i++){
		if (String(jahr) == String(i) || String(jahr) == String(i-2000))
			bIsValidJahr = true;
	}
		
	if (bIsValidTag && bIsValidMonat && bIsValidJahr)
		return true;
	else
		return false;		
}

////////////////////////
//Expressservice-BildUpload
////////////////////////

function FormSubmit(strAction){
	document.getElementById('action').value = strAction;
	
	if (strAction == "SaveBild"){
		if (!checkCopyright())
			return false;
		document.getElementById('CloseOnSave').value = 'true';		
						
		//Kein Bild geladen...
		if (bild.src.search(/dummy.+/) != -1)
			document.getElementById("noPicFile").value = 'true';
	}					
	document.forms['bild'].submit();	
}

function LoadBild(BildNummer){
	if (BildNummer == "prev")
		BildNummer = document.getElementById('current_bildnummer').value-1;		
	if (BildNummer == "next")
		BildNummer = document.getElementById('current_bildnummer').value-(-1);			
		
	if (BildNummer != "1" && BildNummer != "2" && BildNummer != "3")
		if (BildNummer > 3)	
			BildNummer = 3;
		else
			BildNummer = 1;
		
	document.getElementById('current_bildnummer').value = BildNummer;
	if (!checkCopyright())
		return false;
	else
		document.forms['bild'].submit();	
}

function BildBearbeitenClick(CallingObj, aid, code, na_nr, bild_nr){			
	arrTitel 			= document.forms['MainForm'].elements['na_titel[]'];
	arrUnterTitel = document.forms['MainForm'].elements['na_untertitel[]'];
	arrDatumVon 	= document.forms['MainForm'].elements['na_von[]'];
	arrDatumBis 	= document.forms['MainForm'].elements['na_bis[]'];
	arrId					= document.forms['MainForm'].elements['na_id[]'];
		
	if (na_nr == -1)
		document.getElementById('aoid').value = aid;
	else for (i=0; i<arrTitel.length; i++){
		bNichtLeer = false;
		if (arrTitel[i].value != "") 			bNichtLeer = true;
		if (arrUnterTitel[i].value != "") bNichtLeer = true;
		if (arrDatumVon[i].value != "") 	bNichtLeer = true;
		if (arrDatumBis[i].value != "") 	bNichtLeer = true;
		if ((bNichtLeer || i == (na_nr-1)) && (document.getElementById("na_dauerausstellung"+String(na_nr)).checked == false)){
			if (arrTitel[i].value == ""){
				alert("Unvollständige Daten für Ausstellung #"+String(i+1)+": Titel fehlt.");
				return false;
			}
			if (!isDatum(arrDatumVon[i].value) && arrId[i].value == ""){
				alert("Unvollständige Daten für Ausstellung #"+String(i+1)+": Startdatum fehlt.");
				return false;
			}
			if (!isDatum(arrDatumBis[i].value) && arrDatumBis[i].value != "fortlfd."){
				alert("Unvollständige Daten für Ausstellung #"+String(i+1)+": Enddatum fehlt.");
				return false;
			}
		}	
	}
	
	document.getElementById('GotoStep1').value=true;
	document.getElementById('na_nr_triggered').value=na_nr;
	document.getElementById('BildNummer').value=bild_nr;	

	document.forms.MainForm.submit();	
}
	
function AbbrechenKlick(code, na_nr){
	bildSpeichern = false;
	bildEntfernen = false;
	
	if (!checkCopyright())
		return false;
	else
		window.location.href='./expressservice.php?code='+code+'#a'+na_nr;
}

function ShowColor(targetObjName){
	red = document.forms[0].elements.rgb_red.value;
	green = document.forms[0].elements.rgb_green.value;
	blue = document.forms[0].elements.rgb_blue.value;

	Obj = document.getElementById(targetObjName);
	Obj.style.backgroundColor = 'rgb('+String(red)+', '+String(green)+', '+String(blue)+')';
	
	return true;
}

function Ausstellungsortbd2BilderlisteClick(bildNum){
	document.getElementById("edit_pic").value = bildNum;
	document.bd_daten.submit();
}
	
function AssistenzApBilderlisteClick(bildNum){
	document.getElementById("edit_pic").value = bildNum;
	document.au_bd_daten.submit();
}

function AssistenzBilderlisteClick(bildNum){
	document.getElementById("edit_pic").value = bildNum;
	document.p_daten.submit();
}

function ofaAnmeldungBildClick(bildNum){
	if (document.getElementById('vorname').readOnly == true){
		document.getElementById("edit_pic").value = bildNum;
		document.mainform.submit();		
	}
	else{
		alert('Bitte speichern Sie zunächst die Anmeldungsdaten!');
		return false;
	}
}

function assistenzBasisdatenSpeichernClick(){
	document.p_daten.action = document.p_daten.action+"#btm";
	document.p_daten.submit();
}

function beteiligungBildClick(bildNum){
	if (document.getElementById('childid').value != "" || beteiligungOnSubmit()){
		document.getElementById("edit_pic").value = bildNum;
		document.mainform.submit();	
	}
	else
		return false;
}

function beteiligungAuswahlClick(letter){
	list = document.getElementById('auswahl');
	listLength = list.options.length;		
	for (i=0; i<listLength; i++){		
		if (letter.toLowerCase() == list.options[i].text.charAt(0).toLowerCase()){
			list.options.selectedIndex = i;
			return true;
		}
	}
}

function beteiligungOnSubmit(){
	if (document.getElementById("action").value == "Abbrechen")
		return true;
	
	list = document.getElementById('auswahl');
	if (!(list.options.selectedIndex >= 0)){
		alert('Bitte wählen Sie einen Datensatz aus!');
		return false;
	}
	return true;
}

function beteiligungFormSubmit(strAction){
	document.getElementById("action").value = strAction;	
	document.mainform.submit();
}


function gruppenanmeldungDivOpenClose(divId){
	if (document.getElementById(divId).style.display == "none"){
		document.getElementById("icon_"+divId).src = "/image/p_prev_g.gif";	
		document.getElementById(divId).style.display = "block";
	}
	else{
		document.getElementById("icon_"+divId).src = "/image/p_next.gif";
		document.getElementById(divId).style.display = "none";
	}
}

function einzelanmeldungSubmit(){
	if (confirm('Freischalt-Link wird versandt an: '+String(document.getElementById('email').value)+'\nIst die E-Mail-Adresse korrekt ?'))
		return true;
	else
		return false;	
}

function gruppenanmeldungSubmit(){
	//pruefen Hauptteilnehmerdaten
	arrRequired = new Array("nachname", "vorname", "email", "plz_atelier", "ort_atelier", "strasse_atelier", 
		"hnummer_atelier", "stadtteil", "name_atelier");
	
	//pruefen Hauptteilnehmer-Texteingabefelder
	for (countRequiredInput=0; countRequiredInput<arrRequired.length; countRequiredInput++){
		if (navigator.userAgent.search(/MSIE.+/) != -1)
			document.forms['mainform'].elements[arrRequired[countRequiredInput]].style.backgroundColor = "";//CG: original"inherit"
		else
			document.forms['mainform'].elements[arrRequired[countRequiredInput]].style.backgroundColor = "";
			
		if (document.forms['mainform'].elements[arrRequired[countRequiredInput]].value == ""){
			document.forms['mainform'].elements[arrRequired[countRequiredInput]].style.backgroundColor = "#ee9090";
			document.forms['mainform'].elements[arrRequired[countRequiredInput]].focus();
			alert ("Ihre Angaben sind unvollständig!");
			return false;
		}
	}
	//pruefen Terminwahl
	arrTermin = document.forms['mainform'].elements['termin[]'];		
	if (arrTermin[0].checked == false && arrTermin[1].checked == false && arrTermin[2].checked == false){
		arrTermin[0].focus();
					
		alert ("Ihre Angaben sind unvollständig!");
			return false;
	}
		
	
	//pruefen Oeffnungszeitangaben
	arrOzeiten = new Array(3);
	for (i=0; i<arrOzeiten.length; i++)
		arrOzeiten[i] = new Array(2);	
	
	arrOzeiten[0][0] = document.forms['mainform'].elements['freitag_von'];
	arrOzeiten[0][1] = document.forms['mainform'].elements['freitag_bis'];
	arrOzeiten[1][0] = document.forms['mainform'].elements['samstag_von'];
	arrOzeiten[1][1] = document.forms['mainform'].elements['samstag_bis'];
	arrOzeiten[2][0] = document.forms['mainform'].elements['sonntag_von'];
	arrOzeiten[2][1] = document.forms['mainform'].elements['sonntag_bis'];

	leereZeiten = 0;
	for (i=0; i<arrOzeiten.length; i++){
		if (navigator.userAgent.search(/MSIE.+/) != -1){
			arrOzeiten[i][0].style.backgroundColor = "";//CG: original"inherit"
			arrOzeiten[i][1].style.backgroundColor = "";//CG: original"inherit"
		}
		else{
			arrOzeiten[i][0].style.backgroundColor = "";
			arrOzeiten[i][1].style.backgroundColor = "";
		}
		
		if (arrOzeiten[i][0].value != "" ^ arrOzeiten[i][1].value != ""){
			arrOzeiten[i][0].style.backgroundColor = "#ee9090";
			arrOzeiten[i][1].style.backgroundColor = "#ee9090";
			arrOzeiten[i][0].focus();
			alert('Angaben zu Öffnungszeiten sind unvollständig!');
			return false;
		}
		
		if (arrOzeiten[i][0].value == "" && arrOzeiten[i][1].value == "")
			leereZeiten++;
	}
		
	if (leereZeiten == 3){
		alert("Angaben zu Öffnungszeiten fehlen!");
		arrOzeiten[0][0].focus();
		for (i=0; i<arrOzeiten.length; i++){
			arrOzeiten[i][0].style.backgroundColor = "#ee9090";
			arrOzeiten[i][1].style.backgroundColor = "#ee9090";
		}
		return false;
	}
	
	//pruefen der Daten zusaetzlicher Teilnehmer
	arrNachname 	= document.forms['mainform'].elements['nachname_multi[]'];
	arrVorname 		= document.forms['mainform'].elements['vorname_multi[]'];
	arrTechnik 		= document.forms['mainform'].elements['technik_multi[]'];
	arrZusatzinfo	= document.forms['mainform'].elements['zusatzinfo_multi[]'];
	arrLink 			= document.forms['mainform'].elements['link_multi[]'];
	
	for (teilnehmerCount=0; teilnehmerCount<50; teilnehmerCount++){
		if (navigator.userAgent.search(/MSIE.+/) != -1){
			arrVorname[teilnehmerCount].style.backgroundColor = "";//CG: original"inherit"
			arrNachname[teilnehmerCount].style.backgroundColor = "";//CG: original"inherit"
		}
		else{
			arrVorname[teilnehmerCount].style.backgroundColor = "";
			arrNachname[teilnehmerCount].style.backgroundColor = "";
		}
		
		if (arrVorname[teilnehmerCount].value != "" && arrNachname[teilnehmerCount].value == ""){
			divId = "div"+String(Math.floor((teilnehmerCount+1)/5)+1);			
			document.getElementById("icon_"+divId).src = "/image/p_prev_g.gif";	
			document.getElementById(divId).style.display = "block";
			
			arrNachname[teilnehmerCount].style.backgroundColor = "#ee9090";	
			arrNachname[teilnehmerCount].focus();
			alert("Nachname fehlt für Teilnehmer #"+String(teilnehmerCount+1));
			return false;
		}
		if (arrNachname[teilnehmerCount].value != "" && arrVorname[teilnehmerCount].value == ""){
			divId = "div"+String(Math.floor((teilnehmerCount+1)/5)+1);
			document.getElementById("icon_"+divId).src = "/image/p_prev_g.gif";	
			document.getElementById(divId).style.display = "block";
			
			arrVorname[teilnehmerCount].style.backgroundColor = "#ee9090";
			arrVorname[teilnehmerCount].focus();
			alert("Vorname fehlt für Teilnehmer #"+String(teilnehmerCount+1));
			return false;
		}
	}

	if (confirm('Freischalt-Link wird versandt an: '+String(document.getElementById('email').value)+'\nAbsenden?'))
		document.mainform.submit();
}


function au_bd_datenOnSubmit(){
	if (document.au_bd_daten.bd_titel.value == ''){
		alert("Bitte geben Sie einen Namen für die Ausstellung an.");	
		return false;		
	}
	
	total_von = (document.au_bd_daten.bd_von_jahr.value * 12) + document.au_bd_daten.bd_von_monat.value;
	total_bis = (document.au_bd_daten.bd_bis_jahr.value * 12) + document.au_bd_daten.bd_bis_monat.value;

	if ((total_bis - total_von) > 10)
		if (!confirm("Sind Sie sicher, dass die Ausstellungsdauer mehr als 10 Monate beträgt?"))
			return false;
	
			
	document.au_bd_daten.action =	document.au_bd_daten.action+'#b1';		
	return true;
}

/*
function InteressentenListeClick(CallerObj){
	for (i=0; i<CallerObj.attributes.length; i++)
		alert(CallerObj.attributes[10].value);
	
	var result = prompt("Neuer Wert:", CallerObj.title);	
	CallerObj.text = result;
	return true;	
}
*/