// version fuer dart plus Wunderloop
var alert_debugmode = "";
var adsg_dbgmsg="";
adsg_dbgmsg=" \nVersion 2.086\n "; //  debug html debug on ist platzhalter/keine technische relevanz

// Wunderloop Cookie auslesen
var adsg_wlswitch=true;
var js_wlrcmd = ""; 
var wl_str=""; // Wert für WunderLoop auf NULL setzen
var wlrcmd ="kw=";
var ord=Math.random()*10000000000000000;

// wlcacheread
wlrcmd=adsf_cookie("adcc_wl");
if(wlrcmd==""){wlrcmd="kw=";}/*bugfix wlrkw 080520*/
js_wlrcmd=wlrcmd+",";
var adsg_wrlcache=wlrcmd;



// 4. Juli 2008 neue AdAlert Infos
adsa_tempdt=new Date();adsa_temptm=adsa_tempdt.getTime();if(!window.adsg_adids){var adsg_adids=[];}adsg_adids[adsg_adids.length]=["0000000","0000000","000000000","00000000",adsa_temptm,"00 Adengine"];


// muss esrt noch gesetzt werden, weil es als Parameter bei der flash-videoplayer Uebergabe verwendet wird 
var ng_bh_str="CO=1;TE=1;";


var adsc_wunderloop = "chip/sonstiges";
var ad_channel = "/sonstiges";
var ad_subchannel = "";


var adsg_nsiteloc=document.location.href;
var adsg_toplocation=top.location.href;


var tiletype="tile"; //für ptile variante
var adsc_tile=0; //tilenummer: wird inkrementiert
var adsc_adid1=0,adsc_adid2=0,adsc_adid4=0,adsc_adid6=0,adsc_adid12=0,adsc_adid8=0; //für die adids

adsg_katprozent = new Array(); //  das array für die prozentwerte der einzelnen slots
adsg_size = new Array(); //  für die slotgrössen und für dart adids

adsg_dbginit="0"; // dbginit ist dbg eingeschaltet wenn nein schreib layer und dbginit=2
var adsg_debug="",adsc_debug=""; //  debug status --on/onv ab2.0 nur noch on wegen fehlender trace styles in dfp


var adsg_site="chip"; //----->id der site
var adsg_icpsite="20"; //----->nummer der site


// Session Cookie für Besucherzaeler
var c_now = new Date();  // aktuelles Datum
var c_path = "/";        // Pafd für Cookies

var ng_chip_usr=1;


var otp_typ=0;   // Wert wird im PopUp gesetzt, 1=kein PopUpBlocker, 2=PopUp-Blocker, 3=kein PopUp-Blocker aber Frequency Cap
var c_otp_typ=0; // Wert wird aus Cookie ausgelesen


// User Counter
if(document.cookie && document.cookie.indexOf("chip_usr") > -1) { ng_chip_usr=holeKeks("chip_usr"); } else {ng_chip_usr=0;}
ng_chip_usr=parseInt(ng_chip_usr)+1; 

if(document.cookie && document.cookie.indexOf("otp_typ") > -1)
{
	c_otp_typ=holeKeks("otp_typ");

	if(c_otp_typ==3) {c_otp_typ=1}
	if(c_otp_typ==4) {c_otp_typ=1}
	if(c_otp_typ==5) {c_otp_typ=2}

}

// Schreibt mit Zeitverzögerung die Cookie-Werten, damit aus den Anzeigen die Variable otp_typ gelesen werden kann
setTimeout('setzeKeks();',2000);   // Cookie Werte zeitverzögert setzen, damit Variable aus dem PopUp-Fenster abgefragt werden kann.


var dcopt_ist="dcopt=ist;";
var category="!c=bl_chip;";
var adsc_cat="";

if(ng_chip_usr<=6)  // dcopt wird nur 3 mal gesetzt 1,3,5
{
	if(ng_chip_usr%2==0)
	{
		dcopt_ist="";
		adsc_cat="itp;";
		category="!c=bl_chip;!c=otp;"; 
	}
	else
	{
		dcopt_ist="dcopt=ist;";
		adsc_cat="otp;";
		category="!c=bl_chip;!c=itp;"; 
	}
}
else
{
		dcopt_ist="";
		adsc_cat="itp;";
		category="!c=bl_chip;!c=otp;"; 
}

adsg_dbgmsg=adsg_dbgmsg + "\n chip_usr=" + ng_chip_usr + " - " + dcopt_ist + " - Ausschlusskategorie: " + category + " \n\n";


var adsg_cnttop='  ';
var adsg_cntbot='  ';


// test ob alle Variable gesetzt ist
if(window.adsc_agof){}else {adsc_agof="10177"};
if(window.adsc_ressort){}else {adsc_ressort="sonstiges"};
if(window.adsc_rubrik){}else {adsc_rubrik="sonstiges"};
if(window.adsc_rubrik_int){}else {adsc_rubrik_int="36143"};
if(window.adsc_keyword){}else {adsc_keyword=""};
if(window.adsc_layout){}else {adsc_layout="none"};

if(window.adsc_contentwidth){}else {adsc_contentwidth="833"};     // x Startposition für Einfärbungen
if(window.adsc_skyscraperposx){}else {adsc_skyscraperposx="833"}; // x Startposition für SkyScraper
if(window.adsc_bannerposx){}else {adsc_bannerposx="0"}; // früheste Startposition (horizontal) für Bannerleiste
if(window.adsc_bannerposy){}else {adsc_bannerposy="0"}; //Startposition (vertikal) für Bannerleiste
if(window.adsc_bannerheight){}else {adsc_bannerheight="90"}; // Hoehe der Bannerleiste
if(window.adsc_bgc_typ){}else {adsc_bgc_typ="color_hex";};        // Hintergrundfarbe für body setzen oder color_hex oder img_url

// Neue DIV Klassen und Styles fuer Ads ohne Table
// Peter 13. Feb. 2007
document.write("<style type='text/css'><!-- div.dc_cad_abstaende {margin-top:0px;margin-bottom:0px;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_box_abstaende {margin-top:15px;margin-bottom:0px;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad {width:auto;text-align:center;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad .dc_dynamic_container {margin: 0 auto;text-align:left;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad .dc_headline {height:18px;background-color:#e4e4e4;color:#000;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad .dc_ico {float:right;width:15px;height:14px;background:url(http://i.tfag.de/extern.gif) no-repeat 0px 4px; }--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad .dc_txt {float:left;padding:2px 9px 3px 9px;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;font-size:11px; line-height:13px;}--> \n </style>");
document.write("<style type='text/css'><!-- div.dc_ad_platzhalter_height {width:auto;height:90px;padding:0px;margin:0px;border:0px;}--> \n </style>");


// Keyword für Rubriken 2006.04_04 Klcso
for (i = 0; i <= 12; i++) {adsc_rubrik=adsc_rubrik.replace('__', '_');}
adsc_rub=adsc_rubrik;
for (i = 0; i <= 12; i++) {adsc_rub=adsc_rub.replace('_', ',');}


adsc_rub=adsc_rubrik.toLowerCase();
adsc_rub=adsc_rub.replace('chip_', '');
adsc_rub=adsc_rub.replace('die_', '');
adsc_rub=adsc_rub.replace('mit_', '');
adsc_rub=adsc_rub.replace('notebooks', 'notebook');
adsc_rub=adsc_rub.replace('handys', 'handy');
adsc_rub=adsc_rub.replace('e_mail', 'email');
adsc_rub=adsc_rub.replace('w_lan', 'wlan');
adsc_rub=adsc_rub.replace('pdas', 'pda');
adsc_rub=adsc_rub.replace('_und_', '_');
adsc_rub=adsc_rub.replace('pc_hardware', 'pchardware');

for (i = 0; i <= 3; i++) {adsc_rub=adsc_rub.replace(',_', '_');}
for (i = 0; i <= 6; i++) {adsc_rub=adsc_rub.replace('__', '_');}

var adsc_dartsite="";


var adsc_zone= "_" +adsc_rub;

if(adsc_rubrik_int=="1") { adsc_dartsite=adsc_rub; adsc_zone="_frontpage";}; // 


// 28. Januar 2008 Klcso Relaunch nicht mehr verwendet
if(adsc_ressort=="9234")     {ad_channel="/special"; ng_behavior="light";}; // Special
if(adsc_ressort=="22985")    {ad_channel="/foto"; ng_behavior="full";}; // Foto
if(adsc_ressort=="19501")    {ad_channel="/handy"; ng_behavior="full";}; // Handy
if(adsc_ressort=="30715355") {ad_channel="/download_de/content"; ng_behavior="light";}; // download.de - Content
if(adsc_ressort=="15355")    {ad_channel="/download_de/homepage"; ng_behavior="light";}; // download.de - Homepage
if(adsc_ressort=="24072")    {ad_channel="/hardware"; ng_behavior="full";}; // Hardware

// Klcso 31.01.2008 neues Mapping fuer Relaunch mit sprechenden Zonennamen

switch (adsc_ressort)
{
  case "1":     ad_channel="/homepage"; break;
  case "27633": adsc_zone=""; ad_channel="/bildergalerien"; break;
  case "26784": adsc_zone=""; ad_channel="/preisvergleich"; break;
  case "33656": ad_channel="/sicherheit"; break;
  case "19506": ad_channel="/dsl_internet"; adsc_dartsite="dsl_internet"; break;
  case "30593": adsc_dartsite="videos"; ad_channel="/videos"; break;
  case "33105": ad_channel="/archiv"; break;
  case "9231":  adsc_dartsite="community_forum"; adsc_zone= ""; ad_channel="/foren"; break;
  case "blogs": adsc_dartsite="community_blogs"; adsc_zone= ""; ad_channel="/blogs"; break;
  case "9227":
    ad_channel="/test_kaufberatung"; adsc_dartsite="test_kaufberatung";
    switch (adsc_rubrik_int)
    {
      case "36143": adsc_ressort="9227"; adsc_zone="_frontpage"; ad_subchannel=""; break; // Home Entertainment
      case "39535": adsc_ressort="39535"; ad_subchannel=""; break; // Home Entertainment
      case "39536": adsc_ressort="39536"; ad_subchannel=""; break; // PC-Hardware
      case "9228": adsc_ressort="9228"; ad_subchannel=""; break; // Spiele
      case "21013": adsc_ressort="21013"; ad_subchannel=""; break; // Software
      case "43746": adsc_ressort="43746"; ad_subchannel=""; break; // Digitalkameras
      case "43744": adsc_ressort="43744"; ad_subchannel=""; break; // Home Entertainment
      case "43748": adsc_ressort="43748"; ad_subchannel=""; break; // Camcorder
      case "20827": adsc_ressort="20827"; ad_subchannel=""; break; // Navigation
      case "43741": adsc_ressort="43741"; ad_subchannel=""; break; // Brenner & Festplatte
      case "43736": adsc_ressort="43736"; ad_subchannel=""; break; // Drucker & Scaner
      case "14945": adsc_ressort="14945"; ad_subchannel=""; break; // TFT-Display
      case "14933": adsc_ressort="14933"; ad_subchannel=""; break; // Notebook
      case "14948": adsc_ressort="14948"; ad_subchannel=""; break; // MP3-Playeer
      case "44199": adsc_ressort="44199"; ad_subchannel=""; break; // Business Hard- & Software
      default: ad_subchannel=""; break; // Default Wert
    }
  break;
  case "9226": adsc_dartsite="news"; ad_channel="/news";
    switch (adsc_rubrik_int)
    {
      case "1": adsc_zone="_frontpage"; ad_subchannel=""; break; // News Frontpage
      case "9240": adsc_ressort="9240"; ad_subchannel=""; break; // News  Business
     }
  break;
  case "9229": adsc_dartsite="tipps_tools"; ad_channel="/tips_tricks";
    switch (adsc_rubrik_int)
    {
      case "9229": if(adsc_rub=="tipps_tools"){ adsc_dartsite="tipps_tools"; adsc_zone = "_frontpage"; ad_subchannel="";}; break; // Tipps&Tools Frontpage
      case "26113": adsc_ressort="26113"; ad_subchannel=""; break; // Tipps&Tools Sicherheit
     }
  break;
  case "9232": adsc_dartsite="downloads"; ad_channel="/downloads";
    switch (adsc_rubrik_int)
    {
      case "26113": adsc_ressort="26113"; ad_subchannel=""; break; // Downloads
     }
  break;
  case "36143": ad_channel="/sonstiges"; break;
  default:
    adsc_ressort="sonstiges"; adsc_zone= adsc_ressort + "_" + adsc_rubrik + "_" + adsc_rubrik_int;
  break;
}


adsc_wunderloop = "chip"+ ad_channel + ad_subchannel;

if(ad_channel!="" && adsg_wlswitch==true){
adsf_setpix('http://tr.sales.tfag.de/Cnt/tofo/CP/'+adsc_wunderloop+'?d='+Math.random()*10000000000);
}


debout('\n js_wlrcmd=' + js_wlrcmd + '\n  ');


adsg_dbgmsg= adsg_dbgmsg + '\n adsc_wunderloop=' + adsc_wunderloop + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'js_wlrcmd=' + js_wlrcmd + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_ressort=' + adsc_ressort + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_rubrik=' + adsc_rubrik + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_rubrik_int=' + adsc_rubrik_int + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_dartsite=' + adsc_dartsite + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_zone=' + adsc_zone + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'adsc_rub=' + adsc_rub + '\n\n  ';


var now = new Date();
var ng_day = now.getDay(); // 0=SON 1=MON 2=DIE 3=MIT 4=DON 5=FRE 6=SAM
var ng_hour = now.getHours(); // Stunde
var ng_minute = now.getMinutes(); // Minuten
var ng_cache = ng_day + "_" + ng_hour;

// var ng_behavior="false";  //ng_behavior=false; // Notfall-Aus für PHP-Behavior-Script


//globale prozentwerte (werden von kleineren werten in adsc_gettag überschrieben)
adsg_katprozent[1]=100; //banner
adsg_katprozent[2]=100; //contentad 300x250
adsg_katprozent[3]=100; //contentbox
adsg_katprozent[4]=1;  //popup entfällt (interstitial)

adsg_katprozent[6]=100; //skyscraper
adsg_katprozent[7]=100; //content Ad 2
adsg_katprozent[9]=100; //Content Ad 3
adsg_katprozent[12]=100; //Content Ad 3
adsg_katprozent[5]=100; //neu OTP
// Klcso 2004.02-09 um mehrere werte für sz und adsize setzen zu können
adsg_size[1]="dcopt=ist;"; //banner NWC
adsg_size[1]=dcopt_ist; // Aus-/einschaler für 1. 3. 5 Kontakt ....
adsg_size[2]=""; //contentad 1 (300x250
adsg_size[3]=""; //contentbox (460x200)
adsg_size[5]="";          //OTP (Ersatzt für dcopt Slot)
adsg_size[4]=""; //popup  entfällt(interstitial tags)
adsg_size[6]=""; //skyscraper
adsg_size[7]=""; // Content Ad 2 (300x251)
adsg_size[9]=""; // Content Ad 3 (300x252)
adsg_size[12]=""; //Count Pixel

adsg_katval = new Array("00","BANNER","CONTENTAD","CONTENTBOX","POPUP","OTP","SKYSCRAPER","CONTENTAD2","TEXTAD","CONTENTAD3","10","11","COUNT");

var adsg_params=(window.location.search);
adsg_debugmode=adsc_getParams(adsg_params,'jsdbug','&');  

// alert debug mode Klcso 2006.03.23
alert_debugmode=adsc_getParams(adsg_params,'jsalert','&');  

//test debugon  -- bitte entfernen, nur für lokalen test
//adsg_debugmode="on";

if (adsg_debugmode){adsg_debug=adsg_debugmode;}
debout("page_debug= "+adsg_debugmode);      

var adsg_adkeyword=adsc_getParams(adsg_params,'adkeyword','&');
if (adsg_adkeyword){adsc_keyword=adsg_adkeyword;}

var adsg_adkeyword2=adsc_getParams(adsg_params,'showroom','&');//showroom
if (adsg_adkeyword2){adsc_keyword=adsg_adkeyword2;}//showroom

var adsc_isegm="",adsa_isegm="";
var adsc_location=( ! document.location ? 'nourl' : document.location.href);
adsc_location=adsc_location.replace('http://', '/');
adsc_location=adsc_location.replace('&', '/'); 
adsc_location=adsc_location.replace('?', '/');  //reinigt die url hängt - an, um target page von directory zu trennen

debout(adsc_location);
var adsc_transid=(Math.round(Math.random()*9999999));
//hier wird die zufalls-transaction-ord-id für den seitenaufruf hergestellt  

var adsc_percval=(Math.round(Math.random()*100));
//zufallszahl fuer prozentuale auslieferungssteuerung in katprozent

function ads_writetag(adsc_type,adsc_width,adsc_height,adsc_perc){ 
document.write(ads_gettag(adsc_type,adsc_width,adsc_height,adsc_perc));
}

/*
================
GET TAG FUNKTION
================
ads_gettag ist nun wrapper für alte gettag - alte gettag ist nun maketag - für neue otp tags 
*/                            
function ads_gettag(adsc_type,adsc_width,adsc_height,adsc_perc){ 
if((adsc_type=="Banner"||adsc_type=="BANNER"||adsc_type=="1"||adsc_type==1)&&adsc_cat=="otp;"){
var adsg_newtags=ads_maketag("OTP","1","1",adsc_perc);
adsg_newtags=adsg_newtags+ads_maketag(adsc_type,adsc_width,adsc_height,adsc_perc);
return adsg_newtags;  
}else{
return ads_maketag(adsc_type,adsc_width,adsc_height,adsc_perc);
}
}
function ads_maketag(adsc_type,adsc_width,adsc_height,adsc_perc){ 


adsg_dbgmsg= adsg_dbgmsg + '\n js_wlrcmd=' + js_wlrcmd + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + '\n wlrcmd=' + wlrcmd + '\n  ';


adsc_tile++;
//inkrementiert die tilenummer bei jedem aufruf der funktion

adsc_type=getAdType(adsc_type);
//holt den adtype aus dem array

ad_size=adsg_size[adsc_type];
//holt die zum typ passende grösse aus dem dafür vorgesehenen array

adsc_dartsize=adsg_size[adsc_type];
//dartsizes sind in dem array +10

if (adsc_perc>=adsg_katprozent[adsc_type]){
adsc_perc=adsg_katprozent[adsc_type];  //  setzt das katprozent
}   
adsc_tagout="<!--nix-->";  //der nix-kommentar wird bei chip z.b. erwartet
debout("Schreibe Tag:"+adsc_type+"-"+adsc_width+"-"+adsc_height+"-"+adsc_perc+"  \n\r IDS: 1:"+adsc_adid1+" 2:"+adsc_adid2+" 4:"+adsc_adid4+" 6:"+adsc_adid6);
if (adsc_perc>=adsc_percval){ 
debout(adsc_perc+'>='+adsc_percval);
if (adsc_keyword!="") {
adsc_isegm=adsc_isegm+""+adsc_keyword+";";
debout("page_keyword= "+adsc_keyword+" gefunden");
adsc_keyword="";
}

if (adsa_isegm!="") {
if (adsa_isegm=="flashlayer"){
adsc_isegm=adsc_isegm+"!c=flashlayer;";
}else{
adsc_isegm=adsc_isegm+""+adsa_isegm+";"; } 
debout("isegment "+adsa_isegm+" gefunden");  
adsa_isegm="";
}

//alle sonderfälle für adsizes und fehlimplementierungen des scripts
if (adsc_type==6){adsc_width=1;adsc_height=2;} //dart sonderfall sky

adsc_isegm=adsc_isegm.replace('kw=', '');  // wegen Keyword blockit in Wallpapern
adsc_isegm=adsc_isegm.replace('KW=', '');  // wegen Keyword blockit in Wallpapern

js_wlrcmd=js_wlrcmd.replace('kw=none', 'kw=');  // wegen Keyword blockit in Wallpapern
js_wlrcmd=js_wlrcmd.replace('KW=none', 'kw=');  // wegen Keyword blockit in Wallpapern


// sonderfaelle ende

adsc_darturl_adj="http://ad.de.doubleclick.net/adj/"; // Javascript Tag
adsc_darturl_adi="http://ad.de.doubleclick.net/adi/"; // IFRMAE Tag

//adsc_darturl_str=adsg_site+"_"+adsc_ressort+"/"+adsc_dartsite+adsc_zone+";site="+adsg_site+";res="+adsc_ressort+";rub="+adsc_rub+";"+adsg_size[adsc_type]+"cat="+adsc_cat+category+js_wlrcmd+adsc_isegm+"lay="+adsc_layout+";chip_usr="+ng_chip_usr+";otp_typ="+c_otp_typ+";tile="+adsc_tile+";sz="+adsc_width+"x"+adsc_height+";tp="+adsc_location+";ord="+adsc_transid+"?";
adsc_darturl_str=adsg_site+"_"+adsc_ressort+"/"+adsc_dartsite+adsc_zone+";site="+adsg_site+";res="+adsc_ressort+";rub="+adsc_rub+";"+adsg_size[adsc_type]+"cat="+adsc_cat+category+js_wlrcmd+adsc_isegm+";lay="+adsc_layout+";chip_usr="+ng_chip_usr+";otp_typ="+c_otp_typ+";tile="+adsc_tile+";sz="+adsc_width+"x"+adsc_height+";tp="+adsc_location+";ord="+adsc_transid+"?";


adsc_darturl=adsc_darturl_adj+adsc_darturl_str+adsc_transid+"?";

if(adsc_layout=="Diashow" || adsc_layout=="Galerie")
	{
		if (adsc_type==1) {adsc_darturl_banner_top=adsc_darturl_adi+adsc_darturl_str;}
		if (adsc_type==2) {adsc_darturl_contentad1=adsc_darturl_adi+adsc_darturl_str;}
		if (adsc_type==3) {adsc_darturl_contentbox=adsc_darturl_adi+adsc_darturl_str;}
		if (adsc_type==6) {adsc_darturl_skyscraper=adsc_darturl_adi+adsc_darturl_str;}
		if (adsc_type==7) {adsc_darturl_contentad2=adsc_darturl_adi+adsc_darturl_str;}
		if (adsc_type==9) {adsc_darturl_contentad3=adsc_darturl_adi+adsc_darturl_str;}
	}

adsc_tagout="<script language='javascript' src='"+adsc_darturl+"'></script>"; 
if (adsc_type==2){ 
adsc_tagout=adsg_cnttop+adsc_tagout+adsg_cntbot;
}

if (adsc_type==4){debout("kein popup");adsc_tagout="<!--ist-->"; }
debout('\n'+adsc_darturl.replace('adj', 'adi')+'\n');

}
return adsc_tagout;
}

function adsc_getParams(adsc_scringo,adsc_sname,adsc_splitter) {
adsc_scringo_split = adsc_scringo.split(adsc_splitter);
for (adsc_i=0;adsc_i<adsc_scringo_split.length;adsc_i++) {
var adsc_part_of_split = adsc_scringo_split[adsc_i];
var adsc_find_name = adsc_part_of_split.indexOf(adsc_sname);
if (adsc_find_name!=-1) {
var adsc_equal = adsc_part_of_split.indexOf("=") + 1;
var adsc_value_of_split = adsc_part_of_split.substring(adsc_equal,adsc_part_of_split.length);
return adsc_value_of_split; 
}}}

function debout(dbgval)
{
adsg_dbgmsg=adsg_dbgmsg+dbgval+"\n";
if (adsg_debug=="on")
{
window.status="TrueAffinity2=" + adsc_wunderloop;
if (adsg_dbginit==0)
{
adsg_dbginit=2;
document.write('<div id=jsdebug style="position:absolute; top:1px; left:1000px;  text-align:left; font-family:Fixedsys,Courier;"><textarea id=jssdebug cols=80 rows=100></textarea></div>');
}
document.getElementById("jssdebug").value=adsg_dbgmsg;
}
}


function holeKeks(name)
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function setzeKeks()
{

if(otp_typ==1 || otp_typ==2){ } else { otp_typ=c_otp_typ; }

if(otp_typ==1) {adsg_dbgmsg=adsg_dbgmsg+" \n Kein PopUP-Blocker! \n";}
if(otp_typ==2) {adsg_dbgmsg=adsg_dbgmsg+" \n PopUp-Blocker! \n";}
if(otp_typ==3) {otp_typ=1}
if(otp_typ==4) {otp_typ=1}
if(otp_typ==5) {otp_typ=2}

c1_name="chip_usr";
c2_name="otp_typ";

c1_wert=ng_chip_usr;
c2_wert=otp_typ;

c1_expires = new Date(c_now.getTime() +1000*60*60*1);      // 1 Stunden
c2_expires = new Date(c_now.getTime() +1000*60*60*24*30);  // 30 Tage

document.cookie = c1_name+'='+c1_wert+'; path='+c_path+'; expires='+c1_expires.toGMTString()+';';
document.cookie = c2_name+'='+c2_wert+'; path='+c_path+'; expires='+c2_expires.toGMTString()+';';

adsg_dbgmsg=adsg_dbgmsg +"c_otp_typ="+c_otp_typ+", otp_typ="+otp_typ+", chip_usr="+ng_chip_usr+" \n\n";


adsg_dbgmsg= adsg_dbgmsg + '\n adsc_wunderloop=' + adsc_wunderloop + '\n  ';
adsg_dbgmsg= adsg_dbgmsg + 'js_wlrcmd=' + js_wlrcmd + '\n  ';


if (alert_debugmode){alert(adsg_dbgmsg);}

}

// frequencyType bestimmt Art der Frequenzsteuerung
// 1 = Zeitsteuerung in Minuten
// 2 = nach Anzahl der aufgerufenen Videos  
var frequencyType = 2; 
// Value bei 1 in Minuten, bei 2 nach Anzahl der abgespielten Videos
var frequencyValue = 1;
// generelle on-off funktion 1=on, 0=off
var AdspotsOn  = 1;

function videomafo(vmdat){  //+ video mafo
var vmdat; 
var vmrand=Math.round(Math.random()*654646);
var vmdarr=vmdat.split("|");
var vmimgurl="http://php.sales.tfag.de/test/mf/phpmf/mf_05_1b_filter3exa.php?url=keine&cnt="+vmdarr[0]+"&trs=1&cid="+vmdarr[1]+"&dbg=0&cmd=0&rand="+vmrand+"&spotid=none;";
var vmspotimgurl="http://ad.de.doubleclick.net/activity;src=1011930;type="+vmdarr[3]+";cat="+vmdarr[4]+";ord="+vmrand+"?";
if(vmdarr.length==5){
var vmimg=new Image();
vmimg.src=vmimgurl;
if(vmdarr[3]&&vmdarr[4]&&(vmdarr[2]==1||vmdarr[2]==3)){
var vmspimg=new Image();
vmspimg.src=vmspotimgurl; 
}}}


/* geschrumpft, weiss noch nicht ob getparams 100% ident ergebnisse liefert */ 
//function adsc_getParams(str,nam,spl){var str,nam,spl,t,tt="";str=str.split(spl);for(var i=0; i<str.length;i++){t=str[i].split("=");if(t[0]&& t[1] && t[0]==nam){tt=t[1];}}return tt;}
function getAdType(a){var a;if (a && String(a) == String(parseInt(String(a)))) return parseInt(String(a));for (var i=0;i<adsg_katval.length;i++){if(adsg_katval[i]==a.toUpperCase())return i;}return '0';}
function adsf_setpix(tloc){var tloc,wlpix;debout("setpx:"+tloc);if(tloc&&tloc.indexOf("http://")==0){wlpix=new Image();wlpix.src=tloc;}} /*url*/



function adsf_wlread(){      /* wl_read header */  
var a,b;    
a=document.createElement("script"); 
a.type="text/javascript";   
a.src="http://rc.sales.tfag.de/Get/tofo/JS/GetRcmd.js?d="+Math.round(Math.random()*654654); 
var b=document.getElementsByTagName("head"); 
if(b[0]&&(b[0].readyState=="complete"||b[0].readyState==undefined)){
b[0].appendChild(a); 
window.setTimeout(adsf_wlwait,500);
}else{
debout("Och: WL_FAIL");}
} 
function adsf_wlwait(){
if(wlrcmd==adsg_wrlcache){
debout("rcmd==cache"); 
}else{        
debout("wlnew:"+wlrcmd); 
if(wlrcmd.length>3){
adsf_cookie("adcc_wl",wlrcmd,30,"/"); 
}}}  


function adsf_cookie(na,va,du,pa){ /* write:name,wert,tage,pfad, read:name  */
var na,va,du,pa,dur,dut; 
if(arguments.length==4){  
if(du&&parseInt(du)>0){
dur=new Date();dut=dur.getTime()+du*86400000;dur.setTime(dut);dur=dur.toGMTString();
document.cookie=na+"="+escape(va)+"; expires="+dur+"; path="+pa+";";}
//debout("setcookie:"+na);
}else{
dur="";
if(na && na.length>3){ 
debout(document.cookie);
var va=document.cookie.split(';');
for(var i=0;i<va.length;i++){ 
if(va[i].indexOf(na+"=")!=-1){
debout("match"+va[i]);
dut=va[i].split("=");
dur=unescape(dut[1]);
}}} 
debout("cookiereadout:"+dur);
return dur;
}}       

if (adsg_wlswitch==true){/* wltimer */
window.setTimeout(adsf_wlread,9000);
} 

 
function setze_wl_keks(){
debout("catch: setze_wl_keks");
}

