
function setMenuFocus(elem)
{
   document.getElementById(elem).focus();
}

function isZiffer(field)
{
	 var regex=/^[0-9]+$/;	  
     return  regex.test(field);
}

function validPLZ(plz, message)
{
    var res=false;
    if(isZiffer(plz) && (plz.length==5)) res=true;
      else alert(message);  
    return res;
}

function validOrt(ort, message)
{
    var res=false;   
    if(!isZiffer(ort)) res=true;
      else alert(message);
    return res;
}

function validPlzOrt(plz, ort, message1, message2)
{
    var res=false; 
    var res1=false; 
    var res2=false;
    
    if( (plz =='') && (ort==''))  {}
      else if( (plz!='') && (ort!='')) 
      {  
        
          if(isZiffer(plz) && (plz.length==5)) res1=true;       else alert(message1);
          if(!isZiffer(ort)) res2=true;     else alert(message2);
          res = res1 && res2;
      }
    
      else if( plz !='' )
      { 
         if(isZiffer(plz) && (plz.length==5)) res=true;       else alert(message1);
      }
      else if( ort !='' )
      { 
        if(!isZiffer(ort)) res=true;     else alert(message2);
      }
               
    return res;
}


function ShowSmallWindow(src, width, height)
{
    window.open(src, "message","toolbar=0,scrollbars=1,resizable=1,width="+width+",height="+height+",Left=100,Top=50");
}

function add_favorite() {
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
	var tmp = window.location.href.split("/");
	var tmp_count = tmp.length;
	var tmp_in = tmp[tmp_count-1].split("-");
	if(tmp_in[1] != null) 
	        window.external.AddFavorite(window.location.href,tmp[2]+" - "+tmp_in[1]);
	else
        	window.external.AddFavorite(window.location.href,tmp[2]+" - "+tmp[tmp_count-1]);
    }
    else {
        if(navigator.appName == "Netscape") alert("Press Ctrl-D");
        if(navigator.appName == "Opera") alert("Go to menu in your browser Bookmarks");
    }
}


function SelectInterface(fieldname, val, url)
{
	     obj = document.getElementById(fieldname);
       obj.value = val;
	     window.location.href=url;
	     obj.form.submit();
}

