/*
  Copyright Bernd Krech <b.krech@eurofile.de>, 2002 Eurofile e.K Mediagroup, Aschaffenburg
*/

<!--
function IsValidDate(strDate, strFormat)
{//checks if strDate is a valid date matching strFormat
 //strFormat must be like dd.mm.yyyy

	var intPos1 = 0;
	var intPos2 = 0;
	var intPos3 = 0;
	var j = 0;
	var strRead = "";
	var str1 = "";
	var str2 = "";
	var str3 = "";
	var dateVal = new Date();

	strFormat = strFormat.replace("dd", "d");
	strFormat = strFormat.replace("mm", "m");
	strFormat = strFormat.replace("yyyy", "y");
	strFormat = strFormat.replace("yy", "y");

	for(j = 0; j <= strDate.length; j++)
	{
		oResult = strDate.substring(j, j + 1).match(/[0-9]/);
		if(oResult != null)
		{
			strRead = strRead + strDate.substring(j, j + 1);
		}
		else
		{
			if(str1 == "")
			{
				str1 = strRead;
			}
			else if(str2 == "")
			{
				str2 = strRead;
			}
			else if(str3 == "")
			{
				str3 = strRead;
			}
			strRead = "";
		}
	}

	if(strFormat.indexOf("d") == 0)
	{
		strDay = str1;
	}
	if(strFormat.indexOf("d") == 2)
	{
		strDay = str2;
	}
	if(strFormat.indexOf("d") == 4)
	{
		strDay = str3;
	}
	if(strFormat.indexOf("m") == 0)
	{
		strMonth = str1;
	}
	if(strFormat.indexOf("m") == 2)
	{
		strMonth = str2;
	}
	if(strFormat.indexOf("m") == 4)
	{
		strMonth = str3;
	}
	if(strFormat.indexOf("y") == 0)
	{
		strYear = str1;
	}
	if(strFormat.indexOf("y") == 2)
	{
		strYear = str2;
	}
	if(strFormat.indexOf("y") == 4)
	{
		strYear = str3;
	}

	if(strDay > 31 || strDay < 1)
	{
		return false;
	}
	if(strMonth > 12 || strMonth < 1)
	{
		return false;
	}
	if(strYear.length == 1 || strYear.lenth == 3)
	{
		return false;
	}
	dateVal.setDate(strDay);
	dateVal.setMonth(strMonth - 1);
	dateVal.setYear(strYear);
	if(isNaN(dateVal))
	{
		return false;
	}
	if(strYear.length = 2);
	{
		strYear = "20" + strYear;
	}
	if(strMonth == "2" || strMonth == "0")
	{
		if(IsLeapYear(strYear))
		{
			if(strDay > 29)
			{
				return false;
			}
		}
		else
		{
			if(strDay > 28)
			{
				return false;
			}
		}
	}
	if(strMonth == "1" || strMonth == "01"  || strMonth == "3" || strMonth == "03" ||
		 strMonth == "5" || strMonth == "05" || strMonth == "7" || strMonth == "07" ||
		 strMonth == "8" || strMonth == "08"  || strMonth == "10" || strMonth == "12")
	{
		if(strDay > 31)
		{
			return false;
		}
	}
	if(strMonth == "4" || strMonth == "04" || strMonth == "6" || strMonth == "06" ||
		 strMonth == "9" || strMonth == "09" || strMonth == "11")
	{
		if(strDay > 30)
		{
			return false;
		}
	}
	return true;
}
//
function CheckEMail(strEMail)
{
	// Checking if its a standard email format eg: who@where.com
	var strValidEmail = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;

	if (strEMail
	&& strValidEmail.test(strEMail))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function CheckFieldsBewerbung()
{
	if (document.appform.jobVorname.value=='') {
		alert ('Bitte geben Sie Ihren Vornamen ein!');
		document.appform.jobVorname.focus(); return false;
	}
	if (document.appform.jobNachname.value=='') {
		alert ('Bitte geben Sie Ihren Nachnamen ein!');
		document.appform.jobNachname.focus(); return false;
	}
	if (IsValidDate(document.appform.jobGTT.value+'.'+document.appform.jobGMM.value+'.'+document.appform.jobGJJ.value, 'dd.mm.yyyy')==false) {
		alert ('Bitte geben Sie Ihr Geburtsdatum ein!');
		document.appform.jobGTT.focus(); return false;
	}
	if (document.appform.jobStrasse.value=='') {
		alert ('Bitte geben Sie Ihre Strasse ein!');
		document.appform.jobStrasse.focus(); return false;
	}
	if (document.appform.jobPlz.value=='') {
		alert ('Bitte geben Sie Ihre Postleitzahl ein!');
		document.appform.jobPlz.focus(); return false;
	}
	if (document.appform.jobOrt.value=='') {
		alert ('Bitte geben Sie Ihre Stadt ein!');
		document.appform.jobOrt.focus(); return false;
	}
	if (document.appform.jobTelefon.value=='' && document.appform.jobMobil.value=='') {
		alert ('Bitte geben Sie Ihre Telefon- oder Mobilnummer ein!');
		document.appform.jobTelefon.focus(); return false;
	}
	if (CheckEMail(document.appform.jobEmail.value)==false) {
		alert ('Bitte geben Sie Ihre Email-Adresse ein!');
		document.appform.jobEmail.focus(); return false;
	}
	if (document.appform.jobAusbildung.value=='') {
		alert ('Bitte geben Sie den Status Ihrer Ausbildung ein!');
		document.appform.jobAusbildung.focus(); return false;
	}
	if (document.appform.jobBeruf.value=='') {
		alert ('Bitte geben Sie Ihre derzeitige Berufsbezeichnung ein!');
		document.appform.jobBeruf.focus(); return false;
	}
	if (document.appform.jobGehalt.value=='') {
		alert ('Bitte geben Sie Ihren Gehaltswunsch ein!');
		document.appform.jobGehalt.focus(); return false;
	}
	if (IsValidDate(document.appform.jobETT.value+'.'+document.appform.jobEMM.value+'.'+document.appform.jobEJJ.value, 'dd.mm.yyyy')==false) {
		alert ('Bitte geben Sie Ihr gewünschtes Eintrittsdatum ein!');
		document.appform.jobETT.focus(); return false;
	}
	if (document.appform.jobAnschreiben.value=='') {
		alert ('Bitte formulieren Sie ein entsprechendes Bewerbungsanschreiben!');
		document.appform.jobAnschreiben.focus(); return false;
	}
}

function CheckFieldsContact()
{
	if (document.contform.jobVorname.value=='') {
		alert ('Bitte geben Sie Ihren Vornamen ein!');
		document.contform.jobVorname.focus(); return false;
	}
	if (document.contform.jobNachname.value=='') {
		alert ('Bitte geben Sie Ihren Nachnamen ein!');
		document.contform.jobNachname.focus(); return false;
	}
	if (document.contform.jobStrasse.value=='') {
		alert ('Bitte geben Sie Ihre Strasse ein!');
		document.contform.jobStrasse.focus(); return false;
	}
	if (document.contform.jobPlz.value=='') {
		alert ('Bitte geben Sie Ihre Postleitzahl ein!');
		document.contform.jobPlz.focus(); return false;
	}
	if (document.contform.jobOrt.value=='') {
		alert ('Bitte geben Sie Ihre Stadt ein!');
		document.contform.jobOrt.focus(); return false;
	}
	if (document.contform.jobTelefon.value=='' && document.contform.jobMobil.value=='') {
		alert ('Bitte geben Sie Ihre Telefon- oder Mobilnummer ein!');
		document.contform.jobTelefon.focus(); return false;
	}
	if (CheckEMail(document.contform.jobEmail.value)==false) {
		alert ('Bitte geben Sie Ihre Email-Adresse ein!');
		document.contform.jobEmail.focus(); return false;
	}
	if (document.contform.jobAnschreiben.value=='') {
		alert ('Bitte formulieren Sie ein entsprechendes Kontaktanschreiben!');
		document.contform.jobAnschreiben.focus(); return false;
	}
}

// PopUp-Fenster zentriert auf dem Bildschirm -->
function openCenteredWindow(url, name, width, height, additionalOptions)
	{
		if (additionalOptions == null || additionalOptions.length == 0)
			var options =  "width=" + width + ",height=" + height;
		else
			var options =  "width=" + width + ",height=" + height + "," + additionalOptions;
	
		var x = (screen.width  / 2) - (width  / 2);
		var y = (screen.height / 2) - (height / 2);
	
		var win = window.open(url, name, options);
		win.moveTo(x, y);
		win.focus();
	}


function confirmDelete(url) {
	check = confirm("Wollen Sie das Bild wirklich löschen ?");
	if(check == true) {
		location.href = url;
	}
}

//-->

