Sport1_Naviboard = new function() {
  this.showAndHide = function() {
    elementName = 'naviboard';
  
    try {
      htmlObj = document.getElementById(elementName);
      classValue = htmlObj.className;
      showValue = elementName;
      
      if (classValue.substr(elementName.length) == ' show') {
        showValue += ' hidden';
      } else {
        showValue += ' show';
      }
      htmlObj.className = showValue;
    } catch (e) {
      Sport1.log('Error | Sport1_Naviboard: ' + e);
    }
  }
}

Sport1_Plista = new function() {
	this.isSet = false;
	
	this.init = function () {
		if (!this.isSet) {
			Sport1.jsiWriter('http://static.plista.com/sport1.de_v1.js');
			this.isSet = true;
		}
	}

	this.push = function (id, title, url, text, imageLink, category ){	
		obj = {};
		obj.objectid = id;
		obj.title = Sport1.escapeString(title);
		obj.url = url;
		obj.text = Sport1.escapeString(text);
		obj.category = Sport1.escapeString(category);
		
		if (imageLink != null && imageLink != ""){
			obj.img = imageLink;			
		} else {
			obj.img = "http://www.sport1.de/media/_technik/images/aufmacher_redesing/button_artikel.gif";
		}
		try {
			PLISTA.items.push(obj);	
			PLISTA.partner.init();
		} catch (e) {
			Sport1.log("Plista: nothing found"+e);
			if (typeof plista !== 'undefined') {
				Sport1.jsiWriter(PLISTA.path + 'errorreport.js?error=' + encodeURIComponent(e));
			}
		}
	}
	
	this.show = function () {	
		document.write( '<div id="plista_widget_belowArticle"></div>' );
	}
}

Sport1_Superfan = new function() {
  this.allHref = "";
  this.search  = document.location.hash;
  this.searchIframe = "";
  
  this.init = function ( ){
    try{
      // Check and rewrite all hrefs
      baseURLArr = this.search.split("#");
      if( baseURLArr && baseURLArr[1] ){
    		this.search = "#" + baseURLArr[1];
    		this.searchIframe = "&amp;" + baseURLArr[1];
      }
      this.allHref = document.getElementsByTagName( "a" );
      for( var i = 0; i < this.allHref.length; i++){
        href = this.allHref[ i ].href;
        host = "http://" + window.location.hostname;
        searchString = host + "/de/themen/themen_specials/superfan/";
        if( href.slice(0, searchString.length) == searchString ){
          this.allHref[ i ].href = this.allHref[ i ].href + this.search;
        }
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Superfan.init: \n\t' + e );
    }
  }
  
  this.checkURL = function(){
    try{
      sucheergebnis = document.location.href.search(/de\/themen\/themen_specials\/superfan/);
      if( sucheergebnis != -1 ){
        Sport1_Superfan.init();
      }else{
        Sport1.log( 'NEIN Superfan URL' );
      }
    }catch( e ){
      Sport1.log( 'ERROR: Superfan URL: ' + e );
    }
  }
  
  this.getSearch = function(){
    try{
      return this.search;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Superfan.getSearch: \n\t' + e );
    }
  }

  this.getSearchIframe = function(){
    try{
      return this.searchIframe;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Superfan.getSearchIframe: \n\t' + e );
    }
  }
}

Sport1_Ads = new function() {
  this.billboard            = {};
  this.billboard.heightMin  = 250;
  this.billboard.heightMax  = 330;
  this.billboard.topMin     = -80;
  this.billboard.topMax     = 0;
  this.billboard.zMin       = 400;
  this.billboard.zMax       = 500;
  this.billboard.aboveNavi  = "false";
  
  this.rectangle            = {};
  this.rectangle.widthMax   = 300;
  this.rectangle.heightMax  = 250;
  this.rectangle.zMin       = 444;
  this.rectangle.zMax       = 555;
  
  this.artikelVideoModul    = {};
  this.artikelVideoModul.adTag = null;
  
  this.billboard_init = function ( pWhat ){
    try{
      document.getElementById( "content" ).style.top = "-120px";
      document.getElementById( "footer" ).style.top = "-125px";
      document.getElementById( "contentAd" ).style.display = "block";
      if( pWhat == "expand" ){
        Sport1.addEvent( window, 'load', Sport1_Ads.billboard_toggleExpand );
        Sport1.log( '\t Sport1_Ads.billboard_init: expand' );
      }else if( pWhat == "collapse" ){
        Sport1.addEvent( window, 'load', Sport1_Ads.billboard_toggleCollapse );
        Sport1.log( '\t Sport1_Ads.billboard_init: collapse' );
      }else{
        Sport1.log( '\t ERROR: Sport1_Ads.billboard_init pWhat is: ' + pWhat );
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_init: \n\t' + e );
    }
  }

  this.billboard_toggle = function ( pWhat ){
    try{
      if( pWhat == "expand" ){
        if( this.billboard.aboveNavi != "false" ){
          document.getElementById( "contentAd" ).style.zIndex = this.billboard.zMax;
        }
        document.getElementById( "billboard" ).style.top = this.billboard.topMin + "px";
        document.getElementById( "billboard" ).style.height = this.billboard.heightMax + "px";
        document.getElementById( "billboardFlash" ).style.top = this.billboard.topMax + "px";
        document.getElementById( "links" ).style.top = (this.billboard.topMin + 10) + "px";
        document.getElementById( "rechts" ).style.top = (this.billboard.topMin + 10) + "px";
        if( this.billboard.aboveNavi != "false" ){
          document.getElementById( "header" ).style.zIndex = this.billboard.zMin;
        }
      }else if( pWhat == "collapse" ){
        document.getElementById( "contentAd" ).style.zIndex = this.billboard.zMin;
        document.getElementById( "billboard" ).style.top = this.billboard.topMax + "px";
        document.getElementById( "billboard" ).style.height = this.billboard.heightMin + "px";
        document.getElementById( "billboardFlash" ).style.top = this.billboard.topMin + "px";
        document.getElementById( "links" ).style.top = (this.billboard.topMax + 9) + "px";
        document.getElementById( "rechts" ).style.top = (this.billboard.topMax + 9) + "px";
        document.getElementById( "header" ).style.zIndex = this.billboard.zMax;
      }else{
        Sport1.log( '\t ERROR: Sport1_Ads.billboard_toggle: \n\t param missing' );
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_toggle: \n\t' + e );
    }
  }

  this.billboard_toggleCollapse = function ( ){
    Sport1_Ads.billboard_toggle( 'collapse' );
  }
  
  this.billboard_toggleExpand = function ( ){
    Sport1_Ads.billboard_toggle( 'expand' );
  }
  
  this.hideSuperbanner = function(){
    try{
     var allDIV = document.getElementsByTagName( "div" );
     for(var i = 0; i < allDIV.length; i++){ 
       if( allDIV[i].className == "superbanner" ){
         allDIV[i].style.display = "none";
       }
     }
    }catch(e){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_init: \n\t' + e );
    };
  }
  
  // RECTANGLE
  this.rectangle_init = function ( pWhat ){
    try{
      document.getElementById( "rectangle" ).style.overflow = "hidden";
      if( pWhat == "expand" ){
        document.getElementById( "rectangle" ).style.position = "absolute";
        Sport1.addEvent( window, 'load', Sport1_Ads.rectangle_toggleExpand );
      }else{
        document.getElementById( "rectangle" ).style.position = "relative";
        Sport1.addEvent( window, 'load', Sport1_Ads.rectangle_toggleCollapse );
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.rectangle_init: \n\t' + e );
    }
  }

  this.showAds = function (pAdName, pWidth, pHeight, pPercent) {
    if (adActive() && this.testUmtsParam()) {
      document.write(ads_gettag(pAdName, pWidth, pHeight, pPercent));
    } else {
      this.movePageToY(0);
    }
  }

  this.testUmtsParam = function () {
    var result = Sport1.getURLParameter('umts');
    if (result == 'vodafone') {
      return false;
    } else {
      return true;
    }
  }

  this.rectangle_toggle = function ( pWhat ){
    try{
      if( pWhat == "expand" ){
        document.getElementById( "rectangle" ).style.left   = (303 - this.rectangle.widthMax) + "px";
        document.getElementById( "rectangle" ).style.width  = this.rectangle.widthMax + "px";
        document.getElementById( "rectangle" ).style.height = this.rectangle.heightMax + "px";
        document.getElementById( "rectangle" ).style.position = "absolute";
      }else if( pWhat == "collapse" ){
        document.getElementById( "rectangle" ).style.left   = "  0px";
        document.getElementById( "rectangle" ).style.width  = "300px";
        document.getElementById( "rectangle" ).style.height = "250px";
        document.getElementById( "rectangle" ).style.position = "relative";
      }else{
        Sport1.log( '\t ERROR: Sport1_Ads.rectangle_toggle: \n\t param missing' );
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.rectangle_toggle: \n\t' + e );
    }
  }

  this.rectangle_toggleCollapse = function ( ){
    Sport1_Ads.rectangle_toggle( 'collapse' );
  }
  
  this.rectangle_toggleExpand = function ( ){
    Sport1_Ads.rectangle_toggle( 'expand' );
  }
  
  // ArtikelVideoModul Tracking
  this.artikelVideoModul_callTracking = function ( ){
    try{
      var name = 'artikelvideomodul';
	    Sport1_Tracking.countIVWandSitstat(name);
    }catch( e ){
      Sport1.log( "ERROR: Sport1_Ads.artikelVideoModul_callTracking: " + e );
    }
  }
  
  // GENERAL
  this.centerPage_pageX = null;
  this.centerPageParams = [
    ['superbanner', 6, null, 0],
    ['pres_superbanner', 14, null, 0],
    ['ad_skyscraper', 8, null, 832],
    ['pres_skyscraper', 8, null, 832]
  ];
 
  this.centerPage = function () {
    try{
      var allDIV = document.getElementsByTagName( "div" );
      var screenWidth = document.body.clientWidth;
      screenWidth = ( screenWidth - 900 ) / 2;
      //screenWidth += 35;
      // Page Wrapper
      if( screenWidth > 0 ){
        if( !Sport1_Ads.centerPage_pageX ){
          Sport1_Ads.movePageToX( screenWidth );
          Sport1_Ads.centerPage_pageX = screenWidth;
        }else{
          Sport1_Ads.movePageToX( Sport1_Ads.centerPage_pageX );
        }
        // Banner in verschiedenen Formen
        for(var i = 0; i < allDIV.length; i++) {
          for (var p = 0; p < Sport1_Ads.centerPageParams.length; p++) {
            if (allDIV[i].className == Sport1_Ads.centerPageParams[p][0]) {
              if (!Sport1_Ads.centerPageParams[p][2]) {
                var tmpX = Sport1_Ads.correctBrowserDiff(Sport1_Ads.centerPageParams[p][3] + (screenWidth + Sport1_Ads.centerPageParams[p][1]));
                allDIV[i].style.left = tmpX + "px";
                Sport1_Ads.centerPageParams[p][2] = tmpX;
              } else {
                allDIV[i].style.left = Sport1_Ads.centerPageParams[p][2] + "px";
              }
              Sport1.log( '\t MOVE the ' + Sport1_Ads.centerPageParams[p][0] + ' to: ' + Sport1_Ads.centerPageParams[p][2] + "px" );
            }
          }
        }
        Sport1.log( "Sport1_Ads.centerPage to: " + Sport1_Ads.centerPage_pageX );
      }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.centerPage: \n\t' + e );
    }
  }

  this.correctBrowserDiff = function( pValue ) {
    var str_browser = navigator.appVersion;
    
    if (str_browser.indexOf('MSIE') >= 0) {
      var splitValue = str_browser.split(';');
      
      for (var i = 0; i < splitValue.length; i++) {
        if (splitValue[i].indexOf('MSIE') >= 0) {
          var version = parseInt(splitValue[i].substr(5));
          
          if (version < 8) {
            pValue = pValue - 8;
          }
        }
      }
    }
    return pValue;
  }

  this.movePageToX = function ( pX ) {
    try{
     var allDIV = document.getElementsByTagName( "div" );
     for(var i = 0; i < allDIV.length; i++){ 
       if( allDIV[i].className == "page_wrapper" ){
         allDIV[i].style.left = pX + "px";
         Sport1.log( '\t MOVE the page_wrapper to: ' + pX + "px" );
       }
     }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.movePageToX: \n\t' + e );
    }
  }
  
  this.movePageToY = function ( pY ) {
    try{
     var allDIV = document.getElementsByTagName( "div" );
     for(var i = 0; i < allDIV.length; i++){ 
       if( allDIV[i].className == "page_wrapper" ){
         allDIV[i].style.top = pY + "px";
         Sport1.log( '\t MOVE the page_wrapper to: ' + pY + "px" );
       }
     }
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.movePageToY: \n\t' + e );
    }
  }
  
  // Setter
  this.billboard_setAboveNavi = function ( pStatus ) {
    try{
      this.billboard.aboveNavi = pStatus;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_setAboveNavi: \n\t' + e );
    }
  }
  
  this.billboard_setHeight = function ( pMin, pMax ) {
    try{
      this.billboard.heightMin = pMin;
      this.billboard.heightMax = pMax;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_setHeight: \n\t' + e );
    }
  }

  this.billboard_setTop = function ( pMin, pMax ) {
    try{
      this.billboard.topMin = pMin;
      this.billboard.topMax = pMax;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.billboard_setTop: \n\t' + e );
    }
  }
  
  this.rectangle_setMaxWidth = function ( pMax ) {
    try{
      this.rectangle.widthMax = pMax;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.rectangle_setMaxWidth: \n\t' + e );
    }
  }

  this.rectangle_setMaxHeight = function ( pMax ) {
    try{
      this.rectangle.heightMax = pMax;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.rectangle_setMaxHeight: \n\t' + e );
    }
  }
  
  this.artikelVideoModul_setAdTag = function ( pAdTag ){
    try{
      this.artikelVideoModul.adTag = pAdTag;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.artikelVideo_setAdTag: \n\t' + e );
    }
  }

  //GETTER
  this.artikelVideoModul_getAdTag = function(){
    try{
      return this.artikelVideoModul.adTag;
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.artikelVideo_getAdTag: \n\t' + e );
    }
  }

  this.toggleVerticalBanner = function( pHeight ){
    try{
      document.getElementById( "expandableSuperBanner" ).style.height = pHeight + "px";
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1_Ads.toggleVerticalBanner: \n\t' + e );
    }
  }
  
  this.toggleHorizontalBanner = function( pWidth, pHow ){
    if( pHow == "collapse" ){
      document.getElementById( "header" ).style.zIndex = "100";
      document.getElementById( "expandableSky" ).style.zIndex = "60";
      document.getElementById( "expandableSky" ).style.left = "832px";
      document.getElementById( "expandableSkyFlash" ).style.left = -( 888 - pWidth ) + "px";
    }else if( pHow == "expand" ){
      document.getElementById( "header" ).style.zIndex = "0";
      document.getElementById( "expandableSky" ).style.zIndex = "100";
      document.getElementById( "expandableSky" ).style.left = "104px";
      document.getElementById( "expandableSkyFlash" ).style.left = "0px";
    }
    document.getElementById( "expandableSky" ).style.width = pWidth + "px";
  }
  
  /*Die Funktion erzeugt ein Earth-TV Popup*/
  this.showEarthTV = function (pToken) {    
	/*Erzeugen eines neuen Divs auf Höhe des Cursors*/
	var scrollPos = Sport1.getCursorPosition();
  	var page = document.getElementById('content');	
	var outerDiv = new Element('div',{id:'outerDivEarthTV', 'class':'outerDivEarthTV'});
    outerDiv.setStyles({position:'absolute', left:'150px', top:scrollPos+'px', width:'480px', height:'515px', zIndex:'100000', 
					    backgroundImage:'url(/media/_technik/images/bg_earth-tv.png)', backgroundRepeat:'no-repeat'});
						
	/*Erzeugen des Schließen-Button*/
	var close = new Element('div',{'class':'deleteEarthTV'}).setStyles({position:'relative', left:'455px', top:'3px'});
	var closeLink = new Element('a',{'class':'font_24', href:'javascript:Sport1_Ads.closeEarthTV();'});
	var closeText = document.createTextNode('X');
	close.appendChild(closeLink); 
	closeLink.appendChild(closeText); 
	outerDiv.appendChild(close);
	
	/*Erzeugen eines inneren Divs in den später das Flash reingeschrieben wird*/
	var innerDiv = new Element('div',{id:'innerDivEarthTV', 'class':'innerDivEarthTV'});
	page.appendChild(outerDiv);
	outerDiv.appendChild(innerDiv);
	
	/*Erzeugen des Flash*/
	var flashvars = {};
	var params = {};
	var attributes = {};
	params.allowScriptAccess = 'always';
	params.allowFullScreen = 'true';
	params.quality = 'high';
	Sport1.writeFlash("http://player.stream5.tv/earthtv_sales/earthtv_sales.swf?token="+pToken, "innerDivEarthTV", "470", "470", "9", flashvars, params, attributes);
	flashElement = document.getElementById('innerDivEarthTV');	
	flashElement.style.position = 'relative';
	flashElement.style.top = '7px';
  };
  
  /*Funktion zum Schließen des Earth-TV-Popup*/
  this.closeEarthTV = function () {
	document.getElementById('content').removeChild(document.getElementById('outerDivEarthTV'));
  };  
}


Sport1_Karteireiter = new function() {
  this.toogleReiter = function ( pTargetNum, pMaxItems, pHtmlObject ) {
    try{
      for( var i = 1; i <= pMaxItems; i++){
        if( i == pTargetNum ){
          document.getElementById( pHtmlObject + "_l_" + i ).className = "leftActive";
          document.getElementById( pHtmlObject + "_m_" + i ).className = "middleActive font_3";
          document.getElementById( pHtmlObject + "_r_" + i ).className = "rightActive";
          //document.getElementById( "liveTickerBox_" + i ).style.display = "block";
        }else{
          document.getElementById( pHtmlObject + "_l_" + i ).className = "leftInActive";
          document.getElementById( pHtmlObject + "_m_" + i ).className = "middleInActive font_14";
          document.getElementById( pHtmlObject + "_r_" + i ).className = "rightInActive";
          //document.getElementById( "liveTickerBox_" + i ).style.display = "none";
        }
      }
      Sport1_Tracking.countIVWandSitstat();
    }catch( e ){
      Sport1.log( "ERROR: Sport1.toogleLiveTickerReiter: " + e );
    }
  }
  
  this.ajaxCallBackNewsBox = function( req, my_id, optional_var, url ) {
    // Complete
    if( req.readyState == 4 ) {
      // OK response
      if(req.status == 200) {
        if( document.getElementById( my_id ) ){
          this.loading = true;
          var tmpContent = req.responseText.split( "<!--AJAX-->" );

          if( tmpContent.length == 1 ){
            tmpContent = req.responseText.split( "<!-- AJAX -->" );
          }

          if( tmpContent[1] != undefined ){
            document.getElementById( my_id ).innerHTML = tmpContent[1];
          }else{
            document.getElementById( my_id ).innerHTML = "<div style='padding: 5px;'>Das Splitting war nicht erfolgreich!</div>";
          }
        }
      } else {
        if( document.getElementById( my_id ) ){
          var myText = "\n";
          myText += '<table style="isplay:none"><tr><td class="font_0">' + req.responseText + '</td></tr></table><br />';
          document.getElementById( my_id ).innerHTML = myText;
        }else{
          // Bereich nicht definiert
        }
      }
    }else{
      if( this.loading == true ){
        this.loading = false;
        var myText = "\n";
        myText += '<table width="100%" height="600"><tr valign="middle" align="center"><td class="font_18"><img src=""></td></tr></table><br />';
        document.getElementById( my_id ).innerHTML = myText;
      }
    }
  }
}


Sport1_Homogenizer = new function() {
  this.leftID       = "page_bottom_left";
  this.leftIDWhite  = "pblw";
  this.rightID      = "page_bottom_right";
  this.rightIDWhite = "pbrw";
  this.links = "";
  this.rechts = "";
  this.korrektur = 0;
  
  this.init = function () {
    try{
      this.leftTargetWhite = document.getElementById( this.leftIDWhite );
      this.rightTargetWhite = document.getElementById( this.rightIDWhite );
      this.links = document.getElementById( "links" );
      this.rechts = document.getElementById( "rechts" );
  
      if( this.links.offsetHeight > this.rechts.offsetHeight ){
        this.korrektur = 12;
        this.newHeight = ( this.links.offsetHeight - this.rechts.offsetHeight );
        this.rightTargetWhite.style.height = ( this.newHeight + this.korrektur ) + 'px';
      }else if( this.rechts.offsetHeight > this.links.offsetHeight ){ 
        this.korrektur = 15;
        this.newHeight = ( this.rechts.offsetHeight - this.links.offsetHeight );
        this.leftTargetWhite.style.height = ( this.newHeight + this.korrektur ) + 'px';
      }
    }catch( e ){
      Sport1.log( 'ERROR: Sport1_Homogenizer.init: \n\t' + e );
    }
  }
}

Sport1_Aufmacher = new function() { 
  this.currentItem = 0;
  this.currentId = 0;
  this.currentType = "";
  this.clicked = false;
  this.teaser = new Array();
  this.interval = 6000;
  this.active = true;
  this.navWidth = 470;
  this.navPaddingWidthPerItem = 10;
  this.navMarginWidthPerItem = 1;
  this.type = "topstory";
  this.menue = new Array();
  this.innerHTMLfallBackImage = '<a href="https://web.vodafone.de/sbb/redirectToLandingPage?lyt=dsf&SESSION_TARGET_URL=' + document.location.href + '"><img src="/media/_technik/images/video_fallback/video_topnew_fallback.jpg" height="290" width="470"/></a>';
  
  this.addTeaser = function( pArray, pType ){
    if( typeof( this.teaser[ pType ] ) == "undefined" ){
      this.teaser[ pType ] = new Array();
    }
    this.teaser[ pType ].push( pArray );
  }

  this.setTeaser = function ( pId, pType, pActive ) {
    /**
    Sport1.log( 'Sport1_Aufmacher.setTeaser: pId: ' + pId );
    Sport1.log( 'Sport1_Aufmacher.setTeaser: pType: ' + pType );
    Sport1.log( 'Sport1_Aufmacher.setTeaser: pActive: ' + pActive );
    **/
    var items = 0;
    try{
      items = this.teaser[ pType ].length;
      if( typeof(pActive) != "undefined" ){
        this.active = pActive;
      }
      for( var i = 0; i < items; i++ ){
        if( this.teaser[ pType ][i].id == pId ){
          document.getElementById( "aufmacherHeadline_" + pType ).innerHTML    = this.teaser[ pType ][i].header;
          document.getElementById( "aufmacherSubHeadline_" + pType ).innerHTML = this.teaser[ pType ][i].subline;
          document.getElementById( "aufmacherRSS_" + pType ).innerHTML         = this.teaser[ pType ][i].rss;
          document.getElementById( "aufmacherText_" + pType ).innerHTML        = this.teaser[ pType ][i].text;
          document.getElementById( "aufmacherLinks_" + pType ).innerHTML       = this.teaser[ pType ][i].links;
          document.getElementById( "aufmacherIcon_" + pType ).innerHTML        = this.teaser[ pType ][i].typeicon;
          document.getElementById( "overlay_" + pType ).style.display        = "block";
          document.getElementById( "aufmacherPic_" + pType ).innerHTML       = this.teaser[ pType ][i].image;
          if( this.teaser[ pType ][i].token != "" && this.teaser[ pType ][i].type == "video" ){
            if( !pActive ){
              this.currentType = "video";
              this.clicked = true;
              Sport1_Tracking.countIVWandSitstat( "aufmacher." + this.type + ".setTeaser" );
              Sport1.log( 'Sport1_Aufmacher.setTeaser: call Tracking: ' + "aufmacher." + this.type + ".setTeaser" );
            }
            //document.getElementById( "aufmacherIcon_" + pType ).onclick = function(){ Sport1_Aufmacher.playVideo() };
            //document.getElementById( "aufmacherPic_" + pType ).onclick = function(){ Sport1_Aufmacher.playVideo() };
          }else{
            if( !pActive ){
              this.currentType = "";
              this.clicked = true;
              Sport1_Tracking.countIVWandSitstat( "aufmacher." + this.type + ".setTeaser" );
              Sport1.log( 'Sport1_Aufmacher.setTeaser: call Tracking: ' + "aufmacher." + this.type + ".setTeaser" );
            }
          }
          this.currentId = pId;
        }
      }
    }catch( e ){
      Sport1.log( 'ERROR: 1 Sport1_Aufmacher.setTeaser: \n\t' + e );
    }
    try{
      for( var i = 0; i < items; i++ ){
        var target = document.getElementById( "topNewsNavItem_" + pType + "_" + (i+1) );
        if( this.teaser[ pType ][i].id == pId ){
          target.className = "item active font_101";
        }else{
          target.className = "item inactive font_100";
        }
      }
    }catch( e ){
      Sport1.log( 'ERROR: 2 Sport1_Aufmacher.setTeaser: \n\t' + e );
    }
  }
  
  this.playVideo = function(){
    //Sport1.log( 'Sport1_Aufmacher.setTeaser: this.type: ' + this.type );
    //Sport1.log( 'Sport1_Aufmacher.setTeaser: this.currentId: ' + this.currentId );
    items = this.teaser[ this.type ].length;
    if (Sport1_Ads.testUmtsParam()) {
      for( var i = 0; i < items; i++ ){
        if( this.teaser[ this.type ][i].id == this.currentId ){
          if( this.teaser[ this.type ][i].token != "" ){
            Sport1_Aufmacher.clicked = true;
            document.getElementById( "aufmacherPic_" + this.type ).innerHTML = '<div class="player"><div id="aufmacherPlayerContainer" class="aufmacherPlayerContainer"></div></div>';
            Sport1_Video.showAndPlay(this.teaser[ this.type ][i].token);
            //Sport1.log( 'Sport1_Aufmacher.setTeaser: this.type: ' + this.type );
            //Sport1.log( 'Sport1_Aufmacher.setTeaser: this.token: ' + this.teaser[ this.type ][i].token );
            Sport1_Tracking.countIVWandSitstat( "aufmacher." + this.type + ".play.stream5Player." + this.teaser[ this.type ][i].token );
            Sport1.log( 'Sport1_Aufmacher.playVideo: call Tracking: ' + "aufmacher." + this.type + ".play.stream5Player." + this.teaser[ this.type ][i].token );
          }
        }
      }
    } else {
      document.getElementById( "aufmacherPic_" + this.type ).innerHTML = Sport1_Aufmacher.innerHTMLfallBackImage;
    }
  }

  this.startInterval = function(){
    //Sport1.log( "-----------------------------" );
    /**
    Sport1.log( "Sport1_Aufmacher.startInterval -> Sport1_Aufmacher.active: " + Sport1_Aufmacher.active );
    Sport1.log( "Sport1_Aufmacher.startInterval -> Sport1_Aufmacher.currentType != " + Sport1_Aufmacher.currentType );
    Sport1.log( "Sport1_Aufmacher.startInterval -> !Sport1_Aufmacher.clicked: " + Sport1_Aufmacher.clicked );
    **/
    if( Sport1_Aufmacher.active && Sport1_Aufmacher.currentType != "video" && !Sport1_Aufmacher.clicked ){
      var items = Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ].length;
      if( Sport1_Aufmacher.currentItem < items -1 ){
        for( var i = 0; i < items; i++ ){
          if( Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i].id == Sport1_Aufmacher.currentId ){
            if( typeof( Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i+1] ) != "undefined" ){
              //Sport1.log( "id: " + Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i+1].id );
              //Sport1.log( "htmlObject: " + Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i+1].htmlObject );
              Sport1_Aufmacher.setTeaser( Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i+1].id, Sport1_Aufmacher.type, true );
              Sport1_Aufmacher.currentItem++;
              return;
            }else{
              //Sport1.log( "Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][" + i + "+1] is UNDEFINED" );
            }
          }else{
            //Sport1.log( Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][i].id + " | " + Sport1_Aufmacher.currentId  );
          }
        }
      }else{
        Sport1_Aufmacher.currentItem = 0;
        //Sport1.log( "id: " + Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][Sport1_Aufmacher.currentItem].id ); 
        //Sport1.log( "htmlObject: " + Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][Sport1_Aufmacher.currentItem].htmlObject );
        Sport1_Aufmacher.setTeaser( Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][ Sport1_Aufmacher.currentItem ].id, Sport1_Aufmacher.type, true );
      }
      //Sport1_Aufmacher.currentId = Sport1_Aufmacher.teaser[ Sport1_Aufmacher.type ][Sport1_Aufmacher.currentItem].id;
    }
  }
  
  this.generateNav = function( pType ){
    var target = "";
    var target_arr = new Array();
    var width_arr = new Array();
    var allWidth = 0;
    var allWidthFinal = 0;
    var averageWidth = 0;
    var diffWidth = 0;
    var items = 0;
    var counter = 0;
    var tmpWidth = 0;
    if( typeof( this.menue[ pType ] ) == "undefined" ){
      this.menue[ pType ] = true;
    }else{
      Sport1.log( 'Sport1_Aufmacher.generateNav: Menue already generated...: ' + pType );
      return;
    }
    try{
      this.currentId = this.teaser[ pType ][0].id;
      items = this.teaser[ pType ].length;
      averageWidth = ( this.navWidth - (items* ( this.navPaddingWidthPerItem + this.navMarginWidthPerItem) ) ) / items;
      for( var i = 0; i < items; i++){
        target = document.getElementById( "topNewsNavItem_" + pType + "_" + (i + 1) );
        if( target.offsetWidth < averageWidth ){
          target_arr.push( target );
          width_arr.push( target.offsetWidth );
          allWidth = allWidth + target.offsetWidth + this.navMarginWidthPerItem;
        }else{
          allWidth = allWidth + target.offsetWidth + this.navMarginWidthPerItem; 
        }
      }
    }catch( e ){
      Sport1.log( 'ERROR: 1 Sport1_Aufmacher.generateNav: \n\t' + e );
    }
    try{
      diffWidth = this.navWidth - allWidth;
      tmpWidth = Math.floor( diffWidth / target_arr.length );
      for( var i = 0; i < target_arr.length; i++){
        target_arr[ i ].style.width = width_arr[ i ] + (tmpWidth/2) - this.navPaddingWidthPerItem + "px";
        target_arr[ i ].style.paddingLeft = (tmpWidth/2) + "px";
      }
    }catch( e ){
      Sport1.log( 'ERROR: 2 Sport1_Aufmacher.generateNav: \n\t' + e );
    }
    try{
      for( var i = 0; i < items; i++){
        target = document.getElementById( "topNewsNavItem_" + pType + "_" + (i + 1) );
        allWidthFinal = allWidthFinal + target.offsetWidth + this.navMarginWidthPerItem;
      }
      target = document.getElementById( "topNewsNavItem_" + pType + "_" + items );
      target.style.margin = "0px";
      //tmpWidth = ( target.offsetWidth + this.navMarginWidthPerItem + (this.navWidth-allWidthFinal) ) - this.navPaddingWidthPerItem;
      tmpWidth = (this.navWidth-allWidthFinal);
      var tmp = target.style.width;
      tmp = tmp.split("px").join("");
      tmp = Math.floor( Number( tmp ) + Number( tmpWidth ) );
      target.style.paddingLeft = tmpWidth + "px";
      allWidthFinal = 0;
      for( var i = 0; i < items; i++){
        target = document.getElementById( "topNewsNavItem_" + pType + "_" + (i + 1) );
        allWidthFinal = allWidthFinal + target.offsetWidth + this.navMarginWidthPerItem;
      }
      tmpWidth = (this.navWidth-allWidthFinal);
      var tmp = target.style.width;
      tmp = tmp.split("px").join("");
      tmp = Math.floor( Number( tmp ) + Number( tmpWidth ) + this.navMarginWidthPerItem);
      target.style.width = tmp + "px";
    }catch( e ){
      Sport1.log( 'ERROR: 3 Sport1_Aufmacher.generateNav: \n\t' + e );
    }
    /**
    Sport1.log( "" );
    Sport1.log( "Sport1_Aufmacher.generateNav: " + ( this.navWidth - ( this.navMarginWidthPerItem * items ) ) );
    Sport1.log( "Sport1_Aufmacher.generateNav: allWidth: " + allWidth + " (" + this.navWidth + ")" );
    Sport1.log( "Sport1_Aufmacher.generateNav: allWidthFinal: " + allWidthFinal + " (" + this.navWidth + ") --> " + (this.navWidth-allWidthFinal) );
    Sport1.log( "Sport1_Aufmacher.generateNav: diffWidth: " + diffWidth );
    Sport1.log( "Sport1_Aufmacher.generateNav: tmpWidth: " + tmpWidth );
    Sport1.log( "Sport1_Aufmacher.generateNav: averageWidth: " + averageWidth );
    **/
  }
    
  this.setActive = function( pActive ){
    this.active = pActive;
  }
  
  this.setAufmacherType = function( pType ){
    this.type = pType;
    this.clicked = false;
    this.currentType = "";
    this.showAufmacherType( pType );
    this.generateNav( pType );
    //Sport1_Tracking.countIVWandSitstat( "aufmacher." + pType );
    //Sport1.log( 'Sport1_Aufmacher.setAufmacherType: call Tracking: ' + "aufmacher." + this.type );
  }
  
  this.resetCurrentItem = function(){
    this.currentItem = 0;
    this.currentId = this.teaser[ this.type ][0].id;
    this.setTeaser( this.currentId, this.type, true );
  }
  
  this.showAufmacherType = function( pType ){
    try{
      for( i in this.teaser ){
        if( i == pType ){
          if( document.getElementById( "topnews_content_" + i ) ){
            //Sport1.log( 'Sport1_Aufmacher.showAufmacherType: show: ' + i );
            document.getElementById( "topnews_content_" + i ).className = "modul topnews_content activeContent";
            document.getElementById( "button_" + i ).className = i + "Active font_3";
          }
        }else{
          if( document.getElementById( "topnews_content_" + i ) ){
            //Sport1.log( 'Sport1_Aufmacher.showAufmacherType: hide: ' + i );
            document.getElementById( "topnews_content_" + i ).className = "modul topnews_content inactiveContent";
            document.getElementById( "button_" + i ).className = i + "Inactive font_24_active";
          }
        }
      }
    }catch( e ){
      Sport1.log( 'ERROR: Sport1_Aufmacher.showAufmacherType: \n\t' + e );
    }
  }
}

Sport1_ChannelAufmacher = new function() {
  this.token = '';
  
  this.setToken = function (pToken) {
    this.token = pToken;
  }
  
  this.playVideo = function(){
    if( this.token != '' ){
      if (Sport1_Ads.testUmtsParam()) {
        document.getElementById( 'aufmacherPic').innerHTML  = '<div class="player"><div id="aufmacherPlayerContainer" class="aufmacherPlayerContainer"></div></div>';
        Sport1_Video.showAndPlay(this.token);
        Sport1_Tracking.countIVWandSitstat( "aufmacher.video.play.stream5Player." + this.token );
        Sport1.log( 'Sport1_Aufmacher.playVideo: call Tracking: ' + "aufmacher.video.play.stream5Player." + this.token );
      } else {
        document.getElementById( 'aufmacherPic' ).innerHTML = Sport1_Aufmacher.innerHTMLfallBackImage;
      }
    }
  }
}

Sport1_Video = new function() {
  this.showAndPlay = function(pToken) {
    tmpArr = document.URL.split( "/" );
    Stream5baseURL = tmpArr[ 2 ];

    var playerType = 'teaserPlayer';
    if( Stream5baseURL == 'test.sport1.de' || Stream5baseURL == 'local.refactoring.sport1.de' || Stream5baseURL == 's1dev.intern.sport1.de' ){
      playerType = '_staging_teaserPlayer';
    }
    var playerContainer = "aufmacherPlayerContainer";
    //var prepath = 'http://player.stream5.tv/sport1/player/';
    var prepath = 'http://hwcdn.net/m3u3q2y6/cds/sport1/player/';
    var playerNameStandard = '/StandardPlayer.swf';
    var playerNameTeaser = '/sport1teaser.swf';
    var Stream5baseURL = '';
    var flashvarsPlayer = {};
    var paramsPlayer = {};
    var attributesPlayer = {};
    flashvarsPlayer.token = pToken + "&autoplay=true";
    paramsPlayer.Base = prepath + playerType + '/';
    paramsPlayer.AllowFullScreen = 'true';
    paramsPlayer.WMode = 'transparent';
    paramsPlayer.AllowScriptAccess = 'always';
    paramsPlayer.AllowScale = 'false';
    paramsPlayer.TEST = 'JA'; 
    playerWidth = "470";
    playerHeight = "290";
    paramsPlayer.Movie = prepath + playerType + playerNameTeaser;
    paramsPlayer.Src = prepath + playerType + playerNameTeaser;
    swfURL = prepath + playerType + playerNameTeaser;
    Sport1.writeFlash( swfURL, playerContainer, playerWidth, playerHeight, "9.0.115", flashvarsPlayer, paramsPlayer, attributesPlayer);
  }
}


Sport1_Livebox = new function() {
  this.firstLoad = true;
  this.softClickLabel = '';
  this.customerId = '';

  this.setCustomerId = function( pCustomerId ) {
    this.customerId = pCustomerId;
  }
  
  this.setLinks = function(num, reiterName) {
    this.softClickLabel = '';
    this.writeLink(linkList.sporttype[num], 'livebox_icon', 'pic');
    this.writeLink(linkList.head[num], 'headLiveText', 'text');

    if( this.customerId == '' || this.customerId == 'sport1' ){
      this.writeLink(linkList.links[num], 'leftLiveLink', 'link');
      this.writeLink(linkList.rechts[num], 'rightLiveLink', 'link');
      this.writeLink(linkList.pres[num], 'livebox_pres', 'pres');
      this.countClick( reiterName );
    }
  }
  
  this.writeLink = function(linkObj, divName, type) {
    try {
      var customerPath = '';
      var htmlString = '';
      var htmlElement = document.getElementById(divName);
      var target = '_self';
      
      if (type == 'link' || type == 'text') {
        if (typeof(linkObj) != 'undefined' && linkObj.name != '') {
          if (type == 'link') {
            if (typeof(linkObj.target) != 'undefined' && linkObj.target != '') {
              target = linkObj.target;
            }
            htmlString = '<a href="' + linkObj.url + '" target="' + target + '" class="font_50 list">' + linkObj.name + '</a>';
          }
          else {
            htmlString = linkObj.name.toUpperCase();
          }
        }
      }
      
      if (type == 'pic' && !isNaN(linkObj)) {
        var picPath = '';
        if( this.customerId != '' && this.customerId != 'sport1' ){
          customerPath = "../" + this.customerId + "/";
          picPath += '/livebox_' + this.customerId;
        }
        picPath += '/media/_technik/images/live_ticker_box/img';
        var imgList = new Array('liveboxhead_fussball', 'liveboxhead_basketball', 'liveboxhead_eishockey', 'liveboxhead_handball', 
                                'liveboxhead_tennis', 'liveboxhead_football', 'liveboxhead_baseball');
        htmlString = '<img src="' + picPath + '/' + customerPath + imgList[linkObj - 1] + '.gif" width="21" height="19"/>';
      }
      
      if (type == 'pres') {
        if (typeof(linkObj) && linkObj.source != '') {
          var startTag = '<script type="text/javascript">';
          var cleanSource = linkObj.source;

          if (linkObj.source.indexOf(startTag) != -1) {
            cleanSource = this.sliceAndExecute(cleanSource);
          }
          htmlString = cleanSource;
        }
        else {
          htmlString = '<div class="footer"></div>';
        }
      }
      
      htmlElement.innerHTML = htmlString;
    }
    catch (e) {
      Sport1.log('ERROR: Sport1_Livebox.writeLink: \n\t' + e + '\n Param: ' + linkObj + ' | ' + divName + ' | ' + type);
    }
  }

  this.sliceAndExecute = function(string) {
    var startTag = '<script type="text/javascript">';
    var endTag = '</script>';
    var executeString  = '';
    var returnString = '';
    var stringList = string.split(startTag);
    
    for (var i = 0; i < stringList.length; i++) {
      if (stringList[i].indexOf(endTag) != -1) {
        var splitList = stringList[i].split(endTag);
        var checkString = splitList.shift();
        
        if (checkString.indexOf('addElementLabel') > -1) {
          var softList = checkString.split('"');
          this.softClickLabel = softList[1];

          if (this.firstLoad) {
            Sport1_Tracking.addElementLabel(this.softClickLabel);
          }
        }
        else {
          executeString += checkString;
        }
        returnString += splitList.join("");
      }
      else {
        returnString += stringList[i];
      }
    }
    //Sport1.log("Slice_Return: " + returnString);Sport1.log("Slice_Execute: " + executeString);Sport1.log("Sport1_Livebox/softClickLabel: " + this.softClickLabel);
    
    //if (executeString != '') { eval(executeString); }
    return returnString;
  }

  this.countClick = function(reiterName) {
    if (this.firstLoad) { this.firstLoad = false; }
    else {
      if (typeof(reiterName) != 'undefined' && reiterName != '') {
        var countName = 'livebox.' + reiterName;
        Sport1_Tracking.countIVWandSitstat(countName, this.softClickLabel);
      }
    }
  }
}

Sport1_Scroll = new function() {
  this.scrollExecute = false;
  this.startX = null;
  this.stopX = null;
  this.targetName = null;
  this.faktor = 30;
  this.milliseconds = 20;
  
  this.moveLeft = function ( name, faktor ) {
    if( !this.scrollExecute ){
      this.target = document.getElementById( name );
      if( faktor == undefined ){
        var faktor = 221;
      }
      var width = this.target.offsetWidth;
      var left = this.target.style.left;
      var tmp = ( ( width * -1 ) + (faktor * 2) )
      if( left == "" ){
        left = 0;
      }else{
        left = left.replace( /\px/g, "" );
      }
      if( left > tmp ){
        this.startX = Number(left);
        this.stopX = (Number(left) - faktor);
        this.scrollToXLeft();
      } 
      this.scrollExecute = true;
      //Sport1.log( "name: " + name +  "\t width: " + width + "\t left: " + left + "\t tmp: " + tmp );
    }else{
      this.scrollToXLeft();
      //Sport1.log( "ERROR: Sport1_Scroll.moveLeft --> this.scrollExecute --> false != " + this.scrollExecute );
    }
  }

  this.moveRight = function ( name, faktor ) {
    if( !this.scrollExecute ){
      this.target = document.getElementById( name );
      if( faktor == undefined ){
        var faktor = 221;
      }
      var width = this.target.offsetWidth;
      var left = this.target.style.left;
      var tmp = ( ( width * -1 ) + (faktor * 2) )
      if( left == "" ){
        left = 0; 
      }else{
        left = left.replace( /\px/g, "" );
      }
      if( left < 0 ){
        this.startX = Number(left);
        this.stopX = (Number(left) + faktor);
        this.scrollToXRight();
      } 
      this.scrollExecute = true;
      //Sport1.log( "name: " + name +  "\t width: " + width + "\t left: " + left + "\t tmp: " + tmp );
    }else{
      this.scrollToXRight();
      //Sport1.log( "ERROR: Sport1_Scroll.moveRight --> this.scrollExecute --> false != " + this.scrollExecute );
    }
  }

  this.scrollToXLeft = function () {
    if( this.startX > this.stopX ){
      var tmpFaktor = this.faktor;
      if( ( this.startX - this.stopX) < this.faktor ){
        tmpFaktor = this.faktor / 2;
      }
      this.startX = this.startX - tmpFaktor;
    }
    else{
      this.startX = this.stopX;
      if( this.startX != null ){
        this.target.style.left = this.startX + "px";
      }
      this.startX = null;
      this.stopX = null;
      this.scrollExecute = false;
      //Sport1.log( "Sport1_Scroll.scrollToXLeft: ENDE" );
      return;
    }
    this.target.style.left = this.startX + "px";
    setTimeout( "Sport1_Scroll.scrollToXLeft()", this.milliseconds );
  }
  
  this.scrollToXRight = function () {
    if( this.startX < this.stopX ){
      var tmpFaktor = this.faktor;
      if( ( this.stopX - this.startX ) < this.faktor ){
        tmpFaktor = this.faktor / 2;
      }
      this.startX = this.startX + tmpFaktor;
    }
    else{
      this.startX = this.stopX;
      if( this.startX != null ){
        this.target.style.left = this.startX + "px";
      }
      this.startX = null;
      this.stopX = null;
      this.scrollExecute = false;
      //Sport1.log( "Sport1_Scroll.scrollToXRight: ENDE" );
      return;
    }
    this.target.style.left = this.startX + "px";
    setTimeout( "Sport1_Scroll.scrollToXRight()", this.milliseconds );
  }

}();

/*!
 * Sport1
 *
 * @version    $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author     tim taubert, exozet interact <tim.taubert@exozet.com>
 */

/*global Sport1*/
Sport1 = new function () {
  this.loadUrl = function (url) {
    if (typeof(url) != 'undefined' && url != '') {
      window.location.href = url;
    } else {
      this.log('\t ERROR: Sport1.loadUrl: Url ist leer oder nicht gesetzt.\n');
    }
  }

  this.zoomIn = function () {
    var font = document.getElementById('font');
    var href = font.getAttribute('href');
    
    if (href === '/media/_technik/css/fonts.css') {
      font.setAttribute('href', '/media/_technik/css/fonts_1.css');
    } else if (href === '/media/_technik/css/fonts_1.css') {
      font.setAttribute('href', '/media/_technik/css/fonts_2.css');
    }
  };
  
  this.zoomOut = function () {
    var font = document.getElementById('font');
    var href = font.getAttribute('href');
    
    if (href === '/media/_technik/css/fonts_2.css') {
      font.setAttribute('href', '/media/_technik/css/fonts_1.css');
    } else if (href === '/media/_technik/css/fonts_1.css') {
      font.setAttribute('href', '/media/_technik/css/fonts.css');
    }
  };
  
  this.toggleArtikelVideoModul = function(){
    try{
      var target = document.getElementById( "artikelVideo" );
      target.style.width = "400px";
      target.style.height = "320px";
      target.style.paddingLeft = "70px";
    }catch( e ){
      Sport1.log( '\t ERROR: Sport1.toggleArtikelVideoModul: \n\t' + e );
    }
  }  

  this.printPreview = function () {
    var ele1 = document.getElementById('button_print');
    var ele2 = document.getElementById('button_noprint');
    var ele3 = document.getElementById('print_css');
    
    ele1.style.display   = 'block';
    ele2.style.display = 'block';
    ele3.removeAttribute('media');
         
    var head = document.getElementsByTagName('head')[0];
    var link = document.createElement('link');
    link.setAttribute('rel', 'stylesheet');
    link.setAttribute('type', 'text/css');
    link.setAttribute('href', '/media/_technik/css/print.css');
    link.setAttribute('id', 'print');
    
    head.appendChild(link);
    
    window.scrollTop = 0;
    
    //u=u.replace(/\.channel\.article/g,".channel.print.article"); 
    old = Sport1_Tracking.getSitestatCounter();
    Sport1_Tracking.setSitestatCounter(old.replace(/\.channel\.article/g,".channel.print.article"));
    Sport1_Tracking.setSitestatCounter(old);

    window.print();
  };
  
  this.print = function () {
     this.cancelPrint();
     window.print();
  };
  
  this.cancelPrint = function () {
    var head = Sport1_Element.getFirstElement(document, 'head');
    head.removeChild(document.getElementById('print'));
    /*
    * Changed by e. pitschke on 02.08.08
    * Anscheinend wurden die falschen Elemente angesprochen      
    var ele1 = document.getElementById('artikel_print');
    var ele2 = document.getElementById('artikel_noprint');
    */
    var ele1 = document.getElementById('button_print');
    var ele2 = document.getElementById('button_noprint');
    var ele3 = document.getElementById('print_css');
    ele1.style.display   = 'none';
    ele2.style.display = 'none';
    ele3.setAttribute('media', 'print');
  };
  
  this.removeLastHr = function (el) {
    var last_hr = Sport1_Element.getLastElementByClass(el, 'div', 'hr');
    if (last_hr) {
      //last_hr.parentNode.removeChild(last_hr);
      last_hr.className = "hrEmpty";
    }
  };
  
  
  this.harmonizeContentAndMargin = function (){
    var lm = Sport1_Element.getLastElementByClass('links', 'div', 'modul');
    var rm = Sport1_Element.getLastElementByClass('rechts', 'div', 'modul');
    if (lm && rm){
      this.harmonizeEndingPosition(lm, rm);
    }
  };
  
  this.harmonizeEndingPosition = function (el1, el2) {
    el1.style.height = el2.style.height = 'auto';
    
    var end1 = Sport1_Element.getOffsetTop(el1) + el1.offsetHeight;
    var end2 = Sport1_Element.getOffsetTop(el2) + el2.offsetHeight;
    
    var diff = Math.abs(end1 - end2);
    var el = end1 > end2 ? el2 : el1;
    
    el.style.height = (el.offsetHeight + diff) + 'px';
  };
  
  this.createBookmark = function () {
    var title = 'Sport1.de';
    var url   = '/';
    
    if (window.sidebar) /* Gecko */ {
      window.sidebar.addPanel(title, url, '');
    } else if (window.external) /* Trident */ {
      window.external.AddFavorite(url, title);
    }
  };
  
  this.colorizeMenu = function (el) {
    var color = parseInt('#696969'.substring(1), 16);
    var ele   = document.getElementById(el);
    if(!ele)
    return;
    var items = ele.getElementsByTagName('a');
    if(!items || !items.length)
      return;
      for (var i=0; i<items.length; i++) {
        items[i].style.backgroundColor = '#' + color.toString(16);
        color -= 657930;
        
        if (color < 0) {
          color = 0;
        }
     }
  };
  
  this.rePosition = function( pWho ){
    var width = window.innerWidth;
    if( !width ){
     width = document.body.clientWidth;
    }
    var paddLR = ( width - 1000 ) / 2 + "px";
    if( width > 1024 ){
     //Sport1.log( "A: width: " + width + "\npaddLR: " + paddLR);
     document.getElementById( pWho ).style.left = paddLR; 
    }
    else if( width == 1024 ){
     Sport1.log( "B: width: " + width + "\npaddLR: " + paddLR);
    }
    else {}
  }
  
  /**
  *  
  *  Uebernommene Funktionen aus der globalfunctions.js
  *  
  **/
  this.popup = function( file, w, h, s, pName ) {
    var zeit = new Date();
    var ms = zeit.getTime();
    var scroll = "no";
    var wName = "Sport1PopUp_" + ms;
    if( pName && pName != "" ){
      wName = pName;
    }
    if ( s == 1 || screen.height < h ){
      scroll = "yes";
    }
    open( file, wName,
            +'location=0,'
            +'menubar=0,'
            +'scrollbars='+scroll+','
            +'toolbar=0,'
            +'status=0,'
            +'top=50,left=50,'
            +'width='+w+',height='+h);
    Sport1.log( "PopUp opened with this Name: " + wName );
  }

  this.jsiWriter = function( url ) {
    document.write( '<scr' + 'ipt language="javasc' + 'ript" src="' + url + '"></sc' + 'ript>' );
  }
  
  // Cookies
  this.setCookie = function( name, value, expires, path, domain, secure ){
    document.cookie = name+'='+escape(value)+((expires)?';expires='+expires.toGMTString():'')+((path)?';path='+path:'')+((domain)?';domain='+domain:'')+((secure)?';secure':'');
  }
  
  this.getCookieVal = function( offset ){
    var endstr = document.cookie.indexOf( ';', offset );
    if( endstr == -1 ){
      endstr = document.cookie.length;
    }
    return unescape( document.cookie.substring( offset, endstr ) );
  }

  this.getCookie = function( name ){
    var arg = name+'=';
    var alen = arg.length;
    var clen = document.cookie.length;
    var i=0;
    while( i < clen ){ 
      var j = i + alen;
      if(document.cookie.substring(i,j)==arg){
        return this.getCookieVal(j);
      }
      i = document.cookie.indexOf( ' ', i ) + 1;
      if(i==0){
        break;
      }
    }
    return null;
  }

  this.modifyCookie = function( name, newValue ){
    if( this.getCookie( name ) ){
      this.setCookie( name, newValue );
    }
  }
  this.expressInstallSwfurl = 'http://www.adobe.com/go/getflashplayer_de';
  
  this.writeFlash = function( pURL, pID, pWidth, pHeight, pVersion, flashVars, params, attributes ){
    var output = "";
    var postfix = "";
    try{
      var search = location.search.replace( /\?/g, "" );
      if( search != "" ){
        postfix = "?" + search;
      }
      swfobject.embedSWF( pURL + postfix, pID, pWidth, pHeight, pVersion, this.expressInstallSwfurl, flashVars, params, attributes );
    }
    catch( e ){
      if( e == "TypeError: n has no properties" ){
        output = "DIV Bereich mit der ID " + pTarget + " ist undefined";
      }
      this.log( "writeFlash ERROR: " + output + " --> " +  e );
    }
  }    

  this.log = function( pWhat ){
    try{
      if( navigator.userAgent.indexOf('Firefox') >= 0 ||
          navigator.userAgent.indexOf('Chrome') >= 0
        ){
        console.log( "SPORT1: " + pWhat );
      }
    }catch( e ){}
  }

  /* Event Listener                      */
  /* Sport1.addEvent( window, 'load', FUNKTION ); */
  this.addEvent = function( obj, evType, func ){
    if (obj.addEventListener){ 
      obj.addEventListener( evType, func, false ); 
      return true; 
    }
    else if ( obj.attachEvent ){ 
      var r = obj.attachEvent( "on" + evType, func ); 
      return r; 
    }
    else { 
      return false; 
    }
  }

  this.openNews = function (mainTag, opener) {
    if (mainTag != '') {
      var ele1 = document.getElementById(mainTag);
  
      if (ele1.className == 'news_content') {
        ele1.className = 'news_content_open';
        opener.style.backgroundImage = 'url(http://www.sport1.de/media/_technik/images/btn_news_close.gif)';
        opener.style.top = '1px';
      }
      else {
        ele1.className = 'news_content';
        opener.style.backgroundImage = 'url(http://www.sport1.de/media/_technik/images/btn_news_open.gif)';
        opener.style.top = '0px';
      }
      Sport1_Tracking.countIVWandSitstat('newsbox');
    }
  }
  
  this.showContent = function (idTag) {
    if (idTag != '') {
      var idObj = document.getElementById(idTag);
      idObj.style.display = (idObj.style.display == 'none')? 'block' : 'none';
    }
  }

  this.getURL = function( url, my_id, callback_func, optional_var,  method){
    Sport1.log( "getURL: " + url );
    var req, callback_func, url, optional_var;
    if(typeof(callback_func) == "undefined" || callback_func == "") {
      callback_func = "Sport1.processStateChange";
    }
    if(typeof(method) == "undefined" || callback_func == "") {
      method = "GET";
    }
    
    if(url != "") {
      if(window.XMLHttpRequest) { 
        // Non-IE browsers oder IE 7
        req = new XMLHttpRequest();
        req.onreadystatechange = function() {
          eval( callback_func )( req,my_id,optional_var,url );
        }
        try {
          req.open(method, url, true);
          var isbusy = true;
        } catch(e) {
          Sport1.log( "ERROR: method: "+method+" | getURL: " + e ); 
          var isbusy = false;
        }
        if(isbusy){
          req.send(null);
        }
      } 
      else if(window.ActiveXObject) {
        // IE < 7
        try { 
          req = new ActiveXObject("Msxml2.XMLHTTP"); 
        }
        catch(e) {
          try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
          } 
          catch(e) {
            // Error
            Sport1.log( "ERROR: method:"+method+" | getURL: " + e );
          }
        }
        if(req) {
          req.onreadystatechange = function() {
            eval( callback_func )(req,my_id,optional_var,url);
          }
          try { 
            req.open(method, url, true);
            var isbusy = true;
          } 
          catch(e) {
            // Error
            Sport1.log( "ERROR: method:"+method+" | getURL: " + e );
            var isbusy = false;
          }
          if(isbusy){
            req.send();
          }
        }
      } 
      else {
        // AJAX geht nicht
        Sport1.log( "ERROR: method:"+method+" | getURL: " + "AJAX geht nicht" );
      }
    }
  }

  this.getURLParameter = function ( pParamName ) {
    var result = false;
    var searchText = window.location.search.substr(1);
    
    if (searchText.indexOf(pParamName) >= 0) {
      splitText = searchText.split('&');
      for (var i = 0; i < splitText.length; i++) {
        if (splitText[i].indexOf(pParamName) >= 0) {
          result = splitText[i].substr((pParamName.length + 1));
        }
      }
    }
  
    return result;
  }

  this.processStateChange = function( req, my_id, optional_var, url ) {
    // Complete
    if( req.readyState == 4 ) {
      // OK response
      if(req.status == 200) {
        if( document.getElementById( my_id ) ){
          this.loading = true;
          document.getElementById( my_id ).innerHTML = req.responseText;
        }
      } 
      else {
        if( document.getElementById( my_id ) ){
          var myText = "\n";
          myText += '<table style="display:none"><tr><td class="font_18">' + req.responseText + '</td></tr></table><br />';
          document.getElementById( my_id ).innerHTML = myText;
        }
        else{
          // Bereich nicht definiert
        }
      }
    }
    else{
      if( this.loading == true ){
        this.loading = false;
        var myText = "\n";
        myText += '<table width="100%" height="600"><tr valign="middle" align="center"><td class="font_18"><img src=""></td></tr></table><br />';
        document.getElementById( my_id ).innerHTML = myText;
      }
    }
  }
  
  this.verifySearch = function () {
    try {
      var tmp = document.getElementsByName( "search" )[0];
      if( tmp.value == tmp.title){ 
        tmp.value = "Handball Live";
      }
    }
    catch( e ){ 
      Sport1.log( "ERROR: Sport1.verifySearch: " + e );
    }
  }
  
  this.prefillInput = function (obj, classForm) {
    if (obj.value == '') {
      obj.value = obj.title;
      obj.className =  classForm;
    }
  }
  
  this.removePrefillInput = function (obj, classForm) {
    if (obj.value == obj.title) {
      obj.value = '';
    }
    obj.className = classForm;
  }
  
  this.toogleLiveTickerReiter = function ( pTargetNum, pMaxItems ) {
    try{
      for( var i = 1; i <= pMaxItems; i++){
        //Sport1.log( "i: " + i );
        if( i == pTargetNum ){
          document.getElementById( "liveTickerReiter_l_" + i ).className = "leftActive";
          document.getElementById( "liveTickerReiter_m_" + i ).className = "middleActive font_3";
          document.getElementById( "liveTickerReiter_r_" + i ).className = "rightActive";
          document.getElementById( "liveTickerBox_" + i ).style.display = "block";
        }else{
          document.getElementById( "liveTickerReiter_l_" + i ).className = "leftInActive";
          document.getElementById( "liveTickerReiter_m_" + i ).className = "middleInActive font_14";
          document.getElementById( "liveTickerReiter_r_" + i ).className = "rightInActive";
          document.getElementById( "liveTickerBox_" + i ).style.display = "none";
        }
      }
    }catch( e ){
      Sport1.log( "ERROR: Sport1.toogleLiveTickerReiter: " + e );
    }
  }

  this.setDivDisplayBlock = function (divName) {
    element = document.getElementById(divName);
    if (typeof(element) != 'undefined') {
      element.style.display = 'block';
    }
  }
  
  this.setDivDisplayNone = function (divName) {
    element = document.getElementById(divName);
    if (typeof(element) != 'undefined') {
      element.style.display = 'none';
    }
  }
  
  this.getCursorPosition = function (){
    var scrollPos;
	if (typeof window.pageYOffset != 'undefined') {
		scrollPos = window.pageYOffset;
	}
	else if (typeof document.compatMode != 'undefined' &&
		document.compatMode != 'BackCompat') {
		scrollPos = document.documentElement.scrollTop;
	}
	else if (typeof document.body != 'undefined') {
		scrollPos = document.body.scrollTop;
	}
	return scrollPos;
  }   
    this.escapeString = function ( stringText ){	
		var escapedString = stringText.replace(/&uuml;/g, "ü");
		escapedString = escapedString.replace(/&Uuml;/g, "Ü");
		escapedString = escapedString.replace(/&auml;/g, "ä");
		escapedString = escapedString.replace(/&Auml;/g, "Ä");
		escapedString = escapedString.replace(/&ouml;/g, "ö");
		escapedString = escapedString.replace(/&Ouml;/g, "Ö");
		escapedString = escapedString.replace(/&szlig;/g, "ß");
		return escapedString;
	}    
}();

Sport1BWIN = new function () {
  this.generate = function (pId, pClass, pCode ) {
    if(BWINactive() && pCode != ''){
      try{
        outstring = '<div ';
        if (pId != '') {
          outstring += 'id="' + pId + '" ';
        }
        if (pClass != '') {
          outstring += 'class="' + pClass + '" ';
        }
        outstring += '>';
        outstring += '<img class="ad_text" src="http://www.sport1.de/media/_technik/images/ad_text.gif" alt="Anzeige"/>';
        outstring += pCode;
        outstring += '</div>';
        document.write(outstring);
      }
      catch( e ){
        Sport1.log( "ERROR: Sport1BWIN.generate: " + e );
      }
    }
  }
}

Sport1_Top5 = function (elementNameList, openClassName, closedClassName) {
  this.elementList = elementNameList;
  this.openClassName = openClassName;
  this.closedClassName = closedClassName;
  
  this.open = function (id) {
    for (var i = 0; i < this.elementList.length; i++) {
      var elementObj = document.getElementById(this.elementList[i]);
      if(elementObj != null){
        var img = Sport1_Element.getFirstElement(this.elementList[i], 'img');
        
  
        if (id == i) {
          elementObj.className = this.openClassName;
          var str = img.src.replace('small', 'big');
          img.src = str;
        }
        else {
           elementObj.className = this.closedClassName;
          var str = img.src.replace('big', 'small');
           img.src = str;
        }
      }
    }
  }
}

Sport1_tabCicleSwitch = function(elementList) {
  this.elementList = elementList;
  this.counter = 0;
  this.maxHeight = 0;
  
  this.next = function() {
    this.counter += 1;
    if (this.counter >= this.elementList.length) {
      this.counter = 0;
    }
    this.showContent();
    try{
      Sport1_Tracking.countIVWandSitstat('switchbox');
    }catch( e ){ 
      Sport1.log( "ERROR: Sport1_tabCicleSwitch: " + e );
    }
  }
  
  this.previous = function () {
    this.counter -= 1;
    if (this.counter < 0) {
      this.counter = this.elementList.length -1;
    }
    this.showContent();
    try{
      Sport1_Tracking.countIVWandSitstat('switchbox');
    }catch( e ){ 
      Sport1.log( "ERROR: Sport1_tabCicleSwitch: " + e );
    }
  }
  
  this.showContent = function () {
    for (var i = 0; i < this.elementList.length; i++) {
      var curElement = document.getElementById(this.elementList[i]);
      
      curElement.style.display = (i == this.counter)? 'block' : 'none';
      if (curElement.clientHeight < this.maxHeight) {
        curElement.style.height = this.maxHeight + 'px';
      }
    }
  }
  
  this.getMaxHeight = function () {
    for (var i = 0; i < this.elementList.length; i++) {
      var curElement = document.getElementById(this.elementList[i]);
      curElement.style.display =  'block';
      this.maxHeight = (this.maxHeight < curElement.clientHeight)? (curElement.clientHeight + 5) : this.maxHeight;
      curElement.style.display =  'none';
    }    
  }
//  this.getMaxHeight();
  this.showContent();
}

Sport1_Quiz = function (quizName, quizElement, quizSwitch, questionList) {
  this.quizName       = quizName;
  this.showElement   = document.getElementById(quizElement);
  this.switchElement = document.getElementById(quizSwitch);
  this.questionList  = questionList;
  this.showAnswer     = false;
  this.selected      = false;
  this.counter       = 0;
  this.rightAnswer   = 0;
  
  this.showQuestion = function() {
    var innerHTML = '<p class="question">FRAGE ' + (this.counter + 1) + ':</p>';
    innerHTML += '<h3 class="font_31">' + this.questionList[this.counter].text + '</h3>';
    innerHTML += '<ul class="optionen font_0">';
    
    for (var i = 0; i < this.questionList[this.counter].options.length; i++) {
      innerHTML += '<li class="list"><input type="radio" name="answer_' + this.counter +  '" class="option" id="' + this.quizName + '' + i + '"/>';
      innerHTML += '<label for="answer_' + this.counter +  '" class="optionstext">' + this.questionList[this.counter].options[i] + '</label>';
      innerHTML += '<div class="clear"></div></li>';
    }                      
    innerHTML += '</ul>';

    this.showElement.innerHTML = innerHTML;
    this.showAnswer = true;
    this.selected = false;
  }

  this.showSingleAnswer = function () {
    var rightAnswer = this.checkRightAnswer();
    if (this.selected) {
      var response = (rightAnswer)? 'Richtig. ' : 'Falsch. ';
      var innerHTML = '<p class="question">FRAGE ' + (this.counter + 1) + ':</p>';
      innerHTML += '<h3 class="font_31">' + this.questionList[this.counter].text + '</h3>';
      innerHTML += '<p class="answer font_0"><span class="' + rightAnswer + '">' + response + '</span>' + this.questionList[this.counter].result + '</p>';
  
      this.showElement.innerHTML = innerHTML;
      this.showAnswer = false;
      try{
        Sport1_Tracking.countIVWandSitstat('quiz');
      }catch( e ){ 
        Sport1.log( "ERROR: Sport1_Quiz: " + e );
      }
    }
    else {
      alert('Bitte wählen Sie eine Antwort aus!');
      this.selected = false;
    }
  }

  this.checkRightAnswer = function() {
    for (var i = 0; i < this.questionList[this.counter].options.length; i++) {
      var optionName = this.quizName + '' + i;
      var optionElement = document.getElementById(optionName);

      if (this.questionList[this.counter].answer == (i + 1) && optionElement.checked) {
        this.rightAnswer += 1;
        this.selected = true;
        return true;
      }
      else {
        if (optionElement.checked) {
          this.selected = true;
        }
      }
    }
    return false;
  }

  this.showResult = function () {
    var percent = Math.round((100 / this.questionList.length) * this.rightAnswer);
    var outline = '';
    
    if (percent >= 67 && percent <= 100) {
      outline = 'Gl&uuml;ckwunsch! Sie sind wirklich ein echter Experte!';
    }
    if (percent >= 34 && percent <= 66) {
      outline = 'Gratulation! Mit etwas &Uuml;bung schaffen Sie es bestimmt nach ganz oben!';
    }
    if (percent >= 0 && percent <= 33) {
      outline = 'Da m&uuml;ssen Sie noch etwas &uuml;ben. Meisterlich war das noch nicht.';
    }
    
    var innerHTML = '<p class="question">ERGEBNIS:</p>';
    innerHTML += '<p class="answer">Sie haben ' + this.rightAnswer + ' von ' + this.questionList.length + ' Fragen richtig beantwortet.</p>';
    innerHTML += '<p class="answer">' + outline + '</p>';
    
    this.showElement.innerHTML = innerHTML;
    this.switchElement.style.display = 'none';    
  }

  this.next = function() {
    if (this.showAnswer) {
      this.showSingleAnswer();
    }
    else {
      this.counter += 1;
      if (this.counter == this.questionList.length) {
        this.showResult();
      }
      else {
        this.showQuestion();
      }
      try {
        Sport1_Tracking.countIVWandSitstat('quiz');
      }catch( e ){ 
        Sport1.log( "ERROR: Sport1_Quiz: " + e );
      }
    }
  }
  
  this.showQuestion();
}

//------------------------------------------------------Slide Show----------------------------------

Sport1_Slide = new function (){
  this.flashvars = [];
  this.params = [];
  this.attributes = [];
  this.presentingArr = [];

  this.initialize = function (image, text, json, advertisement){
    this.image  = Sport1_Element.$(image);
    this.text   = Sport1_Element.$(text);
    this.advertisement = advertisement;
    new Sport1_AJAX({
      'url': json,
      'method': 'get',
      'onComplete': Sport1_Function.bind(this.jsonLoaded, this)
    }).send();
    this.now = 0;
  };

  this.jsonLoaded = function (response){
    response = eval('(' + response + ')');
    this.title = response.title;
    this.kategorie = response.kategorie;
    this.diashowID= response.id;
    this.slides = [];
    this.sbSlides = [];
        
    Sport1.log('Sport1_Slide().jsonLoaded() | diashowID: '+response.id);
    for (var i=0; i<response.items.length; i++){
      //Sport1.log("File item for slideshow: " + item.file);
      if(item.file){
        var item = response.items[i];
        item.file = Sport1_Slide.linkPrefix + item.file;
        this.slides.push({
          'text': item.title,
          'image': item.file
        });
        this.sbSlides.push([item.file, item.title]);
      }
    }
    this.response = response;
  };
    
  this.next = function (){
    if (++this.now === this.slides.length){
      this.now = 0;
    }
    this.update();
  };
  
  this.previous = function (){
    if (--this.now === -1){
      this.now = this.slides.length-1;
    }
    this.update();
  };
  
  this.update = function (){
    this.image.setAttribute('src', this.slides[this.now].image);
    if (!this.text){
      return;
    }
    this.text.innerHTML = this.slides[this.now].text + ' (Bild ' + (this.now+1) + '/' + this.slides.length + ')';
  };
  
  this.zoom = function (){
    if (!Slimbox) {
      return;
    }
    var img = new Image();
    img.onerror = Sport1_Function.bind(function () {
      Slimbox.open(this.sbSlides, this.now, {'title': this.title,'diashowID':this.diashowID,'kategorie':this.kategorie});
    }, this);
    img.onload = Sport1_Function.bind(function (){
      Slimbox.open(this.sbSlides, this.now, {'title': this.title,'diashowID':this.diashowID, 'advertisement': this.advertisement,'kategorie':this.kategorie});
    }, this);
    img.src = this.advertisement ? this.advertisement.image : '';
    return false;
  };
  
  this.show = function (json) {
    new Sport1_AJAX({
      'url': json,
      'method': 'get',
      'onComplete': Sport1_Function.bind(this.processShow, this)
    }).send();
  };

  this.showDeepDia = function() {
    if (document.URL.contains('#')) {
      var diaPath = '/de/_navi_ignored/preview/ps_diashows_';
      var diaPathEnd = '.json';
      var varCodeString = document.URL.substr(document.URL.indexOf('#') + 1);
      var varCodes = varCodeString.split(',');
      
      for (var i = 0; i < varCodes.length; i++) {
        if (varCodes[i].substr(0, 8) == 'diashow_') {
          var diaCode = varCodes[i].substr(8);

          if (typeof(diaCode) != 'undefined' && diaCode != '') {
            Sport1_Slide.show(diaPath + diaCode + diaPathEnd);
          }
        }
      }
    }
  }
  
  this.processShow = function (response) {
    response = eval('(' + response + ')');
    this.title = response.title;
    this.kategorie = response.kategorie;
    this.diashowID= response.id;
    this.ivw = response.ivw;
    this.sitestat = response.sitestat;
    this.sbSlides = [];
    for (var i=0; i<response.items.length; i++) {
      var item = response.items[i];
      if(item.file) this.sbSlides.push([Sport1_Slide.linkPrefix + item.file, item.title]);
    }
	
    slideshowPresenting = this.getPresentingById(this.diashowID);
	
    if(typeof(slideshowPresenting) != 'undefined') {
		  if(typeof(slideshowPresenting.presenting_diashow_activated) == 'undefined') {
        Sport1.log('No presenting for slideshow defined');
		  }
		  else {
        Sport1.log("Using presVO for slideshow: " + slideshowPresenting.presenting_diashow_activated);
		  }
    }
    else{
      slideshowPresenting = {};
    }
	
    Slimbox.open(this.sbSlides, 0, {'title': response.title,'diashowID':response.id,'kategorie':response.kategorie,'presVO':slideshowPresenting, 
                                    'ivw':response.ivw, 'sitestat':response.sitestat});
  };
  
  this.get = function (id){
    if (!this.slides.hasOwnProperty(id)){
      return {'next': function (){ return false; },'previous': function (){ return false; },'zoom': function (){ return false; }};
    }
    return this.slides[id];
  };
  
  this.set = function (id, slide){
    this.slides[id] = slide;
  };
  
  this.switchTab = function ( pCurrentTabNum, pAllTabNum ){
    var target = target2 = "";
    
    for( var i = 1; i <= pAllTabNum; i++ ) {
      target = document.getElementById( "diashow_" + i + "_menu" );
      target2 = document.getElementById( "diashow_" + i + "_container_menu" );
      if( i == pCurrentTabNum ){
        target.className = "font_24_active";
        if( pCurrentTabNum == 1 ){
          target2.className = "container_menu activeFirst";
        }else{
          target2.className = "container_menu active";
        }
      }else{
        target.className = "font_24";
        if( i == 1 ){
          target2.className = "container_menuFirst";
        }else{
          target2.className = "container_menu";
        }
      }
    }
    Sport1_Tracking.countIVWandSitstat();
  };
  
  this.setBaseVars = function( pURL, pWidth, pHeight, pVersion, pTarget ){
    this.swfURL = pURL;
    this.swfWidth = pWidth;
    this.swfHeight = pHeight;
    this.swfVersion = pVersion;
    this.swfTarget = pTarget;
  }
  
  this.addDiashow = function( pNum, pFlashVars, pParams, pAttributes ){
    this.flashvars[ pNum ] = pFlashVars;
    this.params[ pNum ] = pParams;
    this.attributes[ pNum ] = pAttributes;
  }
  
  this.displaySWF = function ( pNum ){
    Sport1.writeFlash( this.swfURL, this.swfTarget, this.swfWidth, this.swfHeight, this.swfVersion, this.flashvars[ pNum ], this.params[ pNum ], this.attributes[ pNum ] );
    //Sport1.log( "Sport1_Slide.displaySWF \n\tpNum:" + pNum + "\n\tthis.swfTarget: " + this.swfTarget + "\n\tthis.flashvars[ " + pNum + " ].title0: " + this.flashvars[ pNum ].title0 );
  }
  
  // Presentings
  this.setPresenting = function( pId, pPresObj ){
    try {
      this.presentingArr.push( { id:pId, presenting:pPresObj } );
      //Sport1.log( "Sport1_Slide.setPresenting:\n\t" + "Array: " + this.presentingArr.toSource() );
    }
    catch(e) {
      Sport1.log( "Sport1_Slide.setPresenting:\n\t ERROR by logging: " + e.name+" msg: "+e.message);
    }
    this.getPresentingById( pId );
  }
  
  this.getPresentingById = function( pId ){
    try{
      var tmp = "";
      pId = Number( pId );
      for( var i = 0; i < this.presentingArr.length; i++ ){
        tmp = this.presentingArr[ i ];
        if( pId == tmp.id ) {
          try {
            //Sport1.log( "Sport1_Slide.getPresentingById:\n\t" + "id: " + tmp.id + "\n\tpresenting: " + tmp.presenting.toSource() );
          }
          catch(e) {
            Sport1.log( "Sport1_Slide.setPresenting:\n\t ERROR by logging: " + e.name+" msg: "+e.message);
          }
          return tmp.presenting;
        }
      }
    }
    catch( e ) {
      Sport1.log( "ERROR: Sport1_Slide.getPresenting: " + e );
    }
  }
};

Sport1_Google = new function (){
  this.initialize = function (){
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    //Sport1.log( "Sport1_Google.initialize" );
  }
  
  this.track = function (){
    try {
      var pageTracker = _gat._getTracker("UA-6463074-1");
      pageTracker._setDomainName(".sport1.de");
      pageTracker._trackPageview();
    } catch(err) {
      Sport1.log( "ERROR: Google Tracking: " + err );
    }
    //Sport1.log( "Sport1_Google.track" );
  }
};
Sport1_Google.initialize();


Sport1_Comments = new function (){
  this.comments = [];
  this.comments[ "captcha" ] = false;
  
  this.showCaptcha = function (){
    try{
      if( !this.comments[ "captcha" ] ) {
        this.comments[ "captcha" ] = true;
        document.getElementById( "artikelCaptcha" ).style.display  = "block";
        renewCaptcha('captchaImageComment',true);
        document.getElementById( "btn_s1_comment_sbmt" ).style.top = "-1px";
        Sport1.log( "Sport1_Comments.showCaptcha: send captcha request..." );
      }
      else {
        //Sport1.log( "Sport1_Comments.showCaptcha: Captcha already there..." );
        document.getElementById( "btn_s1_comment_sbmt" ).style.top = "1px";
      }
    }catch( e ){
      Sport1.log( "ERROR: Sport1_Comments.showCaptcha: " + e );
    }
  }
    
}

/* --------------------------------------------- INIT -------------------------------------------------------------------------- */

  //Sport1_Slide.initialize(options.image, options.text, options.json, options.advertisement);
  Sport1_Slide.linkPrefix = 'http://multimediacenter.sport1.de/';
  Sport1_Slide.linkPrefix = '';
  Sport1_Slide.slides = {};

  var baseURL = "";
  
  function INIT(){
    try{ 
      var tmp = "";
      tmp += '<style type="text/css">' + "\n";
      tmp += '  @import url(/media/_technik/css/heimspiel_new.css);' + "\n";
      tmp += '</style>' + "\n";
      //document.getElementById( "api" ).innerHTML += tmp;
      //Sport1.log( "INIT: we load a temp css 4 HEIM:SPIEL " + "\n\t/media/_technik/css/heimspiel_new.css" );

      //Sport1.log( "INIT: homogenize the left and right row..." );
      Sport1_Homogenizer.init();
      
      Sport1_Google.track();
      
      Sport1_Superfan.checkURL();
      Sport1_Slide.showDeepDia();
      if( !Sport1_Ads.testUmtsParam() ){
        var divs = document.getElementsByTagName( 'div' );
        for( var i = 0; i < divs.length; i++){
          if( divs[i].className == "ad_rectangle" ){
            divs[i].style.display = "none";
          }
        }
      }
    }
    catch( e ) { 
      Sport1.log( "ERROR: INIT: " + e );
    }
  }
  
  Sport1.addEvent( window, 'load', INIT );
  
/* --------------------------------------------- ARTICLE JS -------------------------------------------------------------------- */

GLOBAL                      = new Object();
comments                    = new Object();
comments['activated']       = true;
comments['count']           = 0;
comments['commentsPerFile'] = 5;
comments['opened']          = '';
comments['maxLength']       = '500';
comments['firstLoad']       = true;

/* ####### FRONTENDSKRIPTE ####### */

function initComments(){
  setCommentVars();
  if(comments['count'] == 0){
    comments['count_html']                = '<div class="anzahl font_31" id="count_comments">Es wurden noch keine Kommentare geschrieben</div>';
  }
  else{
    comments['count_html']                = '<div class="anzahl font_31" id="count_comments">'+comments['count']+' Kommentare</div>';
  }
  Sport1_Element.$('ARITHNEA_comments_headline').innerHTML = comments['count_html'];


  comments['actualPage']                  = 1;
  comments['pages']                    = Math.ceil(comments['count'] / comments['commentsPerFile']);

  if(comments['count'] > 0){
    loadCommentPage(comments['actualPage']);
    comments['firstLoad'] = false;
  }

  //ARITHNEA_calculateTextLength(); textfield for output isnt present at moment.
  return true;
}

function setCommentPagination(){
  var divID = 'comment_pagination';
  var html  = '<div class="paginate"><div class="pages">';
  var pre   = comments['actualPage'] - 1;

  if(pre >= 1){
    html += '<a class="image" href="#comments" onclick="loadCommentPage('+pre+');"><img src="http://www.sport1.de/media/_technik/images/btn_page_left.gif" alt="&lt;&lt;"/></a>';    
  }

  var class_  = '';

  for(var i=1;i<comments['pages']+1;i++) {
    if(i == comments['actualPage']){
      class_ = 'link font_37_active active';
    }
    else{
      class_ = 'link font_37';
    }

    html += '<a class="'+class_+'" href="#comments" onclick="loadCommentPage('+i+');">'+i+'</a>';
  }
  
  var nxt = comments['actualPage'] + 1;
  if(nxt <= comments['pages']){
    html += '<a class="image" href="#comments" onclick="loadCommentPage('+nxt+');"><img src="http://www.sport1.de/media/_technik/images/btn_page_right.gif" alt="&gt;&gt;"/></a>';
  }

  html += '</div><div class="clear"/></div>';
  Sport1_Element.$('ARITHNEA_comments_pagination').innerHTML = html;

  // close and reopen actually opened form to prevent and ie (css/html) bug calculating div heights
  if(comments['opened']){
    if(Sport1_Element.$(comments['opened'])){
      Sport1_Element.$(comments['opened']).style.display='none';
      Sport1_Element.$(comments['opened']).style.display='block';
    }
  }

  return true;
}

function loadCommentPage(pageNR){
  var html = '';
  var num  = pageNR - 1;
  var url  = ssiRootPath+'/'+artikelID+'/comments_'+num+'.shtml';
  var req  = new Sport1_AJAX({url:url,method:'GET',onComplete:
    function setComments(response){
      comments['actualPage'] = pageNR;
      var html = '';
      html += response;
      Sport1_Element.$('ARITHNEA_comments').innerHTML = html;
      setCommentPagination();
      return true;
    }
  });
  
  if(comments['firstLoad'] == false && comments['actualPage'] != pageNR) {
    Sport1_Tracking.countIVWandSitstat('loadCommentPage_pageNR_'+pageNR+'_artikelID_'+artikelID);
  }
  req.send();
  return true;
}

/* ####### COMMENTS ####### */
// makes an asynchronous call for post a comment, checks inserts and captcha
function comment(){
	Sport1.log('sendSitestatCall: comment_artikelID_'+artikelID+'');
	Sport1_Tracking.countIVWandSitstat('comment_artikelID_'+artikelID+'');
	
	var form      = Sport1_Element.$('kommentar_form');
  form.action   = commentsPath;
  var req       = new Sport1_AJAX({url:form.action,method:"POST",data:form,onComplete:
    function calculateCommentResponse(transport){
      // define error messages
      var returnMsg = new Object();
      returnMsg['TRUE'] = 'Der Kommentar wurde geschrieben. Bitte haben Sie f&uuml;r die Aktivierung ein wenig Geduld.';
      returnMsg['1'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['2'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['3'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['4'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['5'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['6'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['7'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['8'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['9'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['10'] = 'Funktion ist deaktiviert';
      returnMsg['11'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['12'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['13'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['14'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['15'] = 'Ihr Kommentar ist zu lang';
      
      var errors = new Array();
      errors = transport.split(';');
      
      setInnerHTML('answer','',false);
      for(var i=0;i<errors.length;i++) {
        // individual code by response
        switch(errors[i]) {
          case 'TRUE':
          // do something more quit is was correct posted
          renewCaptcha('captchaImageComment'),true;
          // clear form elements
          document.getElementById('autor').value='';
          document.getElementById('email').value='';
          document.getElementById('title').value='';
          document.getElementById('captchaValueImageComment').value='';
          document.getElementById('text').innerHTML='';
          // hide send button
          //document.getElementById('btn_s1_comment_sbmt').className='ARITHNEA_hidden';
          // hide all the form.
          document.getElementById('kommentar_form').className='ARITHNEA_hidden';
          break;
          case '1':
          case '2':            
          // do something by errorcode #1
          renewCaptcha('captchaImageComment',true);
          document.getElementById('captchaValueImageComment').focus();
          break;
          case '3':            
          case '4':            
          case '5':
          
          break;
          case '6':            
          case '7':            
          case '8':            
          case '9':            
          case '10':            
          case '11':            
          case '12':            
          case '13':            
          case '14':
          case '15':
            document.getElementById('text').focus();
          break;
          default:
          comments['activated'] = true;
          break;
			  }
			  if(returnMsg[errors[i]]) {
				  setInnerHTML('kommentar_form_answer',returnMsg[errors[i]],false);
				  Sport1.log( "calculateCommentResponse: " + returnMsg[errors[i]] );
			  }
      }// end for all errors
      comments['activated'] = true;
      return;
    }
  });
  
  // prevent that only one req is at the moment: better - to use a queue implemented like in prototype....
  if(comments['activated']) {
    if(comments['activated'] == true) {
      req.send();
    }
  }
  else {
    req.send();
  }
  comments['activated'] = false;
  return false;
}
function openComment(){
  renewCaptcha('captchaImageRecommendation',true);
  Sport1_Element.$('kommentar_formular').style.display='block';
  comments['opened'] = 'kommentar_formular';
  return;
}
function closeComment(){
  Sport1_Element.$('kommentar_formular').style.display='none';
  return;
}

function ARITHNEA_calculateTextLength(){
  var textField = Sport1_Element.$('text');
  var zeichenUebrig = comments['maxLength'];
  if(textField.value){
  var textValue = textField.value;
    zeichenUebrig = comments['maxLength'] - textValue.length;
    if(zeichenUebrig < 0) {
      // cut the text,...
      var newText = '';
      for(var i=0;i<comments['maxLength'];i++) {
        newText += textValue.charAt(i);
      }
      textField.value = newText;
      textField.innerHTML = newText;
    }
  }

  // set the text into fieldbumms
  var comments_length = Sport1_Element.$('comment_length');
  var uebrigText = '';
  if(zeichenUebrig <= 0) {
    uebrigText = 'Es sind <strong>keine</strong> Zeichen mehr &uuml;brig';
  }
  if(zeichenUebrig == 1) {
    uebrigText = 'Es ist noch 1 Zeichen &uuml;brig';
  }
  if(zeichenUebrig > 1) {
    uebrigText = 'Es sind noch <strong>'+zeichenUebrig+'</strong> Zeichen &uuml;brig';
  }
  comments_length.innerHTML = uebrigText;      

  return true;
}

/* ####### RECOMMENDATION ####### */
// makes an asynchronous call for mail a recommendation, checks inserts and captcha
function recommendation(){
	Sport1_Tracking.countIVWandSitstat('recommendation_artikelID_'+artikelID+'');
	
  var form      = Sport1_Element.$('articleRecommendationForm');
  form.action      = recommendationPath;
  var req        = new Sport1_AJAX({url:form.action,method:"POST",data:form,onComplete:
    // calculates the response
    function calculateRecommendationResponse(response){
      // define error messages
      var returnMsg = new Object();
      returnMsg['TRUE'] = 'Weiterempfehlung wurde gesendet';
      returnMsg['1'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['2'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['3'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['4'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['5'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['6'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['7'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['8'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['9'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';     
      returnMsg['10'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['11'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['12'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['13'] = 'Eingabe unvollst&auml;ndig oder fehlerhaft';
      returnMsg['14'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['15'] = 'Funktion ist deaktiviert';
      
      var errors = new Array();
      errors = response.split(';');
      
      setInnerHTML('answer','',true);
      for(var i=0;i<errors.length;i++) {
        // individual code by response
        switch(errors[i]) {
          case 'TRUE':
          // do something more quit is was correct posted
          renewCaptcha('captchaImageRecommendation',true);
          // clear form elements
          document.getElementById('absender').value='';
          document.getElementById('absenderMail').value='';
          document.getElementById('empfaenger').value='';
          document.getElementById('empfaengerMail').value='';
          document.getElementById('captchaValueImageRecommendation').value='';
          break;
          case '1':
          case '2':            
          // do something by errorcode #1
          renewCaptcha('captchaImageRecommendation',true);
          document.getElementById('captchaValueImageRecommendation').focus();
          break;
          case '3':            
          case '4':            
          case '5':
          
          break;
          case '6':            
          case '7':            
          case '8':            
          case '9':            
          case '10':            
          case '11':            
          case '12':            
          case '13':            
          case '14':
          case '15':
          break;
          default:
          
          break;
			  }
			  if(returnMsg[errors[i]]){
				  setInnerHTML('articleRecommendationForm_answer',returnMsg[errors[i]],false);
			  }
      }// end for all errors
      return;
    }
  });
  req.send();
  renewCaptcha('captchaImageRecommendation',true);
  return false;
}

function openArticleRecommendation(){
  renewCaptcha('captchaImageRecommendation');
  Sport1_Element.$('ARITHNEA_articleRecommendation').style.display='block';
  comments['opened'] = 'ARITHNEA_articleRecommendation';
	//Sport1.log('sendSitestatCall: open_article_recommendation');
	//Sport1_Tracking.countIVWandSitstat('open_article_recommendation');
  return;
}
function closeArticleRecommendation(){
  Sport1_Element.$('ARITHNEA_articleRecommendation').style.display='none';
	//Sport1.log('sendSitestatCall: close_article_recommendation');
	//Sport1_Tracking.countIVWandSitstat('close_article_recommendation');
  return;
}
// this is a dummy, and will be overwritten by jsMetaData.js
function setCommentVars(){
  return;
}

/* ####### FLAGGING ARTICLES ####### */
// makes an asynchronous call for post a comment, checks inserts and captcha
function flagArticle(artikelID){
	Sport1.log('sendSitestatCall: flarArticle_artikelID_'+artikelID+'');
	Sport1_Tracking.countIVWandSitstat('flarArticle_artikelID_'+artikelID+'');
	
  var form     = Sport1_Element.$('flagArticle_'+artikelID);
  form.action  = flaggingPath;
  var req      = new Sport1_AJAX({url:form.action,method:"POST",data:form,onComplete:
    // calculates the response
    function calculateFlaggingResponse(response){
      // define error messages
      var returnMsg = new Object();
      returnMsg['TRUE'] = 'Der Kommentar wurde der Sport1- Redaktion gemeldet';
      returnMsg['1'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['2'] = 'Geben Sie die Ziffern aus den Bild korrekt ein';
      returnMsg['6'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['7'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['8'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['9'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';     
      returnMsg['11'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['12'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['13'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      returnMsg['14'] = 'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.';
      
      var errors = new Array();
      errors = response.split(';');
      
      setInnerHTML('answer','',false);
      for(var i=0;i<errors.length;i++) {
        // individual code by response
        switch(errors[i]) {
  				case 'TRUE':
            // do something more quit is was correct posted
  					renewCaptcha('captchaImageFlagging_'+artikelID);
  					// hide the form.
  					document.getElementById('captchaImageFlagging_'+artikelID).className='ARITHNEA_hidden';
  				break;
  				case '1':
  				case '2':            
  					// do something by errorcode #1 or #2
  					renewCaptcha('captchaImageFlagging_'+artikelID);
  				break;
  				case '6':            
  				case '7':            
  				case '8':            
  				case '10':            
  				case '11':            
  				case '12':            
  				case '13':            
  				case '14':
  				case '15':
  				break;
  				default:
  				
  				break;
        }
        
        if(returnMsg[errors[i]]){
          setInnerHTML('flagArticle_'+artikelID+'_answer',returnMsg[errors[i]],true);
        }
      }// end for all errors
      return;
    }
  });
	req.send();
  return false;
}

function openArticleFlagging(artikelID){
  renewCaptcha( 'captchaImageFlagging_' + artikelID,true );
  var flagElement    = document.getElementById( 'comment_' + artikelID );
  var topOffset = flagElement.top;
  
  var target = document.getElementById( 'flagArticle_' + artikelID );
  //target.style.top = topOffset + 'px';
  target.style.top = '100px';
  target.style.left = '30px';
  target.style.display = 'block';
  
  //Sport1.log("openArticleFlagging: " + artikelID + "\n\ttopOffset: " + topOffset );
	//Sport1.log('sendSitestatCall: open_flaging_article_form_'+artikelID);
	Sport1_Tracking.countIVWandSitstat('open_flaging_article_form_'+artikelID);
  return;
}

function closeArticleFlagging(artikelID) {
  var target = document.getElementById( 'flagArticle_' + artikelID );
  target.style.display = 'none';
	
  //Sport1.log('sendSitestatCall: close_flaging_article_form_'+artikelID);
	Sport1_Tracking.countIVWandSitstat('close_flaging_article_form_'+artikelID);
  return;
}



/* ####### CAPTCHA ####### */
function renewCaptcha(divID,notManually){
  var zeit  = new Date();
  if( document.getElementById( divID ) ){
    Sport1.log( "renewCaptcha: path: " + baseURL + captchaImage + "?captcha=" + divID + "&" + zeit.getUTCSeconds() + zeit.getUTCMilliseconds() );
    window.setTimeout("Sport1_Element.$('" + divID + "').src = '" + baseURL + captchaImage + "?captcha=" + divID + "&" + zeit.getUTCSeconds() + zeit.getUTCMilliseconds() + "';",250);
  }else{
    Sport1.log( "ERROR: renewCaptcha - divID: " + divID );
  }
	// if the captcha wasnt triggert by a script, we count ivw stat
	if(notManually !== true){
		//Sport1.log('sendSitestatCall: renew_captcha_'+divID);
		//Sport1_Tracking.countIVWandSitstat('renew_captcha_'+artikelID);
	}
  return;
}

/* ####### MISC ####### */
function setInnerHTML(id,html,add){
  if(id != null){
    if(document.getElementById(id) != undefined){
      var element = document.getElementById(id);
      element.style.display='block';
      
      if(1 || element.innerHTML){
        if(add == null || add == undefined || add == false){
          element.innerHTML = html;
        }
        else {
          if(element.innerHTML){
            element.innerHTML = element.innerHTML+"<br />"+html;
          }
          else {
            element.innerHTML = html;
          }
        }
      }
    }
  }
  return;
}

// this function opens a slimbox. but only a single image - so this is for the zoomed articleimage. there can only be 1 at present.
function ARITHNEA_openZoomedArticleImage(image,headline){
  var options = {loop:false,showCounter:false,zoomedArticleImage:true};
  Sport1_Tracking.countIVWandSitstat('zoomPic');
  Slimbox.open(image,headline,options);
  //Sport1.log("#info: opened zoomedArticleImage() | image: "+image+" | headline: "+headline+" | advertisement: will be set in slimbox.open() ");
  return true;
}

/* --------------------------------------------- /ARTICLE JS ------------------------------------------------------------------- */

/* --------------------------------------------- ARITHNEA JS ------------------------------------------------------------------- */

// calls the backend trendfunction and opens a popup with this
// sendTrend() is minimal modified function from original from s1 "old" function trend();
// not written by ARITHNEA, just minimaly modified.
function sendTrend(trendID) {
  Sport1.log('#info | sendTrend('+trendID+')');
  try {
    formname  = 'umfrage_'+trendID+'_form';
    var x = document.getElementById(formname);
    var v = x.vote;
        b = false;
    for (var i = 0; i < v.length; i++) {b = b || v[i].checked;}
    if (b) {
      var w = window.open('', 'Sport1Trend', 'width=510,height=390');
      x.submit();
      w.focus();
    }
  }
  catch( e ) {
    Sport1.log( "#ERROR: ARITHNEA_js | sendTrend("+trendID+") | trendID: "+trendID+" | exception: " + e );
  }
}

function insertModuleImage(moduleName,img,href,softClick) {
  try{
    var tmpTarget = document.getElementById( "presImage_" + moduleName );
    var aContent = '';
    var softContent = '';
    var imgContent = '';

    if (typeof(softClick) != 'undefined' && softClick != '') {
      softContent = ' onclick="Sport1_Tracking.trackClick(this,\'' + softClick + '\');return false;"';
    }

    if (typeof(img) != 'undefined' && img != '') {
      imgContent = '<img src="' + img + '" alt=""/>';
    }

    if (typeof(href) != 'undefined' && href != '') {
      aContent = '<a href="' + href + '" target="_blank"' + softContent + '>';
      aContent += imgContent;
      aContent += '</a>';
    }
    else {
      aContent = imgContent;
    }
  
    tmpTarget.innerHTML = aContent;
    tmpTarget.style.display = "block";
  }catch( e){
    Sport1.log( "ERROR: insertModuleImage: " + e );    
  }
}

function getUniqueDOMID(prefix){
  if(prefix == "undefined"){
    var prefix = "";
  }

  var domID = prefix+"_"+createSession();
  while(document.getElementById(domID) != null){
    domID = prefix+"_"+createSession();
  }

  var result = domID;
  return result;
}

function random(min,max){
  return Math.floor(Math.random()*(max - min + 1)) + min;
}

function createSession(min,max,charset){
    if(charset == "undefined"){
      charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    }
    if(min == "undefined"){
      min = 8;
    }
    if(max == "undefined"){
      max = 12;
    }
    var cl;
    cl = charset.length - 1;
    var result = "";

    for(var i=min;i<max;i++){
      result += charset[random(0,cl)];
    }
  return result;
}

// switches content from 2 divs of the teasers.
function ARITHNEA_setTeaser(teaserID){
  Sport1_Element.$('ARITHNEA_teaserContainer').innerHTML = Sport1_Element.$('ARITHNEA_teaserContent_'+teaserID).innerHTML;
  return true;
}

function ARITHNEA_copyDiashowAdContainer(adCode){
  document.getElementById('diashowAdContainer').innerHTML=document.getElementById('diashowAdContainerReference').innerHTML;
  return true;
}

function trackPI(category,modName,typeName){
  return true;
}

/* --------------------------------------------- /ARITHNEA JS ------------------------------------------------------------------ */

/* --------------------------------------------- TO BE DELETED ----------------------------------------------------------------- */

/*!
 * Sport1_AJAX
 *
 * @version     $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author      tim taubert, exozet interact <tim.taubert@exozet.com>
 */

function Sport1_AJAX(options){
  this.initialize = function (url, method, data, update, onComplete, exec){
    this.url    = url;
    this.method = method;
    this.data   = Sport1_Element.$(data);
    this.update = Sport1_Element.$(update);
    this.exec   = exec;
    this.onComplete = onComplete;
    this.req = this.getRequest();
    this.req.onreadystatechange = Sport1_Function.bind(this.readyStateChange, this);
  };
  
  this.send = function (){
    this.req.open(this.method.toUpperCase(), this.url, true);
    this.req.send(this.prepareRequestData());
  };
  
  this.prepareRequestData = function (){
    if (!this.data){
      return null;
    }
    if (Sport1_Element.getType(this.data) === 'element'){
      this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      var fields = [];
      var inputs = this.data.getElementsByTagName('input');
      for (var i=0; i<inputs.length; i++){
        if (Sport1_Array.indexOf(['text', 'hidden', 'checkbox', 'radio'], inputs[i].getAttribute('type')) > -1){
          fields.push(inputs[i].getAttribute('name') + '=' + escape(inputs[i].value));
        }
      }
      var textareas = this.data.getElementsByTagName('textarea');
      for (var x=0; x<textareas.length; x++){
        fields.push(textareas[x].getAttribute('name') + '=' + escape(textareas[x].value));
      }
      return fields.join('&');
    }
    
    return null;
  };
  
  this.readyStateChange = function (){
    if (this.req.readyState == 4 && this.req.status == 200){
      if (this.update){
        this.update.innerHTML = this.req.responseText;
        if (this.exec){
          this.execute(this.req.responseText);
        }
      }
      if (this.onComplete){
        this.onComplete(this.req.responseText);
      }
    }
  };
  
  this.execute = function (text){
    var scripts = '';
    text.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function (){
      scripts += arguments[1] + '\n';
      return '';
    });
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.text = scripts;
    var head = Sport1_Element.getFirstElement(document, 'head');
    head.appendChild(script);
    head.removeChild(script);
  }
  
  this.getRequest = function (){
    if (window.XMLHttpRequest){ 
      return new XMLHttpRequest();
    }
    try{ 
      return new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
  };
  this.initialize(options.url, options.method || 'post', options.data, options.update, options.onComplete, options.exec);
}

/*!
 * Sport1_Function
 *
 * @version     $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author      tim taubert, exozet interact <tim.taubert@exozet.com>
 */

/*global Sport1_Function*/
Sport1_Function = new function (){
  this.create = function (func, options){
    var self = func;
    options = options || {};
    return function (event){
      var args = options.args;
      args = (args !== undefined) ? Sport1_Array.splat(args) : Array.prototype.slice.call(arguments, options.event ? 1 : 0);
      if (options.event){
        args = Sport1_Element.extend([event || window.event], args);
      }
      var returns = function (){
        return self.apply(options.bind || null, args);
      };
      if (options.delay){
        return setTimeout(returns, options.delay);
      }
      if (options.periodical){
        return setInterval(returns, options.periodical);
      }
      return returns();
    };
  };

  this.bind = function (func, bind, args){
    return this.create(func, {'bind': bind, 'args': args});
  };
  
  this.bindWithEvent = function (func, bind, args){
    return this.create(func, {'bind': bind, 'event': true, 'args': args});
  };
  
  this.periodical = function (func, interval, bind, args){
    return this.create(func, {'periodical': interval, 'bind': bind, 'args': args})();
  };
  
  this.delay = function (func, delay, bind, args){
    return this.create(func, {'delay': delay, 'bind': bind, 'args': args})();
  };
}();

/*!
 * Sport1_Array
 *
 * @version     $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author      tim taubert, exozet interact <tim.taubert@exozet.com>
 */

/*global Sport1_Array*/
Sport1_Array = new function (){
  this.splat = function (obj){
    var type = Sport1_Element.getType(obj);
    return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
  };
  this.indexOf = function (arr, item){
    for (var i=0; i<arr.length; i++){
      if (arr[i] === item){
        return i;
      }
    }
    return -1;
  };
}();

/*!
 * Sport1_Element
 *
 * @version     $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author      tim taubert, exozet interact <tim.taubert@exozet.com>
 */

Sport1_Element = new function (){
  this.$ = function (id){
    return (typeof id !== 'object') ? document.getElementById(id) : id;
  };
  this.getElementsByClass = function (el, tag, c){
    var els = [];
    var tags = Sport1_Element.$(el).getElementsByTagName(tag);
    for (var i=0; i<tags.length; i++){
      if (this.hasClass(tags[i], c)){
          els.push(tags[i]);
      }
    }
    return els;
  };
  
  this.getFirstElement = function (el, tag){
    var els = Sport1_Element.$(el).getElementsByTagName(tag);
    return els.length === 0 ? null : els[0];
  };
  
  this.getLastElementByClass = function (el, tag, c){
    var els = this.getElementsByClass(el, tag, c);
    return els.length === 0 ? null : els[els.length-1];
  };
  
  this.getOffsetTop = function (el){
    var top = el.offsetTop;
    var parent = el.offsetParent;
    while (parent){
      top += parent.offsetTop;
      parent = parent.offsetParent;
    }
    return top;
  };
  
  this.hasClass = function (el, className){
    return Sport1_String.contains(el.className, className, ' ');
  };
  
  this.addClass = function (el, className){
    if (!this.hasClass(el, className)) {
      el.className = Sport1_String.clean(el.className + ' ' + className);
    }
  };
  
  this.removeClass = function(el, className){
    el.className = Sport1_String.clean(el.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1'));
  };
  
  this.extend = function (el, arr){
    for (var i=0, j=arr.length; i<j; i++){
      el.push(arr[i]);
    }
    return el;
  };
  
  this.getType = function (obj){
    if (obj === undefined){
      return false;
    }
    if (obj.nodeName){
      switch (obj.nodeType){
        case 1:
          return 'element';
        case 3:
          return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
      }
    }else if (typeof obj.length === 'number'){
      if (obj.callee){
        return 'arguments';
      }else if (obj.item){
        return 'collection';
      }
    }
    return typeof obj;
  };
}();

/*!
 * Sport1_String
 *
 * @version     $Id$
 *
 * @copyright   2008 exozet berlin gmbh
 * @author      tim taubert, exozet interact <tim.taubert@exozet.com>
 */

/*global Sport1_String*/
Sport1_String = new function (){
  this.contains = function (haystack, needle, separator){
    return (separator) ? (separator + haystack + separator).indexOf(separator + needle + separator) > -1 : haystack.indexOf(needle) > -1;
  };
    
  this.clean = function (string){
    return this.trim(string.replace(/\s+/g, ' '));
  };
    
  this.trim = function (string){
    return string.replace(/^\s+|\s+$/g, '');
  };
}();

function useOldIVWCodes(){ 
  return false;
}
