

var lastactive = false;

function shownavi(subnavi)
{
     elem = document.getElementById(subnavi);
     
     if (elem != null)
     {
        elem.style.display = "block";
        elem.style.zIndex = 90;
     }
     
     if (lastactive != false && lastactive != subnavi) hidesubnavi(lastactive);
     lastactive = subnavi;
}

function hidenavi(subnavi)
{
     elem = document.getElementById(subnavi);
     if (elem != null)
     {
        elem.style.display = "none";
     }
}

function showsubnavi(subnavi)
{
     elem = document.getElementById(subnavi);
     elem.style.display = "block";
     elem.style.zIndex = 90;
     
     if (lastactive != false && lastactive != subnavi) hidesubnavi(lastactive);
     lastactive = subnavi;
}

function hidesubnavi(subnavi)
{
     elem = document.getElementById(subnavi);
     if (elem != null) elem.style.display = "none";
}
    
    
    function grpform(vars, divid, formname)
    {
      var count = document.eval(formname).part_ids.length;
      
      //alert (count);
      
      var url = "/core/httprequest.php?"+vars;
      
      for (i = 1; i < count; i++)
      {
	    if (document.eval(formname).part_ids[i].selected == true)
	    {
		var part_id = document.eval(formname).part_ids[i].value;
	        url += '&part_ids['+ i +']='+ part_id;
	    }
      }
      
      if (vars != "")
      {
          if(window.XMLHttpRequest)req=new XMLHttpRequest();
          else if(window.ActiveXObject)req=new ActiveXObject("Microsoft.XMLHTTP");
        
          if(req)
          {
            req.onreadystatechange = function()
            {
              
              if(req.readyState==4) // complete
              {
                if(req.status==200) // OK
                {
                  xmldoc=req.responseText;
                  if(xmldoc)
                  {
                    document.getElementById(divid).innerHTML = xmldoc;
                  }
                  //else document.getElementById(divid).innerHTML = "hier";
                }
                else alert("Fehler: "+req.status);
              }
              
            }
            
            req.open("GET",url,true);
            req.send(null);
          }
      }
      //else document.getElementById(divid).innerHTML = "hier";
    }
    
    
    var ie  = document.all;
    var nn6 = document.getElementById && !document.all;
    var ie5 = document.getElementById && document.all && document.styleSheets;
    var opera = window.opera;
    var op5=(document.getElementById&&document.all&&!document.styleSheets)?1:0;


    function closebild()
    {
          document.getElementById("edit1").innerHTML = "";
          document.getElementById("edit1").style.height = "0";
          document.getElementById("edit1").style.width = "0";
          document.getElementById("edit2").innerHTML = "";
          document.getElementById("edit2").style.height = "0";
          document.getElementById("edit2").style.width = "0";
          
    }

    var bild = false;
    var scrollpos = false;
    var fensterhoehe = false;
    
    function ajaxbild(bild, kunde, tiefe, lang)
    {

      if (tiefe == 1) pfad = "../core/";
      else pfad = "core/";
      
      var url = pfad+"httprequest.php?go_target=ajaxbild&image_id="+bild+"&_k="+kunde+"&tiefe="+tiefe;
      
      if (lang) url += "&_l="+lang;
      
      
      if (bild != "")
      {
          if(window.XMLHttpRequest)req=new XMLHttpRequest();
          else if(window.ActiveXObject)req=new ActiveXObject("Microsoft.XMLHTTP");
        
          if(req)
          {
            req.onreadystatechange = function()
            {
              
              if(req.readyState==4) // complete
              {
                if(req.status==200) // OK
                {
                  xmldoc=req.responseText;
                  if(xmldoc)
                  {
                    
                    //hintergrund
                    
					var browserName = navigator.appName;
 					var browserVersion = parseInt(navigator.appVersion);
					
					
					
                    if (opera) document.getElementById("edit1").style.backgroundImage = "url("+ pfad +"js/overlay_schwarz.png)";
                    else document.getElementById("edit1").style.backgroundColor = "#000000";
                    if (ie) document.getElementById("edit1").style.filter = "alpha(opacity=30)";
                    else if (nn6) document.getElementById("edit1").style.MozOpacity = "0.3";
                    
                    scrollpos = nn6 ? window.pageYOffset : document.documentElement.scrollTop;
                    fensterhoehe = nn6 ? window.innerHeight : document.documentElement.clientHeight;
                    
					if(browserName == "Microsoft Internet Explorer" && browserVersion < 6)
					{
						fensterhoehe = top.document.body.clientHeight;
					}
					
                    if (opera) fensterhoehe = window.innerHeight;
                    
                    document.getElementById("edit1").style.width = "100%";
                    
                    if (nn6) 
                    {
                        if(document.body.offsetHeight > window.innerHeight)
                            document.getElementById("edit1").style.height = document.body.offsetHeight+"px";
                        else
                            document.getElementById("edit1").style.height = window.innerHeight+"px";
                    }
                    else if (opera)
                    {
                        if(document.body.offsetHeight > window.innerHeight)
                            document.getElementById("edit1").style.height = document.body.offsetHeight+"px";
                        else
                            document.getElementById("edit1").style.height = window.innerHeight+"px";                 
                    }
                    else
                    {
						if(browserName == "Microsoft Internet Explorer" && browserVersion < 6)
						{
							document.getElementById("edit1").style.height = window.event.clientY+top.document.body.clientHeight+"px";
						}
						else
						{
                        	document.getElementById("edit1").style.height = top.document.body.clientHeight+"px";             
                    	}
					}
                    alert (window.event.clientY);
                    
                    document.getElementById("edit2").style.left = "-1000px";
                    document.getElementById("edit2").style.top = "-1000px";
                    document.getElementById("edit2").innerHTML = xmldoc;
                    
                    setTimeout("ajaxbildPosition("+bild+", "+fensterhoehe+")", 200);
                  }
                }
                else alert("Fehler: "+req.status);
              }
              
            }
            
            req.open("GET",url,true);
            req.send(null);
          }
      }
    }
    
    function ajaxbildPosition(bild_id, fensterhoehe)
    {
            breite = document.getElementById("bild"+bild_id).width + 20;
            hoehe = document.getElementById("bild"+bild_id).height;
            
            links = (document.body.offsetWidth - breite) / 2;
            oben =  scrollpos + ((fensterhoehe - hoehe) / 2);                    
            
            document.getElementById("edit2").style.left = links+"px";
            document.getElementById("edit2").style.top = oben+"px";
            
            document.getElementById("edit2").style.width = (breite) + "px";
            document.getElementById("edit2").style.height = (hoehe) + "px";
    }
    
    
    function divaus(divname)
    {
    	if (document.getElementById)
        { 
        
          var len = document.getElementById(divname).length;
          var p = document.getElementById(divname).style;
          
          if (p.display == "block") p.display = "none";
          else p.display = "block";
    	}
    }
    
    function divan(divname)
    {
    	if (document.getElementById)
        {
          var len = document.getElementById(divname).length;
          var p = document.getElementById(divname).style;
          p.display = "block";
        }
    }
    
    function soft()
    {
     
        var nn6=document.getElementById&&!document.all;
     
        alert(document.all.bodyid.offsetHeight); 
     
    	if (document.getElementById)
        {
          var p = document.getElementById("soft").style;
          p.display = "block";
        }
    }
    
    
    var ur = document.URL;
    function divshow(divid)
    {
        var element = document.getElementById(divid);
        if (element.style.display == "none" || ur.match(/nsin/i)) element.style.display = "block";
        else element.style.display = "none";
    }
    
    function divnameaus(divname)
    {
      
    	if (document.getElementsByName)
        { 
          var len = document.getElementsByName(divname).length;
        
          for(var i = 0; i < len; i++)
          {	
               with (document.getElementsByName(divname)[i])
               {
                    if (style.display == "none") style.display = "block";
                    else style.display = "none";
               }
          }
    	}
    }
    
    function anfuegen(formular, feld, data)
    {
        var mom = document.eval(formular).eval(feld).value;
        
        var separator = ",";
        if (mom == "") var separator = "";
        
        if(data != "") document.eval(formular).eval(feld).value = mom+separator+data;
    }
    
    function change_l(wo, sprache)
    {
        if (sprache != "")
        {
            if (sprache == 0)
            {
                location.href = wo+"&clean_lang=1";
            }
            else
            {
                location.href  = wo+"&_l="+sprache;
            }
        }
    }
    
    function opensuche(feldvalue, pfad)
    {
      if (feldvalue != "")
      {
          var url = pfad+"/httprequest.php?feldvalue="+feldvalue;
          
          if(window.XMLHttpRequest)req=new XMLHttpRequest();
          else if(window.ActiveXObject)req=new ActiveXObject("Microsoft.XMLHTTP");
        
          if(req)
          {
            req.onreadystatechange=callback;
            req.open("GET",url,true);
            req.send(null);
          }
      }
      else document.getElementById("suchtext").innerHTML = "";
    }
    
    function callback()
    {
      if(req.readyState==4) // complete
      {
        if(req.status==200) // OK
        {
          xmldoc=req.responseText;
          if(xmldoc)
          {
             document.getElementById("suchtext").innerHTML = xmldoc;
          }
        }
        else alert(req.status);
      }
    }

    function nachfragen(message,ziel)
    {
	    var is_confirmed = confirm(message);
	    if(is_confirmed == true){
		    location.href = ziel;
	    }
    }
    
    function navi_over(bild,quelle)
    {
        var b = eval(document.images[bild]);
        b.src = quelle;
    }
    
    
    function js_meldung (meldung)
    {
      var neu_m = meldung.replace("|","\n");
      neu_m = neu_m.replace("<br />","\n");
      neu_m = neu_m.replace("<br />","\n");
      alert (neu_m);
    }
    
    
    
    
    
    
    
    
    
    
  

