var SearchFormHandler = function (form) {
    this.form = form;
    var inputs = this.form.getElementsByTagName('input');
    for (var i=0; i<inputs.length;i++) {
        if(typeof inputs[i].type != 'undefined' && inputs[i].type == 'text') {
            inputs[i].init = {value:inputs[i].value};
            inputs[i].onfocus = function () {
                this.select();
            }
        }
    }
    var message = 'Die Suche im Umkreis benötigt eine Ortsangabe oder\neine vollständige, fünfstellige Postleitzahl!';
    this.form.onsubmit = function () {
        if (this.umkreis.options.selectedIndex > 0 &&
            (!this.plz.value.match(/[0-9]{5}/) &&
            (this.ort.value == this.ort.init.value || this.ort.value == ''))) {
            alert(message);
            return false;
        } else {
            return true;
        }
    }
}


var RouteFormHandler = function (form) {
    this.form = form;
    var inputs = this.form.getElementsByTagName('input');
    for (var i=0; i<inputs.length;i++) {
        if(typeof inputs[i].type != 'undefined' && inputs[i].type == 'text') {
            inputs[i].init = {value:inputs[i].value};
            inputs[i].onfocus = function () {
                this.select();
            }
        }
    }
    this.form.onsubmit = function () {
        if (this.sstreet.value == this.sstreet.init.value) {
            this.sstreet.value = '';
        }
        if (this.scity.value == this.scity.init.value) {
            this.scity.value = "";
        }
        if (this.szip.value == "" || this.szip.value == this.szip.init.value) {
            alert ("Bitte geben Sie eine Start-PLZ ein.");
            return false;
        } else {
            return true;
        }
    }
}

		
function openExtraPics(id) {
	if (typeof moved != 'undefined') {
		moved = 'undefined';
	}
	extrapicspopup = window.open('extraPics.php?id='+id, '', 'width=100,height=100,left='+parseInt(window.outerWidth/2 - 50)+',resizeable=yes');
}