function checkfestival_1 ()
   {
document.suche_1.ort.disabled = false;
document.suche_1.ort.options[0].text = '- alle Orte -';
    }

function checkfestival_2 ()
   {
document.suche_1.ort.selectedIndex = 0;
document.suche_1.ort.options[0].text = 'inaktiv';
document.suche_1.ort.disabled = true;
    }

function fensterergebnis(theUrl){
	var winergebnis;
	winergebnis=window.open(theUrl,"","width=700,height=500,innerwidth=700,innerheight=500,resizable=no,left=150,top=150,screenX=150,screenY=150,scrollbars");
	winergebnis.focus()
}

function setIndex( indexref ){
	top.location.href = indexref; 			
}

function DatumAusUrl( str ){
	retDate = "";
	if ( str != "" ){
		tmpar = str.split("=");
		retDate = tmpar[1];
		}//if
	return retDate;
}	

function openPopUp (url)
   {
popup =window.open (url,"popup","width=860,height=480,scrollbars=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
popup.focus ();
   }

function openKarte (url)
   {
popup =window.open (url,"karte","width=572,height=345,scrollbars=no,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
popup.focus ();
   }

function openKarteRVR ()
   {
popup =window.open ("/bilder/landkarteruhrgebiet.gif","karte","width=520,height=320,scrollbars=no,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0");
popup.focus ();
   }

function resetPopup(item)
  {
      if(item.name =='datum')
      {
          document.suche_1.jahr.options[0].selected  =true;
          document.suche_1.monat.options[0].selected =true;
          document.suche_1.datumString.options[0].selected =true;
      }

      if(item.name =='monat' || item.name =='jahr')
      {
          document.suche_1.datumString.options[0].selected =true;
          document.suche_1.datum.value ='';
      }

      if(item.name =='datumString')
      {
          document.suche_1.jahr.options[0].selected  =true;
          document.suche_1.monat.options[0].selected =true;
          document.suche_1.datum.value ='';
      }
  }

function openKalendar(id) {

		var datum;
		var m;
		var y;

		dfield = id;
		datum=  eval("document.suche_1."+id+".value");

		if(datum != null && datum != "")
		{
			values = datum.split('.');
			m = values[1];
			y = values[2];
		}
		if(datum == null || isNaN(m)){
			jetzt = new Date();
			m = jetzt.getMonth() + 1;
		}
		if (datum == null || isNaN(y)) {
		   jetzt = new Date();
		   y = jetzt.getFullYear();
		}

		calendar = open ("suche/calender/calendar.html?month="+m+"&year="+y, "calendar", "dependent=yes,menubar=no,width=220,height=200,status=no,scrollbars=yes,resizable=yes");
		calendar.blur();
		calendar.focus();
	}


function checkDate(date_string, formatError, valueError){
	result = true;
	if (date_string.value.toUpperCase() == 'IM JULI') {
		alert ('Herzlichen Glückwunsch! Sie haben sich soeben für den engsten Kreis der Anwärter auf den Support-Ehrenpreis qualifiziert. Entnehmen Sie die Mitmachbedingungen bitte der Packungsbeilage.');
		}
	else {
		if(date_string.value != ''){
			values = date_string.value.split('.');
			if (values.length != 3) {
				alert(formatError);
				result = false;
				}
			else {
				MonthLong = new Array (1, 3, 5, 7, 8, 10, 12);
				MonthShort = new Array (4, 6, 9, 11);

				if(values[0].length > 2 || values[0].length < 1 || isNaN(values[0]) || values[0] < 1) {
					alert(formatError);
					result = false;
					return result;
					}
				else {
					 if(values[1].length > 2 || values[1].length < 1 || isNaN(values[1]) || values[1] > 12 || values[1] < 1) {
						alert(formatError);
						result = false;
						}
					else {
						 if(values[2].length != 4 || isNaN(values[2])) {
						alert(formatError);
						result = false;
							}
						}
					}
				for (c = 0; c < MonthLong.length; c++) {
					if (values[1] == MonthLong[c]) {
						if (values[0] > 31) {
							alert(valueError);
							result = false;
							}
						}
					}
				for (c = 0; c < MonthShort.length; c++) {
					if (values[1] == MonthShort[c]) {
						if (values[0] > 30) {
							alert(valueError);
							result = false;
							}
						}
					}
				if (values[2].length == 2)
					values[2] = "20" + values[2];
				if (values[1] == 2) {
					if (values[2] % 4 == 0 && ((values[2] % 100 != 0) || (values[2] % 400 == 0))) {
						if (values[0] > 29) {
							alert(valueError);
							result = false;
							}
						}
					else {
						if (values[0] > 28) {
							alert(valueError);
							result = false;
						}
					}
				}
			}
		}
	}	return result;
}

