

/* SmartLog-Version: 4.0.0 M */

var s_glo_OldPrice = "Alter Preis:";
var s_glo_NewPrice = "Ihr Preis:";
var s_glo_YourSaving = "Sie sparen:";

function LISort1(a, b){
	var x = a[iLI2sort1];
	var y = b[iLI2sort1];
	var t1 = parseFloat(x);
	var t2 = parseFloat(y);
	return(t1 > t2 ? 1 :	t1 < t2 ? -1 : x > y ? 1 : x < y ? -1 :	0);
};
var iLI2sort1 = 0;
function LIsortAry1(aA,iField,iR){
	iLI2sort1 = iField;
	aA = aA.sort(LISort1);
	if(iR == 1) aA = aA.reverse();
	return(aA);
};

cSMBasket.prototype.LIreset=function(){
	var $g=this,$t=arguments,$1c=$g.base,$1k=$g.xml,$2n=($t[0])?$t[0]:false;
	if($2n){
		while($1k.selectNodes(_SMPrd).length()>0){
			$1k.removeChild($1k.selectSingleNode(_SMPrd));
		};
	};
};

function initLogin(){
	var sReturn = 'OK';
	var sTest_LI = '';
	sTest_LI = SMShop.getAttribute("UserLogin");
	if((sTest_LI.length==0) || (sTest_LI=="false")){
		SMShop.setAttribute("UserLogin", "false");
		SMShop.update();
		return('NO_USER');
	};
	sTest_LI = '';
	sTest_LI = SMShop.getAttribute("UserDiscount");
	if((sTest_LI.length==0) || (sTest_LI=="false")){
		SMShop.setAttribute("UserDiscount", "false");
		SMShop.update();
		return('NO_DISC');
	};
	return(sReturn);
};

function LogMeInData(sData){
	SMShop.setAttribute("UserLogin", sData);
	SMShop.update();
};

function UserLogout(){
	var sPathLogout = SMShop.getAttribute("LIuserLogoutPath");
	SMShop.basket.LIreset(true);
	SMShop.basket.update();
	SMShop.setAttribute("UserLogin", "false");
	SMShop.setAttribute("UserDiscount", "false");
	SMShop.update();
	removeLoginDiscounts();
	SMProduct = null;
	SMProductLI = null;
	SMSession.removeSession(SMShop.id);
	SMSession.save();

	var http_sl_request = false;
	http_sl_request = false;
	if(window.XMLHttpRequest){
		http_sl_request = new XMLHttpRequest();
		if(http_sl_request.overrideMimeType){
			http_sl_request.overrideMimeType("text/xml");
		};
	} else if(window.ActiveXObject){
		try {
			http_sl_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) { };
	} else try {
		http_sl_request = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) { };
	if (!http_sl_request) {
		//alert("Kann keine XMLHTTP-Instanz erzeugen");
	} else {;
		try{
			var url = "./modules/login/php/logout.php5";
			http_sl_request.open("GET",sPathLogout,true);
			http_sl_request.send(null);	
		} catch(e) { };
	};
	var oElem = document.getElementsByName("smartLog")[0];
	if(!oElem) var oElem = document.getElementById("smartLog");
	if(oElem){
		oElem.src = sPathLogout;
	} else if(arguments.length > 0){
		var sHTML = '<iframe name="FrmSmartLogInfoLogout" id="FrmSmartLogInfoLogout" src="' + arguments[0] + '" scrolling="no" frameborder="0" width="1" height="1"></iframe>';
		document.getElementById("smartLogInfoLogout").innerHTML = sHTML;
	} else {
		location.href = location.href;
	};
};

SMShop.base.addMember("osetIframeDimensions");
function osetIframeDimensions_windowOnLoad(args){
	setIframeDimensions(false,false,false,1);
};

function setIframeDimensions(n,iAddWidth,iAddHeight,iEvent){
	if(n) SMShop.setAttribute("LI_iframeDim_n",n);
	if(iAddWidth) SMShop.setAttribute("LI_iframeDim_W",iAddWidth);
	if(iAddHeight) SMShop.setAttribute("LI_iframeDim_H",iAddHeight);
	if(! n) n = SMShop.getAttribute("LI_iframeDim_n");
	if(! iAddWidth) iAddWidth = SMShop.getAttribute("LI_iframeDim_W");
	if(! iAddHeight) iAddHeight = SMShop.getAttribute("LI_iframeDim_H");
	var d = 15;
 	if(iAddHeight>0) d = iAddHeight;
 	try {
	  var ifObj = document.getElementsByName(n)[0];
  	if(!ifObj) var ifObj = document.getElementById(n);
	  if(!ifObj) return(false);
  	var p = (document.all)?'scroll':'offset';
		if(iAddWidth > 0){
			ifObj.style.width = String(iAddWidth) + "px";
		} else {
			eval("ifObj.style.height=Math.max(1,window.frames[n].document.getElementsByTagName('body')[0]."+p+"Width+"+d+")+'px'");
		};
 		eval("ifObj.style.height=Math.max(1,window.frames[n].document.getElementsByTagName('body')[0]."+p+"Height+"+d+")+'px'");
	 	return(true);
	} catch(e) { };
};

function LIExtractField(sChain, sPosit){
	var aChain = sChain.split("_;_");
	for(var i=0; i<aChain.length; i++){
		var aField = aChain[i].split("_=_");
		if(aField[0] == sPosit){return(aField[1]);};
	};
	return('');
};

function getUserName(){
	sLoginData = SMShop.getAttribute("UserLogin");
	return(LIExtractField(sLoginData, 'USERNAME'));
};

function LIUserIsIn(){
	sLoginData = SMShop.getAttribute("UserLogin");
	var sLI_Name = LIExtractField(sLoginData, 'BILLTO_LASTNAME');
	var sLI_Firstname = LIExtractField(sLoginData, 'BILLTO_FIRSTNAME');
	var sLI_Company = LIExtractField(sLoginData, 'BILLTO_COMPANY');
	var sLI_Salutation = LIExtractField(sLoginData, 'BILLTO_SALUTATION');
	var sLI_Prompt = '';
	var sLI_Result = '';
	if(sLI_Company.length>0) sLI_Prompt = sLI_Company;
	if(sLI_Name.length>0 && sLI_Firstname.length>0) sLI_Prompt = sLI_Firstname + ' ' + sLI_Name;
	if(sLI_Name.length>0 && sLI_Firstname.length==0 && sLI_Salutation.length>0) sLI_Prompt = sLI_Salutation + ' ' + sLI_Name;
	sLI_Result += 'Guten Tag_NAME_!<BR>Willkommen in unserem Shop!';
	if(sLI_Prompt.length>0){
		var userNameString = ' ' + sLI_Prompt;
	} else {
		var userNameString = sLI_Prompt;
	};
	sLI_Result = sLI_Result.replace(/_NAME_/,userNameString);
	document.write(sLI_Result);
	return(LIExtractField(sLoginData, 'USERNAME'));
};

function printLoginButtons(sURL2){
	var sHTMLf = '';
	sHTMLf += '<div id="divUserLogButtons" align="center"><button class="LIbutLogout" name="but" type="button" value="" onclick="UserLogout()">';
	sHTMLf += '<img src="' + sURL2 + '" alt="abmelden">';
	sHTMLf += '<br>abmelden';
	sHTMLf += '</button></div>';
	document.write(sHTMLf);
};

function printLoginButtonsAdmin(sURL2){
	var sHTMLf = '';
	sHTMLf += '<div style="padding-top:10px" align="center">&nbsp;</div>';
	sHTMLf += '<div id="divUserLogButtonsAdmin" align="center">';
	sHTMLf += '<button class="LIbutLogout" type="button" onclick="UserLogout()"><img src="' + sURL2 + '" alt="abmelden">';
	sHTMLf += '<br>abmelden</button>';
	sHTMLf += '</div>';
	sHTMLf += '<div style="padding-bottom:10px" align="center">&nbsp;</div>';
	sHTMLf += '<div id="2ndLogoutButton" style="z-index:99999999; position:absolute; right:15px; top:20px; width:60px; height:60px" align="center">';
	sHTMLf += '<button class="LIbutLogout" type="button" onclick="UserLogout()"><img src="' + sURL2 + '" alt="abmelden"></button>';
	sHTMLf += '</div>';
	return(sHTMLf);
};

function RemoveSpecialSigns(sText){
	if(sText == null) return("");
	if(sText.length == 0) return("");
	sText = sText.replace(/"/g, '');
	sText = sText.replace(/'/g, '');
	sText = sText.replace(/&/g, '');
	sText = sText.replace(/§/g, '');
	sText = sText.replace(/\\/g, '');
	sText = sText.replace(/²/g, '');
	sText = sText.replace(/³/g, '');
	sText = sText.replace(/\|/g, '');
	sText = sText.replace(/°/g, '');
	return(sText);
};

function LIFindHeight(){
	var y;
	if (self.innerHeight){
		y = self.innerHeight;
	}	else if (document.documentElement && document.documentElement.clientHeight){
		y = document.documentElement.clientHeight;
	} else if (document.body){
		y = document.body.clientHeight;
	};
	return(y);
};

function LIFindWidth(){
	var x;
	if (self.innerHeight){
		x = self.innerWidth;
	}	else if (document.documentElement && document.documentElement.clientHeight){
		x = document.documentElement.clientWidth;
	} else if (document.body){
		x = document.body.clientWidth;
	};
	return(x);
};

function ReloadLoginWindow(){
	location.href = location.href;	
};

function ShowAdminFrame(sURL){
	var oFrame = document.getElementsByTagName("body")[0];
	oFrame.style.overflow = "hidden";

	var oFrame = document.getElementById("SmartLogBackgroundFrame");
	var iScreenX = LIFindWidth();
	var iScreenY = LIFindHeight();
	oFrame.style.zIndex = "99999997";
	oFrame.style.position = "absolute";
	oFrame.style.left = "0px";
	oFrame.style.top = "0px";
	oFrame.style.width = String(iScreenX)+"px";
	oFrame.style.height = String(iScreenY)+"px";
	oFrame.style.backgroundImage = "url('" + sURL + "')";
	oFrame.style.backgroundRepeat = "repeat";
	oFrame.style.overflow = "hidden";

	var oFrame = document.getElementById("SmartLogAdminFrame");
	var iScreenX = LIFindWidth();
	var iScreenY = LIFindHeight();
	oFrame.style.zIndex = "99999998";
	oFrame.style.position = "absolute";
	oFrame.style.left = "0px";
	oFrame.style.top = "0px";
	oFrame.style.width = String(iScreenX)+"px";
	oFrame.style.height = String(iScreenY)+"px";
	oFrame.style.overflow = "scroll";
};

// ** M ->

function bInGross(){
	var bTest = (SMShop.getAttribute(_SMAInGross)=="1")?true:false;
	return(bTest);
};
function bOutGross(){
	var bTest = (SMShop.getAttribute(_SMAOutGross)=="1")?true:false;
	return(bTest);
};
function getVAT(){
	var aRegion = SMShop.getActiveRegion();
	var $g = arguments[0];
	var iRegSet = parseInt($g.getAttribute(_SMARegion), 10);
	var iActTax = parseFloat(aRegion[iRegSet + 2]) / 100;
	return(iActTax);
};

cSMGDiscounts.prototype.addForLogin = function(id,$2C,$2D,$x,$2E){
	var $g=this,$1c=$g.base,$1k=$g.xml,$2F="",$2G="",$2H="",$2y="",$2I="",$2J="";
	if($1c.raiseEvent(7,true,true,$g,$2C,$x,$2E)){
		$2F=$1k.getAttribute(_SMAUniqueID);
		$2G=$1k.getAttribute(_SMAAmount);
		$2H=$1k.getAttribute(_SMAMode);
		$2y=$1k.getAttribute(_SMAValue);
		$2I=$1k.getAttribute(_SMATextBuffer);
		$2J=$1k.text;
		if(SMShop.getAttribute("finit")=="1"){
			$2F+=(($2F.length>0)?";":"")+id;
			$2G+=(($2G.length>0)?";":"")+fnSMRndCur($2C);
			$2H+=(($2H.length>0)?";":"")+$2D;
			$2y+=(($2y.length>0)?";":"")+fnSMRndCur($x);
			$2I+=(($2I.length>0)?";":"")+$2E.length;
			$2J+=$2E;
		};
		$1k.setAttribute(_SMAUniqueID,$2F);
		$1k.setAttribute(_SMAAmount,$2G);
		$1k.setAttribute(_SMAMode,$2H);
		$1k.setAttribute(_SMAValue,$2y);
		$1k.setAttribute(_SMATextBuffer,$2I);
		$1k.text=$2J;
		$1c.raiseEvent(8,false,null,$g,$2C,$x,$2E);
	}else $1c.raiseEvent(10,false,null,$g,$2C,$x,$2E);
};

cSMGDiscounts.prototype.remove = function(id,$2C,$2D,$x,$2E){
	var $g=this,$1c=$g.base,$1k=$g.xml,$2F="",$2G="",$2H="",$2y="",$2I="",$2J="";
	$g.init();
	return(true);
	if($1c.raiseEvent(7,true,true,$g,$2C,$x,$2E)){
		$2F = id;
		$2G = fnSMRndCur($2C);
		$2H = $2D;
		$2y = fnSMRndCur($x);
		$2I = $2E.length;
		$2J = $2E;
		$1k.setAttribute(_SMAUniqueID,$2F);
		$1k.setAttribute(_SMAAmount,$2G);
		$1k.setAttribute(_SMAMode,$2H);
		$1k.setAttribute(_SMAValue,$2y);
		$1k.setAttribute(_SMATextBuffer,$2I);
		$1k.text=$2J;
		$1c.raiseEvent(8,false,null,$g,$2C,$x,$2E);
	}else $1c.raiseEvent(10,false,null,$g,$2C,$x,$2E);
};

function LogMeInDiscount(sData){
	SMShop.setAttribute("UserDiscount", sData);
	SMShop.update();
};

function LogMeInDiscountText(sData){
	SMShop.setAttribute("UserDiscountText", sData);
	SMShop.update();
};

function getUserDiscountText(sType){
	var sData = SMShop.getAttribute("UserDiscountText");
	var oData = sData.split("_X_");
	if(sType=="text") return(oData[0]);
	if(sType=="bool") return((oData[1]=="true" || oData[1]==true)?true:false);
	return("");
};

function LIsetGlobalDiscounts(){
	removeLoginDiscounts();
	var sData = SMShop.getAttribute("UserDiscount");
	var iCnt = 0;
	if((sData.length==0) || (sData=="false")){return(false);};
	var aDiscounts = sData.split("_;_");
	SMShop.setAttribute("finit", "1");
	SMShop.update();
	for(var i=0; i<aDiscounts.length; i++){
		var aFields = aDiscounts[i].split("|");
		if(aFields[0].length == 0){
			if(aFields[2] == 0 && aFields[4] != 0) aFields[2] = 0.01;
			if(aFields[2] != 0 && aFields[4] != 0){
				if(bInGross() != bOutGross()){
					var iTax = aDefaultVAT[0];
					if(!bInGross()){
						aFields[4] = aFields[4] * (1 + iTax);
					} else {
						aFields[4] = aFields[4] / (1 + iTax);
					};
				};
				with(SMShop.basket.discounts){addForLogin(aFields[1], aFields[2], (aFields[3] - 1), aFields[4], aFields[5]);};
				SMShop.basket.discounts.update();
				SMShop.basket.update();
				SMShop.update();
			};
		};
	};
	SMShop.setAttribute("finit", "0");
	SMShop.update();
};

function removeLoginDiscounts(){
	SMShop.basket.discounts.remove(0,0,0,0,"Sie erhalten keine Rabatte.");
	SMShop.basket.discounts.update();
	SMShop.basket.update();
	SMShop.update();
};

var aVAT = SMShop.regions;
var aDefaultVAT = new Array();
for(i=0; i<aVAT.length; i++){
	if(aVAT[i][7] == "true" || aVAT[i][7] == true){
		for(var j=0; j<aVAT[i].length; j++){
			aDefaultVAT[j] = parseFloat(aVAT[i][3+j]) / 100;
			break;
		};
	};
};

function frmSumPrcDetail(){
	var aObj = new Array();
	for(var i=0; i < arguments[0].length; i++){
		aObj[i] = arguments[0][i];
	};
	var sTyp = arguments[1];
	if(sTyp.indexOf('stff') > 0){
		if(String(aObj[3]) == "1"){
			aObj[4] = cprimary.format(parseFloat(aObj[4]), SM_CGROUP + SM_CSYMBOL);
			aObj[4] = aObj[4].replace("&nbsp;", " ");
		} else if(String(aObj[3]) == "2"){
			aObj[4] = cprimary.format(parseFloat(aObj[4])) + "%";
		} else if(parseInt(aObj[3],10) >= 4 && parseInt(aObj[3],10) <= 7){
			aObj[4] = cprimary.format(parseFloat(aObj[4])) + "% (Stufe " + String(parseInt(aObj[3],10) - 3) + ")";
		};
		switch (String(aObj[3])) {
			case "0":
				aObj[3] = "Sonderpreis";
				if(bInGross() != bOutGross()){
					var iTax = aDefaultVAT[0];
					if(!bInGross()){
						aObj[4] = aObj[4] * (1 + iTax);
					} else {
						aObj[4] = aObj[4] / (1 + iTax);
					};
				};
				aObj[4] = cprimary.format(parseFloat(aObj[4]), SM_CGROUP + SM_CSYMBOL);
				aObj[4] = aObj[4].replace("&nbsp;", " ") + '<sup class="LIDiscTabSup"> (1)</sup>';
				break;
			case "1":
				aObj[3] = "Prozent";
				aObj[4] = cprimary.format(parseFloat(aObj[4])) + '% <sup class="LIDiscTabSup"> (2)</sup>';
				break;
			case "2":
				aObj[3] = "+x kostenlos";
				aObj[4] = cprimary.format(parseFloat(aObj[4])) + ' VE <sup class="LIDiscTabSup"> (3)</sup>';
				break;
			case "3":
				aObj[3] = "Fix-Betrag";
				if(bInGross() != bOutGross()){
					var iTax = aDefaultVAT[0];
					if(!bInGross()){
						aObj[4] = aObj[4] * (1 + iTax);
					} else {
						aObj[4] = aObj[4] / (1 + iTax);
					};
				};
				aObj[4] = cprimary.format(parseFloat(aObj[4]), SM_CGROUP + SM_CSYMBOL);
				aObj[4] = aObj[4].replace("&nbsp;", " ") + '<sup class="LIDiscTabSup"> (4)</sup>';
				break;
			default:
				// nothing;
				break;
		};
		if(aObj[5].length == 0){
			aObj[5] = "&nbsp;";
		};
	} else {
		aObj[2] = cprimary.format(parseFloat(aObj[2]), SM_CGROUP + SM_CSYMBOL);
		aObj[2] = aObj[2].replace("&nbsp;", " ");
		if(String(aObj[3]) == "1"){
			if(bInGross() != bOutGross()){
				var iTax = aDefaultVAT[0];
				if(!bInGross()){
					aObj[4] = aObj[4] * (1 + iTax);
				} else {
					aObj[4] = aObj[4] / (1 + iTax);
				};
			};
			aObj[4] = cprimary.format(parseFloat(aObj[4]), SM_CGROUP + SM_CSYMBOL);
			aObj[4] = aObj[4].replace("&nbsp;", " ");
		} else if(String(aObj[3]) == "2"){
			aObj[4] = cprimary.format(parseFloat(aObj[4])) + "%";
		} else if(parseInt(aObj[3],10) >= 4 && parseInt(aObj[3],10) <= 7){
			aObj[4] = cprimary.format(parseFloat(aObj[4])) + "% (Stufe " + String(parseInt(aObj[3],10) - 3) + ")";
		};
		switch (String(aObj[3])) {
			case "1":
				aObj[3] = "Fester Rabattbetrag";break;
			case "2":
				aObj[3] = "Prozent";break;
			case "4":
				aObj[3] = "Prozent-Stufe 1";break;
			case "5":
				aObj[3] = "Prozent-Stufe 2";break;
			case "6":
				aObj[3] = "Prozent-Stufe 3";break;
			case "7":
				aObj[3] = "Prozent-Stufe 4";break;
			default:
				// nothing;
				break;
		};
		if(aObj[5].length == 0){
			aObj[5] = "&nbsp;";
		};
	};
	return(aObj);
};

function printLoginDiscountsDetail(sLink){
	var sHTMLh = sHTMLb = sHTMLf = '';
	sHTMLh += '<br>&nbsp;<br>';
	sHTMLh += '<div align="center">';
	sHTMLb += 'Sie erhalten keine Rabatte. Wenn Sie an einer persönlichen Rabatt-Staffelung interessiert sind, _START_LINK_setzen Sie sich bitte mit uns in Verbindung_END_LINK_.';
	sHTMLb = sHTMLb.replace(/_START_LINK_/,'<a href="' + sLink + '">');
	sHTMLb = sHTMLb.replace(/_END_LINK_/,'</a>');
	sHTMLf += '</div>';
	sHTMLf += '<span id="LoginInlineFrame">&nbsp;</span>';
	var sData = '';
	if(getUserDiscountText("text").length>0){
		document.write('<br>&nbsp;<br>' + getUserDiscountText("text") + '<br>&nbsp;');
	};
	if(oLIDisc['length'] == 0){
		if(getUserDiscountText("bool")){
			document.write(sHTMLh + sHTMLb + sHTMLf);
		};
		return(false);
	};
	if(!getUserDiscountText("bool")){
		document.write(sHTMLh + sHTMLf);
		return(false);
	};

	sHTMLb = '<div style="padding:20px" align="center">';
	sHTMLb += 'Sie erhalten folgende Rabatte:<br>&nbsp;<br>';
	sHTMLb += '<table class="LIDiscTab" cellspacing="0">';
	var sHTMLhVAT = '';
			sHTMLhVAT += '<div class="LIDiscTabStffDiscDesc" align="center">';
			sHTMLhVAT += (bOutGross()) ? "inkl. MwSt" : "zzgl. MwSt";
			sHTMLhVAT += '</div>';
	var sHTMLh2 = '';
			sHTMLh2 += '<tr>';
			sHTMLh2 += '<td class="LIDiscTabHeadL">Beschreibung</td>';
			sHTMLh2 += '<td class="LIDiscTabHeadM" align="center">Rabatt-Art</td>';
			sHTMLh2 += '<td class="LIDiscTabHeadR" align="center">Rabatt' + sHTMLhVAT + '</td>';
			sHTMLh2 += '</tr>';
	var sHTMLhStD = '';
			sHTMLhStD += '<div class="LIDiscTabStffDiscDesc" align="left">';
			sHTMLhStD += '1: Sonderpreis<br>';
			sHTMLhStD += '2: Prozent<br>';
			sHTMLhStD += '3: +x kostenlos<br>';
			sHTMLhStD += '4: Fix-Betrag';
			sHTMLhStD += '</div>';
	var sHTMLb2 = '';
			sHTMLb2 += '<tr>';
  	  sHTMLb2 += '	<td class="LIDiscTabBody2" colspan="3"></td>';
    	sHTMLb2 += '</tr>';
	var sCont;
	for(oObj in oLIDisc){
		switch (oObj) {
      case "global":
	 	    sHTMLb += '<tr>';
     	  sHTMLb += '<td class="LIDiscTabBody3" style="color:#FFFFFF" align="center" colspan="3">Globalrabatte</td>';
      	sHTMLb += '</tr>';
      	sHTMLb += sHTMLh2;
        for(var i=0; i<oLIDisc[oObj].length; i++){
        	if(i==0){
        	};
        	sCont = frmSumPrcDetail(oLIDisc[oObj][i][0],oObj);
        	sHTMLb += '<tr>';
        	sHTMLb += '<td class="LIDiscTabBodyL">';
					if(sCont[5] != "&nbsp;") sHTMLb += '"' + sCont[5] + '"<br>';
					sHTMLb += 'auf den gesamten Warenkorb ab ' + sCont[2];
        	sHTMLb += '</td>';
					sHTMLb += '<td class="LIDiscTabBodyM">' + sCont[3] + '</td>';
					sHTMLb += '<td class="LIDiscTabBodyR" align="right">' + sCont[4] + '</td>';
					sHTMLb += '</tr>';
        };
        sHTMLb += sHTMLb2;
        break;
      case "manufacturer":
	 	    sHTMLb += '<tr>';
    	  sHTMLb += '<td class="LIDiscTabBody3" style="color:#FFFFFF" align="center" colspan="3">Herstellerrabatte</td>';
  	  	sHTMLb += '</tr>';
 	    	sHTMLb += sHTMLh2;
       	for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
          	sCont = frmSumPrcDetail(oLIDisc[oObj][oSubObj][i][0],oObj);
          	sHTMLb += '<tr>';
          	sHTMLb += '<td class="LIDiscTabBodyL">';
          	sHTMLb += 'Artikel des Herstellers<br>"' + sCont[5] + '"';
          	sHTMLb += '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyM">' + sCont[3] + '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyR" align="right">' + sCont[4] + '</td>';
  					sHTMLb += '</tr>';
					};
        };
        sHTMLb += sHTMLb2;
        break;
      case "category":
	 	    sHTMLb += '<tr>';
  	 	  sHTMLb += '<td class="LIDiscTabBody3" style="color:#FFFFFF" align="center" colspan="3">Warengruppenrabatte</td>';
   	  	sHTMLb += '</tr>';
 	     	sHTMLb += sHTMLh2;
       	for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
          	sCont = frmSumPrcDetail(oLIDisc[oObj][oSubObj][i][0],oObj);
          	sHTMLb += '<tr>';
          	sHTMLb += '<td class="LIDiscTabBodyL">';
          	sHTMLb += 'Artikel der Warengruppe<br>"' + sCont[5] + '"';
          	sHTMLb += '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyM">' + sCont[3] + '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyR" align="right">' + sCont[4] + '</td>';
  					sHTMLb += '</tr>';
					};
        };
        sHTMLb += sHTMLb2;
        break;
      case "product":
	 	    sHTMLb += '<tr>';
  	 	  sHTMLb += '<td class="LIDiscTabBody3" style="color:#FFFFFF" align="center" colspan="3">Produktrabatte</td>';
   	  	sHTMLb += '</tr>';
				sHTMLb += sHTMLh2;
       	for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
          	sCont = frmSumPrcDetail(oLIDisc[oObj][oSubObj][i][0],oObj);
          	sHTMLb += '<tr>';
          	sHTMLb += '<td class="LIDiscTabBodyL">';
          	sHTMLb += 'Artikel-Nr. ' + sCont[5];
          	sHTMLb += '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyM">' + sCont[3] + '</td>';
  					sHTMLb += '<td class="LIDiscTabBodyR" align="right">' + sCont[4] + '</td>';
  					sHTMLb += '</tr>';
					};
        };
        sHTMLb += sHTMLb2;
        break;
      default:
        //sHTMLb += '';
        break;
    };
	};
	sHTMLb += '	</table></div>';
	document.write(sHTMLh + sHTMLb + sHTMLf);
	return(true);
};

function frmSumPrcSummary(){
	var aObj = new Array();
	for(var i=0; i < arguments[0].length; i++){
		aObj[i] = arguments[0][i];
	};
	if(arguments[3]){ //Stff-Darstellung
		var sStff = new Array(1,2,50,1);
		aObj[3] = sStff[aObj[3]];
	};
	aObj[2] = cprimary.format(parseFloat(aObj[2]), SM_CGROUP + SM_CSYMBOL);
	aObj[2] = aObj[2].replace("&nbsp;", " ");
	if(String(aObj[3]) == "1"){
		aObj[4] = (arguments[2]) ? cprimary.format(LIconvertN2B(arguments[2],parseFloat(aObj[4])), SM_CGROUP + SM_CSYMBOL) : cprimary.format(LIconvertN2B(false,parseFloat(aObj[4]),aDefaultVAT[0]), SM_CGROUP + SM_CSYMBOL);
		aObj[4] = aObj[4].replace("&nbsp;", " ");
	} else if(String(aObj[3]) == "2"){
		aObj[4] = cprimary.format(parseFloat(aObj[4])) + "%";
	} else if(String(aObj[3]) == "50"){
		aObj[4] = "+ " + cprimary.format(parseFloat(aObj[4])) + " VE kostenlos";
	} else if(parseInt(aObj[3],10) >= 4 && parseInt(aObj[3],10) <= 7){
		aObj[4] = cprimary.format(parseFloat(aObj[4])) + "% (Stufe " + String(parseInt(aObj[3],10) - 3) + ")";
	};
	aObj[5] = aObj[5].replace("&nbsp;", " ");
	if(aObj[5] == " ") aObj[5] = "";
	return(aObj[arguments[1]]);
};

function LIShowSum(sTag,iAct,sURLp,sURLm){
	switch (iAct){
		case 1:
			document.getElementById(sTag).style.display = "inline";
			document.getElementById(sTag).style.visibility = "visible";
			document.getElementById('a' + sTag).src = sURLm;
			eval("document.getElementById('a" + sTag + "').onclick = function(){LIShowSum('" + sTag + "',0,'" + sURLp + "','" + sURLm + "');};");
			break;
		case 0:
			document.getElementById(sTag).style.display = "none";
			document.getElementById(sTag).style.visibility = "hidden";
			document.getElementById('a' + sTag).src = sURLp;
			eval("document.getElementById('a" + sTag + "').onclick = function(){LIShowSum('" + sTag + "',1,'" + sURLp + "','" + sURLm + "');};");
			break;
		default:
			break;
	};
};

function printLoginDiscountsSummary(sLink,sURLp,sURLm){
	var sHTMLb = '';
	sHTMLb += '<br>Sie erhalten keine Rabatte. Wenn Sie an einer persönlichen Rabatt-Staffelung interessiert sind, _START_LINK_setzen Sie sich bitte mit uns in Verbindung_END_LINK_.';
	sHTMLb = sHTMLb.replace(/_START_LINK_/,'<a href="' + sLink + '">');
	sHTMLb = sHTMLb.replace(/_END_LINK_/,'</a>');
	var sData = '';
	if(getUserDiscountText("text").length>0){
		document.write('<br>&nbsp;<br>' + getUserDiscountText("text") + '<br>&nbsp;');
	};
	if(oLIDisc['length'] == 0){
		if(getUserDiscountText("bool")){
			document.write(sHTMLb);
		};
		return(false);
	};
	if(!getUserDiscountText("bool")){
		return(false);
	};
	var	sHTMLb = '';
	sHTMLb += '<br>Sie erhalten folgende Rabatte:';
	sHTMLb += '(';
	sHTMLb += (bOutGross()) ? "inkl. MwSt" : "zzgl. MwSt";
	sHTMLb += ')';

	sHTMLb += '<br><br><table class="LIInfoSumHead" border="0" cellspacing="2" cellpadding="0">';
	for(var j=0; j<aLIDisc.length; j++){
		oObj = aLIDisc[j];
		switch (oObj) {
      case "global":
      	if(oLIDisc[oObj]){
      	sHTMLb += '<tr><td><b>Globalrabatte</b></td><td><img id="aLIdivSumGlo" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumGlo\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumGlo" class="LIdivSum"><ul>';
        for(var i=0; i<oLIDisc[oObj].length; i++){
        	sHTMLb += '<li>';
        	sHTMLb += (frmSumPrcSummary(oLIDisc[oObj][i][0],5).length > 0) ? frmSumPrcSummary(oLIDisc[oObj][i][0],5) + ':<br>' : '';
        	sHTMLb += 'ab ' + frmSumPrcSummary(oLIDisc[oObj][i][0],2) + ' Warenwert:<br>' + frmSumPrcSummary(oLIDisc[oObj][i][0],4) + '</li>';
        };
       	sHTMLb += '</ul></div></td></tr>';
       	};
        break;
      case "manufacturer":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Herstellerrabatte</b></td><td><img id="aLIdivSumMan" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumMan\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumMan" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
        		sHTMLb += '<li>Artikel des Herstellers<br>"' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],5) + '":<br>' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],4) + '</li>';
        	};
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      case "category":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Warengruppenrabatte</b></td><td><img id="aLIdivSumCat" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumCat\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumCat" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
        		sHTMLb += '<li>Artikel der Warengruppe<br>"' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],5) + '":<br>' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],4) + '</li>';
        	};
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      case "product":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Produktrabatte</b></td><td><img id="aLIdivSumPro" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumPro\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumPro" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
        		sHTMLb += '<li>Artikel-Nr. ' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],5) + ':<br>' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],4) + '</li>';
        	};
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      case "product-new-price":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Individualpreise</b></td><td><img id="aLIdivSumProNP" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumProNP\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumProNP" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
		       	sHTMLb += '<li>Ihr Preis für Artikel-Nr.<br>' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],5) + ': ' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][0][0],4) + '</li>';
		       };
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      case "product-price-sug":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Preisvorschläge</b></td><td><img id="aLIdivSumProPS" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumProPS\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumProPS" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
       		for(var i=0; i<oLIDisc[oObj][oSubObj].length; i++){
       			sHTMLb += '<li>Artikel-Nr.: ' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][i][0],5) + '</li>';
       		};
        };
        sHTMLb += '</ul></div></td></tr>';
      	};
        break;
      case "product-stff":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Produktstaffeln</b></td><td><img id="aLIdivSumProSt" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumProSt\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumProSt" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
     			sHTMLb += '<li>Artikel-Nr. ' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][0][0],5) + '</li>';
        };
        sHTMLb += '</ul></div></td></tr>';
      	};
        break;
      case "category-stff":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Warengruppenstaffeln</b></td><td><img id="aLIdivSumCatSt" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumCatSt\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumCatSt" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
     			sHTMLb += '<li>Artikel der Warengruppe<br>"' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][0][0],5) + '"</li>';
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      case "manufacturer-stff":
        if(oLIDisc[oObj]){
        sHTMLb += '<tr><td><b>Herstellerstaffeln</b></td><td><img id="aLIdivSumManSt" src="' + sURLp + '" onclick="LIShowSum(\'LIdivSumManSt\',1,\'' + sURLp + '\',\'' + sURLm + '\')" width="15" height="15"></td></tr>';
      	sHTMLb += '<tr><td colspan="2"><div id="LIdivSumManSt" class="LIdivSum"><ul>';
        for(oSubObj in oLIDisc[oObj]){
     			sHTMLb += '<li>Artikel des Herstellers<br>"' + frmSumPrcSummary(oLIDisc[oObj][oSubObj][0][0],5) + '"</li>';
        };
        sHTMLb += '</ul></div></td></tr>';
        };
        break;
      default:
        //sHTMLb += '';
        break;
    };
	};
	sHTMLb += '</table>';
	document.write(sHTMLb);
	return(true);
};

// <- M **

var aLIDisc = new Array('global');
if(! oLIDisc) var oLIDisc = new Object();
function init_oLIDisc(){
	var sData = SMShop.getAttribute("UserDiscount");
	if(sData.length==0 || sData=="false" || sData==false){
		oLIDisc['length'] = 0;
		return(false);
	};
	var iCnt = 0;
	var aDiscounts = sData.split("_;_");
	if(aDiscounts[0].length > 0){
  	for(var i=0; i<aDiscounts.length; i++){
  		var aFields = aDiscounts[i].split("|");
  		var aRule = aFields[0].split("==");
  		if(aRule[0].length == 0){
  			aRule[0] = 'global';
  			aRule[1] = '';
  		};
  		if(aRule[0] == 'global'){
  			if(aFields[2] != '' && aFields[4] != ''){
	  			if(! oLIDisc[aRule[0]]) oLIDisc[aRule[0]] = new Array();
	  			oLIDisc[aRule[0]][oLIDisc[aRule[0]].length] = new Array();
	  			oLIDisc[aRule[0]][oLIDisc[aRule[0]].length - 1][0] = aFields;
	  			oLIDisc[aRule[0]][oLIDisc[aRule[0]].length - 1][1] = aRule;
	  			iCnt++;
  			};
  		} else {
  			if(! oLIDisc[aRule[0]]) oLIDisc[aRule[0]] = new Object();
  			if(! oLIDisc[aRule[0]][aRule[1]]) oLIDisc[aRule[0]][aRule[1]] = new Array();
  			oLIDisc[aRule[0]][aRule[1]][oLIDisc[aRule[0]][aRule[1]].length] = new Array();
  			oLIDisc[aRule[0]][aRule[1]][oLIDisc[aRule[0]][aRule[1]].length - 1][0] = aFields;
  			oLIDisc[aRule[0]][aRule[1]][oLIDisc[aRule[0]][aRule[1]].length - 1][1] = aRule;
  			iCnt++;
  		};
  	};
	};
	oLIDisc['length'] = iCnt;
};
if(! oLIDisc['length']) init_oLIDisc();

function LIconvertN2B($g,iP){
	if(bInGross() != bOutGross()){
		var iTax = (arguments[2]) ? arguments[2] : getVAT($g);
		if(!bInGross()){
			iP = iP * (1 + iTax);
		} else {
			iP = iP / (1 + iTax);
		};
	};
	return(iP);
};
function LIconvertB2N($g,iP){
	if(bInGross() != bOutGross()){
		var iTax = (arguments[2]) ? arguments[2] : getVAT($g);
		if(!bInGross()){
			iP = iP / (1 + iTax);
		} else {
			iP = iP * (1 + iTax);
		};
	};
	return(iP);
};

function bInGross(){
	var bTest = (SMShop.getAttribute(_SMAInGross)=="1")?true:false;
	return(bTest);
};
function bOutGross(){
	var bTest = (SMShop.getAttribute(_SMAOutGross)=="1")?true:false;
	return(bTest);
};
function getVAT(){
	var aRegion = SMShop.getActiveRegion();
	var $g = arguments[0];
	var iRegSet = parseInt($g.getAttribute(_SMARegion), 10);
	var iActTax = parseFloat(aRegion[iRegSet + 2]) / 100;
	return(iActTax);
};

// <- L **

