/*
#########################################################################
# Scripts for Selfmadeshop 5.0
# display.js v1.2 / 21.07.2005
#
# (c) 2001-2005 CATMEDIA e-busines solutions http://www.catmedia.de/
#
# Lizenzbedingungen
#
# ACHTUNG! Diese Scripte sind kein Open Source, keine Freeware, keine
#          Public Domain. Sie unterliegen zu 100% dem Urheberrecht 
#          und unseren Lizenbedingungen.
#
# Diese Scripte duerfen nur zusammen mit einer legalen Version
# von Selfmadeshop verwendet werden. Jede andere Form der 
# Verwendung bedarf der ausdruecklichen Zustimmung von CATMEDIA.
# Unberechtigte Nutzung, Vervielfaeltigung, Verbreitung sowie
# Veraenderung oder Entfernung der Urheberrechtshinweise sind 
# bei Strafe verboten!
#
# Funktionelle Veraenderungen oder der Einbau spezieller Funktionen 
# sind CATMEDIA durch Ueberlassung einer Kopie der angepassten
# Version zu belegen.
#
# Alle Aenderungen gehen in das Eigenntum von CATMEDIA ueber und 
# duerfen von CATMEDIA kuenftig ohne Einschraenkung verwendet werden.
#
#########################################################################
*/


/*
* - gibt die Vor-Zurückleiste aus
*  (globale Variablen aus article_xxx.html werden genutzt)
*/
function displayBackButton(anz) {
	if (!anz) anz=-1;
  document.write('<hr>\n');
  document.write('<p align="left"><a href="javascript:history.go('+anz+')"><img src="'+rooturl+'shopimg/back.gif" alt=" zur&uuml;ck " title=" zur&uuml;ck " align="absmiddle" border="0"></a></p>\n');
}


/*
* die Funktion displayOrder erzeugt den Bestellbutton, das Eingabefeld für die Anzahl
* 
*
*/

function displayOrder(w,a,form,einheit,minmenge,art,nr){
		if (!eval(minmenge)) minmenge=1;
		if (art && art.area=="true"){
				var target='javascript:arttowako('+a+',this.document.'+form+'.order_anz1.value,this.document.'+form+'.order_anz2.value,'+nr+')';
				w.document.write('<table width="100%" border="0" cellpadding="0" cellmargin="0"><tr><td align=left><nobr>');
				w.document.write('<a href='+target+' ><img src="'+rooturl+'shopimg/cart.gif" border="0" align=absmiddle alt="'+parent.I18N["WK_ORDER"]+'" title="'+parent.I18N["WK_ORDER"]+'"></a> '+'&nbsp;');
				w.document.write('<input type="text" name="order_anz1" value="'+eval(minmenge)+'" style="width:50px; max-width:50px">&nbsp;x&nbsp;<input type="text" name="order_anz2" value="'+eval(minmenge)+'" style="width:50px; max-width:50px">'+' '+'<span class="arttext">'+einheit+'</span>');
		} else {
				var target='javascript:arttowako('+a+',this.document.'+form+'.order_anz.value,0,'+nr+')';
				w.document.write('<table width="100%" border="0" cellpadding="0" cellmargin="0"><tr><td align=left><nobr>');
				w.document.write('<a href='+target+' ><img src="'+rooturl+'shopimg/cart.gif" border="0" align=absmiddle alt="'+parent.I18N["WK_ORDER"]+'" title="'+parent.I18N["WK_ORDER"]+'"></a> '+'&nbsp;');
				w.document.write('<input type="text" name="order_anz" value="'+eval(minmenge)+'" style="width:50px; max-width:50px">'+' '+'<span class="arttext">'+einheit+'</span>');
		}
		w.document.write('</nobr></td></tr></table>');
}

/*
* die Funktion displayDetail erzeugt den Detailbutton
* 
*
*/
function displayDetail(w,a,form){
  	w.document.write('<table width="100%" border="0" padding="0 0 0 0"><tr><td align=left><a href="'+eval(a).page+'"><img src="'+rooturl+'shopimg/detail.gif" border="0" title="'+parent.I18N["ART_DETAIL"]+'" alt="'+I18N["ART_DETAIL"]+'"></a></td></tr></table>');
}
function displayDetail2(w,page){
  	w.document.write('<table width="100%" border="0" padding="0 0 0 0"><tr><td align=left><a href="'+page+'"><img src="'+rooturl+'shopimg/detail.gif" border="0" title="'+parent.I18N["ART_DETAIL"]+'" alt="'+I18N["ART_DETAIL"]+'"></a></td></tr></table>');
}

function arttowako(a,m,m2,nr){
//	alert ("Der Artikel wurde in den Warenkorb übernommen!");

	if (m2) m=eval(m.replace(',','.'))*eval(m2.replace(',','.'))+'';
	parent.vars.gWK.SetMenge(m,a);
	//basket muß aktuelle Werte anzeigen
	parent.frames["basket"].location.reload();
	//in main muß ein neues object erzeugt werden
	parent.vars.pagelocation='#top'+nr;
	
	parent.frames["main"].location.reload();

}

function displayOrderNavig(){
	var page="pay.html";
	document.write('<table width="100%" class="artnav" cellpadding="0" cellspacing="0" border="0">');
	document.write('<tr>');
	document.write('<td align="left" valign="middle">');
	document.write('</td>');
	document.write('<td align="right" valign="middle">');
	document.write('<a href="'+rooturl+page+'" alt="'+I18N["ART_NEXT"]+'" title="'+I18N["ART_NEXT"]+'" target="_self" ><img src="'+rooturl+'shopimg/buy.gif" border="0" title="'+I18N["ART_NEXT"]+'" alt="'+I18N["ART_NEXT"]+'"></a></td>');
	document.write('</tr>');
	document.write('</table>');
	
}

function displayWakoNavig(){
	var best="order.html";
	document.write('<table width="100%" class="artnav" cellpadding="0" cellspacing="0" border="0">');
	document.write('<tr>');
	document.write('<td align="left" valign="middle">');
	document.write('<a href=javascript:history.back() alt="'+I18N["ART_PREV"]+'" title="'+I18N["ART_PREV"]+'" target="_self"><img src="'+rooturl+'shopimg/article_back.gif" border="0" title="'+I18N["ART_PREV"]+'" alt="'+I18N["ART_PREV"]+'"></a></td>');
	document.write('<td align="right" valign="middle">');
	document.write('<a href="'+rooturl+best+'" alt="'+I18N["ART_NEXT"]+'" title="'+I18N["ART_NEXT"]+'" target="_self" ><img src="'+rooturl+'shopimg/article_next.gif" border="0" title="'+I18N["ART_NEXT"]+'" alt="'+I18N["ART_NEXT"]+'"></a></td>');
	document.write('</tr>');
	document.write('</table>');
	
}

function displayHeight(i){
	document.write('<table width="100%" class="artnav" cellpadding="0" cellspacing="0" border="0">');
	document.write('<tr>');
	document.write('<td height='+i+'><td>');
	document.write('</tr>');
	document.write('</table>');
	
}

function displayOrderOptionen(text){
//alert('start')	
	document.write('<table class="tbl_small">');
	
	// Region
	document.write('<tr>');
	document.write('<td align="left" valign="middle">');
	document.write(parent.I18N["VA_REG"]);
	document.write('</td>');
	document.write('<td align="left" valign="middle">');
	
	if (text=='1'){
		for (var i=0;i<gZOErlaubnis.length;i++){
			document.write(((gZOErlaubnis[i][0] == parent.vars.clientRegion) ? parent.I18N[gZOErlaubnis[i][1]] : ''));
			if (gZOErlaubnis[i][0] == parent.vars.clientRegion) parent.vars.clientRegionString=parent.I18N[gZOErlaubnis[i][1]];
		}
	} else {
		document.write('<select name=Region onChange=changeClientRegion()>');
		
		for (var i=0;i<gZOErlaubnis.length;i++){
			document.write('<option value='+gZOErlaubnis[i][0]+' '+((gZOErlaubnis[i][0] == parent.vars.clientRegion) ? ' selected' : '')+'>'+parent.I18N[gZOErlaubnis[i][1]]+'</option>')
		}
		
		document.write('</select>');
		if (!parent.vars.clientRegion){
			parent.vars.clientRegion=document.order.Region.value;
			parent.vars.ges_warenwert=eval(parent.vars.gWK.Sum("ArtGP"));
			parent.vars.VersArt=""
		}
	}
	document.write('</td>');
	document.write('</tr>');

	var is_gVK=false;
	for (var i=0;i<parent.vars.gVKF.length;i++){
		if (parent.vars.gVKF[i][0]==parent.vars.clientRegion) {
			parent.vars.gVKfrei=parent.vars.gVKF[i][1];//.push("INL",100.00);
			is_gVK=true;
		}
	}
	if (is_gVK==false) parent.vars.gVKfrei="99999999999999999999";
	



	// Versandart

	// Prüfen, ob Versandoption für diese Region definiert ist

	var showVersand=false;
	for (var i_ge=0;i_ge<gVA.length;i_ge++){
		if ((parent.vars.clientRegion=='IN' && gVA[i_ge][3]=='Inland') || (parent.vars.clientRegion=='EU' && gVA[i_ge][3]=='Europa') || (parent.vars.clientRegion=='AU' && gVA[i_ge][3]=='Ausland')) {
			showVersand=true;
		}
	}

	if (showVersand){
		document.write('<tr>');
		document.write('<td align="left" valign="middle">');
		document.write(parent.I18N["VA_STR"]);
		document.write('</td>');
		document.write('<td align="left" valign="middle">');
	
	// automatisch wird der erste Versandart vorgewählt
		parent.vars.gVA=gVA;
		if (text=='1'){
			for (var i_ge=0;i_ge<gVA.length;i_ge++){
				document.write((gVA[i_ge][0] == parent.vars.VersArt) ? gVA[i_ge][1] + ' ' + gVA[i_ge][3]  + ' '  : '');
				if (gVA[i_ge][0] == parent.vars.VersArt) {
					parent.vars.clientVersandartString=gVA[i_ge][1] + ' ' + gVA[i_ge][3];
				}
			}
		} else {

			document.write('<select name=VersArt onChange=changeVersArt()>');
	
			var VK=0;
			var GE=(parent.vars.gWK.Sum('ArtGew','Float')*1.05);
			var compare_logistics="";
			var match_logistic=false;
			var resGE=0;
			var max_logistic_gew=new Array();

			var regio_logistic=new Array();
			var max_logistic=new Array();
			var this_VersArt=0;
			
			// alle Versandarten werden abgefragt

			for (var i_ge=0;i_ge<gVA.length;i_ge++){
				// nur die Versandarten der Region werden berücksichtigt
				if ((parent.vars.clientRegion=='IN' && gVA[i_ge][3]=='Inland') || (parent.vars.clientRegion=='EU' && gVA[i_ge][3]=='Europa') || (parent.vars.clientRegion=='AU' && gVA[i_ge][3]=='Ausland')) {
					if (compare_logistics!=gVA[i_ge][1]+gVA[i_ge][2]+gVA[i_ge][3]+gVA[i_ge][5]){
						regio_logistic.push(gVA[i_ge])
						compare_logistics=gVA[i_ge][1]+gVA[i_ge][2]+gVA[i_ge][3]+gVA[i_ge][5];
					}
				}
			}				
			
			if (regio_logistic.length==0){
				for (var i_ge=0;i_ge<gVA.length;i_ge++){
					// nur die Versandarten der Region werden berücksichtigt
					if ((parent.vars.clientRegion=='IN' && gVA[i_ge][3]=='Inland') || (parent.vars.clientRegion=='EU' && gVA[i_ge][3]=='Europa') || (parent.vars.clientRegion=='AU' && gVA[i_ge][3]=='Ausland')) {
						regio_logistic.push(gVA[i_ge])
					}
				}				
			}
			
			for (var i_ge=0;i_ge<regio_logistic.length;i_ge++){
				if (regio_logistic[i_ge][0]==parent.vars.VersArt) this_VersArt=i_ge;			
			}
			
			compare_logistics="";
			for (var i_ge=0;i_ge<regio_logistic.length;i_ge++){
				if (parent.vars.ges_warenwert < parent.vars.gVKfrei) VK=regio_logistic[i_ge][4]
				else VK=0;

				/*
				regio_logistic array('1','Brief','Deutsche Post','Inland','Preis','Gewicht','MwSt')
				GE ist Gesamtgewicht des Warenkorbs			
				*/
				
				/* Fall 1: Gesamtgewicht des Warenkobes ist 0, 
				*          es werden die Versandarten ausgewählt, die keine Gewichtsbeschränkung haben + die kleinsten
				*          Versandarten mit Gewichtsbeschränkung
				*  Fall 2: Die Gewichtsbeschränkung der Versandart liegt über dem Gesamtgewicht des Warenkorbes,
				*          Es werden die kleinsten Versandarten über dem entsprechenden Gewicht angezeigt
				*  Fall 3: Der Warenkorb ist schwerer als die maximale Versandart
				*          Es werden die größten Versandarten angezeigt
				*/
				if (eval(GE)==0){
					// Fall 1:
					if (eval(regio_logistic[i_ge][5])==0 && (regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3])!=compare_logistics) {
if (parent.vars.VersArt=="") {
	parent.vars.VersArt=regio_logistic[i_ge][0];
	this_VersArt=i_ge;
}
						document.write('<option value=' + regio_logistic[i_ge][0]  + (i_ge==this_VersArt ? ' selected' : '') + '>' + regio_logistic[i_ge][1] + ' ' + regio_logistic[i_ge][3] + ' ' + regio_logistic[i_ge][2] + ' ' + ((VK!=0) ? '(' + printPreis(VK) + ')' : '') + '</option>');
						match_logistic=true;
						compare_logistics=regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3];
					}
					if (eval(regio_logistic[i_ge][5])!=0 && (regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3])!=compare_logistics) {
if (parent.vars.VersArt=="") {
	parent.vars.VersArt=regio_logistic[i_ge][0];
	this_VersArt=i_ge;
}
						document.write('<option value=' + regio_logistic[i_ge][0]  + ((i_ge==this_VersArt) ? ' selected' : '') + '>' + regio_logistic[i_ge][1] + ' ' + regio_logistic[i_ge][3] + ' ' + regio_logistic[i_ge][2] + ' ' + ((VK!=0) ? '(' + printPreis(VK) + ')' : '') + '</option>');
						match_logistic=true;
						compare_logistics=regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3];
					}					
				}	else if (regio_logistic[i_ge][5]>eval(GE)) {
					match_logistic=true;	
				}			
			}

			compare_logistics='';
			for (var i_ge=0;i_ge<regio_logistic.length;i_ge++){
				if (parent.vars.ges_warenwert < parent.vars.gVKfrei) VK=regio_logistic[i_ge][4];
				
				if (match_logistic){
					// Fall 2:
					if (eval(GE)!=0 && eval(regio_logistic[i_ge][5])>eval(GE) && (regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3])!=compare_logistics) {

if (parent.vars.VersArt=="") {
	parent.vars.VersArt=regio_logistic[i_ge][0];
	this_VersArt=i_ge;
}
						document.write('<option value=' + regio_logistic[i_ge][0]  + ((i_ge==this_VersArt) ? ' selected' : '') + '>' + regio_logistic[i_ge][1] + ' ' + regio_logistic[i_ge][3] + ' ' + regio_logistic[i_ge][2] + ' ' + ((VK!=0) ? '(' + printPreis(VK) + ')' : '') + '</option>');

						match_logistic=true;
						compare_logistics=regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3];
					}					
				} else {
					var in_max_logistic=false
					for (var j_ge=0;j_ge<max_logistic_gew.length;j_ge++){
						if (max_logistic_gew[j_ge][1]+max_logistic_gew[j_ge][2]+max_logistic_gew[j_ge][3]==regio_logistic[i_ge][1]+regio_logistic[i_ge][2]+regio_logistic[i_ge][3]){
							max_logistic_gew[j_ge][5]=regio_logistic[i_ge][5];
							in_max_logistic=true;
						}
					}
					if (in_max_logistic==false) {
						max_logistic_gew.push(regio_logistic[i_ge]);
					}
				}

				if (parent.vars.ges_warenwert < parent.vars.gVKfrei) {
					parent.vars.gVersandPreis=regio_logistic[this_VersArt][4];
					parent.vars.gVersand_mwst=regio_logistic[this_VersArt][6];
				} else {
					parent.vars.gVersandPreis=0;
					parent.vars.gVersand_mwst=0;
				}
			}


			if (!match_logistic){
				// Fall 3:
				for (var i_ge=0;i_ge<max_logistic_gew.length;i_ge++){
					if (max_logistic_gew[i_ge][0]==parent.vars.VersArt) this_VersArt=i_ge;			
				}

				var this_z=1;
				for (var i_ge=0;i_ge<max_logistic_gew.length;i_ge++){
if (parent.vars.VersArt=="") {
	parent.vars.VersArt=regio_logistic[i_ge][0];
	this_VersArt=i_ge;
}
					if (parent.vars.ges_warenwert < parent.vars.gVKfrei) VK=max_logistic_gew[i_ge][4];

					if (eval(max_logistic_gew[i_ge][5])>0) var z=Math.ceil(eval(GE/max_logistic_gew[i_ge][5]))
					else var z=1

					document.write('<option value=' + max_logistic_gew[i_ge][0]  + ((i_ge==this_VersArt) ? ' selected' : '') + '>' + (z>1?z+' ':'') + max_logistic_gew[i_ge][1] + ' ' + max_logistic_gew[i_ge][3]  + (max_logistic_gew[i_ge][5]>0?' - bis ' + max_logistic_gew[i_ge][5] + ' g - ':' ') + max_logistic_gew[i_ge][2] + ' ' + ((VK!=0 && parent.vars.ges_warenwert<parent.vars.gVKfrei) ? '(' + (z>1?'a ':'') + printPreis(VK) + ')' : '') + '</option>');
					if (i_ge==this_VersArt) this_z=z;
				}
				
				if (parent.vars.ges_warenwert < parent.vars.gVKfrei) {
					parent.vars.gVersandPreis=this_z*max_logistic_gew[this_VersArt][4];
					parent.vars.gVersand_mwst=max_logistic_gew[this_VersArt][6];
				} else {
					parent.vars.gVersandPreis=0;
					parent.vars.gVersand_mwst=0;
				}
			}

			document.write('</select>');
			document.write('</td>');
			document.write('</tr>');

		}		

		

	}
	// Zahlungsoptionen
	// Die Zahlungsoptionen ergeben sich aus Zahlungsarten und Zahlungsmodulen(Paysysteme)
	// 
	document.write('<tr>');
	document.write('<td align="left" valign="middle">');
	document.write(parent.I18N["ZA_STR"]);
	document.write('</td>');
	document.write('<td align="left" valign="middle">');

	// ZahlOptgesamt ist ein Array über Zahlungarten und Zahlungsmodule
	// Zahlungsoptionen: gZO.push(new Array('IN','Nachnahme','3.50','0.00','1.00'));
	// Zahlungsmodule:   gZM.push(new Array('IN','Eurocoin iclear','0.00000','3.50000','','2000000689'));
	var ZahlOptgesamt=gZO.concat(gZM);
	if (text=='1'){
		for (var ix=0;ix<ZahlOptgesamt.length;ix++){
			if (!parent.vars.ZahlOpt && parent.vars.ZahlOpt!='0') parent.vars.ZahlOpt=ix;
			document.write((ix == parent.vars.ZahlOpt) ?  ZahlOptgesamt[ix][1] + ' '  : '');
		}
	} else {
		document.write('<select name=ZahlOpt onChange=changeZahlOpt()>');
		
		//ZOK ZahlOptionsKosten (Variable wird gefüllt, wenn Zahlsystem gewählt ist)
		//parent.vars.Zahlopt ist der Index aus ZahlOptgesamt, der gewählt wurde
		var ZOK="";

		for (var ix=0;ix<ZahlOptgesamt.length;ix++){
			//Die Kosten für Zahloptionen sind abhängig vom Warenwert und einem Festpreis
			ZOK=getZOKosten(ix);
			
			if (ZahlOptgesamt[ix][0]==parent.vars.clientRegion) {
				if (!parent.vars.ZahlOpt && parent.vars.ZahlOpt!='0') {
					parent.vars.ZahlOpt=ix;
					if (gZO[parent.vars.ZahlOpt] && (gZO[parent.vars.ZahlOpt][1]=='Überweisung' || gZO[parent.vars.ZahlOpt][1]=='Vorauskasse')) parent.vars.BankData=parent.vars.ShopData2
					else parent.vars.BankData="";
					parent.vars.ShopData=parent.vars.ShopData1;
				}
				if (ix==parent.vars.ZahlOpt)parent.vars.clientZahloptionString=ZahlOptgesamt[ix][1]
				document.write('<option value=' + ix  + ((ix==parent.vars.ZahlOpt) ? ' selected' : '') + '>' + ZahlOptgesamt[ix][1]   + ((eval(ZOK)!=0) ? ' ('+printPreis(ZOK)+')' : '')+ '</option>');
				
			}

		}

		document.write('</select>');
		if (document.order && document.order.ZahlOpt) {
			parent.vars.ZahlOpt=document.order.ZahlOpt.value
			parent.vars.gZahlPreis=getZOKosten(document.order.ZahlOpt.value);
			parent.vars.gZahl_mwst=getZOMwST(document.order.ZahlOpt.value);
		} 
	}
	document.write('</td>');
	document.write('</tr>');

//Versicherung

	if (gZOVers && gZOVers.length>0){
		var gZOVersPreis="";
		var gZOVersMwst="";
		var displayVersi=false;
		for (i_v=0;i_v<gZOVers.length;i_v++){
			if (gZOVers[i_v][0]==parent.vars.clientRegion) {
				var x=gZOVers[i_v][2];
				gZOVersPreis=parent.vars.ges_warenwert*gZOVers[i_v][3]/100;
				if (x>gZOVersPreis) gZOVersPreis=x;
				gZOVersMwst=gZOVers[i_v][4];
				displayVersi=true;
			}	
		}
		if (displayVersi==true){
			if (parent.vars.Versicherung=='false') parent.vars.Versicherung=false;
			document.write('<tr>');
			document.write('<td align="left" valign="middle">');
			document.write(parent.I18N["VERS_STR"]);
			document.write('</td>');
			document.write('<td align="left" valign="middle">');
			if (text=='1') document.write('<input type="checkbox" name="VersCheck" value="true" '+(parent.vars.Versicherung?' checked':'') +' disabled </input>')
			else {
				document.write('<input type="checkbox" name="VersCheck" value="true" '+(parent.vars.Versicherung?' checked':'') +' onClick="javascript:changeVersicherung('+gZOVersPreis+','+gZOVersMwst+')"</input>');
				document.write(printPreis(gZOVersPreis));
			}
			document.write('</td>');
			
			document.write('</tr>');
		}
		
		parent.vars.gVersicherungPreis=gZOVersPreis+'';
		parent.vars.gVersicherung_mwst=gZOVersMwst+'';

	}else{
		parent.vars.Versicherung=false;
		parent.vars.gVersicherungPreis='';
		parent.vars.gVersicherung_mwst='';
		
	}

	document.write('</table>');
}

/* Andi */
function displayOrderConfirmSystem(val){
	var basketID=""; 
 	var productString="";
	var existPaysystem;
	var constPaysystem="";
	var transID="";
	var actionPage="";
	if (parent.vars.StdScript!="") actionPage=parent.vars.StdScript+"/php/order.php"
	else if (parent.vars.RedScript!="") actionPage=parent.vars.RedScript+"/php/order.php"
	else if (parent.vars.StdSSLScript!="") actionPage=parent.vars.StdSSLScript+"/php/order.php"
	else if (parent.vars.RedSSLScript!="") actionPage=parent.vars.RedSSLScript+"/php/order.php"
	else actionPage="php/order.php";
	
	if (val	== "mail") actionPage="mail.php";
	parent.vars.gZMPayData[0]=parent.vars.sKName.substring(0,parent.vars.sKName.indexOf(" "));
	parent.vars.gZMPayData[1]=parent.vars.sKName.substring(parent.vars.sKName.indexOf(" ")+1,parent.vars.sKName.length);
	parent.vars.gZMPayData[2]=parent.vars.sKMail;
	
	if (parent.vars.ZahlOpt>=gZO.length && gZM[parent.vars.ZahlOpt-gZO.length]) {
		parent.vars.PaySystem[1]=gZM[parent.vars.ZahlOpt-gZO.length][1]
		parent.vars.PaySystem[4]=gZM[parent.vars.ZahlOpt-gZO.length][4]
		parent.vars.PaySystem[5]=gZM[parent.vars.ZahlOpt-gZO.length][5]
		parent.vars.PaySystem[6]=gZM[parent.vars.ZahlOpt-gZO.length][6]
		parent.vars.PaySystem[7]=gZM[parent.vars.ZahlOpt-gZO.length][7]
	}else parent.vars.PaySystem[1]="";
	
	existPaysystem=parent.vars.PaySystem[1];

	if (constPaysystem=="" || parent.vars.PaySystem[1]==""){

		if (sslurl) {
			if (sslurl.lastIndexOf("/")!=sslurl.length) sslurl=sslurl+"/";
			document.write('<FORM name="payconfirm" ACTION="'+actionPage+'" METHOD="POST" TARGET="main">');
		} else document.write('<FORM name="payconfirm" ACTION="'+actionPage+'" METHOD="POST" TARGET="main">');

		document.write('<INPUT TYPE="HIDDEN" NAME="tcphMerchantID" VALUE="'+parent.vars.PaySystem[5]+'">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphAcquirerID" VALUE="telecash">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphTransactionID" VALUE="'+ transID +'">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphOrderDescription" VALUE="Einkauf">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphPaymentType" VALUE="CreditCard">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphAmount" VALUE="'+ parent.vars.gSumWako +'">');
		document.write('<INPUT TYPE="HIDDEN" NAME="tcphCurrency" VALUE="'+ parent.vars.curr +'">');
		var Pos=0;
		for(var i=0; i < parent.vars.gWK.db.vRows.length; i++){
			Pos++;
			productString+=Pos+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"Anz")+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"ArtNr")+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"ArtBez")+"::"+""+printPreis(parent.vars.gWK.db.fGetValByRowCol(i,"ArtEP"))+"::"+""+printPreis(parent.vars.gWK.db.fGetValByRowCol(i,"ArtGP"))+"::"+parent.vars.gWK.db.fGetValByRowCol(i,"ArtMwSt")+"%%";
		}

		for(var i=0; i < parent.vars.gWK.db.vRows.length; i++){
			if (parent.vars.gWK.db.fGetValByRowCol(i,"ArtVersOpt") && parent.vars.gWK.db.fGetValByRowCol(i,"ArtVersOpt")!=0) {
				Pos++;
				productString+=Pos+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"Anz")+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"ArtNr")+"::"+""+parent.vars.gWK.db.fGetValByRowCol(i,"ArtBez")+"::"+""+printPreis(parent.vars.gWK.db.fGetValByRowCol(i,"ArtVersOpt"))+"::"+""+printPreis(eval(parent.vars.gWK.db.fGetValByRowCol(i,"Anz"))+eval(parent.vars.gWK.db.fGetValByRowCol(i,"ArtVersOpt")))+"::"+parent.vars.gWK.db.fGetValByRowCol(i,"ArtMwSt")+"%%";
			}
		}

		document.write('<input type="hidden" name="Products" value="'+productString.substring(0,productString.length-2)+'">');
			var clientString=+parent.I18N["PERS_KUNDENNUMMER"]+parent.vars.sKNummer+"::"+parent.I18N["PERS_FIRMA"]+parent.vars.sKFirma;
			clientString +="::"+parent.I18N["PERS_NAME"]+parent.vars.sKName+"::"+parent.I18N["PERS_STRASSE"]+parent.vars.sKStrasse;
			clientString +="::"+parent.I18N["PERS_PLZ"]+parent.vars.sKPlz+"::"+parent.I18N["PERS_ORT"]+parent.vars.sKOrt;
			clientString +="::"+parent.I18N["PERS_TELEFON"]+parent.vars.sKTelefon+"::"+parent.I18N["PERS_TELEFAX"]+parent.vars.sKTelefax;
			clientString +="::"+parent.I18N["PERS_EMAIL"]+parent.vars.sKMail+"::"+parent.I18N["PERS_LAND"]+parent.vars.sKLand;
			clientString +="::"+parent.I18N["PERS_USTID"]+parent.vars.sKUStID;
			var clientLString =parent.I18N["PERS_FIRMA"]+parent.vars.sLKFirma;
			clientLString +="::"+parent.I18N["PERS_NAME"]+parent.vars.sLKName;
			clientLString +="::"+parent.I18N["PERS_STRASSE"]+parent.vars.sLKStrasse;
			clientLString +="::"+parent.I18N["PERS_PLZ"]+parent.vars.sLKPlz;
			clientLString +="::"+parent.I18N["PERS_ORT"]+parent.vars.sLKOrt;
			clientLString +="::"+parent.I18N["PERS_TELEFON"]+parent.vars.sLKTelefon;
			clientLString +="::"+parent.I18N["PERS_TELEFAX"]+parent.vars.sLKTelefax;
			clientLString +="::"+parent.I18N["PERS_EMAIL"]+parent.vars.sLKMail;
			clientLString +="::"+parent.I18N["PERS_LAND"]+parent.vars.sLKLand;
			var clientBaString =parent.I18N["PERS_KREDITINSTITUT"]+parent.vars.sKBank;
			clientBaString +="::"+parent.I18N["PERS_KONTOINHABER"]+parent.vars.sKInhaber;
			clientBaString +="::"+parent.I18N["PERS_BLZ"]+parent.vars.sKBlz;
			clientBaString +="::"+parent.I18N["PERS_KONTONUMMER"]+parent.vars.sKKonto;
			var clientBString =parent.I18N["PERS_MITTEILUNG"]+parent.vars.sMitteilung;
			clientBString +="::"+parent.I18N["PERS_BENACHRICHTIGUNG"]+parent.vars.showFAG2;
			
		document.write('<input type="hidden" name="Client" value="'+clientString+'">');
		document.write('<input type="hidden" name="ClientL" value="'+clientLString+'">');
		document.write('<input type="hidden" name="ClientB" value="'+clientBString+'">');
		document.write('<input type="hidden" name="ClientBa" value="'+clientBaString+'">');
		document.write('<input type="hidden" name="Warenwert" value="'+parent.vars.ges_warenwert+'">');
		document.write('<input type="hidden" name="MwSt" value="'+parent.vars.ges_mwst+'">');
		document.write('<input type="hidden" name="Versand" value="'+parent.vars.gVersandPreis+'">');
		document.write('<input type="hidden" name="Zahlung" value="'+parent.vars.gZahlPreis+'">');
		if (parent.vars.gCP.length>0) document.write('<input type="hidden" name="GutscheinWert" value="'+parent.vars.gCP[0][0]+'">');
		if (parent.vars.gCP.length>0) document.write('<input type="hidden" name="Gutschein" value="'+parent.vars.gCP[0][1]+'">');
		document.write('<input type="hidden" name="Gesamt" value="'+parent.vars.gGesamtPreis+'">');

		document.write('<input type="hidden" name="Warenwert_cur" value="'+printPreis(parent.vars.ges_warenwert)+'">');
		document.write('<input type="hidden" name="MwSt_cur" value="'+printPreis(parent.vars.ges_mwst)+'">');
		document.write('<input type="hidden" name="Versand_cur" value="'+printPreis(parent.vars.gVersandPreis)+'">');
		document.write('<input type="hidden" name="Zahlung_cur" value="'+printPreis(parent.vars.gZahlPreis)+'">');
		document.write('<input type="hidden" name="Gesamt_cur" value="'+printPreis(parent.vars.gGesamtPreis)+'">');

		document.write('<input type="hidden" name="ClientRegion" value="'+parent.vars.clientRegionString+'">');
		document.write('<input type="hidden" name="ClientVersandart" value="'+parent.vars.clientVersandartString+'">');
		document.write('<input type="hidden" name="ClientZahloption" value="'+parent.vars.clientZahloptionString+'">');

		document.write('<input type=hidden name="ShopKind" value="'+parent.vars.gShopkind+'">');
		document.write('<input type=hidden name="ShopID" value="'+parent.vars.PaySystem[5]+'">');
		document.write('<input type=hidden name="BasketID" value="'+basketID+'">');
		document.write('<input type="hidden" name="Currency" value="'+ parent.vars.curr +'">');
		document.write('<input type="hidden" name="ProductIndex" value="'+Pos+'">');
		document.write('<input type="hidden" name="RootUrl" value="'+parent.vars.rooturl+'">');
		document.write('<input type=hidden name="ShopID2" value="'+parent.vars.PaySystem[4]+'">');
		document.write('<input type=hidden name="ShopID3" value="'+parent.vars.PaySystem[5]+'">');
		document.write('<input type=hidden name="ShopID4" value="'+parent.vars.PaySystem[6]+'">');
		document.write('<input type=hidden name="ShopID5" value="'+parent.vars.PaySystem[7]+'">');

		document.write('<input type=hidden name="to_email" value="'+parent.vars.to_email+'">');
		document.write('<input type=hidden name="from_email_name" value="'+parent.vars.from_email_name+'">');
		document.write('<input type=hidden name="from_email_address" value="'+parent.vars.from_email_address+'">');
	
	}
}

function displayCoupon(version){
	if (parent.vars.ges_coupon==0){
		if (version==1){
			parent.vars.showCoupon=0;
			document.write('<table><tr><td colspan="3">');
			document.write(parent.I18N["COU_TXT"]);
			document.write('</td></tr>');
			document.write('<tr><td>'+parent.I18N["COU_REF"]+'</td>');
			document.write('<td><input type="text" name="RefNr" value=""> </td></tr>');
			document.write('<tr><td>'+parent.I18N["COU_WERT"]+'</td>');
			document.write('<td><input type="text" name="CouponVal" value=""> </td>');
			document.write('<td></tr><tr><td></td><td><input type="button" name="btnCoupon" value="Übernehmen" onClick="javascript:checkCoupon(document.shopwako.RefNr.value,document.shopwako.CouponVal.value)"> </td></tr>');
			document.write('</table>');
		} else {
			if (gCoupon.length>0){
				document.write('<table><tr><td colspan="3">');
				document.write(parent.I18N["COU_OPT"]);
				document.write('</td>');
				document.write('</table>');
			} 
		}
	}
}

function display_Coupon(){
	if (parent.vars.ges_coupon!=0){
		document.write('<tr class="sumitems">');
		document.write('<td align="right" colspan="5">'+parent.I18N["COUPON"]+'</td>');
		document.write('<td align="right">'+printPreis(eval(parent.vars.ges_coupon))+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}

function display_Versand(){
  
  if (eval(parent.vars.ges_versand)!=0 || eval(parent.vars.gVersandPreis)!=0){
		document.write('<tr class="sumitems">');
		document.write('<td align="right" colspan="5">'+parent.I18N["WK_VERSOPT"]+'</td>');
		document.write('<td align="right">'+printPreis(eval(parent.vars.gVersandPreis)+eval(parent.vars.ges_versand))+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}

function display_Zahlung(){
	if (eval(parent.vars.gZahlPreis)!=0){
		//Zahlungskosten
		document.write('<tr>');
		document.write('<td align="right" colspan="5">'+parent.I18N["WK_ZAHLOPT"]+'</td>');
		document.write('<td align="right">' + printPreis(parent.vars.gZahlPreis)+'</td>');
		document.write('<td>&nbsp;</td></tr>');

	}
}

function display_Versicherung(){
	
	if (parent.vars.Versicherung){
		//Versicherung
		document.write('<tr>');
		document.write('<td align="right" colspan="5">'+parent.I18N["VERS_BEZ"]+'</td>');
		document.write('<td align="right">' + printPreis(parent.vars.gVersicherungPreis)+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}

function display_MwStDetail(){
	// Auflistung der Mehrwertsteuern nach dem Mehrwertsteuersatz

	if (parent.vars.MwStKind=="det"){
		for (var k=0; k < y_mwst.length; k++){
			if (p_mwst[y_mwst[k]]) {
				document.write('<tr class="summwst">');
				document.write('<td align="right" colspan="5">'+parent.I18N["WK_SUMMWST"]+' '+y_mwst[k]+' %</td>');
				document.write('<td align="right">'+printPreis(p_mwst[y_mwst[k]])+'</td>');
				document.write('<td>&nbsp;</td></tr>');
			}
		}
	}
}

function display_MwStSumme(){
	if (parent.vars.MwStKind=="sum"){
		// Im Bruttoshop wird die MwST nicht nach %-Sätzen ausgewiesen.
		document.write('<tr class="summwst">');
		document.write('<td align="right" colspan="5">'+parent.I18N["WK_SUMMWST_IN"]+'</td>');
		document.write('<td align="right">'+printPreis(parent.vars.ges_mwst)+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}

function display_Gesamtsumme(){
	document.write('<tr><td height="20" colspan="5"></tr>');

	//Brutto
	//Gesamt
	document.write('<tr class="sumitems">');
	document.write('<td align="right" colspan="5">'+parent.I18N["WK_SUMTOT"]+'</td>');
	document.write('<td align="right">'+printPreis(parent.vars.gGesamtPreis)+'</td>');
	document.write('<td>&nbsp;</td></tr>');

}

function display_Warenwert(){
	if (parent.vars.gShopkind=="b"){
		document.write('<tr class="sumitems">');
		document.write('<td align="right" colspan="5">'+parent.I18N['WK_WARENWERT']+'</td>');
		document.write('<td align="right">'+printPreis(parent.vars.ges_warenwert)+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}

function display_Nettowert(){
	if (parent.vars.gShopkind=="n"){
		document.write('<tr class="sumitems">');
		document.write('<td align="right" colspan="5">'+parent.I18N['WK_WARENWERT_NETTO']+'</td>');
		document.write('<td align="right">'+printPreis(parent.vars.ges_warenwert)+'</td>');
		document.write('<td>&nbsp;</td></tr>');
	}
}
