  // identify user agents
  var tileValue = 1;
  var gnEbMinZIndex = 0;
  var hbx_pagename = "";
  var hbx_seg_val = "";
  
  var mac    = window.navigator.platform == "MacPPC" && navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4";
  var mac_ie = window.navigator.platform == "MacPPC" && navigator.userAgent.match(/MSIE/i);
  var safari = window.navigator.platform == "MacPPC" && navigator.userAgent.match(/Safari/i);
  var ie     = navigator.userAgent.match(/MSIE\s5.*/i);
  var ie4    = navigator.userAgent.match(/MSIE\s4.*/i);
  var ie5    = navigator.appVersion.match(/MSIE.+5\.0/i);
  var ie6    = navigator.userAgent.match(/MSIE\s6.*/i);
  var ie7    = navigator.userAgent.match(/MSIE\s7.*/i);  
  var ie8    = navigator.userAgent.match(/MSIE\s7.*/i);  
  var ua_ie = ie || ie4 || ie5 || ie6 || ie7 || ie8;
  var op     = navigator.userAgent.indexOf('Opera') != -1;
  var ns4    = navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4";
  var moz    = navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) > "4";
  var ns6    = navigator.userAgent.match(/Netscape6/i);
  var konq   = navigator.userAgent.match(/Konqueror/i);
  var fustyUserAgent = mac_ie || ns4 || ns6 || mac || ie4;
  var msie   = ie || ie5 || ie6;

  if(mac_ie)
    document.writeln('<link rel="stylesheet" href="/css/GEO/ie_mac.css" type="text/css" media="screen" />');

// adtag flags
  fullsize = 0;
  wallpaper = 0;
  LeaderBoard = 0;
  LeaderBoard_oversize = 0;
  promo = 0;
  halfpage = 0;
  contentad = 0;
  skyscraper = 0;
  textteaser = 0;
  textcontent = 0;
  popup = 0;
  
  var no_col_adj = 0;
  
// vars for adplace refreshing
  ad_refresh_counter = 1;
  ad_date = new Date();
  ad_timestamp = ad_date.getTime();  
  //ad_belegung = "homepage";  

//detect flash 7 plugin or active-x
  var usesActiveX = false;
  var swf7 = false;
  var swf8 = false;
  var swf9 = false;
  var swf10 = false;
  
  if (navigator.plugins.length != 0) {
    for (i=0; i<navigator.plugins.length; i++) {
      var plugDescr = navigator.plugins[i].description.toLowerCase();
      if ((plugDescr.indexOf('flash') != -1) && (plugDescr.indexOf('7.') != -1)) {
        swf7 = true;        
      } else if((plugDescr.indexOf('flash') != -1) && (plugDescr.indexOf('8.') != -1)) {
        swf8 = true;
      } else if((plugDescr.indexOf('flash') != -1) && (plugDescr.indexOf('9.') != -1)) {
        swf9 = true;
      } else if((plugDescr.indexOf('flash') != -1) && (plugDescr.indexOf('10.') != -1)) {
        swf10 = true;
      }
    }
  } else {
    usesActiveX = true;
  }

// #### resize layout for halfpage-integration ####
function resizeLayout() {
  document.getElementById("magNav").style.padding            = "0 0 3px 60px";
  document.getElementById("rubrikenAd").style.width          = "991px";
  document.getElementById("mainHeader").style.width          = "991px";
  if(ie5) document.getElementById("mainNav").style.width     = "991px"; 
  else    document.getElementById("mainNav").style.width     = "992px"; 
  document.getElementById("seperatorHalfpage").style.display = "block";
  document.getElementById("topNavHalfpage").style.display    = "block";
  document.getElementById("mainContent").style.width         = "993px";
  document.getElementById("right").style.width               = "336px";
  if(document.getElementById("issueBoxLarge")) 
    document.getElementById("issueBoxLarge").style.display   = "block";
  if(ie5) document.getElementById("footer").style.width      = "992px";
  else    document.getElementById("footer").style.width      = "991px";
  if (document.getElementById("floater")) document.getElementById("floater").style.display = "none";
  if (document.getElementById("skyscraper_1")) document.getElementById("skyscraper_1").style.display = "none";
  document.getElementById("gujSites").style.width            = "991px";
  document.getElementById("promoAd").style.display           = "inline";
  document.getElementById("promoAd").style.visibility        = "visible";
  //document.getElementById("promoAd").style.visibility        = "visible";
  document.getElementById("promoAd").style.width             = "336px";
  document.getElementById("promoAd").style.margin            = "0 0 10px 0";
  if(document.getElementById('issueBox'))
    document.getElementById('issueBox').style.display        = "none";
}

// #### resize layout for halfpage-integration ####
function resizeLayout2() {
  document.getElementById("magNav").style.padding            = "0 0 3px 60px";
  if(document.getElementById("superbanner_1")) {
    document.getElementById("superbanner_1").style.width          = "991px";
  }
  document.getElementById("mainHeader").style.width          = "991px";
  if(ie5) document.getElementById("mainNav").style.width     = "991px"; 
  else    document.getElementById("mainNav").style.width     = "992px"; 
  document.getElementById("seperatorHalfpage").style.display = "block";
  document.getElementById("topNavHalfpage").style.display    = "block";
  document.getElementById("mainContent").style.width         = "993px";
  document.getElementById("right").style.width               = "336px";
  if(document.getElementById("issueBoxLarge")) {
    document.getElementById("issueBoxLarge").style.display   = "block";
    //document.getElementById("issueBoxLarge").style.margin   = "16px 0 0 0";
  }
  if(ie5) document.getElementById("footer").style.width      = "992px";
  else    document.getElementById("footer").style.width      = "991px";
  if (document.getElementById("floater")) 
    document.getElementById("floater").style.display = "none";
  document.getElementById("gujSites").style.width            = "991px";
  //document.getElementById("halfpagead_1").style.width             = "336px";
  //document.getElementById("halfpagead_1").style.padding            = "0 17px 10px 0";
  if(document.getElementById('issueBox'))
    document.getElementById('issueBox').style.display        = "none";
    
  adjustRightCol();
}


// submit search query for specified service
	function submitQuery(formular, query, service){
    
    if(!service)
      var service = document.forms[formular].service.options[document.forms[formular].service.options.selectedIndex].value;
    if(!query)
		  var query   = document.forms[formular].elements["q"].value;
      
		switch(service){
      case "geo":
        document.headerSearchForm.action = "/GEO/info/suche/?service=geo&q="+query;
        document.headerSearchForm.submit();
        break;
      case "geolino":
        document.headerSearchForm.action = "/GEOlino/service/suche/?service=geolino&serviceid=GEOlino&q="+query;
        document.headerSearchForm.submit();
        break;
       case "georc":
        blank_window("http://www.geo-reisecommunity.de/suche?suche="+query,"rc");
        break;
      case "presse":
        //blank_window("http://www.geo.de/GEO/static/registersuche/results.html?START=1&JBEGIN=&TEXT=" + query,"register");
        break;
      case "register":
        var jetzt = new Date();
        var reg_bis_day   = jetzt.getDate();
        var reg_bis_month = jetzt.getMonth();        
        var reg_bis_year  = jetzt.getFullYear();
        reg_bis_month     = reg_bis_month+1;
        if(reg_bis_day < 10) reg_bis_day = "0"+reg_bis_day;
        if(reg_bis_month < 10) reg_bis_month = "0"+reg_bis_month;
        reg_bis = reg_bis_day+"."+reg_bis_month+"."+reg_bis_year;
        document.headerSearchForm.action = "/GEO/info/suche/heftregister.html?q="+query+"&is_search=1&reg_von=01.01.1976&reg_bis="+reg_bis+"&sortRev=0";
        document.headerSearchForm.submit();
        break;
      case "forum":
        blank_window("/GEO/static/forum/dosearch.php?Words="+query+"&Cat=1,2,3&Forum=All_Forums&Match=And&Old=allposts&Limit=25","forum");
        break;
      case "shop":
        var popup = window.open("/search/webshop.html?q="+query,"shop","width=637,height=650,scrollbars=yes,resizable=yes,menubar=no,locationbar=no");
        popup.focus();
        break;
      case "stern":
        var popup = window.open("http://wefind.stern.de/stern/search?query=" + query, "stern");
        popup.focus();
        break;
      case "wissen":
        var popup = window.open("http://www.wissen.de/wde/generator/wissen/services/suche/index.html?query="+query,"wissen");
        popup.focus();
        break;
    }
	}

// various popup-functions
  function openWindow(page,breite,hoehe,name){
    var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=no,resizable=yes,menubar=no,locationbar=no");
    popup.focus();
  }  
  function openScrollWindow(page,breite,hoehe,name){
    var popup = window.open(page,name,"width=" + breite + ",height=" + hoehe + ",scrollbars=yes,resizable=yes,menubar=no,locationbar=no");
    popup.focus();
  }
  function blank_window(page, target){
    var popup = window.open(page,target);
    popup.focus();
  }
  function open_leserreise(page){
		popup = window.open(page,"leserreise","width=660,height=730,scrollbars=yes,resizable=yes,menubar=no,locationbar=no,toolbar=no,left=0,top=0");
		popup.focus();
	}


  function sendArticle(headline){
    var url  = window.location.href;
    var link = url.replace(/\?.*/,"");
    window.location.href = 'mailto:?subject=GEO.de Linktipp: ' + headline + '&body=%0A' + link;
  }

  // add function  getElementsByClassName
  function getElementsByClassName(class_name) {
    var all_obj, ret_obj = new Array(), j = 0, teststr;

    if(document.all) 
      all_obj = document.all;
    else if (document.getElementsByTagName && !document.all)
      all_obj = document.getElementsByTagName("*");
      
    for(i = 0; i < all_obj.length; i++) {
      if(all_obj[i].className.indexOf(class_name)!= -1) {
        teststr = "," + all_obj[i].className.split(" ").join(",")+",";
        if(teststr.indexOf("," + class_name + ",") != -1) {
          ret_obj[j] = all_obj[i];
          j++;
        }
      }
    }
    return ret_obj;
  }

// transform  teaser layout on contentad-delivery   
  function transformTeaserLayout() {
    var teaserElement = getElementsByClassName("teaserM").length - 1;
    var teaserWidth = 573;
    var teaserMargin = "0 18px 18px 18px";   
   
    if(msie) teaserMargin = "0 0 10px 9px";
    if(ie7)  teaserMargin = "18px";
    
    document.getElementsByName("teaserImg")[teaserElement].style.display = "none";      
    getElementsByClassName("teaserM")[teaserElement].style.width = teaserWidth + "px";  
    getElementsByClassName("teaserM")[teaserElement].style.padding = "10px";  
    getElementsByClassName("teaserM")[teaserElement].style.margin = teaserMargin;  
    getElementsByClassName("teaserM")[teaserElement].style.border = "1px solid #" + catColorDark; 
  }

// display or hide the reportBox for  article comments
  function reportComment(warn_comment, comment_nr, pv, comments_pv) {
    var report_box    = document.getElementById("report"+comment_nr);
    var report_button = document.getElementById("button"+comment_nr);
    var comment_box   = document.getElementById("commentBox"+comment_nr);
    
    if(report_box) {
      comment_box.removeChild(report_box);
      report_button.style.display = "block";
    } else {
      report_button.style.display = "none";
      comment_content = comment_box.innerHTML;
      report_content = '<div class="reportBox" id="report'+comment_nr+'"><form name="notify_form'+comment_nr+'" id="notify_form'+comment_nr+'" action="#comments" method="post"><input type="hidden" name="comment_id" value="'+comment_nr+'" /><input type="hidden" name="com" value="notify" /><input type="hidden" name="p" value="'+pv+'" /><input type="hidden" name="pageview" value="'+comments_pv+'" /><strong>Beitrag mit bedenklichem Inhalt melden</strong><div class="close" title="Box schlie&szlig;en" onclick="reportComment(\''+warn_comment+'\',\''+comment_nr+'\',\''+pv+'\');">[x]</div><br class="clearFloat" /><br />Grund der Meldung (mindestens 10 Zeichen): <p id="errorMessage'+comment_nr+'" style="color:red"></p><input type="text" style="margin-left: 0px;width:350px; font-size:10px;" name="reportReason" maxlength="50" value="" onfocus="if (this.value == \'Eingabe von mindestens 10 Zeichen\') this.value=\'\'" /><br /><br /><img src="/images/GEO/kommentar/beitrag_melden.gif" width="92" height="19" onclick="checkReportComment(0, '+comment_nr+', 0, 0)" alt="Beitrag melden!" title="Beitrag melden!"/> </form></div>';
      comment_box.innerHTML = comment_content+report_content;
    }
  }
  
  function checkReportComment(warn_comment, comment_nr, pv, comments_pv) {
	
	textlaenge = document.getElementById("notify_form"+comment_nr).reportReason.value;
	textlaenge = textlaenge.length;
	if (textlaenge < 10)
	document.getElementById("errorMessage"+comment_nr).innerHTML = "Bitte geben Sie mindestens 10 Zeichen ein!";
	
	else
	//document.getElementById("errorMessage"+comment_nr).innerHTML = "alright";
	document.getElementById("notify_form"+comment_nr).submit();
	
  }

  
  /* 2007-08-03 js (spiegel.julia@guj.de) 
  	Zaehlt, wie viele Zeichen schon ins Textfeld eingegeben wurden, und gibt einen Status darueber aus. 
	Ausserdem eine Fehlermeldung, wenn es mehr als 1000 Zeichen sind */
	function count_textarea(text)
	{
		
		if (text.length >= 1000)
		{
			document.getElementById("form-error-msg_comment_text").innerHTML = "<strong style=\"color:red\">Sie haben die maximale Textl&auml;nge von 1000 Zeichen erreicht!<strong>";
			document.getElementById("form-comment-text-counter").innerHTML = "";
			document.getElementById("mitteilung").value = document.getElementById("mitteilung").value.substring(0,1000);
		}
		
		else
		{
			document.getElementById("form-comment-text-counter").innerHTML = "Noch "+(1000 - text.length) + " Zeichen frei";
			document.getElementById("form-error-msg_comment_text").innerHTML = "";
		}
		
	}


//tracking for flash and dhtml applications
function flashInteractionTracking (application, action, clicktarget, refresh_freq){	
  if(!refresh_freq) refresh_freq = 2;
  
  var IVW = "http://geo.ivwbox.de/cgi-bin/ivw/CP/"+agof_id+";"+ivw_id+",,"+application+",";	
  
  //google analytics alt
  if(typeof urchinTracker == "function") {
    urchinTracker(application+"-"+action+"="+clicktarget);
  }	
  
  //google analytics neu
  //pageTracker._trackPageview(application);
  //pageTracker._trackEvent(application, action, clicktarget);
  _gaq.push(['_trackPageview', "/"+application+"/"+action+"/"+clicktarget]);
  //alert("/"+application+"/"+action+"/"+clicktarget);
  _gaq.push(['_trackEvent', application, action, clicktarget]);
  
  // Site Catalyst
  if((typeof s != "undefined") && (s != null)) {
    savehier = s.hier1;
    saveprop7 = s.prop7;    

    if (application.match(/schiebepuzzle/)) {
      application = application.replace(/_\d{4,5}/g, "");
    }
    
    //s.prop7 = application;
    s.prop7 = "interaktion-spiele";
    s.hier1 = s.hier1 + ","+application;
    
    s.referrer=window.location.protocol+"//"+document.location.host+document.location.pathname;
    void(s.t());
    s.prop7 = saveprop7;
    s.hier1 = savehier;
  }
  
  if(!document.getElementById("pixel_container")) {
    var pc = document.createElement('div');  
    pc.setAttribute('id', 'pixel_container');
    $('body').append(pc);
  }
  
  document.getElementById("pixel_container").innerHTML = "<img src='"+IVW+"?r=noref&amp;d="+(Math.random()*100000)+"' width='1' height='1' alt='' \/><br \/>";
  
  //refreshAdPlaces(refresh_freq);
}

//tracking for brightcove video
function videoTracking(player, lineup, video, videoKeywords) {
 
	var p1 = deleteUmlaute(player);
    var p2 = deleteUmlaute(lineup);
    var p3 = deleteUmlaute(video);
	var p3 = deleteUmlaute(video);
    if (videoKeywords) {
        p4 = deleteUmlaute(videoKeywords);
    }
	//alert(agof_id+videoKeywords);
	ivw_string = 'http://geo.ivwbox.de/cgi-bin/ivw/CP/'+agof_id+';'+ivw_id+',,Brightcove_'+ p1 +':'+ p2 +':'+ p3 +',?p='+ (Math.random()*100000);
	
	if(typeof _hbPageView == "function") {
		  _hbPageView(hbx_para_1, hbx_para_2);
		}
	 	 
	 if(!document.getElementById("pixel_container")) {
    var pc = document.createElement('div');  
    pc.setAttribute('id', 'pixel_container');
    $('body').append(pc);
	}
  
	document.getElementById("pixel_container").innerHTML = "<img src='"+ivw_string+"?r=noref&amp;d="+(Math.random()*100000)+"' width='1' height='1' alt='' \/><br \/>";
  
}

// global cookie function
function setCookie (name, string, expires){	
  var date = new Date();
  killtime = date.getTime()+expires;
  document.cookie = name+"="+string+"; expires="+killtime;
  //alert(name+"="+string+"; expires="+killtime);
}


function doRequest(url) {  
        http_request = false;
        error = false;
        
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Ende: ( Kann keine XMLHTTP-Instanz erzeugen');
            return false;
        }
     
        if(!error) {
          http_request.onreadystatechange = processAdResponse;
          http_request.open('GET', url, true);
          http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded charset:ISO-8859-1');
          http_request.send(null);         
        } 
}

function processAdResponse() {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {

                // get the response XML and the ad values
                var xmlDoc = http_request.responseXML;
                var bannerCode = xmlDoc.getElementsByTagName("banner")[0].childNodes[0].nodeValue;
                var bannerType = xmlDoc.getElementsByTagName("banner")[0].getAttribute("type");
                var skyCode = xmlDoc.getElementsByTagName("sky")[0].childNodes[0].nodeValue;
                
                //alert(skyCode);
                //alert(bannerType);
                
                if(bannerType == "leaderboard" || bannerType == "wallpaper") {
                  $("#rubrikenAd").css("height", "90px");
                  $("#floater").css("top", "128px");
                } else if(bannerType == "fullsize"){
                  $("#rubrikenAd").css("height", "60px");
                  $("#floater").css("top", "98px");
                } else {
                  $("#rubrikenAd").css("display", "none");
                  $("#floater").css("top", "23px");
                }
                
                // append the ad-code to the ad-containers
                if(bannerCode != "" && $("#rubrikenAd")) {
                  document.getElementById("rubrikenAd").innerHTML = "";
                  $("#rubrikenAd").html(bannerCode); 
                }
                if(skyCode != "" && $("#floater")) {
                  document.getElementById("floater").innerHTML = "";
                  $("#floater").html(skyCode);
                }
            } 
        }

      }
      
/* === Media === */
function writeMediaCode(extension, source, width, height, id, display) {
  if (extension == "mpeg" || extension == "avi") extension = "mpg";
  if (extension == "swf") extension = "flv";
  if(extension != "flv") height = parseInt(height) + 15;
  switch(extension) {
    case "flv":
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
      document.writeln('<param name="movie" value="'+source+'" \/>');
      document.writeln('<param name="wmode" value="transparent" \/>');
      document.writeln('Für die Darstellung des Inhalts ist der Flash Player von Adobe erforderlich, den Sie unter folgender Adresse kostenlos herunterladen können:<br /> <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Adobe Flash Player Download-Center</a><br \/><br \/>');
      document.writeln('<\/object>');
	  break;
	case "swf":
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
      document.writeln('<param name="movie" value="'+source+'" \/>');
      document.writeln('<param name="wmode" value="transparent" \/>');
      document.writeln('Für die Darstellung des Inhalts ist der Flash Player von Adobe erforderlich, den Sie unter folgender Adresse kostenlos herunterladen können:<br /> <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Adobe Flash Player Download-Center</a><br \/><br \/>');
      document.writeln('<\/object>');
	  break;
    case "wmv":
      height = parseInt(height) + 44;
      document.writeln('<object id="'+id+'" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" standby="Der Microsoft Windows Media Player wird geladen..." width="'+width+'" height="'+height+'">');      
        document.writeln('<param name="fileName" value="'+source+'" />');
        document.writeln('<param name="autostart" value="1" />');
        document.writeln('<param name="AnimationatStart" value="0" />');
        document.writeln('<param name="TransparentatStart" value="0" />');
        document.writeln('<param name="ShowControls" value="1" />');
        document.writeln('<param name="ShowPositionControls" value="0" />');
        document.writeln('<param name="ShowStatusBar" value="0" />');
        document.writeln('<embed id="'+id+'2" type="application/x-mplayer2" showcontrols="1" showpositioncontrols="0" animationatstart="0" transparentatstart="0" showstatusbar="0" src="'+source+'" width="'+width+'" height="'+height+'"></embed>');
      document.writeln('<\/object>');
      break;
    case "mpg":
      document.writeln('<object id="'+id+'" type="video/mpeg" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');      
        document.writeln('<param name="type" value="video/mpeg" />');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="controls" value="ImageWindow" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('Für die Darstellung des Videos ist der Quicktime-Player von Apple erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://www.apple.com/de/quicktime/download/" target="_blank">&raquo; http://www.apple.com/de/quicktime/download/</a>');
      document.writeln('<\/object>');
      break;
    case "mov":
      document.writeln('<object id="'+id+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');
        document.writeln('<param name="controller" value="true" />');
        document.writeln('<param name="kioskmode" value="true" />');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('<object type="video/quicktime" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" class="mov">');
          document.writeln('<param name="controller" value="true" />'); 
          document.writeln('<param name="kioskmode" value="true" />');
          document.writeln('<param name="src" value="'+source+'" />');
          document.writeln('<param name="autostart" value="true" />');
          document.writeln('Für die Darstellung des Videos ist der Quicktime-Player von Apple erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://www.apple.com/de/quicktime/download/" target="_blank">&raquo; http://www.apple.com/de/quicktime/download/</a>');
        document.writeln('</object>'); 
      document.writeln('</object>');
      break;
    case "rm":
      document.writeln('<object id="'+id+'" type="audio/x-pn-realaudio-plugin" data="'+source+'" autostart="true" width="'+width+'" height="'+height+'" style="display:'+display+'">');      
        document.writeln('<param name="type" value="audio/x-pn-realaudio-plugin" />');
        document.writeln('<param name="src" value="'+source+'" />');
        document.writeln('<param name="controls" value="ImageWindow" />');
        document.writeln('<param name="autostart" value="true" />');
        document.writeln('Für die Darstellung des Videos ist der RealPlayer erforderlich, den Sie unter folgender Adresse herunterladen können:<br /> <a href="http://de.real.com/player/" target="_blank">&raquo; http://de.real.com/player/</a>');
      document.writeln('<\/object>');
      break;
    case "mp3":
      var real_source = source.replace(/\/_components\/GEO\/article\/audio_player\/geo_audioplayer\.swf\?audio_file=/i,"");
      real_source = real_source.replace(/\&rubrik.*$/i,"");
      document.writeln('<object id="'+id+'" type="application/x-shockwave-flash" data="'+source+'" width="'+width+'" height="'+height+'">');
        document.writeln('<param name="movie" value="'+source+'" \/>');
        document.writeln('Zum Abspielen der Audio-Datei ist der Flash Player von Macromedia erforderlich, den Sie unter folgender Adresse herunterladen können: <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German" target="_blank">&raquo; Macromedia Flash Player Download-Center</a><br \/><br \/>');
        document.writeln('Alternativ können Sie auch folgende Datei aufrufen:<br /> <a href="'+real_source+'">&raquo; Audio starten</a>');
      document.writeln('<\/object>');
      break;
  }
}

function switchMedia(p, id) {
  // the number of media objects allowed for each paragraph
  nof_media = 10;
  // loop over media objects -> control display property
  for(var i = 0; i <= nof_media; i++) {
    if(document.getElementById("mediaObj"+p+i)) {
      if(i != id)
        document.getElementById("mediaObj"+p+i).style.display = "none";
      if(i == id)
        document.getElementById("mediaObj"+p+i).style.display = "block";
    }
  }
}

function checkCompatibility(alertID) {
  hideContainer= alertID;
  if(safari && !swf9) {    
    document.writeln('<div id="errorbox">');
    document.writeln('<strong>Hinweis:</strong> F&uuml;r eine optimale Darstellung des Videos ist der Adobe Flash Player ab Version 9 erforderlich, den Sie unter folgender Adresse kostenlos herunterladen k&ouml;nnen:<br />');
    document.writeln('<a href="http://www.adobe.com/de/products/flashplayer/" target="_blank">&#187; http://www.adobe.com/de/products/flashplayer/</a><br />');
    document.writeln('<a href="javascript:document.getElementById(\'errorbox\').style.display=\'none\'" style="font-size:82%; color:#666; display:block; float: right">Hinweis schlie&szlig;en [x]</a><br class="clearFloat" />');
    document.writeln('</div>');
	
  }
  if(swf9){
	document.getElementById(hideContainer).style.display = "none";
  }
  
}

/* === Ads === */   
function doAdStuff() {
  // ======== Rubriken Ad ========
  if(LeaderBoard == 1 || fullsize == 1 || LeaderBoard_oversize ==1 || wallpaper == 1) {
    var rubrikenAdContainer = document.getElementById("rubrikenAd");
    if (fullsize) document.getElementById("rubrikenAd").style.height = "60px";
  } else {
    var topborder = "border-top";
    if(document.getElementById("rubrikenAd")) {
      document.getElementById("rubrikenAd").style.display = "none";
      document.getElementById("mainHeader").style.topborder = "none";
    }
  }
  // ======== Content Ad ========
  if(contentad && document.getElementById("contentAd")) {
    document.getElementById("contentAd").style.display = "block";
  }
  
  // ======== Promo/Halfpage Ad ========
  if(!fustyUserAgent && (promo || halfpage) && document.getElementById("promoAd")) {
    var promoAdContainer = document.getElementById("promoAd");
    if(halfpage) {
      resizeLayout();
      var anz_element = document.createElement("div");
      var anz_wording = document.createTextNode("Anzeige");
      anz_element.setAttribute("style", "text-align:left;");
      anz_element.appendChild(anz_wording);  
    } else {
      document.getElementById("promoAd").style.display = "block";
      document.getElementById("promoAd").style.visibility = "visible";        
    }
  }
  // ======== Skyscraper ========
  if(document.getElementById("floater")) {   
    if (LeaderBoard || LeaderBoard_oversize) { 
      document.getElementById("floater").style.top = '128px';
    }
    else if (fullsize) document.getElementById("floater").style.top = "98px";
    else               document.getElementById("floater").style.top = "23px";
  }
  // ======== Text-Teaser rechte Spalte ========
  if((textcontent||textteaser) && document.getElementById("textAd")) 
    document.getElementById("textAd").style.display = "block";
  
  if(document.getElementById("floater")) {
  if(wallpaper == 1)
    document.getElementById("floater").style.display = "none";
  }
}

function doAdStuffNew() {
  GujAd.registerAdPositionLoadedHandler(function(position) {
    //alert(position.getAdType());
    //alert(wallpaper);
    if(position.getAdType() == 'wallpaper' || wallpaper == 1) {
      $('#skyscraper_1').hide();
      $('#superbanner_1').show();
    }
    if(position.getAdType() == 'superbanner' && !GujAd.adPositionIsEmpty('superbanner_1') || LeaderBoard == 1 || fullsize == 1 || LeaderBoard_oversize == 1) {
      $('#superbanner_1').show();
    }
    if(position.getAdType() == 'halfpagead' && !GujAd.adPositionIsEmpty('halfpagead_1') || halfpage == 1) {      
      $('#skyscraper_1').hide();
      $('#halfpagead_1').show();
      resizeLayout2();
    }
    
    if(position.getAdType() == 'rectangle' && !GujAd.adPositionIsEmpty('rectangle_1') || contentad == 1) {
      $('#rectangle_1').show();
      $('#rectangle_1 hr').hide();
    }
    if(position.getAdType() == 'textlink' && !GujAd.adPositionIsEmpty('textlink_1') || textcontent == 1 || textteaser == 1) {
      $('#textlink_1').show();
    }
  });
  
  if(halfpage && ua_ie) {
    $('#skyscraper_1').hide();
    resizeLayout2();
  }

}

function doAdStuff2() {
  // ======== Rubriken Ad ========
  
  if(LeaderBoard == 1 || fullsize == 1 || LeaderBoard_oversize ==1) {
    var rubrikenAdContainer = document.getElementById("rubrikenAd");
    if (fullsize) document.getElementById("rubrikenAd").style.height = "60px";
  } else {
    var topborder = "border-top";
    //document.getElementById("iframe_ad_leaderboard").style.display = "none";
    document.getElementById("rubrikenAd").style.display = "none";
    document.getElementById("mainHeader").style.topborder = "none";
  }
  // ======== Content Ad ========
  if(contentad && document.getElementById("contentAd")) {
    document.getElementById("contentAd").style.display = "block";
  }
  // ======== Promo/Halfpage Ad ========
  if(!fustyUserAgent && (promo || halfpage) && document.getElementById("promoAd")) {
    var promoAdContainer = document.getElementById("promoAd");
    if(halfpage) {
      resizeLayout();
      var anz_element = document.createElement("div");
      var anz_wording = document.createTextNode("Anzeige");
      anz_element.setAttribute("style", "text-align:left;");
      anz_element.appendChild(anz_wording);  
    } else {
      document.getElementById("promoAd").style.display = "block";
      document.getElementById("promoAd").style.visibility = "visible";       
    }
  }

  // ======== Skyscraper ========
  if(document.getElementById("floater")) {    
    if (LeaderBoard || LeaderBoard_oversize) { 
      //alert(document.getElementById("floater"));
      document.getElementById("floater").style.top = '128px';
    }
    else if (fullsize) document.getElementById("floater").style.top = "98px";
    else               document.getElementById("floater").style.top = "23px";
  }

}
// #### adjust the length of the sidebar ####
function adjustRightCol() {
  if(document.getElementById("left") && document.getElementById("right") && !no_col_adj) {
    var left  = document.getElementById("left").offsetHeight;
    var right = document.getElementById("right").offsetHeight;
    if (left > right) {
      document.getElementById("right").style.height = (left - 20) + "px";
      right = document.getElementById("right").offsetHeight;
    } else {
      document.getElementById("right").style.margin = "15px 0 20px 0";
    }
  }  
}

/* === Gogle Maps === */
var markers = new Array();
var geoMap = {
	settings : {
		title : "Geo Map",
		type: "selectMap",
		markerType: "flag",
		size: "small",
		targetContainer: "mapContainer",
		initLat: 0,
		initLng: 0,
		initZoom: 5,
    fallbackLat: '10.3',
    fallbackLng: '41.7',
    fallbackZoom: 6,
		hasControls: 'on',
    typeControl: 'on',
    overviewMap: false,
    markCenter: 'off',
    zoomControl: 'small',
    mapType: 'G_PHYSICAL_MAP',
    clickable: 'on',
    draggable: 'on',    
		onClickFuncs : {
				getLocation: 
				{
						coutryTextField: '#countryInput',
						cityTextField: '#locationInput',
						placeTextField: '#placeInput',
						lngTextField: '#lngInput',
						latTextField: '#latInput'
				}
		},		
		onMove : {}
	},  
  initialized: false,
	map : null,
  gCoder: null,
  gDir: null,
	init : function(initObj){
		if(GBrowserIsCompatible()) {
			GUnload();
			//overwrite base settings with initObject if in there TODO: use jquery.extend
			$.each(geoMap.settings, function(key, val){
	  		if(initObj[key]){
          if(key == 'onClickFuncs'){
            geoMap.settings.onClickFuncs = $.extend(geoMap.settings.onClickFuncs, initObj[key]);
          }
          else{
  					geoMap.settings[key] = initObj[key];             
          }
				}
			});
      
      //now set up the map
			try{
				this.map = new GMap2(document.getElementById(geoMap.settings.targetContainer));
			}
			catch(e){
				alert(e);
			}
      if(geoMap.settings.hasControls == 'on'){
        if(geoMap.settings.zoomControl == 'small'){
          this.map.addControl(new GSmallMapControl());  
        } 
        else{
          this.map.addControl(new GLargeMapControl());
        }
	  		
      }
      
      if(geoMap.settings.typeControl == 'on'){
        this.map.addControl(new GMapTypeControl());
      }
      
      //stupid coordinates have been passed, use fallback coordinates
      if(this.settings.initLat == 0 &&  this.settings.initLng == 0){  
        try {
         this.map.setCenter(new GLatLng(this.settings.fallbackLat, this.settings.fallbackLng), this.settings.fallbackZoom, G_HYBRID_MAP);                
        }
        catch(e){
          console.warn(e);
  		  }   
      }
      else{
        try {
          this.map.setCenter(new GLatLng(this.settings.initLat, this.settings.initLng), this.settings.initZoom, G_HYBRID_MAP);                
        }   
        catch(e){
          console.warn(e);
  		  }        
        if(this.settings.markCenter == 'on'){
          this.markLatLng(this.settings.initLat, this.settings.initLng);
        }
      }
      
			this.initialized = true;
      
			//set up on click listening
      if(this.settings.clickable == 'on'){
        $.each(geoMap.settings.onClickFuncs, 
  				function(func, params){
  					GEvent.addListener(geoMap.map, "click", 
  						function(marker, point)
  						{							
  							if(!point){
  								if(marker){
  									point = marker.getPoint();
  								}
  								else{
  									point = new GLatLng();
  								}			
  							}
  							try{
  								geoMap[func].apply("test", [marker, point, params]);
  							}
  							catch(e){
  								//alert(e);
                  console.warn(e);
  							}
  						}
  					);
  				}
			  );
        
      }		
    }
	},
	
	//returns the current click coordinates to a text field
	getLocation : function(marker, point, params){
		if(!marker){
			var lat = point.lat();
			var lng = point.lng();
			$(params.lngTextField).val(lng);
			$(params.latTextField).val(lat);
		}
	},
  
  /**
   * 
   * @param {Float} lat
   * @param {Float} lng
   * @param {Integer} zoom
   */
  setLocation : function(lat, lng, zoom){
     var newZooom = zoom || 8;
     var point = new GLatLng(lat, lng);
     geoMap.map.setCenter(point, newZooom);
  },
  
	/** returns the icon of markers */
	getMarkerIcon : function(index){	
		if(geoMap.settings.markerType == "flag"){
      
			var icon = new GIcon();
			
			icon.image = "http://www.geo.de/images/GEO/flag"+index+".png";
			if(markerStyle== "-fussball" && (specialMarkers.indexOf(index) != -1))
			icon.image = "http://www.geo.de/images/GEO/flag"+markerStyle+".png";
			icon.shadow = "http://www.geo.de/images/GEO/flag_shadow.png";
			icon.iconSize = new GSize(60, 35);
			icon.shadowSize = new GSize(60, 35);
			icon.iconAnchor = new GPoint(30, 35);
			icon.infoWindowAnchor = new GPoint(25, 5);
			return icon;		
		}
    
		else if(geoMap.settings.markerType == "smallflag"){
			var icon = new GIcon();
			icon.image = "http://www.geo.de/images/GEO/flag.png";
			icon.shadow = "http://www.geo.de/images/GEO/shadow-flag.png";
			icon.iconSize = new GSize(40, 23);
			icon.shadowSize = new GSize(40, 23);
			icon.iconAnchor = new GPoint(20, 23);
			icon.infoWindowAnchor = new GPoint(15, 3);
			return icon;
		}	
    
		else
			return "";		
	},
	
/**
   * 
   * @param {gLatLng} point
   * @param {Array} params
   * @param {Integer} index
   + @param {Array} description
*/
	setMarker : function(point, params, index, descriptions, bubbleContent, bubbleWidth){	
    index += 1;
	
    marker = new GMarker(point, geoMap.getMarkerIcon(index));
	
     /** add listener for info bubbles */
    GEvent.addListener(marker, "click", function() {
    if(bubbleWidth == 250) 
      var tempHtml = "<div style=\"width:300px\"><h3>"+descriptions[index-1]+"</h3><small><i>"+coords_strings[index-1]+"</i><br />"+bubbleContent[index-1]+"</div>";
    else
      var tempHtml = "<div style=\"width:200px\"><h3>"+descriptions[index-1]+"</h3><small><i>"+coords_strings[index-1]+"</i><br />"+bubbleContent[index-1]+"</div>";
      geoMap.map.openInfoWindowHtml(point, tempHtml); 
    });
    
    markers[index]=marker;
    geoMap.map.addOverlay(markers[index]);
	}
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function getTopVideosTrailingWeek() {
	//addScriptTag("topVideos", "http://api.brightcove.com/services/library?command=find_all_videos&token=CNnmbZ-jMglpvUShxdYM16UleH57pO_wyHnfYYhQRns.&fields=id,name,thumbnailURL,playsTrailingWeek,linkURL,length, referenceId&sort_by=plays_trailing_week&page_size=10", "response");
	addScriptTag("topVideos", "http://api.brightcove.com/services/library?command=find_all_videos&token=CNnmbZ-jMglpvUShxdYM16UleH57pO_wyHnfYYhQRns.&sort_by=plays_trailing_week&page_size=10", "response_video_sidebar");
}

function response_video_sidebar(jsonData) {
	var resp = document.getElementById("videoCatapult");
	for (var i=0; i<jsonData["items"].length; i++) {
		title = jsonData["items"][i];
		if (title.linkURL != undefined)
		{
		    var titleMin = parseInt(title.length/60000);
			var titleS = title.length/1000 - titleMin*60;
			titleS = titleS.toFixed(0);
			var str = "";
			str += '<a title="' + title.name + '" href="' + title.linkURL + '">';
			str += '<img src="' + title.thumbnailURL + '" width="143" height="107" alt="" title="" style="margin-top:0px;margin-bottom:0px"/><br /><p style="text-align:right;color:#737373; padding-right:2px;line-height:16px; background-image:url(http://www.geo.de/images/GEO/video/videoplay.gif);";>'+ titleMin + ':'+ titleS +'</p>';
			//str += '<p class="displayName">' + title.name + '</p>';	
			//str += '<p class="views">viewed ' + title.playsTrailingWeek + ' times</p>';
			str += '</a>';
			resp.innerHTML += str;
		}
		 $('#videoCatapult').cycle({ 
			fx:     'fade', 
			speed:  'slow', 
			timeout: 5000000, 
			next:   '#next', 
			prev:   '#prev' ,
			after:   onAfter
		 });
 
		 $('#videoschleuder').cycle('stop');
			}
}
