
//get pref. cookie
  function prefcookie(){
  
  if(document.cookie){
     a = document.cookie;
     refintervall = a.substring(0,a.search('='));
     relinterv = a.substring(a.search('=')+1,a.search(';'));
     if(relinterv == '')
     {relinterv = a.substring(a.search('=')+1,a.length);}
     
     a = a.substring(a.search(';')+1,a.length);
     sourcen1 = a.substring(0,a.search('='));
     sourcen = a.substring(a.search('=')+1,a.search(';'));
     if(sourcen == '')
     {sourcen = a.substring(a.search('=')+1,a.length);}

     a = a.substring(a.search(';')+1,a.length);
     sidebrfunction = a.substring(0,a.search('='));
     sidebrfunc = a.substring(a.search('=')+1,a.search(';'));
     if(sidebrfunc == '')
     {sidebrfunc = a.substring(a.search('=')+1,a.length);}

     a = a.substring(a.search(';')+1,a.length);
     zoomvalue = a.substring(0,a.search('='));
     zoom = a.substring(a.search('=')+1,a.search(';'));
     if(zoom == '')
     {zoom = a.substring(a.search('=')+1,a.length);}
  
  }else { 
    relinterv = 30000;
    sourcen = "rf";
    sidebrfunc ="info";
    zoom = 7
    alert("pse allow cookie")
    }
 }

//set pref. cookie
 function userpref(){
   var a = new Date();
   a = new Date(a.getTime() +1000*60*60*24*365);
   document.cookie="refintervall="+relinterv+";expires="+a.toGMTString()+";";
   document.cookie="sourcen1="+sourcen+";expires="+a.toGMTString()+";";
   document.cookie="sidebrfunction="+sidebrfunc+";expires="+a.toGMTString()+";";
   document.cookie="zoomvalue="+zoom+";expires="+a.toGMTString()+";";
   document.cookie="ende="+end+";expires="+a.toGMTString()+";";
 }

// set/save refresh interval
function setref() {
   refinterval = document.ref.inp.value;
   relinterv = refinterval + "000";
   userpref();
 }

// set/save sidebar function (html-window)                             
function setsidebar() {
  sidebrfunc = document.ref.sidebarfunction.value;
  userpref();
 }
                             
// set/save source (data.xml)
function setsource() { 
sourcen = document.ref.sourcefunction.value;
  userpref();
 }
                       
//set/save map zoom
function setzoom() { 
  zoomfactor = document.ref.zoomfunc.value;
  if (zoomfactor == 1) {
      zoom = 1
 }if (zoomfactor == 2) {
      zoom = 2
 }if (zoomfactor == 4) {
      zoom = 4
 }if (zoomfactor == 5) {
      zoom = 5
 }if (zoomfactor == 6) {
      zoom = 6
 }if (zoomfactor == 7) {
      zoom = 7
 }if (zoomfactor == 8) {
      zoom = 8
 }if (zoomfactor == 9) {
      zoom = 9
 }if (zoomfactor == 10) {
      zoom = 10
 }if (zoomfactor == 11) {
      zoom =11
 }if (zoomfactor == 12) {
      zoom = 12
 }if (zoomfactor == 13) {
     zoom = 13
 }
 map.setZoom(zoom)
 userpref();  
}
                         
function zoompos(){
  if (zoom == 1) {
      myzoom = 1
 }if (zoom == 2) {
      myzoom = 2
 }if (zoom == 4) {
      myzoom = 4
 }if (zoom == 5) {
      myzoom = 5
 }if (zoom == 6) {
      myzoom = 6
 }if (zoom == 7) {
      myzoom = 7
 }if (zoom == 8) {
      myzoom = 8
 }if (zoom == 9) {
      myzoom = 9
 }if (zoom == 10) {
      myzoom = 10
 }if (zoom == 11) {
      myzoom =11
 }if (zoom == 12) {
      myzoom = 12
 }if (zoom == 13) {
      myzoom = 13
   }
 }
                                      
//preselect dropdown listings       
function Preselect(listing){
    var Dropdown = document.ref.sourcefunction;
    for (iLoop = 0; iLoop< Dropdown.options.length; iLoop++){    
    if (Dropdown.options[iLoop].value == listing){
        Dropdown.options[iLoop].selected = true;
        break;
        }
      } 
    }
function Preselect1(listing){
     var Dropdown = document.ref.inp;
     for (iLoop = 0; iLoop< Dropdown.options.length; iLoop++){    
     if (Dropdown.options[iLoop].value == listing){
         Dropdown.options[iLoop].selected = true;
         break;
         }
       } 
     }
function Preselect2(listing){
     var Dropdown = document.ref.sidebarfunction;
     for (iLoop = 0; iLoop< Dropdown.options.length; iLoop++){    
      if (Dropdown.options[iLoop].value == listing){
          Dropdown.options[iLoop].selected = true;
          break;
          }
        } 
      }
function Preselect3(listing){
     var Dropdown = document.ref.zoomfunc;
     for (iLoop = 0; iLoop< Dropdown.options.length; iLoop++){    
      if (Dropdown.options[iLoop].value == listing){
          Dropdown.options[iLoop].selected = true;
          break;
          }
         } 
       }
       
//start at myposition
function gohome() {
  map.setCenter(myposition, zoom);
}
