//******** GLOBALE VARIABLEN ***************************************************************
var baugebiet="";
var photos=new Array();
var which=0;
var info_text="";
var info_x=10;
var info_y=10;

//******************************************************************************************
//------------------------------------------------------------------------------------------
function baugeb(wert){
baugebiet=wert;

}
//------------------------------------------------------------------------------------------
function statustext(text)
{
  window.defaultStatus = text;
}
//------------------------------------------------------------------------------------------
function neu(url){
win2=window.open("dummy_mitte.html","Fenster1","width=310,height=400,left=0,top=0");
}
//------------------------------------------------------------------------------------------
function wechsler(bild,url){
document.images[bild].src=""+ url + "";
}
//------------------------------------------------------------------------------------------
function anker(){
//var lay=document.getElementById('layer_mitte').layer.document.location.href="#bauleitplanung";
// lay=document.location.href="lei_sta.html#bauleitplanung";
//lay.location.href = "#bauleitplanung";
//var lay=document.getElementById('layer_mitte');
//var name=document.getElementById('layer_mitte').anchors[3].y;
//var name2=window-location.hash;
//lay.document.layers.location.href="../kap_lei/lei_sta.html#machbarkeitsstudien"
//alert(name);
}
//------------------------------------------------------------------------------------------
function menu_stadtentwicklumg(){
document.write("<table width='*' cellspacing=3 cellpadding=4>");
document.write("<tr><td>hallo");
document.write("</td></tr></table>");
//document.write("");
document.write("</table>");
}
//------------------------------------------------------------------------------------------
function new_win(win_url,win_name,win_width,win_height,links,oben)
      {
      win2=open(win_url,win_name, "width="+win_width+",height="+win_height+",left="+links+",top="+oben);
      win2.focus();
      }
//------------------------------------------------------------------------------------------
function new_win2(win_url,win_name,win_width,win_height,links,oben)
      {
      win2=open(win_url,win_name, "width="+win_width+",height="+win_height+",left="+links+",top="+oben+",scrollbars=yes");
      win2.focus();
      }
//------------------------------------------------------------------------------------------
function new_win5(win_url,win_name,win_width,win_height,links,oben){

    // Wenn ie
    if(navigator.appName.indexOf("Explorer") != -1){
    win_width=win_width-3;
    }
    win2=open(win_url,win_name, "width="+win_width+",height="+win_height+",left="+links+",top="+oben+",scrollbars=yes,resizable=yes");
    win2.focus();
}
//------------------------------------------------------------------------------------------
function new_win3(win_url,win_name)
      {
      win3=open(win_url,win_name,"channelmode=yes,directories=yes,scrollbars=yes,resizable=yes");
      win3.focus();
      }
//------------------------------------------------------------------------------------------
function new_window(win_url,win_name,win_width,win_height,links,oben)
      {
      win2=open(win_url,win_name, "width="+win_width+",height="+win_height+",left="+links+",top="+oben+",resizable=yes");
      win2.focus();
      }
//------------------------------------------------------------------------------------------
function zu(){
document.close();
}
//------------------------------------------------------------------------------------------
//**************PHOTOSLIDER*****************************************************************
function backward(){
         if (which>0){
         window.status='';
         which--;
         document.images.photoslider.src=photos[which];
         }
}

function forward(){
         if (which<photos.length-1){
         which++
         document.images.photoslider.src=photos[which]
         }
         else window.status='Ende der Bilder'
         //which=1;backward();return false
}
//**************PHOTOSLIDER*****************************************************************
//------------------------------------------------------------------------------------------
function farbe(el,farb){
        col=document.getElementById(el).style;
        col.color=farb;
}
//------------------------------------------------------------------------------------------
function info(job,text){  // Info Fenster allgemein
          if(parseInt(navigator.appVersion) >= 4){ //Browser-Check
             if(navigator.appName=="Netscape"){
                alt_x=info_x+15;
                alt_y=info_y+15;
             }
             else{
               alt_x = window.event.x+15;
               alt_y = window.event.y+15;
             }
          }
         //-----------------
          anz=text.length;
          //-----------------

         inf=document.getElementById("layer_info").style;
         if(job !="aus"){
          //-----------------
          for(i=0;i<anz;i++){
              var info_inhalt = document.createTextNode(text[i]);
              var info_br     = document.createElement("br");
              document.getElementById("layer_info").appendChild(info_inhalt);
              document.getElementById("layer_info").appendChild(info_br);
          }
          //-----------------
          inf.left=alt_x;
          inf.top=alt_y;
          inf.visibility="visible";
         }
         if(job=="aus"){;
          //-----------------
          var anzahl=document.getElementById("layer_info").childNodes.length;
          for(i=0;i<anzahl;i++){
              var knoten=document.getElementById("layer_info").firstChild;
              document.getElementById("layer_info").removeChild(knoten);
          }
          //-----------------
          inf.visibility="hidden";
         }
}
//------------------------------------------------------------------------------------------
function info_coord(ereignis){     // speichert die aktuellen Mouse- Koordinaten
         if(parseInt(navigator.appVersion) >= 4){ //Browser-Check
             if(navigator.appName=="Netscape"){
               info_x=ereignis.pageX;
               info_y=ereignis.pageY;
               return info_x;
              return info_y;
             }
          }

}
//------------------------------------------------------------------------------------------
function info2(job,text){  //Info-Fenster  --> tabellarische Darstellung mit 6 Zellen
          if(parseInt(navigator.appVersion) >= 4){ //Browser-Check
             if(navigator.appName=="Netscape"){
                alt_x=info_x+10;
                alt_y=info_y;
             }
             else{
               alt_x = window.event.x+10;
               alt_y = window.event.y;
             }
          }
         //-----------------
          anz=text.length;
          //-----------------

         inf=document.getElementById("layer_info").style;
         if(job !="aus"){
          //-----------------
          document.getElementById("a").firstChild.nodeValue=text[0];
          document.getElementById("b").firstChild.nodeValue=text[1];
          document.getElementById("c").firstChild.nodeValue=text[2];
          document.getElementById("d").firstChild.nodeValue=text[3];
          document.getElementById("e").firstChild.nodeValue=text[4];
          document.getElementById("f").firstChild.nodeValue=text[5];
          document.getElementById("h").firstChild.nodeValue=text[6];
          document.getElementById("j").firstChild.nodeValue=text[7];
          //-----------------
          inf.left=alt_x;
          inf.top=alt_y;
          inf.visibility="visible";
         }
         if(job=="aus"){;
          //-----------------
          //-----------------
          inf.visibility="hidden";
         }
}

//------------------------------------------------------------------------------------------
function uk_foto(bild){
  foto=bild;
 var win_foto=window.open("dummy.html","foto_fenster","width=660,height=560, left=100,top=100, resizable=no, scrollbars=no");

     win_foto.focus();
     //win_foto.document.write("<br>Hallo");
}
//------------------------------------------------------------------------------------------
function uk_foto2(bild){
 var win_foto=window.open("","foto_fenster","width=660,height=560, left=100,top=100, resizable=no, scrollbars=no");
     win_foto.focus();
     win_foto.document.write("<center>");
     win_foto.document.write("<table width='250' height='270' cellspacing=0 cellpadding=0 bgcolor='#cccccc' border=0><tr  height='90%'><td style='vertical-align:middle;text-align:center;'>");
     win_foto.document.write("<img name='foto' src="+bild+">");
     win_foto.document.write("</td></tr>");
     win_foto.document.write("<tr height='10%'><td style='vertical-align:middle;text-align:right;'>")
     win_foto.document.write("<a href='javascript:this.close()'><p style='color: #525252;text-decoration:none;'>Schliessen</p></a>") ;
     win_foto.document.write("</td></tr></table>");
     win_foto.document.write("</center>");

}
//------------------------------------------------------------------------------------------
function uk_foto3(bild){
 var win_foto=window.open(bild,"foto_fenster","width=660,height=560, left=100,top=100, resizable=no, scrollbars=no");
     win_foto.focus();

}
//------------------------------------------------------------------------------------------
function checkEmail(adr){
   var res=true;
   //Erzeugen des Paterns als regular expression
   var re_email = /^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,3})$/;

   // Anwenden des Patterns gegen die zu üprüfende E-Mail
   if ((re_email.test(adr))==false || adr.length<10) {
      //alert("E-Mail-Adresse falsch!");
      res = false;
   }
   return res;
}
//------------------------------------------------------------------------------------------
function bild_wechsler_1(obj,ziel_src){
   obj.src=ziel_src;
   return 1;
}
//------------------------------------------------------------------------------------------
function wechselBgColor(element,color){
   if(this.document.getElementById(element)){
   this.document.getElementById(element).style.background=color;
   }
}
//------------------------------------------------------------------------------------------
function showLayer(element){
   if(this.document.getElementById(element)){
    this.document.getElementById(element).style.visibility='visible';
   }
}
//------------------------------------------------------------------------------------------
function hideLayer(element){
   if(this.document.getElementById(element)){
    this.document.getElementById(element).style.visibility='hidden';

   }
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
function drucken_ohne(kopf,fuss){
  factory.printing.header = kopf;
  factory.printing.footer = fuss+"............."+"Datum : "+"&d"+" .............Seite : "+"&p"+"/"+"&P";
  factory.printing.Print(true);
}
//------------------------------------------------------------------------------------------
function drucken_ohne2(kopf,fuss,fenster){

  factory.printing.header = kopf;
  factory.printing.footer = fuss+"&b&d&b"+"Seite : "+"&p"+"/"+"&P";
  factory.printing.Print(true);
}
//------------------------------------------------------------------------------------------
function drucken_ohne3(kopf,fuss,fenster){
  if(!factory.printing){
     print();
  }
  else{
  factory.printing.header = kopf;
  factory.printing.footer = fuss+"&b&d&b"+"Seite : "+"&p"+"/"+"&P";
  factory.printing.portrait = true;
  factory.printing.leftMargin = 5.0;
  factory.printing.topMargin = 5.0;
  factory.printing.rightMargin = 5.0;
  factory.printing.bottomMargin = 5.0;
  factory.printing.Print(true);
  }

}
//------------------------------------------------------------------------------------------
function drucken_ohne4(kopf,fuss,fenster){
  if(!factory.printing){
     print();
  }
  else{
  factory.printing.header = kopf;
  factory.printing.footer = fuss+"&b&d&b"+"Seite : "+"&p"+"/"+"&P";
  factory.printing.portrait = false;
  //factory.printing.landscape = true;
  factory.printing.leftMargin = 5.0;
  factory.printing.topMargin = 5.0;
  factory.printing.rightMargin = 5.0;
  factory.printing.bottomMargin = 5.0;
  factory.printing.Print(true);
  }

}
//------------------------------------------------------------------------------------------
function drucken_scriptx_1(kopf,fuss,fenster){
  fenster.factory.printing.header = kopf;
  fenster.factory.printing.footer = fuss+"&b&d&b"+"Seite : "+"&p"+"/"+"&P";
  fenster.factory.printing.portrait = true;
  fenster.factory.printing.Print(true);
}
//------------------------------------------------------------------------------------------
function drucken_scriptx_1_quer(kopf,fuss,fenster){
  fenster.factory.printing.header = kopf;
  fenster.factory.printing.footer = fuss+"&b&d&b"+"Seite : "+"&p"+"/"+"&P";
  fenster.factory.printing.portrait = false;
  fenster.factory.printing.Print(true);
}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
function checkNurZahl(zahl){
   var res=true;
   //Erzeugen des Paterns als regular expression
   var re_zahl = /^([0-9])*$/;

   // Anwenden des Patterns gegen die zu üprüfende Zahl
   if ((re_zahl.test(zahl))==false) {
      //alert("Zahl falsch!");
      res = false;
   }
   return res;
}
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
function select_window_to_print(){

   if(parent.main.bericht_nach_konten){
       drucken_scriptx_1_quer("","TerraMag GmbH",parent.main.bericht_nach_konten);
   }
   if(parent.main.bericht_nach_empfaenger){
       drucken_scriptx_1_quer("","TerraMag GmbH",parent.main.bericht_nach_empfaenger);
   }
   if(parent.main.statistik_nach_konten){
       drucken_scriptx_1("","TerraMag GmbH",parent.main.statistik_nach_konten);
   }
   if(parent.main.statistik_projekt_uebersichten){
       drucken_scriptx_1("","TerraMag GmbH",parent.main.statistik_projekt_uebersichten);
   }

}
//---------------------------------------------------------------------------------------------
function resizeIframeComeFromSufuErw(sizeasstyle){
         var hoehe;

         hoehe=document.all.fensterdaten_inhalt.offsetHeight;
         switch(sizeasstyle){
            case "1":
               top.document.getElementById('liste').style.height=hoehe+50;
            break;
            default:
               top.document.getElementById('liste').height=hoehe+50;
            break;
         }


         return true;
      }
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
function resizeIframeComeFromSufuErwXandY(sizeasstyle){
         var hoehe;
         var breite;

         hoehe=document.all.fensterdaten_inhalt.offsetHeight;
         breite=document.all.fensterdaten_inhalt.offsetWidth;

         switch(sizeasstyle){
            case "1":
               top.document.getElementById('liste').style.height=hoehe+50;
               top.document.getElementById('liste').style.width=breite;
            break;
            default:
               top.document.getElementById('liste').height=hoehe+50;
               top.document.getElementById('liste').width=breite;
            break;
         }


         return true;
      }
//---------------------------------------------------------------------------------------------
function browserweiche(){
    if(navigator.appName=="Netscape"){
       browserv="ns";
    }
    else if(navigator.appName=="Microsoft Internet Explorer"){
       browserv="ie";
    }
    else{
        browserv="ie";
    }
    return browserv;
}
//---------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
//id in div element speichern
function saveShowexp(Id){

   parent.document.getElementById("showexp").innerHTML = Id;
   parent.document.getElementById("showexp_aktuell").innerHTML = "ja";
   return false;
}
//------------------------------------------------------------------------------------------
//Die funktion ermittelt den link
//   bei "haeuser" "wohnungen" und "grundstuecke" :zum aktuellen Expose mit typ_main.php?showexp=id aus dem div "showexp"
//   bei "suche" den link zum aktuellen ergebnis
function linkFreundSenden(Typ){
   var link;
   if(document.getElementById("showexp").innerHTML && document.getElementById("showexp_aktuell").innerHTML == "ja"){
      //wenn id in div gespeichert
      link = window.location.hostname + "/module_wg/" + Typ + '/' + Typ + '_main.php?showexp=' + document.getElementById("showexp").innerHTML;

   }
   else{//wenn kein expose gespeichert
      if(link_SESSION){//wenn suchstring vorhanden
         link=window.location.hostname + "/module_wg/" + Typ + '/' + Typ + '_main.php' + link_SESSION;
         if(aktuelleSeite != 0) link += '&aktuelleSeite='+ aktuelleSeite;//wenn aktuelle Seite gespeichert
         if(anzZeilen != 0) link += '&anzZeilen='+ anzZeilen;//anzzeilen
         if(sort != 0) link += '&sort='+ sort;//sort
         if(dir != 0) link += '&dir='+ dir;//dir hinzufürgen
         if(records_ansicht != '') link += '&records_ansicht='+ records_ansicht;//dir hinzufürgen

      }
      else{//wenn keine suche oder expose: startseite des typs
         link = window.location.hostname + "/module_wg/" + Typ + '/' + Typ + '_main.php';
      }
   }
    link = encodeURIComponent(link);
    window.open("../../module_wg/freund_senden/form_freund.php?page=" + link  ,"Kontakt","width=600,height=480,left=40,top=80");

}
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
function resizeIframeListeForAtts(sizeasstyle,hoehe,anzAtts,task){
         //var hoehe;
         //hoehe=document.all.liste.offsetHeight;

         var bw=browserweiche();
         var hoeheDelta;
         if(task=="plus"){
            hoeheDelta=anzAtts*20;
         }
         else if(task=="minus"){
            if(bw=="ie"){
               hoeheDelta=anzAtts*20*(-1);
            }
            else{
               hoeheDelta=anzAtts*20*(-1)*0;
            }
         }

         switch(sizeasstyle){
            case "1":
               top.document.getElementById('liste').style.height=hoehe+hoeheDelta;
            break;
            default:
               top.document.getElementById('liste').height=hoehe+hoeheDelta;
            break;
         }


         return true;
      }
//---------------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------