function get_plz_from_array(plz,arr)
{

  if(!plz.match(/^\d{5}$/))return [false];
  
  plz=trim(plz);
  
  for(i=1;i<arr.length;++i)
    {
      for(j=1;j<arr[i].length;++j)
        {
          a_plz=arr[i][j].split('-');
          if(plz>=a_plz[0]&&plz<=a_plz[1])
            {
               return [i,plz];
            }
        }
    }
    
  return [false];
}






function function_exists(f)
{
  return( eval('typeof '+ f)!="undefined"?1:0);
}

function trim(str)
{
    return str.replace(/(^\s+|\s+$)/g,'');
}

function round(lng,x)
{
  return (round.arguments.length==1)
            ? lng.toFixed(2)
            : String(lng.toFixed(2)).replace('.',',');
}

window.onload=function()
{
  
  if(document.getElementById && typeof document.getElementsByTagName('body')[0].innerHTML!='undefined')
    {
      divs=document.getElementsByTagName('div');
      for(i=0;i<divs.length;++i)
        {
            if(divs[i].className.match(/jsonly/))divs[i].style.display="block";
        }
      for(f=0;f<document.forms.length;++f)
        {
          if(document.forms[f].name.match(/^form_/))
            {
              elm=document.forms[f].elements;
              
                for(i=0;i<elm.length;++i)
                  {
                    if(elm[i].name.match(/uip/))
                      {
                        switch(elm[i].type)
                          {
                            case 'checkbox':
                                  evt='onclick';
                                  break;
                            case 'radio':
                                  evt='onclick';
                                  break;
                            case 'text':
                                  evt='onkeyup';
                                  if(elm[i].name.match(/(int1|blz1|banknr1|blz1|plz1)$/))
                                    {
                                      
                                      elm[i].onkeypress=function(e){return (!isNaN(String.fromCharCode((window.event)?event.keyCode:e.which)));}
                                    }
                                  break;
                            default:        
                                    evt=(elm[i].tagName=='SELECT')?'onchange':false;
                 
                          }
                
                
                
                        if(evt && function_exists('eval_'+document.forms[f].name) )
                          {
                            fx=String(document.forms[f].name).replace(/^form_/,'');
                            eval("elm[i]." + evt +  "=new Function('eval_'+document.forms[f].name+'(document.forms['+f+'],this)');");
                            
                          }
                  }
          
        }
       }}
    }
}

function DOM(parent_,type,id,index)
{
    
    switch(type)
      {
          case 'id':
            return document.getElementById(id);
          case 'name':
            return (typeof index=='undefined')?document.getElementsByName(id):document.getElementsByName(id)[index];
          case 'frm':
          
            if(typeof index!='undefined' && typeof parent_.elements[id][index]=='undefined')return parent_.elements[id];
            return (typeof index=='undefined')?parent_.elements[id]:parent_.elements[id][index];
      }
}

function check(obj)
{ 
  
  if(typeof obj.length=='undefined')return (obj.checked==true)?1:-1;
  for(i=0;i<obj.length;++i)
    {
        if(obj[i].checked)return i;
    }
  
  return -1;
}

function setClassName(obj,ix,arr)
{
  if(ix)arr.reverse();
  obj.className=String(obj.className).replace(new RegExp(arr[0]),arr[1]);
  
  return ix;
}



