// neues fenster fuer links und zoombild
function newWindow(url, name, width, height, toolbar, status, scrollbar, resizable, menubar, location) {
  if (width < 240 ) {
    width = 240 + 58;
    }
  else {
    width = width + 58;
    }
  if (width > 768 ) {
    width = 768;
    scrollbar="1";
    }
  if (height == 400 ) {
    height = height + 150;
	}
  else {
    height = height + 269;
    if (height > 550 ) {
      height = 550;
      scrollbar="1";
      }
    }
  var win = window.open(url,name,"width=" + width + ",height=" + height + ", toolbar=" + toolbar + ",status=" + status + ",scrollbars=" + scrollbar + ",resizable=" + resizable + ",menubar=" + menubar + ",location=" + location);
  win.focus();
  return false;
  }

//Ausgelagerte Hilfefunktion für Suchfelder
function setEmpty(content, field) {
  if (document.getElementById(field).value == content) {
    document.getElementById(field).value = "";
    }
  }

function setValue(content, field) {
  if (document.getElementById(field).value == "") {
    document.getElementById(field).value = content;
    }
  }

function openHilfe(url) {
  loadUrl(2,url,520,220,200,50);
  }

function loadUrl (type, url, width, height, x, y) {
  // 0: load into current window
  if (type=="0") {
    window.location.href = url;
    }
  if (type=="1") {
    var prefs = "";
    if (arguments.length > 3) prefs += "width="+width+",height="+height;
    prefs += ",scrollbars=yes";
    w = window.top.open(url, "popwin", prefs);
    w.focus();
    }
  if (type=="2") {
    var prefs = "";
    if (arguments.length > 3) prefs += "width="+width+",height="+height+",screenX="+x+",screenY="+y;
    prefs += ",scrollbars=yes";
    w = window.top.open(url, "popwin", prefs);
    w.moveTo(x,y);
    w.focus();
    }
  if (type=="4") {
    window.opener.location.href = url;
    }
  }

// <!-- SZ Videointegration -->
function SZFlashDetectInit(){
	if(!document.getElementById('swfversionscript')){
		var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
		var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
		var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
		if(isIE && isWin && !isOpera){
			document.write('<scr'+'ipt id="swfversionscript" type="text/vbscript">\n');
			document.write('Function SZwhichflash(i)\n');
			document.write('on error resume next\n');
			document.write('Dim swControl, swVersion\n');
			document.write('swVersion = 0\n');
			document.write('set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))\n');
			document.write('if (IsObject(swControl)) then\n');
			document.write('swVersion = swControl.GetVariable("$version")\n');
			document.write('end if\n');
			document.write('SZwhichflash = swVersion\n');
			document.write('End Function\n');
			document.write('<\/scr'+'ipt>\n');
			document.write('\n');
		} else {
			document.write('<scr'+'ipt id="swfversionscript" type="text/javascript">\n');
			document.write('function SZwhichflash(i)\n');
			document.write('{\n');
			document.write('if (navigator.plugins != null && navigator.plugins.length > 0) {\n');
			document.write('if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {\n');
			document.write('var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";\n');
			document.write('var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;\n');
			document.write('descArray = flashDescription.split(" ");\n');
			document.write('tempArrayMajor = descArray[2].split(".");\n');
			document.write('versionMajor = tempArrayMajor[0];\n');
			document.write('versionMinor = tempArrayMajor[1];\n');
			document.write('if ( descArray[3] != "" ) {tempArrayMinor = descArray[3].split("r");} else {tempArrayMinor = descArray[4].split("r");}\n');
			document.write('versionRevision=tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;\n');
			document.write('// variable flashVer zusammensetzen -> analog zu ie\n');
			document.write('flashVer="x " + versionMajor + "," + versionMinor + "," + versionRevision;\n');
			document.write('}else{flashVer=-1;}\n');
			document.write('}\n');
			document.write('// MSN/WebTV 2.6 supports Flash 4\n');
			document.write('else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;\n');
			document.write('// WebTV 2.5 supports Flash 3\n');
			document.write('else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;\n');
			document.write('// older WebTV supports Flash 2\n');
			document.write('else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;\n');
			document.write('// Can\'t detect in all other cases\n');
			document.write('else {flashVer = -1;}\n');
			document.write('return flashVer;\n');
			document.write('}\n');
			document.write('<\/scr'+'ipt>\n');
			document.write('\n');
		}
	}
}

function SZFlashDetect(reqMajorVer, reqMinorVer, reqRevision) {
	var reqVer = parseFloat(reqMajorVer + "." + reqRevision);
	// loop backwards through the versions until we find the newest version
	for (var i=25;i>0;i--) {
		versionStr = SZwhichflash(i);
		if (versionStr == -1 ) {
			return false;
		} else if (versionStr != 0) {
			var versionArray = new Array();
			var tempArray   = versionStr.split(" ");
			var tempString  = tempArray[1];
			versionArray    = tempString .split(",");
			var versionMajor    = versionArray[0];
			var versionMinor    = versionArray[1];
			var versionRevision = versionArray[2];
			var versionString   = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			var versionNum      = parseFloat(versionString);
			// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
			}
		}
	}
}

function SZLoadFlash(videoid, flashvars){
	if(document.getElementById){
		if ( SZFlashDetect(7,0,14) ) {
			document.getElementById('flashvideoswf'+videoid).innerHTML = '<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="180" height="154" id="sz-video" align="middle">\n<param name="allowScriptAccess" value="sameDomain" />\n<param name="FlashVars" value="' + flashvars + '" />\n<param name="movie" value="/app/video/sz-video.swf" />\n<param name="quality" value="high" />\n<param name="bgcolor" value="#ffffff" />\n<embed src="/app/video/sz-video.swf" quality="high" bgcolor="#ffffff" width="180" height="154" name="sz-video" align="middle" FlashVars="' + flashvars + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n</embed>\n</object>\n</div>';
		} else {
			document.getElementById('flashvideoswf'+videoid).innerHTML = '<div style="width:100%;height:152px;background-color:#f0f0f0;font-size:9px;font-family:verdana;">\nDer benötigte Flash Player 7 wurde nicht gefunden.<br />\nMögliche Ursachen:<br /><br />\nJavaScript erkennt den Player nicht korrekt.<br />\n<br /><br />\nDer Player ist nicht vorhanden.<br />\n<a href="http://www.macromedia.com/go/getflash/" target="_blank">Jetzt installieren<\/a>\n<\/div>';
			document.getElementById('flashvideoswf'+videoid).style.zIndex=3;
		}
	}
}

function winOpen(url){
	breite = 470;
	hoehe = 470;
	links=(screen.width/2)-(breite/2);
	oben=(screen.height/2)-(hoehe/2);
	window.open(url,"SZ","height="+hoehe+",width="+breite+",status=no,toolbar=no,menubar=no,locateion=no,resizable=yes,titlebar=yes,scrollbars=yes,fullscreen=no,top="+oben+",left="+links);
}

// <!-- /SZ Videointegration -->

// Funktion: Abfrage ob Suche nach Archiv oder Web (im Header)
function getHeadersearch() {
  if (document.getElementById) {
    var modi = 'archiv';
    for (var i=0; i<=document.formsearch.suche.length; i++) {
      if (document.formsearch.suche[i].checked == true) {
        modi = document.formsearch.suche[i].value;
        break;
        }
      }
    if (modi == 'yahoo') {
      location.href = 'http://www.sueddeutsche.de/app/service/suche/yahoo/goto.php?fr=cb-sued&ei=ISO-8859-1&p=' + escape(document.formsearch.inputsearch.value);
      return false;
      }
    }
  return true;
  }

// Funktion: Nicht eingeloggter Zustand ausblenden
function changeLog() {
  var ElemIdDiv = document.getElementById('myLogin');
  for (var i=0; i < (ElemIdDiv.childNodes.length); i++) {
    var ElemIdHide = document.getElementById(ElemIdDiv.childNodes[i].id);
    ElemIdHide.style.visibility = "hidden";
    ElemIdHide.style.position = "absolute";
    ElemIdHide.style.left = -800;
    ElemIdHide.style.top = -800;
    }
  var ElemIdShow = document.getElementById('headerLogin');
  var PareNdShow = document.getElementById('headerLogin').parentNode;
  ElemIdShow.parentNode.removeChild(ElemIdShow);
  ElemIdShow.style.visibility = "visible";
  ElemIdShow.style.position = "relative";
  ElemIdShow.style.left = 0;
  ElemIdShow.style.top = 0;
  PareNdShow.appendChild(ElemIdShow);
  }

// Funktion: Benamung des Passwortfeldes mit Klartext und erst bei Eingabe verschlüsselte Ansicht
function LoginBoxPassFocus() {
  document.lbox.passtxt.style.display = "none";
  document.lbox.login_passwort.style.display = "inline";
  document.lbox.login_passwort.focus();
  }

function LoginBoxExit() {
  if(document.getElementById("login_passwort").value == '') {
    document.getElementById("login_passwort").style.display = "none";
    document.getElementById("passtxt").style.display = "inline";
    }
  }

// Funktion: Je nach Browsertyp wird eine andere Möglichkeit der "Startseite einrichten" angezeigt
function startseiteLink() {
  var echoStartseite = '';
  // wenn Internet Explorer (also auch kein verkappter Opera)
  if ((navigator.userAgent.indexOf("Opera") == -1) && (navigator.appName.indexOf("Explorer") != -1)) {
    echoStartseite = '<a href="' + document.URL + '" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.sueddeutsche.de\');">';
    }
  // wenn Firefox
  else if (navigator.userAgent.indexOf("Firefox") != -1) {
    echoStartseite = '<a href="' + document.URL + '" onClick="javascript:window.open(\'http://www.sueddeutsche.de/app/homepage/startseite/\',\'Startseite\',\'width=600,height=800,resizable\').focus();">';
    }
  // alle anderen Browser
  else {
    echoStartseite = '<a href="http://www.sueddeutsche.de/service/app/923/18905/">';
    }
  document.write(echoStartseite);
  }

// Wechsel BG Box Meinung + Tausch Font + FontWeight
// layernameshow,bgimage,colorhi,fontWeighthi,colorlow,fontWeightlow
function changeBgBox(layernamehide,layernameshow,bgimage,colorhi,weighthi,colorlow,weightlow) {
    hideLayer (layernamehide);
    showLayer (layernameshow);
    var nmyobj0 = document.getElementById("nmeinungbg");
    var nmyobj1 = document.getElementById("nmeinungheader");
    var nmyobj2 = document.getElementById("nkolumneheader");
    nmyobj1.style.color = colorhi;
    nmyobj1.style.fontWeight = weighthi;
    nmyobj2.style.color = colorlow;
    nmyobj2.style.fontWeight = weightlow;
    nmyobj0.style.backgroundImage = "url('"+bgimage+"')";
}

// Themen der Woche

function _debug(msg) {
    document.getElementById("debug").value += msg + "\n";
}

/**
 * Array der Bilder (Thumbnails) fuer die Themen der Woche. Kann z. B. dynamisch generiert werden
 * Format:
 * ------
 * szTOWTeaserImages[<element_id>]["over"] = "Bildname fuer aktivstatus";
 * szTOWTeaserImages[<element_id>]["out"]  = "Bildname fuer normalen status";
 */
var szTOWTeaserImages = {
    "themaderwoche_bildklein:1": {"over": "/g_abdunkeln.png", "out": "/g_.gif"},
    "themaderwoche_bildklein:2": {"over": "/g_abdunkeln.png", "out": "/g_.gif"},
    "themaderwoche_bildklein:3": {"over": "/g_abdunkeln.png", "out": "/g_.gif"},
    "themaderwoche_bildklein:4": {"over": "/g_abdunkeln.png", "out": "/g_.gif"},
    "themaderwoche_bildklein:5": {"over": "/g_abdunkeln.png", "out": "/g_.gif"}
};


var szTOWTeaser = {

    oTopic:       null,
    numImages:    null,
    actImageId:   "",
    pos:          1,               // Position des Startthemas
    imgDir:       "/img",  // Pfad zum Bilderordner, das die Bilder der Themen enthaelt
    delay:        4000,            // Verzoegerung in Milisekunden fuer den Wechsel des Themas
    timeoutId:    null,
    initialized:  false,

    init: function() {
        if (!document.getElementById) {
            return;
        }

        var images = document.getElementsByName("themaderwoche_bildklein");
        if (!images) {
            return;
        }

        var img;
        for (var i=0; i<images.length; i++) {
            img = images[i];
            img.onmouseover = function () {
                //szTOWTeaser.setImgOverState(this);
                var arr = this.id.split(":");
                szTOWTeaser.show(arr[1]);
            }
            img.onmouseout = function () {
                szTOWTeaser.setImgOutState(this);
            }
            img.onclick = function () {
                var arr = this.id.split(":");
                szTOWTeaser.show(arr[1]);
            }
        }

        this.oTopic = document.getElementById("themaderwoche_container");
        this.numImages = 0;
        for (img in szTOWTeaserImages) {
            this.numImages++;
        }
        this.initialized = true;
        this._showTopic();
    },

    setImgOverState: function (img) {
        img.src = this.imgDir + szTOWTeaserImages[img.id].over;
    },

    setImgOutState: function (img) {
        if (img.id == this.actImageId) { return; }
        img.src = this.imgDir + szTOWTeaserImages[img.id].out;
    },

    showNext: function () {
        if (++this.pos > this.numImages) {
            this.pos = 1;
        }

        this._showTopic();
    },

    show: function (pos) {
        if (pos < 1) {
            this.pos = 1;
        } else if (pos > this.numImages) {
            this.pos = this.numImages;
        } else {
            this.pos = pos;
        }
        this.clearTimer();
        this._showTopic();
    },

    setTimer: function () {
        this.timeoutId = window.setTimeout("szTOWTeaser.showNext()", this.delay);
    },

    clearTimer: function () {
        if (this.timeoutId !== null) {
            window.clearTimeout(this.timeoutId);
            this.timeoutId = null;
        }
    },

    _showTopic: function() {
        if (!this.initialized) { return; }

        var newTopic = document.getElementById("themaderwoche_sammlung_"+this.pos);
        if (!newTopic) {
            return;
        }

        // handle image over out states
        if (this.actImageId != "") {
            // reset previous over state
            var img = document.getElementById(this.actImageId);
            this.actImageId = "";
            this.setImgOutState(img);
        }

        this.actImageId = "themaderwoche_bildklein:"+this.pos;
        // set image over state of actual topic
        this.setImgOverState(document.getElementById(this.actImageId));

        // set new topic
        this.oTopic.innerHTML = newTopic.innerHTML;

        this.setTimer();
    }

}


window.onload = function () {
    /**
     * Aufruf der Funktion szTOWTeaser.init() bei onload
     */
    szTOWTeaser.init();
}

// END Themen der Woche

// Teaser Meinung/Kolumne

/**
 * Tabbed teaser header. Used to switch tabbed elements inside a teaser. Changes header
 * class name, switches content by hiding previous and displaying new element content.
 * Usage:
 * -----
 * <code>
 * <script>
 * oTTH = new szTabbedTeaserHeader("teaserid", "activeelementid");
 * </script>
 * <div id="headerA"><a href="#" onmouseover="oTTH.show('headerA');">Activate me</a></div>
 * <div id="headerB"><a href="#" onmouseover="oTTH.show('headerB');">or me</a></div>
 * </code>
 */

/**
 * Constructor. Initialize a new tabbed teaser.
 * @param  string  teaserId  Id of element which holds te tabbed teaser header
 * @param  string  activeElement  Id of element witch is the initial one
 */
function szTabbedTeaserHeader(teaserId, activeElement) {
    this.teaserId = teaserId;
    this.activeElement = activeElement;
}

/**
 * Switch to tab based on passed key.
 *
 * @param  string  key  Key of element to activate
 */
szTabbedTeaserHeader.prototype.show = function(key){
    if (key == this.activeElement) {
        // passed key is allready active, get out here
        return;
    }

    if (this.activeElement !== "") {
        // hide previous displayed element
        document.getElementById(this.activeElement).style.display = "none";
    }

    // set active key, display new element and change classname
    // formatting definitions are set by different class selectors
    this.activeElement = key;
    document.getElementById(this.activeElement).style.display = "block";
    document.getElementById(this.teaserId).className = key + "_headerbox";
}

// END Teaser Meinung/Kolumne

// Listenmodul mit Reiter

/**
 * Tabbed teaser header. Used to switch tabbed elements inside a teaser. Changes header
 * class name, switches content by hiding previous and displaying new element content.
 *
 * Usage:
 * -----
 * <code>
 * <script>
 * oTTH = new szTabbedSliders("listId", "activeelementid");
 * </script>
 * <div id="headerA"><a href="#" onmouseover="oTTH.show('headerA');">Activate me</a></div>
 * <div id="headerB"><a href="#" onmouseover="oTTH.show('headerB');">or me</a></div>
 * </code>
 */

/**
 * Constructor. Initialize a new tabbed teaser.
 *
 * @param  string  listId  Id of list which holds the tabbed teaser
 * @param  string  activeElement  Id of element witch is the initial one
 */
function szTabbedSliders(listId, activeElement) {
    this.listId = listId;
    this.activeElement = activeElement;
    this.ok = false;
    if(!document.getElementById || !document.createTextNode){
        return;
    }

    var elem = document.getElementById(this.listId);
    if(!elem){ return; }

    this.list = elem.getElementsByTagName("li");
    if(!this.list){ return; }

    this.ok = true;
}


/**
 * Switch to tab based on passed key.
 *
 * @param  string  key  Key of element to activate
 */
szTabbedSliders.prototype.show = function(key){

    if(!this.ok){
        return;
    }

    if (key == this.activeElement) {
        // passed key is allready active, get out here
        return;
    }

    if (this.activeElement !== "") {
        // hide previous displayed element
        document.getElementById(this.activeElement).style.display = "none";
    }

    // set active key, display new element and change classname
    // formatting definitions are set by different class selectors
    this.activeElement = key;
    document.getElementById(this.activeElement).style.display = "block";

    // reset other list item
    for (var i=0; i < this.list.length; i++) {
        if (this.list[i].className == "firstActive") {
            this.list[i].className = "first";
        } else if (this.list[i].className == "middleActive") {
            this.list[i].className = "middle";
        } else if (this.list[i].className == "lastActive") {
            this.list[i].className = "last";
        }
    }

    // activate actual list item
    var item = document.getElementById(key+"Item");
    if (item.className == "first") {
        item.className = "firstActive";
    } else if (item.className == "middle") {
        item.className = "middleActive";
    } else if (item.className == "last") {
        item.className = "lastActive";
    }

}

// END: Listenmodul mit Reiter

// START: Google Adsense - Funktion fuer Boxen im Content, rechte Leiste und Skyscraper
var google_adnum  = 0;
var google_cont   = 0;
var google_sky    = 0;
var google_renav  = 0;
var google_home   = 0;

/*
* This function is required and is used to display the ads
* that are returned from the JavaScript request. You should
* modify the document.write commands so that the HTML they
* write out fits with your desired ad layout.
*/

function google_ad_request_done(google_ads) {        
  var s = '';
  var i;

  if (google_ads.length > 0) {
    if (google_ads[0].type == "image") {
      //document.write('<a href="' + google_ads[0].url + '" target="_top" title="go to ' + google_ads[0].visible_url + '"><img style="border:none;" src="' + google_ads[0].image_url + '" width="' + google_ads[0].image_width + '" height="' + google_ads[0].image_height + '"/></a>');
      }
    // =========== Google-Anzeigen im Content ============================================================
    else if (google_cont == 1) {
      document.write('<div id="googleAdSense"><div class="eckeLo"><div class="eckeRo"></div></div>');
      document.write('<p><a href="' + google_info.feedback_url + '" target="_blank">Google-Anzeigen</a></p>');
      document.write('<ul>');
      for (i = 0; i < google_ads.length; i++) {
        document.write('<li><a href="' + google_ads[i].url  + '" class="blackBig">' + google_ads[i].line1 + '</a><br><a href="' + google_ads[i].url  + '" class="blackSmall">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a><br><a href="' + google_ads[i].url  + '">' + google_ads[i].visible_url + '</a></li>');
        }
      document.write('</ul><div class="eckeLu"><div class="eckeRu"></div></div></div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen im Skyscraper ============================================================
    else if (google_sky == 1) {
      document.write('<div class="nMain" style="width:160px;"><div class="nteaser301bg1px" style="width:160px; height:600px; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_bg1px_google.gif);"><div class="nteaser301top1px" style="width:160px; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_top1px_google.gif); background-repeat:no-repeat;">');
      document.write('<div class="nteaserheader" style="width:160px; padding-left:10px;"><a href="' + google_info.feedback_url + '" class="nlinkstandard" style="font-weight:bold;" target="_blank">Google-Anzeigen</a></div>');
      document.write('</div><div class="nteaser301content" style="height:557px; _height:567px; padding-left:10px;">');
      var anzahlAds = google_ads.length;
      for(i = 0; i < anzahlAds; i++) {
        if (i == 0) { document.write ('<div class="ndivlinetopfirst" style="margin-bottom:15px;">'); }
        else if (i == (anzahlAds - 1)) { document.write('<div class="ndivlinebottom">'); }
        else { document.write('<div class="ndivlinetop" style="margin-bottom:15px;">'); }
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank"><strong>' + google_ads[i].line1 + '</strong></a><br>');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a><br>');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinkstandard" target="_blank">' + google_ads[i].visible_url.substr(0,20) + '</a></div>');
        }
      document.write('</div>');
      document.write('<div class="nteaser301bottom1px" style="width:160px; background-color:#f2f2f2; background-image:url(http://pix.sueddeutsche.de/app/google/img/nteaser301_bottom1px_google.gif); background-repeat:no-repeat;"></div>');
      document.write('</div>');
      document.write('</div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen in der Servicespalte ============================================================
    else if (google_renav == 1) {
      document.write('<div class="nteaser301bg1px"><div class="nteaser301top1px">');
      document.write('<div class="nteaserheader"><a href="' + google_info.feedback_url + '" class="nlinkheaderteaserschwarz" target="_blank">Google-Anzeigen</a></div>');
      document.write('</div><div class="nteaser301content">');
      var anzahlAds = google_ads.length;
      for (i = 0; i < anzahlAds; i++) {
        if (i == 0) { document.write ('<div class="ndivlinetopfirst">'); }
        else if (i == (anzahlAds - 1)) { document.write('<div class="ndivlinebottom">'); }
        else { document.write('<div class="ndivlinetop">'); }
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank"><strong>' + google_ads[i].line1 + '</strong></a><br>');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinktext" target="_blank">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a><br>');
        document.write('<a href="' + google_ads[i].url  + '" class="nlinkstandard" target="_blank">' + google_ads[i].visible_url + '</a></div>');
        }
      document.write('</div>');
      document.write('<div class="nteaser301bottom1px"></div>');
      document.write('</div>');
      // Note that google_adnum is only incremented for CPC text ads
      if (google_ads[0].bidtype == "CPC") {
        google_adnum = google_adnum + google_ads.length;
        }
      }

    // =========== Google-Anzeigen in der Homepage ============================================================
    else if (google_home == 1) {
      document.write('<table class="ModulBox" cellpadding="0" cellspacing="0"><tr><td class="ModulBoxObenLinks"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxRahmenTop"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxObenRechts"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td></tr><tr><td class="ModulBoxRahmenContent" colspan="3" id="rechteSpalte">');
      document.write('<div class="ModulBoxDachzeile"><p><a href="' + google_info.feedback_url + '" id="title" target="_blank">Google-Anzeigen</a></p></div>');
      var anzahlAds = google_ads.length;
      for(i = 0; i < anzahlAds; i++) {
        document.write('<table class="ModulBoxContent" cellpadding="0" cellspacing="0"><tr><td class="ModulBoxContentText"><h4 class="headline"><a href="' + google_ads[i].url  + '" target="_blank">' + google_ads[i].line1 + '</a></h4><h5 class="fliesText"><a href="' + google_ads[i].url  + '" target="_blank">' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</a><br><a href="' + google_ads[i].url  + '" class="mehr" target="_blank">' + google_ads[i].visible_url + '</a></h5></td></tr></table>');
        if (i < (anzahlAds - 1)) {
          document.write('<div class="linie"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></div>');
          }
        }
      document.write('</td></tr><tr><td class="ModulBoxUntenLinks"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxRahmenBottom"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td><td class="ModulBoxUntenRechts"><img src="http://pix.sueddeutsche.de/img/g_.gif" class="spacerGif"></td></tr></table>');
      }

    // =========== Google-Anzeigen ausgeblendet ============================================================
    else {
      //document.write('<!--' + google_info.feedback_url + '-->');
      //document.write('<!--' + google_ads[i].url  + '-->');
      //document.write('<!--' + google_ads[i].line1 + '-->');
      //document.write('<!--' + google_ads[i].line2 + '-->');
      //document.write('<!--' + google_ads[i].line3 + '-->');
      //document.write('<!--' + google_ads[i].visible_url + '-->');
      document.write('');
      }
    }
  }
// ENDE: Google Adsense


// JavaScript Document


// Listenmodul mit Reiter

/**
 * Wenn Tabs bei MouseOver innerhalb eines DIV Containers geändert werden sollen. Pro Tab
 * Unique Klassen Namen und eindeutige DIV Conteiner der Inhalte
 * Anwendung:
 * -----
 * <code>
 * <script>
 * idChangeTop = new idTabbedTeaserHeader("teaserid", "activeelementid");
 * </script>
 * <div id="header1"><a href="#" onmouseover="idChangeTop.show('header1');">Header1 aktiviert</a></div>
 * <div id="header2"><a href="#" onmouseover="idChangeTop.show('header2');">Header2 aktiviert</a></div>
 * </code>
 * WICHTIG:
 * @variable  eindeutiger ID Name des DIV Containers, der die Navigation beinhaltet
 * @variable  aktive Element ID, welche initalisiert werden soll
 */
function idTabbedSliders(listId, activeElement) {
    this.listId = listId;
    this.activeElement = activeElement;
    this.ok = false;
    if(!document.getElementById || !document.createTextNode){
        return;
    }

    var elem = document.getElementById(this.listId);
    if(!elem){ return; }

    this.list = elem.getElementsByTagName("li");
    if(!this.list){ return; }

    this.ok = true;
}


/**
 * Wechsle zum TAB, der geklickt wird
 *
 * @variable  string KEY, der weitergegeben wird
 */
idTabbedSliders.prototype.show = function(key){

    if(!this.ok){
        return;
    }

    if (key == this.activeElement) {
        return;
    }

    if (this.activeElement !== "") {
        // verstecke, das letzte Element
        document.getElementById(this.activeElement).style.display = "none";
    }

    // setze aktiven KEY, zeige das neue Element und ändere den Klassennamen
    this.activeElement = key;
    document.getElementById(this.activeElement).style.display = "block";

    // lösche die anderen Listen
    for (var i=0; i < this.list.length; i++) {
        if (this.list[i].className == "firstActive") {
            this.list[i].className = "first";
        } else if (this.list[i].className == "middleActive") {
            this.list[i].className = "middle";
        } else if (this.list[i].className == "lastActive") {
            this.list[i].className = "last";
        }
    }

    // aktiviere die aktuelle Liste
    var item = document.getElementById(key+"Item");
    if (item.className == "first") {
        item.className = "firstActive";
    } else if (item.className == "middle") {
        item.className = "middleActive";
    } else if (item.className == "last") {
        item.className = "lastActive";
    }

}


/**
 * WICHTIG:
 * @variable  eindeutiger ID Name des DIV Containers, der die Navigation beinhaltet
 * @variable  aktive Element ID, welche initalisiert werden soll
 */
idTabbedTeaserHeader = function(teaserId, activeElement) {
    this.teaserId = teaserId;
    this.activeElement = activeElement;
}

/**
 * Wechsle zum TAB, der geklickt wird
 *
 * @variable  string KEY, der weitergegeben wird
 */
idTabbedTeaserHeader.prototype.show = function(key){
    if (key == this.activeElement) {
        return;
    }

    if (this.activeElement !== "") {
        // verstecke das letzte Element
        document.getElementById(this.activeElement).style.display = "none";
    }

    // setze aktiven KEY, zeige das neue Element und ändere den Klassennamen
    this.activeElement = key;
    document.getElementById(this.activeElement).style.display = "block";
    document.getElementById(this.teaserId).className = key + "_headerbox";
}

// ENDE: Listenmodul mit Reiter


function setSortboxItemActive(whichItem) {
   whichItem.parentNode.className = "sortbox-item active";    
}
    
function setSortboxItemInActive(whichItem) {
   whichItem.parentNode.className = "sortbox-item";    
}
