///////////////////////////////////////////
//copyright 2003
//ahhh kah! GmbH www.akbs.de
//jochen.ihl@akbs.de
////////////////////////////////////////////

var initdone=false;

function popup_virtuell(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup_v','width=796,height=575,resizable=yes,scrollbars=no,status=no,toolbar=no,directories=no,menubar=yes,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}

function popup_pdf(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=450,height=500,resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}

function popup_gross_scroll(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=600,height=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}


function popup_kuenstler_klein(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=400,height=500,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
FENSTER.focus();
}

function popup_variabel(add)
{
var FENSTER;
FENSTER=window.open(add,'','width=400,height=550,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,directories=no,menubar=yes,location=no,screenX=150,screenY=150') ;
if (FENSTER.opener == null) FENSTER.opener = window;
FENSTER.opener.name = "opener";
FENSTER.focus();
}

function popup(add)
{
var FENSTER;
FENSTER=window.open(add,'Teppichassistent','width=400,height=550,resizable=no,scrollbars=auto,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
if (FENSTER.opener == null) FENSTER.opener = window;
FENSTER.opener.name = "opener";
FENSTER.focus();
}


function popup_scroll(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=450,height=550,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}

// Seite empfehlen
function popup_emp(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=460,height=533,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}

// Sitemap
function popup_sitemap(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=510,height=550,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
if (FENSTER.opener == null) FENSTER.opener = window;
FENSTER.opener.name = "opener";
FENSTER.focus();
}

// Url in offenes Fenster übergeben
function openMainSitemap(url) {
		if (opener) {
			opener.location.href = url;
			opener.focus();
		} else this.close();
	}


// Suche Fkt
function openMain(url) {
		if (opener) {
			opener.location.href = url;
			opener.focus();
		} else this.close();
	}
	function openPopup(url) {
		var FENSTER;
		FENSTER=window.open(url,'PopupSuchergebnis','width=400,height=500,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
		FENSTER.focus();
	}


//Ende Suche Fkt
// Virtuelles Einrichten
function popup_gross(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=800,height=800,resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}
// Farbmuster
function popup_farbmuster(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=790,height=490,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=150,screenY=150') ;
FENSTER.focus();
}
// Teppichmuster
function popup_teppichmuster(quality)
{
var FENSTER;
FENSTER=window.open('/popup_teppichmuster.brw?quality=' + quality,'Popup','width=515,height=560,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=250,screenY=150') ;
FENSTER.focus();
}
// Teppichmuster klein
function popup_teppichmuster_klein(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup2','width=465,height=375,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
FENSTER.focus();
}
// Teppichmuster loeschen
function popup_teppichmuster_loeschen(add)
{
var FENSTER;
FENSTER=window.open(add,'Popup','width=400,height=220,resizable=no,scrollbars=no,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
if (FENSTER.opener == null) FENSTER.opener = window;
FENSTER.opener.name = "opener";
FENSTER.focus();
}
// Teppichassistent Ergebnis
function popup_ergebnis()
{

 document.wizard.operation.value='result';
 document.wizard.target='PopupErg';
 FENSTERERG=window.open('','PopupErg','width=420,height=600,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
 document.wizard.submit();
 window.close();
}

function popup_ergebnis_noClose()
{

 document.wizard.operation.value='result';
 document.wizard.target='PopupErg';
 FENSTERERG=window.open('','PopupErg','width=420,height=600,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
 document.wizard.submit();
}


function callPage (i)
{
document.wizard.callpage.value=i;
document.wizard.submit();
}

/*function haendler_suche () {
var FENSTER;
FENSTER=window.open('','Popup','width=300,height=400,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no,screenX=450,screenY=150') ;
//if (FENSTER.opener == null) FENSTER.opener = window;
//FENSTER.opener.name = "opener";
document.haendlersuche.target = FENSTER;
document.haendlersuche.submit();
//FENSTER.focus();
}*/

function menu (l,i){
switch(i) {
  case 0: {
    if (navigator.appVersion.charAt(0)<'5') {
     var layers=document.all.tags ("div");
    }
   else {
    var layers=document.getElementsByTagName("div");
   }
   layers[l].style.display="none";
   return;
  }
  case 1: {
    if (navigator.appVersion.charAt(0)<'5') {
     var layers=document.all.tags ("div");
    }
    else {
     var layers=document.getElementsByTagName("div");
    }
    for (j=0; j<6; j++) {
     if (j != l) {
       layers[j].style.display="none";
     }
    }
    layers[l].style.display="block";
    return;
   }
 }
}

var Position = (function() {
  // Resolve a string identifier to an object
  // ========================================
  function resolveObject(s) {
    if (document.getElementById && document.getElementById(s)!=null) {
      return document.getElementById(s);
    }
    else if (document.all && document.all[s]!=null) {
      return document.all[s];
    }
    else if (document.anchors && document.anchors.length && document.anchors.length>0 && document.anchors[0].x) {
      for (var i=0; i<document.anchors.length; i++) {
        if (document.anchors[i].name==s) {
          return document.anchors[i]
        }
      }
    }
  }

  var pos = {};
  pos.$VERSION = 1.0;

  // Set the position of an object
  // =============================
  pos.set = function(o,left,top) {
    if (typeof(o)=="string") {
      o = resolveObject(o);
    }
    if (o==null || !o.style) {
      return false;
    }

    // If the second parameter is an object, it is assumed to be the result of getPosition()
    if (typeof(left)=="object") {
      var pos = left;
      left = pos.left;
      top = pos.top;
    }

    o.style.left = left + "px";
    o.style.top = top + "px";
    return true;
  };

  // Retrieve the position and size of an object
  // ===========================================
  pos.get = function(o) {
    var fixBrowserQuirks = true;
      // If a string is passed in instead of an object ref, resolve it
    if (typeof(o)=="string") {
      o = resolveObject(o);
    }

    if (o==null) {
      return null;
    }

    var left = 0;
    var top = 0;
    var width = 0;
    var height = 0;
    var parentNode = null;
    var offsetParent = null;


    offsetParent = o.offsetParent;
    var originalObject = o;
    var el = o; // "el" will be nodes as we walk up, "o" will be saved for offsetParent references
    while (el.parentNode!=null) {
      el = el.parentNode;
      if (el.offsetParent==null) {
      }
      else {
        var considerScroll = true;
        /*
        In Opera, if parentNode of the first object is scrollable, then offsetLeft/offsetTop already
        take its scroll position into account. If elements further up the chain are scrollable, their
        scroll offsets still need to be added in. And for some reason, TR nodes have a scrolltop value
        which must be ignored.
        */
        if (fixBrowserQuirks && window.opera) {
          if (el==originalObject.parentNode || el.nodeName=="TR") {
            considerScroll = false;
          }
        }
        if (considerScroll) {
          if (el.scrollTop && el.scrollTop>0) {
            top -= el.scrollTop;
          }
          if (el.scrollLeft && el.scrollLeft>0) {
            left -= el.scrollLeft;
          }
        }
      }
      // If this node is also the offsetParent, add on the offsets and reset to the new offsetParent
      if (el == offsetParent) {
        left += o.offsetLeft;
        if (el.clientLeft && el.nodeName!="TABLE") {
          left += el.clientLeft;
        }
        top += o.offsetTop;
        if (el.clientTop && el.nodeName!="TABLE") {
          top += el.clientTop;
        }
        o = el;
        if (o.offsetParent==null) {
          if (o.offsetLeft) {
            left += o.offsetLeft;
          }
          if (o.offsetTop) {
            top += o.offsetTop;
          }
        }
        offsetParent = o.offsetParent;
      }
    }


    if (originalObject.offsetWidth) {
      width = originalObject.offsetWidth;
    }
    if (originalObject.offsetHeight) {
      height = originalObject.offsetHeight;
    }

    return {'left':left, 'top':top, 'width':width, 'height':height
        };
  };

  // Retrieve the position of an object's center point
  // =================================================
  pos.getCenter = function(o) {
    var c = this.get(o);
    if (c==null) { return null; }
    c.left = c.left + (c.width/2);
    c.top = c.top + (c.height/2);
    return c;
  };

  return pos;
})();


function showInfo( obj, index, move ) {
    var loc = Position.get(obj);
    document.getElementById(index).style.top = loc.top + move + "px";
    document.getElementById(index).style.left = loc.left + 0 + "px";
    document.getElementById(index).style.visibility = "visible";
}

function hideInfo(index) {
   //document.getElementById(index).style.visibility = "hidden";
}
