/**
 * oft genutzte Objekte in DHTML:
 *  Coord
 *  Canvas
 * oft genutzt Funktionen in DHTML
 *  @return LayerReference getLayerRef(String ID)
 *  @return void setPosition(LayerReference objLayer, Coord coords)  
 *  @return void setVisibility(LayerReference objLayer, boolean visible)
 *  @return Coord getMouseXY(evt)
 *  @return void setVisibility4DivByPrefix(prefix, visible)
 */

// Objekte
function Coord(x, y){
  this.x = (!x)?0:x;
  this.y = (!y)?0:y;
  
  this.toString = objToString;
  this.equals = equalsCoord;
}

function Canvas(x, y, width, height){
  this.width = (!width)?0:width;
  this.height = (!height)?0:height;
  
  this.Coord = Coord;
  this.Coord(x, y);
  
  this.equalsCoord = this.equals;
  this.equals = equalsCanvas;
}

function objToString(){
  var ret = "{";
  for(p in this ){
    if (typeof this[p] == "function" || typeof this[p] == "object") continue;
    if(ret.length > 1)
      ret += ",";
    ret += p + ":" + this[p];
  }
  return ret + "}";
}

function equalsCoord(/*Coord*/ c){
  return (this.x == c.x && this.y == c.y);
}
function equalsCanvas(/*Canvas*/ c){
  return ( this.equalsCoord == c.equalsCoord && this.width == c.width && this.height == c.height);
}

// Funktionen

function getLayerRef (id, document) {
  if (!document)
    document = window.document;
  if (document.layers) {
    for (var l = 0; l < document.layers.length; l++)
      if (document.layers[l].id == id)
        return document.layers[l];
    for (var l = 0; l < document.layers.length; l++) {
      var result = getLayerRef(id, document.layers[l].document);
      if (result)
        return result;
    }
    return null;
  }
  else if (document.all) {
    return document.all[id];
  }
  else if (document.getElementById) {
    return document.getElementById(id);
  }
}

function setPosition(objLayer, coords){

    if (document.layers) {
      objLayer.top = coords.y;
      objLayer.left = coords.x;
    } else if (window.opera) {
      objLayer.style.top = coords.y;
      objLayer.style.left = coords.x;
    } else if (document.all) {
      objLayer.style.top = coords.y;
      objLayer.style.pixelLeft = coords.x;
    } else if (document.getElementById) {
      objLayer.style.top = coords.y + 'px'; 
      objLayer.style.left = coords.x + 'px';
    }
}

function setVisibility(objLayer, visible) {

  if(document.layers){
    objLayer.visibility  = 
        (visible == true) ? 'show' : 'hide';
  } else {
    objLayer.style.visibility = 
        (visible == true) ? 'visible' : 'hidden';
  }

}

function setVisibility4DivByPrefix(prefix, visible, d){
  if (!d)
    d = window.document;

  if(document.layers){
    for (var l = 0; l < d.layers.length; l++){
      if(d.layers[l].id.substr(0, prefix.length ) == prefix)
        setVisibility(d.layers[l], visible);
      setVisibility4DivByPrefix(prefix, 
                                visible, 
                                d.layers[l].document);
    }

  } else if(document.all) {

    var layers = document.all.tags("div"); 
    for(i=0; i < layers.length; i++) { 
      if(layers[i].id.substr(0, prefix.length ) == prefix )
        setVisibility(document.all.tags("div")[i], visible);
    }

  } else if(document.getElementsByTagName) {

    var layers = document.getElementsByTagName("div");
    for(i=0; i < layers.length; i++){
      if(layers[i].id.substr(0, prefix.length ) == prefix)
        setVisibility(layers[i], visible);
    }

  }
}

function getMouseXY(evt) {
  e = evt || window.event;
  if(!e) return null;
  
  if(document.layers) {
    return new Coord(e.pageX, e.pageY);
  }else if(window.opera){
    return new Coord(e.clientX, e.clientY);
  }else if(document.all ) {
    return new Coord(e.clientX + document.body.scrollLeft, e.clientY + document.body.scrollTop);
  }else if(document.getElementById) {
    return new Coord(e.pageX , e.pageY );
  }
}

function Kamera1() {
 setVisibility(getLayerRef('cam1') , false);
 MeinFenster =
 window.open("index.php?id=673", "cam1", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera2() {
 setVisibility(getLayerRef('cam2') , false);
 MeinFenster =
 window.open("index.php?id=674", "cam2", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera3() {
 setVisibility(getLayerRef('cam3') , false);
 MeinFenster =
 window.open("index.php?id=675", "cam3", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera4() {
 setVisibility(getLayerRef('cam4') , false);
 MeinFenster =
 window.open("index.php?id=676", "cam4", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera5() {
 setVisibility(getLayerRef('cam5') , false);
 MeinFenster =
 window.open("index.php?id=679", "cam5", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera6() {
 setVisibility(getLayerRef('cam6') , false);
 MeinFenster =
 window.open("index.php?id=680", "cam6", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera7() {
 setVisibility(getLayerRef('cam7') , false);
 MeinFenster =
 window.open("index.php?id=677", "cam7", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function Kamera8() {
 setVisibility(getLayerRef('cam8') , false);
 MeinFenster =
 window.open("index.php?id=678", "cam8", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function C1() {
 setVisibility(getLayerRef('C1') , false);
 MeinFenster =
 window.open("index.php?id=697", "C1", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function C2() {
 setVisibility(getLayerRef('C2') , false);
 MeinFenster =
 window.open("index.php?id=698", "C2", "width=520,height=465,scrollbars:no");
 MeinFenster.focus();
}

function C3() {
 setVisibility(getLayerRef('C3') , false);
 MeinFenster =
 window.open("index.php?id=699", "C3", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3601() {
 setVisibility(getLayerRef('p3601') , false);
 MeinFenster =
 window.open("index.php?id=681", "3601", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3602() {
 setVisibility(getLayerRef('p3602') , false);
 MeinFenster =
 window.open("index.php?id=682", "3602", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3603() {
 setVisibility(getLayerRef('p3603') , false);
 MeinFenster =
 window.open("index.php?id=683", "3603", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3604() {
 setVisibility(getLayerRef('p3604') , false);
 MeinFenster =
 window.open("index.php?id=684", "3604", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3605() {
 setVisibility(getLayerRef('p3605') , false);
 MeinFenster =
 window.open("index.php?id=685", "3605", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3606() {
 setVisibility(getLayerRef('p3606') , false);
 MeinFenster =
 window.open("index.php?id=686", "3606", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function a3607() {
 setVisibility(getLayerRef('p3607') , false);
 MeinFenster =
 window.open("index.php?id=687", "3607", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i1() {
 setVisibility(getLayerRef('inf1') , false);
 MeinFenster =
 window.open("index.php?id=688", "i1", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i2() {
 setVisibility(getLayerRef('inf2') , false);
 MeinFenster =
 window.open("index.php?id=689", "i2", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i3() {
 setVisibility(getLayerRef('inf3') , false);
 MeinFenster =
 window.open("index.php?id=690", "i3", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i4() {
 setVisibility(getLayerRef('inf4') , false);
 MeinFenster =
 window.open("index.php?id=691", "i4", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i5() {
 setVisibility(getLayerRef('inf5') , false);
 MeinFenster =
 window.open("index.php?id=692", "i5", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i6() {
 setVisibility(getLayerRef('inf6') , false);
 MeinFenster =
 window.open("index.php?id=693", "i6", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i7() {
 setVisibility(getLayerRef('inf7') , false);
 MeinFenster =
 window.open("index.php?id=694", "i7", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i8() {
 setVisibility(getLayerRef('inf8') , false);
 MeinFenster =
 window.open("index.php?id=695", "i8", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}

function i9() {
 setVisibility(getLayerRef('inf1') , false);
 MeinFenster =
 window.open("index.php?id=696", "i9", "width=520,height=465,scrollbars:no");
  MeinFenster.focus();
 
}
