function sucheVal(obj, unique)
{
	if (obj["plz_"+unique].value && isNaN(obj["plz_"+unique].value))
	{
		obj["plz_"+unique].style.color="red";
		alert ('Das ist keine Zahl.');
		return false;
	}
	else
	{
		obj["plz_"+unique].style.color="#5B5959";
	}
	if (obj["plz_"+unique].value && obj["plz_"+unique].value.length < 2)
	{
		obj["plz_"+unique].style.color="red";
		alert ('Bitte geben Sie mindestens die ersten zwei Stellen der Postleitzahl ein.');
		return false;
	}
	else
	{
		obj["plz_"+unique].style.color="#5B5959";
	}
	
	var rx = new RegExp("[^0-9a-zäöüßA-ZÄÖÜ.,-/ ]");
	if (rx.test(obj["ort_"+unique].value) == true)
	{
		obj["ort_"+unique].style.color = 'red';
		alert('Ihre Eingabe wird nicht akzeptiert.\nBitte verwenden Sie ausschließlich Alphanumerische Zeichen sowie .,-/');
		return false;
	}
	else
	{
		obj["ort_"+unique].style.color="#5B5959";
	}
	if (rx.test(obj.stichwort.value) == true)
	{
		obj.stichwort.style.color = 'red';
		alert('Ihre Eingabe wird nicht akzeptiert.\nBitte verwenden Sie ausschließlich Alphanumerische Zeichen sowie .,-/');
		return false;
	}
	else
	{
		obj.stichwort.style.color="#5B5959";
	}
	
	if (obj.umkreis.value && isNaN(obj.umkreis.value))
	{
		obj.umkreis.style.color="red";
		alert ('Das ist keine Zahl.');
		return false;
	}
	else
	{
		obj.umkreis.style.color="#5B5959";
	}
	if (obj.umkreis.value && (obj.umkreis.value<1 || obj.umkreis.value>50))
	{
		obj.umkreis.style.color="red";
		alert ('Bitte wählen Sie einen Umkreis zwischen 1 und 50 KM.');
		return false;
	}
	else
	{
		obj.umkreis.style.color="#5B5959";
	}
	//return false;
}

function mouseoverimg (obj)
{
	obj = document.getElementById(obj);
	if (obj.src.indexOf('_o') == -1)
	{
		file = obj.src.replace(/(\.gif|jpg|jpeg|png)/, '_o$1');
		document.getElementById(obj.id).src = file;
	}
}
function mouseoverimgoff (obj)
{
	obj = document.getElementById(obj);
	if (obj.src.indexOf('_o') > -1)
	{
		file = obj.src.replace(/_o/, '');
		document.getElementById(obj.id).src = file;
	}
}
/* helpBox */
function remove(vater, kind)
{
	var node = document.getElementById(kind);
	document.getElementById(vater).removeChild(node);
}
function kreissuche(suche)
{
	suche ? hreff = suche : hreff = "suche";
	if (document.suchForm && document.suchForm.kat.options[document.suchForm.kat.selectedIndex].value > 0){
		hreff+="-"+document.suchForm.kat[document.suchForm.kat.selectedIndex].value;
		
	}/* es gibt keine kries-suche mehr
	else if (document.katform.kat && document.katform.kat.value != ''){
		hreff+="-"+document.katform.kat.value;
		alert(document.suchForm.kat.selectedIndex);
	}*/
	document.location.href=hreff+".html";
	return false;
}
function plzsuche(suche)
{
	suche ? hreff = "plzsuche"+suche : hreff = "plzsuche";
	if (document.suchForm && document.suchForm.kat.options[document.suchForm.kat.selectedIndex].value > 0)
	{
		hreff+="-"+document.suchForm.kat[document.suchForm.kat.selectedIndex].value;
	}
	else if (document.katform.kat && document.katform.kat.value != '')
	{
		hreff+="-"+document.katform.kat.value;
	}
	document.location.href=hreff+".html";
	return false;
}
function switchText(name)
{
	if( window.document.getElementById("kreisnameOben"))
	{
		window.document.getElementById("kreisnameOben").firstChild.data=name;
	 	if (window.innerHeight < 700)
	 	{
			window.document.getElementById("kreisnameUnten").firstChild.data=name;
		}
	}

}
function restoreText()
{
	if( window.document.getElementById("kreisnameOben"))
	{
		window.document.getElementById("kreisnameOben").firstChild.data="";
		window.document.getElementById("kreisnameUnten").firstChild.data="";
	}
}
function deleteText()
{
	if( window.document.getElementById("kreisnameOben"))
	{
		window.document.getElementById("kreisnameOben").firstChild.data="";
		window.document.getElementById("kreisnameUnten").firstChild.data="";
	}
}

function winOpen(id, width, height)
{
		 width=width+40;
		 height=height+40;
		 window.open('referenzen.php?id=' + id + '', '', 'width='+ width +',height='+ height +',scrollbars=yes');
}

/*********************************************
/      routenplaner
/********************************************/
function routeVal()
{
	var plzValue = document.route.szip.value;
	if (document.route.sstreet.value == "Strasse und Nr.") 
	{
		document.route.sstreet.value = '';
	}
	if (document.route.scity.value == "-Ort-") 
	{
		document.route.scity.value = "";
	}
	if (document.route.szip.value == "" || document.route.szip.value == "PLZ" || isNaN(document.route.szip.value) == true) 
	{
		alert ("Bitte geben Sie eine Start PLZ ein.");
		document.route.szip.value == "";
		document.route.szip.focus();
		return false;
	}
	
	else 
	{
		var plz = document.route.szip.value.length;
		if (document.route.szip.value != "" && plz < 5)
		{
			var eingabe = confirm('Die Eingabe einer nicht vollständigen PLZ kann zu unerwarteten Ergebnissen führen.\n\nTrotzdem fortfahren?');
			if (eingabe == true)
			{
				document.route.szip.value = plzValue;
				return true;
			}
			else
			{
				return false;
			}
		}
		return true;
	}
}


function mask(end,middle,start,subject)
{
	var one ='mai';
	var two='lto:';
	var three='?Subject=';
	//start,middle,end,subject;
	var putogether= one+two+start+middle+end+three+subject;
	document.location.href=eval('"'+putogether+'"');
	window.status=putogether;
}

