
	windowOnLoad.add("Suchauftrag.init()");
	Message.load("email,editmail,confirm", "index.suchen.suchauftrag.");
	
	
	var Suchauftrag = {
		init: function() {
			if(Global.kontakt) {
				fillForm(Global.kontakt);
			}
			
			if(Global.suchparams) {
				fillForm(Global.suchparams);
			}
		},
		
		
		typChange: function(obj) {
			window.location.href = "/" + LANG + "/suchauftrag/erstellen.php?typ=" + obj;
		},
		
		
		CheckNewSearch: function() {
			var email_regex = /^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/;
			var zahl_regex = /^([0-9]*)$/;
			var node = document.sucheerstellen;
			
			
			if((email_regex.test($$("[name='suchauftrag[email]']")[0].value)) == false) {
				Message.post("email"); 
				return false; 
			}
			
			
			return true;
		},
		
		
		CheckEditSearch: function() {
			var email_regex = /^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/;
				
			if((email_regex.test($$("[name='suchauftrag[email]']")[0].value)) == false) { 
				Message.post("editmail"); 
				return false; 
			}
			
			return true;
		},
		
		
		edit: function(code) {
			window.location.href = "/" + LANG + "/suchauftrag/erstellen.php?code=" + code;
		},
		
		
		del: function(code, zeit) {
			var Text = Message.get("confirm", {zeit: zeit});

			if(confirm(Text)) { 
				window.location.href = "/" + LANG + "/suchauftrag/bearbeiten.php?del=" + code;
			}
		},
		
		New: function() {
			window.location.href = "/" + LANG + "/suchauftrag/erstellen.php";
		}
	}