﻿/************ 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];

  if (bIvwSecure){
   if (typeof(sRemoteAdr)== "undefined") sRemoteAdr = "n/a";
   var SercueImg = sProtocol+"//www.faz.net/IN/INtemplates/faznet/common/ivwhttp.asp?i="+sRemoteAdr
         + "&p3="+sPath+"&k=/cgi-bin/ivw/CP/"+sKeyV3+"&n="+ iNum+ "&r="+ escape(document.referrer);
   document.write('<IMG SRC=\"'+SercueImg+'\" WIDTH=1 HEIGHT=1>');

  }
  else
    document.write ('<IMG SRC="http://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
}


// 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{
    o = {};
    if (window.TSV2) o = TSV2.payload || {};
    o.gmed=medid;
    o.stit=title;
    o.id=1001;
    TSV2.send(o); 
  } catch(e){}
}

function femFLV(videoId, playerWidth, suppressad, magnifierLink, targetDivId, adXmlStruktur, isAudio, medid, title, tagIt) {
  if (!VideoFlashCheck(targetDivId)) return;
  if (tagIt) new_tag();
  TS_Video(medid, title);
  writeFLV(videoId, playerWidth, suppressad, magnifierLink, targetDivId, adXmlStruktur, isAudio);
}

//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 {};}


