	function StartSearch(CriteriaType)
	{
		Criteria = "";
		href = window.location.href;
		if (CriteriaType == "DL_Betrieb")
		{
			Crit1 = "";
			Crit2 = "";
			if (document.all("Bezeichnung") != null)
			{
				Crit1 = document.all.Bezeichnung.value;
				if (Crit1 != "")
					Crit1 = "%" + Crit1 + "%";
			}
			if (document.all("Strasse") != null)
			{		
				Crit2 = document.all.Strasse.value;
				if (Crit2 != "")
					Crit2 = "%" + Crit2 + "%";
			}
			Crit3 = "";			
			if (document.all("Lage") != null)
			{						
				if (document.all.Lage.value != "")
				{
					i = document.all.Lage.selectedIndex;
					Crit3 = document.all.Lage.options(i).value;
				}
				else
					Crit3 = "";
			}
			Crit4 = "";			
			if (document.all("Kategorie") != null)
			{				
				if (document.all.Kategorie.value != "")
				{
					i = document.all.Kategorie.selectedIndex;
					Crit4 = document.all.Kategorie.options(i).value;
				}
				else
					Crit4 = "";	
			}
			Crit5 = "";
			if (document.all("Ort") != null)
			{
				if (document.all.Ort.value != "")
				{
					i = document.all.Ort.selectedIndex;
					Crit5 = document.all.Ort.options(i).value;
				}
				else
					Crit5 = "";
				}
			Crit6 = "";
			if (document.all("Anreisedatum") != null)
			{				
				if ((document.all.Anreisedatum.value != "") || (document.all.Naechte.value != "") || (document.all.Zimmer.value != "") || (document.all.Personen.value != ""))
				{
					if ((document.all.Anreisedatum.value == "") || (document.all.Naechte.value == "") || (document.all.Zimmer.value == "") || (document.all.Personen.value == ""))
					{
						alert("Geben Sie bitte für alle Felder der Vakanzsuche einen Wert an!");
						return;
					}
				}
				if (document.all.Anreisedatum.value != "")
				{
					if (isDate(document.all.Anreisedatum.value))
						Crit6 = document.all.Anreisedatum.value;
					else
					{
						alert("Ungültiger Wert für das Anreisedatum!");
						document.all.Anreisedatum.focus();
						return;
					}
				} 
				else
					Crit6 = "";	
			}
			Crit7 = "";
			if (document.all("Naechte") != null)
			{				
				if (document.all.Naechte.value != "")
				{
					if (isNaN(document.all.Naechte.value))
					{
						alert("Ungültiger Wert für die Anzahl der Nächtigungen!");
						document.all.Naechte.focus();
						return;
					}	
					else
						Crit7 = document.all.Naechte.value;
				}
				else
					Crit7 = "";
			}
			Crit8 = "";
			if (document.all("Zimmer") != null)
			{			
				if (document.all.Zimmer.value != "")
				{
					if (isNaN(document.all.Zimmer.value))
					{
						alert("Ungültiger Wert für die Anzahl der Zimmer!");
						document.all.Zimmer.focus();
						return;
					}	
					else			
					Crit8 = document.all.Zimmer.value;
				}
				else
					Crit8 = "";
			}
			Crit9 = "";
			if (document.all("Personen") != null)
			{
				if (document.all.Personen.value != "")
				{
					if (isNaN(document.all.Personen.value))
					{
						alert("Ungültiger Wert für die Anzahl der Personen!");
						document.all.Personen.focus();
						return;
					}	
					else			
					Crit9 = document.all.Zimmer.value;
				}
				else
					Crit9 = "";	
			}
			Crit10 = "";
			if (document.all("Betriebsart2") != null)
			{
				if (document.all.Betriebsart2.value != "")
				{
					i = document.all.Betriebsart2.selectedIndex;
					Crit10 = document.all.Betriebsart2.options(i).value;
				}
				else
					Crit10 = "";				
			}	
			Crit11 = "";
			if (document.all("Kategorie2") != null)
			{
				if (document.all.Kategorie2.value != "")
				{
					i = document.all.Kategorie2.selectedIndex;
					Crit11 = document.all.Kategorie2.options(i).value;
				}
				else
					Crit11 = "";				
			}	
			Crit12 = "";
			if (document.all("Marketing") != null)
			{
				if (document.all.Marketing.value != "")
				{
					i = document.all.Marketing.selectedIndex;
					Crit12 = document.all.Marketing.options(i).value;
				}
				else
					Crit12 = "";
			}
			Criteria = Crit1 + "|" + Crit2 + "|" + Crit3 + "|" + Crit4 + "|" + Crit5 + "|" + Crit6 + "|" + Crit7 + "|" + Crit8 + "|" + Crit9 + "|" + Crit10 + "|" + Crit11 + "|" + Crit12;
		}
		else if (CriteriaType == "DL_Event")
		{
			Crit1 = document.all.Bezeichnung.value;
			if (Crit1 != "")
				Crit1 = "%" + Crit1 + "%";
			Crit2 = document.all.von.value;
			Crit3 = document.all.bis.value;
			if (document.all("Kategorie") != null)
			{
				if (document.all.Kategorie.value != "")
				{
					i = document.all.Kategorie.selectedIndex;
					Crit4 = document.all.Kategorie.options(i).value;
				}
				else
					Crit4 = "";	
			}
			if (document.all("Ort") != null)
			{			
				if (document.all.Ort.value != "")
				{
					i = document.all.Ort.selectedIndex;
					Crit5 = document.all.Ort.options(i).value;
				}
				else
					Crit5 = "";
			}
			Criteria = Crit1 + "|" + Crit2 + "|" + Crit3 + "|" + Crit4 + "|" + Crit5		
		}
		else if (CriteriaType == "DL_Infoseite")
		{
			Crit1 = document.all.Bezeichnung.value;
			if (Crit1 != "")
				Crit1 = "%" + Crit1 + "%";
			if (document.all("Kategorie") != null)
			{				
				if (document.all.Kategorie.value != "")
				{
					i = document.all.Kategorie.selectedIndex;
					Crit2 = document.all.Kategorie.options(i).value;
				}
				else
					Crit2 = "";	
			}
			if (document.all("Subkategorie") != null)
			{	
				if (document.all("Subkategorie").value != "")
				{
					i = document.all("Subkategorie").selectedIndex;
					Crit3 = document.all("Subkategorie").options(i).value;
				}
				else
					Crit3 = "";
			}
			if (document.all("Ort") != null)
			{			
				if (document.all.Ort.value != "")
				{
					i = document.all.Ort.selectedIndex;
					Crit4 = document.all.Ort.options(i).value;
				}
				else
					Crit4 = "";
			}
			Criteria = Crit1 + "|" + Crit2 + "|" + Crit3 + "|" + Crit4 		
		}
		else if (CriteriaType == "DM_Search")
		{
			Crit1 = document.all.Bezeichnung.value;
			if (Crit1 != "")
				Crit1 = "%" + Crit1 + "%";
			Criteria = Crit1 + "|" 		
		}
		pos1 = href.indexOf("&Search=");
		if (pos1 > -1)
		{
			pos2 = href.indexOf("&", pos1 + 1);
			if (pos2 > -1)
			{
				href = href.substr(0, pos1) + href.substr(pos2);	
			}
			else
				href = href.substr(0, pos1);
		}
		pos1 = href.indexOf("&PageNr=");
		if (pos1 > -1)
		{
			pos2 = href.indexOf("&", pos1 + 1);
			if (pos2 > -1)
			{
				href = href.substr(0, pos1) + href.substr(pos2);	
			}
			else
				href = href.substr(0, pos1);
		}
		Criteria = Criteria.replace(/%/g, "~^~");
		href = href + "&Search=" + Criteria + "&PageNr=1";
		window.location.href = href;
	}
	
	function isDate(strDate)
	{
		var datepart = strDate.split(".");
		
		if (datepart.length != 3)
			return false;
		year = datepart[2];
		month = datepart[1] - 1;
		day = datepart[0];

		var nDate = new Date(datepart[2], datepart[1] - 1, datepart[0]);
			
		if ((nDate.getDate() != day) || (nDate.getMonth() != month) || (nDate.getYear() != year))
			return false;
		return true;
	}
	
	function Clear()
	{
		if (document.all("Bezeichnung") != null)
			window.document.all.Bezeichnung.value = "";
		if (document.all("Strasse") != null)
			window.document.all.Strasse.value = "";
		if (document.all("Lage") != null)
			window.document.all.Lage.selectedIndex = -1;
		if (document.all("Kategorie") != null)
			window.document.all.Kategorie.selectedIndex = -1;
		if (document.all("Ort") != null)
			window.document.all.Ort.selectedIndex = -1;	
		if (document.all("Anreisedatum") != null)
			window.document.all.Anreisedatum.value = "";
		if (document.all("Naechte") != null)
			window.document.all.Naechte.value = "";
		if (document.all("Zimmer") != null)
			window.document.all.Zimmer.value = "";
		if (document.all("Personen") != null)
			window.document.all.Personen.value = "";
		if (document.all("Kategorie2") != null)
			window.document.all.Kategorie2.selectedIndex = -1;
		if (document.all("Marketing") != null)
			window.document.all.Marketing.selectedIndex = -1;
	}
	
	function Display(intDisplay)
	{
		if (intDisplay == 1)
		{
			if (document.all.CMSExtensionRow.style.display != "none")
				document.all.CMSExtensionRow.style.display = "none";
			else
				document.all.CMSExtensionRow.style.display = "block";
		}
		else if (intDisplay == 2)
		{
			if (document.all.CMSVacancyRow.style.display != "none")
				document.all.CMSVacancyRow.style.display = "none";
			else
				document.all.CMSVacancyRow.style.display = "block";
		}
		else if (intDisplay == 3)
		{
			if (document.all.CMSPropertyRow.style.display != "none")
				document.all.CMSPropertyRow.style.display = "none";
			else
				document.all.CMSPropertyRow.style.display = "block";
		}
	}
	
	function CheckPCFields()
	{
		if (document.all("VornameE") != null)
		{	
			if (document.all("VornameE").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld Vorname (Empfänger) ein!");
				document.all("VornameE").focus();
				return false;
			}
		}
		if (document.all("NachnameE") != null)
		{	
			if (document.all("NachnameE").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld Nachname (Empfänger) ein!");
				document.all("NachnameE").focus();
				return false;
			}
		}
		if (document.all("EMailE") != null)
		{	
			if (document.all("EMailE").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld EMail (Empfänger) ein!");
				document.all("EMailE").focus();
				return false;
			}
		}
		if (document.all("Nachricht") != null)
		{	
			if (document.all("Nachricht").innerText == "")
			{
				alert("Geben Sie bitte einen Text in das Feld Nachricht (Empfänger) ein!");
				document.all("Nachricht").focus();
				return false;
			}
		}
		if (document.all("VornameA") != null)
		{	
			if (document.all("VornameA").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld Vorname (Absender) ein!");
				document.all("VornameA").focus();
				return false;
			}
		}
		if (document.all("NachnameA") != null)
		{	
			if (document.all("NachnameA").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld Nachname (Absender) ein!");
				document.all("NachnameA").focus();
				return false;
			}
		}
		if (document.all("EMailA") != null)
		{	
			if (document.all("EMailA").value == "")
			{
				alert("Geben Sie bitte einen Text in das Feld EMail (Absender) ein!");
				document.all("EMailA").focus();
				return false;
			}
		}
		return true;
	}
	
	function SendMail(URL, Site, DetailImageID, target, newPageID, Preview)
	{
		if (document.all.PCForm)
		{
			document.all.PCForm.target = target;
			document.all.PCForm.action = URL + "/Postcard_Send.asp?Site=" + Site + "&ImageID=" + DetailImageID + "&PageID=" + newPageID + "&Preview=" + Preview;
			if (CheckPCFields())
				document.all.PCForm.submit();
		}
		else
			if (target == "_blank_")
				open (URL + "/Postcard_Send.asp?Site=" + Site + "&ImageID=" + DetailImageID + "&PageID=" + newPageID + "&Preview=" + Preview);
			else
				window.location.href = URL + "/Postcard_Send.asp?Site=" + Site + "&ImageID=" + DetailImageID + "&PageID=" + newPageID + "&Preview=" + Preview;
	}
	
	function ShowPreview(URL, Site, DetailImageID, target)
	{
		document.all.PCForm.target = target;
		document.all.PCForm.action = URL + "/Postcard_View.asp?Site=" + Site + "&ImageID=" + DetailImageID;
		if (CheckPCFields())
			document.all.PCForm.submit();
	}
	
	function FillFieldValues(DataString)
	{
		var Fields = DataString.split("|");
		var curFieldName = "";
		var curFieldValue = "";
		
		for (i = 0; i < Fields.length; i++)
		{
			curFieldName = Fields[i].split(":")[0];
			curFieldValue = Fields[i].split(":")[1];
			if (document.getElementById(curFieldName))
			{
				switch (document.getElementById(curFieldName).tagName.toUpperCase())
				{
					case "INPUT":
						switch (document.getElementById(curFieldName).type.toUpperCase())
						{
							case "CHECKBOX":
								if (curFieldValue.toUpperCase() == "TRUE" || curFieldValue.toUpperCase() == "1")
									document.getElementById(curFieldName).checked = true;
								else
									document.getElementById(curFieldName).checked = false;
								break;
							case "RADIO":
								if (curFieldValue.toUpperCase() == "TRUE" || curFieldValue.toUpperCase() == "1")
									document.getElementById(curFieldName).checked = true;
								else
									document.getElementById(curFieldName).checked = false;
								break;
							case "TEXT":
								document.getElementById(curFieldName).value = curFieldValue;
								break;
						}
						break;
					case "SELECT":
						for (n = 0; n < document.getElementById(curFieldName).options.length; n++)
						{
							if (document.getElementById(curFieldName).options[n].value.toUpperCase() == curFieldValue.toUpperCase() || document.getElementById(curFieldName).options[n].text.toUpperCase() == curFieldValue.toUpperCase())
							{
								document.getElementById(curFieldName).selectedIndex = n;
								n = document.getElementById(curFieldName).options.length;
							}
						}	
						break;
					case "TEXTAREA":
						document.getElementById(curFieldName).innerText = curFieldValue;
						break;
				}
			}
		}
	}