

//Flash-Detection
var requiredVersion = 6;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var maxVersion = 8;
var actualVersion = 0;
var hasRightVersion = false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

if(isIE && isWin){
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
        document.write('on error resume next \n');
        document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
        document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
        document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
        document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
        document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
        document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
        document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
        document.write('</SCR' + 'IPT\> \n');
}

function detectFlash(flashurl,bildurl,weite,hoehe)
{
        if (navigator.plugins)
		{
                if (navigator.plugins["Shockwave Flash 2.0"]
                || navigator.plugins["Shockwave Flash"])
				{
                        var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                        var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
                        var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

                        flash2Installed = flashVersion == 2;
                        flash3Installed = flashVersion == 3;
                        flash4Installed = flashVersion == 4;
                        flash5Installed = flashVersion == 5;
                        flash6Installed = flashVersion == 6;
                        flash7Installed = flashVersion == 7;
                        flash8Installed = flashVersion == 8;
                }
        }

        for (var i = 2; i <= maxVersion; i++) {
                if (eval("flash" + i + "Installed") == true) actualVersion = i;
        }
        if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;

        if ((actualVersion >= requiredVersion) && (flashurl != ""))
        {
            var nn4 = (navigator.appName.indexOf("Netscape") >= 0) && (navigator.appVersion.indexOf("4.") >= 0);
            if (nn4)
                document.write("<ilayer>");
            document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+weite+' HEIGHT='+hoehe+'><param name="menu" value=false><PARAM NAME=movie VALUE="'+flashurl+'"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="'+flashurl+'" quality=high bgcolor=#FFFFFF WIDTH='+weite+' HEIGHT='+hoehe+' Menu="False" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
            if (nn4)
               document.write("</ilayer>");
        }
        else
            document.write("<IMG src="+bildurl+" width="+weite+" height="+hoehe+" border=0>");
}

// ende Flash-Detection


function followPopUpLink(pUrl, pAddress, paktPath) {

   if (self != top)
   {
       control = 1;
       // Pfad der aktuell links gesetzt ist
       path = "";
       if (document.images)
           path = top.opener.parent.frames.toc.navPath;
       else
           path = top.opener.parent.navPath;

       // wenn andere linke Navigation aktualisiere linke Navigation
       if (!(paktPath == path)) {

           control = 0;
           Address = pAddress;
           if (document.images)
               top.opener.parent.frames.toc.location.replace(Address);
           else
               top.opener.parent.location.href=Address;
       }
       // btobody aktualisieren
       top.opener.parent.btobody.location.href = pUrl;
   }
}

function followTocLink(pUrl, pAddress, paktPath) {

   if (self != top) {
        control=1;
        var path = top.toc.navPath;
        if (!(paktPath == path)) {
            control = 0;
            Address = pAddress;
            if(document.images) top.frames.toc.location.replace(Address);
            else top.location.href=Address;
        }
   }
   parent.btobody.location.href = pUrl;
}



function followExternalLink(pUrl, pAddress, paktPath, pCounter)
{
    loadRedirectPixel(pCounter);

    if (self.name == "btobody")
    {
        // Link aus dem btobody-frame moeglicherweise andere Domain, muss security beachten
        // gilt auch fuer ersatzbild regul im nc4
        self.location.href = pUrl;
    }
    else if (self.name == "OASregul")
    {
        // fuer ie ersatzbild regul
        parent.location.href = pUrl;
    }
    else if (self.name == "toc")
    {
        // eigenes Frameset und identische Domain
        followTocLink(pUrl, pAddress, paktPath);
    }
    else
    {
        // zugriff auf frameset ueber top.opener ist immer eigene Domain
        followPopUpLink(pUrl, pAddress, paktPath);
    }
}



function followLink (pUrl, pTarget, pCounter)
{
    loadRedirectPixel(pCounter);

    if (pTarget == "btobody")
        setBtobody(pUrl);
    else
        window.open(pUrl, "_blank");
}



function setBtobody (pUrl)
{
    if (top.opener == null)
    {
        if (parent.btobody == null)
            location.href = pUrl;
        else
            parent.btobody.location.href = pUrl;
    }
    else
    {
        if (top.opener.parent.btobody == null) {
            if (parent.btobody == null) {
                location.href = pUrl;
            }
            else {
                parent.btobody.location.href = pUrl;
            }
        }
        else {
            top.opener.parent.btobody.location.href = pUrl;
        }
    }
}


function loadRedirectPixel (pCounter)
{
    if ((pCounter == null) || (pCounter.length == 0))
        return;

    
    pixel = new Image();
    pixel.src = "http://bild.ivwbox.de/cgi-bin/ivw/LP/weiterleitung;/" + pCounter;
    pixel.seconds = 5;
    pixel.wait = waitForPixel;
    pixel.interval = setInterval("pixel.wait()", 1000);
    pixel.wait();
    
    pixel = new Image();
    pixel.src = "http://dyn.bild.t-online.de/toolkit/ClientServlet.jsp?komponenten_id=5&server_action=0&pixel=" + pCounter;
    pixel.seconds = 5;
    pixel.wait = waitForPixel;
    pixel.interval = setInterval("pixel.wait()", 1000);
    pixel.wait();
            
}

function waitForPixel ()
{
    this.seconds--;
    if (document.layers || this.complete || (this.seconds <= 0))
        clearInterval(this.interval);
}


function openWindowAndCount (pLink, pName, pSize, pCounter)
{
    loadRedirectPixel(pCounter);
    window.open(pLink, pName, pSize);
}


// News-Ticker ----------------------------------------------
function Fensterweite()
{
    if (window.innerWidth)
    {
        return window.innerWidth;
    }
    else
    {
        if (document.body && document.body.offsetWidth)
            return document.body.offsetWidth;
        else
            return 0;
    }
}

function regenerate()
{
    window.location.reload();
}

//nn-Version
function regenerate2()
{
    if (document.layers)
    {
        setTimeout("window.onresize=regenerate",450);
        intializemarquee();
    }
}

function intializemarquee()
{
    document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>');
    document.cmarquee01.document.cmarquee02.document.close();
    thelength=document.cmarquee01.document.cmarquee02.document.width;
    scrollit();
}

function scrollit()
{
    if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1))
    {
        document.cmarquee01.document.cmarquee02.left-=speed;
        setTimeout("scrollit()",60);
    }
    else
    {
        document.cmarquee01.document.cmarquee02.left=marqueewidth;
        scrollit();
    }
}


function writeMarque()
{
    if (document.getElementById && !document.all)
    {
        document.write('<div id="divlogo" style="position:absolute;width:10000px;height:25px;left:'
                        +window.innerWidth+'px;top:0px;z-index:5;">'+marqueecontents+'</div>');
        logo = eval("document.getElementById('divlogo').style");

        // Auslesen der Inhaltslaenge
        dieLinks=marquee.split("<a");
        for (i=0; i<dieLinks.length; i++)
        {
                linkInhalt=eval('dieLinks['+i+'].split(">")');
                buchstaben+=linkInhalt[1];
        }

        bewegDich();
    }
}

function bewegDich()
{
    x+=2;
    logo.left=window.innerWidth-x;
    if (x>=(buchstaben.length*7+window.innerWidth))	x=0;// Wert "7" ist geschaetzte Buchstabenbreite
    setTimeout('bewegDich()',50);
}

function readKDDBCookie(name)	{
    var dc = document.cookie;
    var prefix = name + '=';
    var begin = dc.indexOf('; ' + prefix);
    if( begin == -1) {
        begin = dc.indexOf(prefix);
        if( begin != 0) return null;
    }
    else {
        begin += 2;
    }
    var end = document.cookie.indexOf(';', begin);
    if( end == -1) end = dc.length;
    return unescape( dc.substring( begin + prefix.length, end));
}



