/************ FAZ.NET IVW Tools **********/
function IVWTag (sPath, sTpl, sRub,sV3,sKeyV3,sRemoteAdr) {
  if (!sPath) sPath = "faz.net/unknown";
  if (!sTpl) sTpl = ""; if (!sRub) sRub = "";

	var oLocation = window.location;
	var sProtocol = oLocation.protocol;
	var bIvwSecure= (sProtocol=="https:")?true:false;
	
	var iNum = 10000 + Math.floor(Math.random() * 990000);
  var SesMatch = document.cookie.match(/ClSes=([^;]*)/i);
  var sSesID = '0'; 
  if (!SesMatch) {
	var sZeit = new Date();
	sSesID='' + (parseInt(sZeit.valueOf()/1000)%1000000) + '_' + iNum;
	var sC1 ='ClSes=' + sSesID + ';path=/ ';
	document.cookie = sC1;
  } else
	sSesID = SesMatch[1];

    document.write ('<IMG SRC="'+sProtocol+'//faz.ivwbox.de/cgi-bin/ivw/CP/'+ sKeyV3 +';'+sPath+'?n='
	  + iNum +'&r=' + escape(document.referrer) +'" alt="" width=1 height=1>'
	  + '<br/>\n');


}


// register an IVW page impression (via browser JavaScript side-effects)
function new_tag(tag, elm)
{
  var proto = window.location.protocol=="https:"? "https:": "http:";
  var ref=escape(document.referrer);

  if (typeof(tag) == "undefined" || tag == null) { 
	  tag =(typeof(gsIvwId)== "undefined") ? "2B0100000000;faz.net/aktuell" : gsIvwId;
  }
  var myIVW=proto+"//faz.ivwbox.de/cgi-bin/ivw/CP/" + tag;

  var do_rand = "&n="+new Date().getTime();

  var countIVW = new Image();
   
  countIVW.src = myIVW+"?r="+ref+""+do_rand;

  try{   TSV2.clk(elm); } catch(e){} // -- FAZgets V2-Tag
//  try{ __GETS.clk(elm); } catch(e){} // -- FAZgets V3-Tag
  //if (adsc_ressort == 'FAZNETServices_Unterhaltung' && adsc_rubrik != '')
 /* if(0==1)
  {
    if(unterhaltung_reload_i >=4)
    {
      //ConW4AdMove3();    
      //debugger;
      var w4AdContainer= $('ConW4Ad').getElement('div[class=AdData]');
      w4AdContainer.innerHTML ='';

      var script4click = document.createElement("script");
      script4click.setAttribute('type','text/javascript'); 
      script4click.text='AdTagV3(\'468\',\'63\',\'100\',\'BANNER\');';

      w4AdContainer.adopt(script4click);

      //w4AdContainer.innerHTML = '<center><scr'+'ipt type=\"text/javascript\" language=\"JavaScript1.2\">AdTagV3(\'468\',\'63\',\'100\',\'BANNER\');</sc'+'ript></center>';
      unterhaltung_reload_i = 1;
    }
    unterhaltung_reload_i++;
  }*/
}
var unterhaltung_reload_i = 1;


// Trackt das Abspielen eines Videos
//function TS_Video(medid, title) {
//  o = {gmed:medid, stit:title};
//  try{   TSV2.etag(o); } catch(e){}
//  try{ __GETS.etag(o); } catch(e){}
//}

// Trackt das Abspielen eines Videos
function TS_Video(medid, title) {
  try{
    __GETS.etag({id:1001, gmed:medid, stit:title, t:'v2'});
  } catch(e){}
}

function femFLV(videoId, playerWidth, suppressad, magnifierLink, targetDivId, adXmlStruktur, isAudio, medid, title, tagIt, ivideoId) {
  var isiDevice = /iPad|iPhone|iPod/i.test(navigator.userAgent);
  if (!(isiDevice && ivideoId)) {ivideoId=""};
  if (!ivideoId){if (!VideoFlashCheck(targetDivId)) return;}
  if (tagIt) new_tag();
  TS_Video(medid, title);
  writeFLV(videoId, playerWidth, suppressad, magnifierLink, targetDivId, adXmlStruktur, isAudio, ivideoId);
}

//FAZgets V1.0. Wird nur noch für Seiten in Caches benötigt daher Kompatibilitaetsgruenden noch vorhanden. Kann ca. Mitte 2009 raus!
//(dann sollten nur noch wenige Caches eine "falsche" Version haben)
function TSTag (sParam) {
  var loc = window.location;
  var prot = loc.protocol || '';
  if (prot=='https:') sParam = sParam.replace('http:', 'https:');
  
  var iNum = Math.floor(Math.random() * 1000000000);
  sParam += '|' + iNum + '|ref='+escape(document.referrer);
  document.write ('<img src="'+sParam+'" width="1" height="1" alt="" /><br>\n');
}

//UB: Nur noch "hohler" function body um script-errors zu vermeiden. wird jetzt alles von TSV2- und GETS-Objekt abgefackelt
//Nachfolgende Funktionen wurden entfernt
function new_TSTag() {}
function ParamsFromUrl() {return {};}



