//Automatisierung der Testmärkte für die Blätterkomponente laden:
// JS-Include
date 		= new Date();
date_string = date.getFullYear().toString() + (date.getMonth()+1).toString() + date.getDate().toString();

/*var scriptElem = document.createElement('script');
scriptElem.type = 'text/javascript';
scriptElem.src = '/script/testmaerkte_blaetterkomponente/testmaerkte.inc.js?'+date_string;
var head = document.getElementsByTagName('head')[0];
if( head ) head.appendChild( scriptElem );
*///*****************************



function flipbox(divID, image, layerHeight, layerWidth){
	var flipbox=document.getElementById(divID);
	var flipboxbg = document.getElementById('picture_zoomed_background');
	var divBackground = 'url('+image+')';
	var divHeight = ''+(layerHeight)+'px';
	var divWidth = ''+(layerWidth)+'px';
	if (flipbox!=null) {
		flipbox.style.display = (flipbox.style.display=='none') ? "block" :"none";
		flipbox.style.backgroundImage = divBackground;
		flipbox.style.height = divHeight;
		flipbox.style.width = divWidth;
	}
	if (flipboxbg!=null){
		flipboxbg.style.display = (flipboxbg.style.display=='none') ? "block" :"none";
		flipboxbg.style.height = divHeight;
		flipboxbg.style.width = divWidth;
	}
}

function flipboxsimple(divID){
	var flipbox=document.getElementById(divID);
	if (flipbox!=null) {
		flipbox.style.display = (flipbox.style.display=='none') ? "block" :"none";
	}
}

function getQueryVariable(variable) {
	  var query = window.location.search.substring(1);
	  var vars = query.split("&");
	  for (var i=0;i<vars.length;i++) {
	    var pair = vars[i].split("=");
	    if (pair[0] == variable) {
	      return pair[1];
	    }
	} 
  }

function nx_send(){
        nx_win = window.open("/nx_mail_news.php?url="+escape(document.location)+"&title="+escape(document.title),"_danke", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=360,height=440');
        nx_win.focus();
        return false;
}

 function openEinkaufsliste(Titel,Portionen){
	
	inhalt = document.getElementById('rezept_zutaten').innerHTML;

	NewWindow=window.open('',"Einkaufsliste","height=400,width=350,scrollbars=no,toolbar=no,resizable=yes,top=100,left=100");
	
	NewWindow.document.write ("<html><head><title>");
	NewWindow.document.write (Titel);
	NewWindow.document.write ("</title>");
	NewWindow.document.write ("<link rel='stylesheet' href='style/penny_rd08.css' type='text/css'></head>");
	NewWindow.document.write ("<body class='rezepte_popup' onload='javascript:print();'>");
	NewWindow.document.write ("<table border=0 cellspacing=5 align=center width=350><tr>");
	NewWindow.document.write ("<td>");
	NewWindow.document.write ("<h2>"+Titel+"</h2><br /><span style='font-size:12px; font-style:normal;color:#000000'>Zutaten fï¿½r "+Portionen+" Portionen</span><br />");
	NewWindow.document.write ("<br />"+inhalt+"</td></tr></table></body></html>");
	NewWindow.focus();
	NewWindow.document.close();
	
	
	
  }
  
  function nx_linkangebote(strurl) {
	var today = new Date();
	//mktid=getmktcookie();
	
/*	mycookie = getmktcookie();
						mktid_ch_array = mycookie.split("-");
						
						mktid = mktid_ch_array[0]
						chash1 = mktid_ch_array[1];
						chash2 = mktid_ch_array[2];
						chash3 = mktid_ch_array[3];
						chash4 = mktid_ch_array[4];
						viewtype = mktid_ch_array[5];
	*/
	var wd="";


	if (strurl.href.indexOf("id=8385")>=0) {
		if (mktid>0) {
			strurl.href="index.php?id=8385&tx_nxneuimsortiment_pi1[markt]="+mktid+"&cHash="+chash2;
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=2-8385&cHash=8a594e6bd0";
		}
	}
	if (strurl.href.indexOf("id=8383")>=0) {
		if (mktid>0) {
			strurl.href="index.php?id=8383&tx_nxbilliger_pi1[markt]="+mktid+"&cHash="+chash3;
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=3-8383&cHash=3de5727900";
		}
	}
	if (strurl.href.indexOf("id=8376")>=0) {
		if (mktid>0) {
			strurl.href="index.php?id=8376&tx_nxbionaturgut_pi1[markt]="+mktid+"&cHash="+chash4;
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=4-8376&cHash=69af0a9eba";
		}
	}
	// Aktuell
	if (strurl.href.indexOf("id=8393")>=0 || strurl.href.indexOf("id=8387")>=0) {
		if (mktid>0) {
		  if (viewtype==2) {
        strurl.href="index.php?id=8716&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
			} else {
        strurl.href="index.php?id=8715&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      }
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=1-8393&cHash=69af0a9eba";
		}
	}
	// Vorschau
	if (strurl.href.indexOf("id=8391")>=0) {
		if (mktid>0) {
		  if (viewtype==2) {
		    strurl.href="index.php?id=8718&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      } else {
        strurl.href="index.php?id=8720&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      }
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=1-8391&cHash=69af0a9eba";
		}
	}
	// Restposten
	if (strurl.href.indexOf("id=8389")>=0) {
		if (mktid>0) {
		  if (viewtype==2) {
        strurl.href="index.php?id=8719&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
			} else {
        strurl.href="index.php?id=8721&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      }
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=1-8389&cHash=69af0a9eba";
		}
	}
	// Vorschau2
	if (strurl.href.indexOf("id=8460")>=0) {
		if (mktid>0) {
		  if (viewtype==2) {
		    strurl.href="index.php?id=8736&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      } else {
        strurl.href="index.php?id=8735&tx_nxangebote_pi1[markt]="+mktid+"&cHash="+chash1;
      }
		} else {
			strurl.href="index.php?id=marktauswahl0&tx_nxmarktsuche_pi1[returnid]=1-8391&cHash=69af0a9eba";
		}
	}
}
  
  /*function getmktcookie() {
	  
	// cookie wird in folgender Form gespeichert: 2118-65edab662d-390def3431-38cf398726-c469f8fbcb-2-31 
    var lf = "\n";
    var CookieString = document.cookie;
    var CookieSet = CookieString.split (';');
    var SetSize = CookieSet.length;
    var CookiePieces
    var ReturnValue = "";
    var x = 0;
    for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) {
      CookiePieces = CookieSet[x].split ('=');
      if (CookiePieces[0].substring (0,1) == ' ') {
        CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
      }
      if (CookiePieces[0] == 'marktid') {
        ReturnValue = CookiePieces[1];
      }
     }
     return ReturnValue;
  }
  */
function printthispage(){ 
	var sOption="toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=660,height=600,left=100,top=25"; 

	var sWinHTML = document.getElementById('content_container').innerHTML;
	var strBereich = document.title;
	var strBody = document.body.className;
	/*if (sWinHTML.indexOf('width=797')>=0) {
		sWinHTML = sWinHTML.replace(/width=797/g, "width=624");
	}
	if (sWinHTML.indexOf('width=799')>=0) {
		sWinHTML = sWinHTML.replace(/width=799/g, "width=624");
	}*/
	
	var winprint=window.open("","",sOption); 
       winprint.document.open(); 
       winprint.document.write('<html><title>' + document.title + '</title><link rel="stylesheet" type="text/css" href="style/penny_typo3.css" /><link rel="stylesheet" href="style/penny08_rd.css" type="text/css"><link rel="stylesheet" href="style/penny_rd08_print.css" type="text/css"><body class="'+strBody+'" onload="window.print();">'); 
       winprint.document.write('<div style="position: relative; z-index: 10;"><img src="image/rd08/druck_kv.png" width="640" height="145" border="0"><br>');
       winprint.document.write('<div id="infoDiv" style="position: absolute; left: 290px; top: 111px; width: 340px; height: 16px; z-index: 2; text-align: right;"><span style="font-size: 15px; color: #fff; font-family: arial; text-decoration: none;"><strong>' + strBereich + '</strong></span></div></div>');
       winprint.document.write('<div id="printable">'+sWinHTML+'</div>');
       winprint.document.write('</body></html>');
       winprint.document.close(); 
       winprint.focus(); 
}



//Rezepte
function checkRecieptCategory() {
  for (i = 0; i < document.forms['rezepte_kat'].kid.length; ++i)
    if (document.forms['rezepte_kat'].kid.options[i].selected == true)
      window.location.href = document.forms['rezepte_kat'].kid.options[i].value;
}

function checkRecieptArchive() {
  for (i = 0; i < document.forms['rezepte_archiv'].rid.length; ++i)
    if (document.forms['rezepte_archiv'].rid.options[i].selected == true)
      window.location.href = document.forms['rezepte_archiv'].rid.options[i].value;
}

//check for flash
var flashversionMin = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

if (plugin) {
	for (f = 0; f < 20; f++) {
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
		if (plugin.description.indexOf(f+".")>=0){
			flashversion = f;
			
			if (flashversion >= flashversionMin){
				plugin = true;
				break;
			}
		}
	}
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+flashversionMin+'")))\n');
	document.write('</SCRIPT\> \n'); 
}

function playSWF(file,id,vars,width,height,wmode,bgcolor,baseurl)	{
			document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
			document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
			document.write(' ID='+id+' WIDTH='+width+'px; HEIGHT='+height+'px>' );
			document.write(' <PARAM NAME="allowScriptAccess" VALUE="sameDomain" /> <PARAM NAME=movie VALUE="'+file+'"> <PARAM NAME=FlashVars VALUE="page_vars='+vars+'"> <PARAM NAME=menu VALUE=true>  <PARAM NAME="BASE" VALUE='+baseurl+'> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode value='+wmode+'> <PARAM NAME=bgcolor VALUE='+bgcolor+'>'); 
				if(navigator.userAgent.indexOf("Opera")==-1)	{
					document.write(' <EMBED src="'+file+'" FlashVars="'+vars+'" wmode='+wmode+' menu=true quality=high bgcolor='+bgcolor+'');
					document.write(' swLiveConnect=FALSE allowScriptAccess="sameDomain" NAME='+id+' WIDTH='+width+'px HEIGHT='+height+'px');
					document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" BASE='+baseurl+'>');
					document.write(' </EMBED>');
				}
				else	{
					document.write(' <EMBED src="'+file+'" FlashVars="'+vars+'" wmode='+wmode+' menu=true quality=high bgcolor='+bgcolor+'');
					document.write(' swLiveConnect=FALSE allowScriptAccess="sameDomain" ID='+id+' WIDTH='+width+'px HEIGHT='+height+'px');
					document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" BASE='+baseurl+'>');
					document.write(' </EMBED>');
				}
			document.write(' </OBJECT>');
}

function playSWF2(file,id,vars,width,height,wmode,bgcolor,baseurl,wLName) {
	fsource='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	fsource+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
	fsource+=' ID='+id+' WIDTH="'+width+'"; HEIGHT="'+height+'">';
	fsource+=' <PARAM NAME="allowScriptAccess" VALUE="sameDomain" /> <PARAM NAME=movie VALUE="'+file+'"> <PARAM NAME=FlashVars VALUE="'+vars+'"> <PARAM NAME=menu VALUE=false>  <PARAM NAME="BASE" VALUE='+baseurl+'> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode value='+wmode+'> <PARAM NAME=bgcolor VALUE='+bgcolor+'>';
		if(navigator.userAgent.indexOf("Opera")==-1) {
			fsource+=' <EMBED src="'+file+'" FlashVars="'+vars+'" wmode='+wmode+' menu=false quality=high bgcolor='+bgcolor+'';
			fsource+=' swLiveConnect=FALSE allowScriptAccess="sameDomain" NAME='+id+' WIDTH="'+width+'" HEIGHT="'+height+'"';
			fsource+=' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" BASE='+baseurl+'>';
			fsource+=' </EMBED>';
		}
		else	{
			fsource+=' <EMBED src="'+file+'" FlashVars="'+vars+'" wmode='+wmode+' menu=false quality=high bgcolor='+bgcolor+'';
			fsource+=' swLiveConnect=FALSE allowScriptAccess="sameDomain" ID='+id+' WIDTH="'+width+'" HEIGHT="'+height+'"';
			fsource+=' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" BASE='+baseurl+'>';
			fsource+=' </EMBED>';
		}
	fsource+=' </OBJECT>';

	if (document.getElementById){
		document.getElementById(wLName).innerHTML=fsource;
	}
}

function SetLayer2(LName,funct,wert){
	if (document.getElementById){
		var newLayer = document.getElementById(LName).style;
		newLayer[funct]=wert;
	}
}

function SetLayer3(LName,funct,wert){
	if (document.getElementById){
		var newLayer = document.getElementById(LName);
		newLayer[funct]=wert;
	}
}

function CheckFile(fid,fsrc,fwidth,fheight){
	if (fsrc.indexOf(".swf")>=0){
		playSWF(fsrc,fid,"",fwidth,fheight,"opaque","#fff","",fid)
	}
	else {
		SetLayer3(fid,'innerHTML','<image src="'+fsrc+'" />');
	}
}


var et_up=''; function et_pQ(param){var ll,fl, pV, rS; var qS=
document.location.search; pV=""; if(qS.length>1){ qS=qS.substr
(1);fl=qS.indexOf(param);if(fl!=-1){fl+=param.length + 1;ll=qS
.indexOf('&',fl);if(ll== - 1 )ll = qS.length;pV = qS.substring
(fl,ll);rS=new RegExp(" ",'g');pV=pV.replace( rS,'+' ); fl=pV.
indexOf('=',0);pV = pV.substring( fl+1 );}}return pV;}if((tc =
et_pQ( "et_cid" ))&&(tl=et_pQ( "et_lid" )))et_up += "&amp;et"+
"_cid=" + tc +  "&amp;et_lid="  + tl ; if( typeof( et_sub ) !=
"undefined" && typeof( et_sub )!="unknown")et_up += "&amp;et"+
"_sub="+et_sub;else if( et_tmp=et_pQ( "et_sub" ))et_up += "&"+
"amp;et_sub="+et_tmp;if( typeof( et_target ) != "undefined" &&
typeof( et_target )!="unknown") if (tt = et_pQ("et_target") ||
et_target!="" ){ tv = et_pQ("et_tval"); to = et_pQ("et_tonr");
ts=et_pQ("et_tsale");}

var et_server = "http://www.etracker.de";
var et_sslserver = "https://www.etracker.de";
var et_referer = et_server + '/app?et=', cex = '';
var et_la = '', et_js = 1, et_pl, et_co, et_iw,  et_sh, et_sw;
var et_sc = 'na',   et_gp = '',   lt = '<',   et_ih ,  et_up ;
if( typeof( tt ) == "undefined" || typeof( tt ) == "unknown" )
{var tt='';} var tv, to,  ts,  et_tmp; function et_eC( param )
{var et_a = '', et_t = '', et_p = '', et_b='', et_s='',et; var
et_ref=escape(document.referrer);if(et_js>=1.3){if(typeof(top.
document)=='object')eval('try{et_ref=escape(top.document.ref'+
'errer);}catch(e){et_ref="";}');} if(et_ref!='') et_gp+='&am'+
'p;ref='+et_ref; et_gp +='&amp;swidth='+et_sw+'&amp;sheight='+
et_sh+'&amp;siwidth='+et_iw+'&amp;siheight='+et_ih+'&amp;sco'+
'okie='+et_co+'&amp;scolor='+et_sc;if(et_easy)et_gp+='&amp;e'+
't_easy=1'; if( et_pl!='' ) et_gp+='&amp;p='+escape(et_pl);if(
et_areas != '' )et_gp += '&amp;et_areas='+escape(et_areas);if(
typeof(et_target)== "undefined"||typeof(et_target)=="unknown")
{et_target = ""; et_tval = "0";  et_tonr = "0"; et_tsale = 0;}
et_gp+="&amp;"+"et_target="+ escape( tt.length?tt:et_target )+
"," + ( tv?tv:et_tval ) + "," + ( to?to:et_tonr )+ ","+(ts?ts:
et_tsale )+","+( typeof( et_cust ) == "number"?et_cust:0 );if(
typeof( et_lpage )=='undefined' ||typeof(et_lpage)=='unknown')
et_lpage=''; else et_gp += '&amp;et_lpage='+et_lpage;if(typeof
(et_se) == 'undefined' || typeof(et_se)=='unknown')et_se='';if
(et_se!='')et_gp +='&amp;et_se='+et_se;if(typeof( et_trig ) ==
'undefined'||typeof(et_trig)=='unknown')et_trig='';if( et_trig
!='' )et_gp+='&amp;et_trig='+et_trig;if(et_pagename!='') et_gp
+='&amp;et_pagename='+escape(et_pagename);if(typeof(et_basket)
=='string')et_gp += '&amp;et_basket=' + escape(et_basket); if(
typeof(et_up) == 'undefined' || typeof(et_up)=='unknown')et_up
= ''; if( et_url ) { et_gp += '&amp;et_url=' + et_url } else {
et=document.location.href.split('?'); et_gp += '&amp;et_url='+
escape( et[0] );}et_gp += '&amp;slang=' +et_la; tc=new Date();
document.write( lt + "a target='_blank' href='" +  et_referer+
param+"'>" +lt  + "img border='0' alt='' src='" + ( et_ssl==1?
et_sslserver:et_server) + "/cnt.php?v=2.4&amp;java=y&amp;tc="+
tc.getTime()+ "&amp;et="+param +"&amp;et_ilevel=" + et_ilevel+
et_gp  +  et_up  +  "'/>" +lt+"/a>"  ) ; }  

document.write(lt+'script lan'+
'guage="JavaScript1.3"> var et_js = 1.3;' + lt + '/script>' );

et_sw = screen.width;et_sh = screen.height;et_co =( navigator.
cookieEnabled == true ? 1:(navigator.cookieEnabled==false?2: 0
 ));if ( navigator.language ) et_la = navigator.language; else
 if ( navigator.userLanguage ) et_la = navigator.userLanguage;
et_sc  =  (   (   screen.pixelDepth  )   ?   screen.pixelDepth
: screen.colorDepth ); if ( et_js >= 1.3 ){ eval('try{et_iw='+
'top.innerWidth;et_ih=top.innerHeight;}catch(e){et_iw=window'+
'.innerWidth;et_ih=window.innerHeight;}');}if(typeof(et_iw) ==
'undefined'){eval('if(document.documentElement&&document.doc'+
'umentElement.clientHeight){et_iw=document.documentElement.c'+
'lientWidth;et_ih=document.documentElement.clientHeight;}els'+
'e if(document.body){et_iw = document.body.clientWidth; et_i'+
'h = document.body.clientHeight; }' ) ; }