var iLock = false;
function getElementsByClassName(a_sClassName){
    oElements = window.document.getElementsByTagName('*');
    aRet      = new Array();

    for (i=0; i<oElements.length; i++) {
        if (oElements[i].className == a_sClassName) {
            aRet[aRet.length] = oElements[i];
        }
    }
    return aRet;
}

function getPosition(obj) {
  var pos = { x:0, y:0 };

  do {
    pos.x += obj.offsetLeft;
    pos.y += obj.offsetTop;
  } while (obj = obj.offsetParent);

  return pos;
}

function cloneContent(source, destination, zelle){
    if (!destination) { destination = 'teaserlib'; }
    document.getElementById(destination).innerHTML = document.getElementById(source).innerHTML;
    var pos = getPosition(document.getElementById(zelle));
    document.getElementById(destination).style.top = pos.y - 20 + "px";
    document.getElementById(destination).style.left = pos.x - 20 + "px";
    showelement(destination);
}

function cloneContent2(source, destination, zelle, posi){
       if (!destination) { destination = 'teaserlib'; }
       if (!posi) { posi = 0};
       var inhalt = document.getElementById(source).innerHTML;
       var minLength = (source.indexOf("hitgs")>-1) ? 50 : 120;
       if (inhalt.length > minLength){
           document.getElementById(destination).innerHTML = inhalt;
           var pos = getPosition(document.getElementById(zelle));
           document.getElementById(destination).style.top = pos.y + 1 + "px";
           document.getElementById(destination).style.left = pos.x - 5 + posi  + "px";
           showelement(destination);
//           callIVW();   
       }
}

function delayit(func, el){
    window.setTimeout(func + "('"+ el +"')", 300);
}

/*
function lockIVW() {
    iLock = true;
    var unlock = function() {
        iLock = false;
    };
    window.setTimeout(unlock, 2500);
}

function callIVW() {
    if (!iLock) {
        lockIVW();
        var body = document.getElementsByTagName("body")[0];
        var IVW="http://tagspieg.ivwbox.de/cgi-bin/ivw/CP/tsHPmover;";
        var pixel = document.createElement("img");
        pixel.src = IVW + "?r=" + escape(document.referrer) + "&d=" + (Math.random()*100000);
        pixel.width = 1;
        pixel.height = 1;
        body.appendChild(pixel);
        pixel.onload = function(){
            body.removeChild(pixel);
        }
    }
}
*/ 

function showelement(el)
{
        document.getElementById(el).style.visibility ="visible";
}

function hideelement(el)
{
    document.getElementById(el).style.visibility ="hidden";
}
