

/* SmartLog-Version: 3.2.4 L */

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 = '';
	try {
		sTest_LI = SMShop.getAttribute("UserLogin");
	} catch(e) { };
	if((sTest_LI.length==0) || (sTest_LI=="false")){
		SMShop.setAttribute("UserLogin", "false")
		SMShop.update();
		return('NO_USER');
	};
	sTest_LI = '';
	try {
		sTest_LI = SMShop.getAttribute("UserDiscount");
	} catch(e) { };
	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.setAttribute("StffDiscount", "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;
	};
};

function setIframeDimensions(n,iAddWidth,iAddHeight){
 	var args = arguments;
 	if(args.length == 1) var n = args[0];
	if(args.length == 2) var iAddWidth = args[1];
	if(args.length == 3) var iAddHeight = args[2];
	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 printLoginToForms(sType,iLfdNr,sContent){
	try {
		if(sContent.length == 0){
			var sLogin = SMShop.getAttribute("UserLogin");
		} else {
			var sLogin = sContent;
		};
	} catch(e) { };
	if((sLogin.length==0) || (sLogin=="false")){
		return(false);
	};
	var aLogin = sLogin.split("_;_");
	var aUserData = new Array;
	for(var i=0; i<aLogin.length; i++){
		var aField = aLogin[i].split("_=_");
		aUserData[i] = new Array();
		aUserData[i][0] = aField[0];
		aUserData[i][1] = aField[1];
	};
	for(var i=0; i<aUserData.length; i++){
		try {
			if(document.getElementsByName(aUserData[i][0]).length > 0){
				if(aUserData[i][0].indexOf("COUNTRY") > 0 && aUserData[i][1].length > 2){
					//document.getElementsByName(aUserData[i][0])[0].value = LIgetRegion(aUserData[i][1]);
				} else if(aUserData[i][0].indexOf("SALUTATION") > 0 && document.getElementsByName(aUserData[i][0]).length > 0){
					var sDDElem = document.getElementsByName(aUserData[i][0])[0];
					for(var j=0; j<sDDElem.length; j++){
						if(sDDElem.options[j].value == aUserData[i][1]){
							sDDElem.options[j].selected = true;
							break;
						};
					};
				} else if(aUserData[i][0].indexOf("CUSTOMERID") > 0 && document.getElementsByName(aUserData[i][0]).length > 0){
					document.getElementsByName(aUserData[i][0])[0].value = aUserData[i][1];
					var sOpenTransCID = aUserData[i][0].replace("CUSTOMERID","CUSTOMER_NUMBER");
					document.getElementsByName(sOpenTransCID)[0].value = aUserData[i][1];
				} else {
					document.getElementsByName(aUserData[i][0])[0].value = aUserData[i][1];
				};
			};
		} catch(e) { };
	};
	var bShipToDiff = false;
	for(var i=0; i<aUserData.length; i++){
		if(aUserData[i][0].indexOf("SHIPTO")>=0 && aUserData[i][1].length>0){
			if(aUserData[i][0].indexOf("COUNTRY")>=0 || aUserData[i][0].indexOf("SALUT")>=0){
				//nothing
			} else {
				bShipToDiff = true;
			};
		};
	};
	if(bShipToDiff){
		if(document.getElementsByName("BILLTO_SHIPTO_DIFFERS").length > 0){
			document.forms.BILLTO.BILLTO_SHIPTO_DIFFERS.checked = true;
		};
	};
	// Contact Form
	if(iLfdNr == 1){
		sLogin = sLogin.replace(/BILLTO/g, "CONTACT");
		var sStreet1 = LIExtractField(sLogin, 'CONTACT_STREET_1');
		var sStreet2 = LIExtractField(sLogin, 'CONTACT_STREET_2');
		sLogin += '_;_CONTACT_STREET_=_';
		sLogin += sStreet1 + ' (' + sStreet2 + ')';
		printLoginToForms("CONTACT", 2, sLogin);
	};
	// Individual Form 1.Step
	if(iLfdNr == 2){
		sLogin = sLogin.replace(/CONTACT/g, "MAILFORM");
		printLoginToForms("MAILFORM", 3, sLogin);
	};
	//  Individual Form 2.Step
	if(iLfdNr == 3){
		var sLI_Name_IMF = LIExtractField(sLogin, 'MAILFORM_LASTNAME');
		var sLI_Firstname_IMF = LIExtractField(sLogin, 'MAILFORM_FIRSTNAME');
		var sLI_Mail_IMF = LIExtractField(sLogin, 'MAILFORM_EMAIL');
		var sLI_NewName_IMF = sLI_Firstname_IMF + ' ' + sLI_Name_IMF;
		sLogin += '_;_FromName_=_' + sLI_NewName_IMF;
		sLogin += '_;_FromMail_=_' + sLI_Mail_IMF;
		printLoginToForms("MAILFORM", 4, sLogin);
	};
};

function printLoginButtons(sURL2){
	var sHTMLf = '';
	sHTMLf += '<div id="divUserLogButtons" align="center">';
	sHTMLf += '<a href="javascript:UserLogout()"><img src="' + sURL2 + '" alt="abmelden"></a>';
	sHTMLf += '<br>abmelden';
	sHTMLf += '</div>';
	document.write(sHTMLf);
};

function printLoginButtonsAdmin(sURL2){
	var sHTMLf = '';
	sHTMLf += '<div style="padding-top:20px" align="center">&nbsp;</div>';
	sHTMLf += '<div id="divUserLogButtonsAdmin" style="width:250px;overflow:show;padding:10px" align="center">';
	sHTMLf += '<a href="javascript:UserLogout()"><img src="' + sURL2 + '" alt="abmelden"></a>';
	sHTMLf += '<br>abmelden';
	sHTMLf += '</div>';
	sHTMLf += '<div style="padding-bottom:20px" 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 += '<a href="javascript:UserLogout()"><img src="' + sURL2 + '" alt="abmelden"></a>';
	sHTMLf += '</div>';

	return(sHTMLf);
};

function RemoveSpecialSigns(sText){
	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";
};

function setLogoutBackground(){  
	var sColor = "";
	try {
		sColor = SMShop.getAttribute("LIbgColor");
	} catch(e) { };
	if(sColor != ""){
		document.getElementById("divUserLogButtonsAdmin").style.backgroundColor = sColor;
	};
};

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);
};

// ** M ->

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="";
	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 setLoginDiscounts(){
	removeLoginDiscounts();
	var sData = SMShop.getAttribute("UserDiscount");
	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;};
			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();
};

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;');
	};
	try {
		sData = SMShop.getAttribute("UserDiscount");
	} catch(e) { };
	if((sData.length==0) || (sData=="false") || (sData==false)){
		try {
			sData = SMShop.getAttribute("StffDiscount");
		} catch(e) { };
		if(sData.length>0){
			//document.write("<br>&nbsp;<br>Sie erhalten auf verschiedene Hersteller, Kategorien oder Produkte gesonderte Rabattstaffeln. Diese werden bei den entsprechenden Produkten angezeigt. Details finden Sie auch auf der Login-Seite.");
			//return(false);
		} else {
			document.write(sHTMLb);
			return(false);
		};
	};
	var aDiscounts = sData.split("_;_");
	if(aDiscounts.length == 1){
		var aFields = aDiscounts[0].split("|");
		if(aFields[4] == 0){
			if(getUserDiscountText("bool")){
				document.write(sHTMLh + sHTMLb + sHTMLf);
			};
			return(false);
		};
	};
	if(!getUserDiscountText("bool")){
		document.write(sHTMLh + sHTMLf);
		return(false);
	};
	sHTMLb = '';
	sHTMLb += 'Sie erhalten folgende Rabatte:<br>&nbsp;<br>';
	sHTMLb += '<table class="LIDiscTab" cellspacing="0">';
	sHTMLb += '	<tr>';
	sHTMLb += '		<td class="LIDiscTabHead" style="color:#CFDFB9">Beschreibung</td>';
	sHTMLb += '		<td class="LIDiscTabHead" style="color:#CFDFB9">Rabatt-Art</td>';
	sHTMLb += '		<td class="LIDiscTabHead" style="color:#CFDFB9">Rabatt</td>';
	sHTMLb += '	</tr>';
	for(var i=0; i<aDiscounts.length; i++){
		var aFields = aDiscounts[i].split("|");
		aFields[2] = cprimary.format(aFields[2], SM_CGROUP + SM_CSYMBOL);
		aFields[2] = aFields[2].replace("&nbsp;", " ");
		if(String(aFields[3]) == "1"){
			aFields[4] = cprimary.format(aFields[4], SM_CGROUP + SM_CSYMBOL);
			aFields[4] = aFields[4].replace("&nbsp;", " ");
		} else if(String(aFields[3]) == "2"){
			aFields[4] = cprimary.format(aFields[4]) + "%";
		/* Tecberlin */
		} else if(parseInt(aFields[3],10) >= 4 && parseInt(aFields[3],10) <= 7){
			aFields[4] = cprimary.format(aFields[4]) + "%";
		/* Tecberlin */
		};
		if(String(aFields[3]) == "1"){
			aFields[3] = "Fester Rabattbetrag";
		} else if(String(aFields[3]) == "2"){
			aFields[3] = "Prozent";
		/* Tecberlin */
		} else if(String(aFields[3]) == "4"){
			aFields[3] = "Prozent-Stufe 1";
		} else if(String(aFields[3]) == "5"){
			aFields[3] = "Prozent-Stufe 2";
		} else if(String(aFields[3]) == "6"){
			aFields[3] = "Prozent-Stufe 3";
		} else if(String(aFields[3]) == "7"){
			aFields[3] = "Prozent-Stufe 4";
		/* Tecberlin */
		};
		if(aFields[5].length == 0){
			aFields[5] = "&nbsp;";
		}
		if(aFields[0].indexOf("product-price-sug") >= 0){
			sHTMLb += '	<tr>';
			sHTMLb += '		<td class="LIDiscTabBody">' + aFields[5] + '</td>';
			sHTMLb += '		<td class="LIDiscTabBody" align="center" colspan="2">verhandeln Sie den Preis</td>';
			sHTMLb += '	</tr>';
		} else if(aFields[0].indexOf("product-new-price") >= 0){
			sHTMLb += '	<tr>';
			sHTMLb += '		<td class="LIDiscTabBody">' + aFields[5] + '</td>';
			sHTMLb += '		<td class="LIDiscTabBody">&nbsp;</td>';
			sHTMLb += '		<td class="LIDiscTabBody" align="right">' + aFields[4] + '</td>';
			sHTMLb += '	</tr>';
		} else {
			sHTMLb += '	<tr>';
			sHTMLb += '		<td class="LIDiscTabBody">';
			if(aFields[0].length == 0){
				sHTMLb += aFields[5];
				if(aFields[5].length > 0) sHTMLb += '<br>';
				sHTMLb += 'auf den gesamten Warenkorb ab ' + aFields[2];
			} else {
				if(aFields[5].length == 0){
					sHTMLb += '&nbsp;';
				} else sHTMLb += aFields[5];
			};
			sHTMLb += '		</td>';
			sHTMLb += '		<td class="LIDiscTabBody">' + aFields[3] + '</td>';
			sHTMLb += '		<td class="LIDiscTabBody" align="right">' + aFields[4] + '</td>';
			sHTMLb += '	</tr>';
		};
	};
	sHTMLb += '	</table>';
	try {
		sData = SMShop.getAttribute("UserDiscount");
	} catch(e) { };
	if((sData.length==0) || (sData=="false") || (sData==false)){
		sHTMLb = 'Sie erhalten folgende Rabatte::<br>&nbsp;<br>';
	};
	document.write(sHTMLh + sHTMLb + sHTMLf);
	sData = SMShop.getAttribute("StffDiscount");
	if(sData.length>0 && sData!="false"){
		var sStffP = getSerializedStff("product");
		var sStffC = getSerializedStff("category");
		var sStffM = getSerializedStff("manufacturer");
		sHTMLb = '';
		sHTMLb += '<div style="padding:20px" align="center"><table class="LIDiscTab" cellspacing="0">';
		sHTMLb += '<tr>';
		if(sStffM!="none") sHTMLb += '<td class="LIDiscTabHead" style="color:#CFDFB9" align="center">Hersteller-Staffeln</td>';
		if(sStffC!="none") sHTMLb += '<td class="LIDiscTabHead" style="color:#CFDFB9" align="center">Kategorie-Staffeln</td>';
		if(sStffP!="none") sHTMLb += '<td class="LIDiscTabHead" style="color:#CFDFB9" align="center">Produkt-Staffeln</td>';
		sHTMLb += '</tr><tr>';
		if(sStffM!="none"){
			var aStffM = sStffM.split(", ");
			sHTMLb += '<td class="LIDiscTabBody">';
			sHTMLb += '<p><UL>';
			for(var i=0; i<aStffM.length; i++){
				sHTMLb += '<LI>' + aStffM[i] + '</LI>';
			};
			sHTMLb += '</UL></p>';
			sHTMLb += '</td>';
		};
		if(sStffC!="none"){
			var aStffC = sStffC.split(", ");
			var sCatList = '1==Frühlingsangebote_;_2==Anspruchsvolle Haut_;_4==Augenpflege_;_5==Duftobjekte_;_7==Gesichtspflege_;_9==kultkosmetik Pinsel_;_11==Loser Puder_;_13==Nagelpflege_;_15==Shampoo_;_16==Empfindliche Haut_;_19==Haarkur_;_20==Hand- und Nagelpflege_;_21==Kompaktpuder_;_24==Körperpflege_;_704==Neu bei Binella_;_25==Nagelhautpflege_;_26==Pinsel und Quasten_;_677==Schnäppchen 30%_;_28==Sonderaktionen_;_30==Handpflege_;_33==Mischhaut_;_34==Multifunktionspflege_;_36==Profi Make-Up_;_38==Wellness  Pflege aus dem Gemüsegarten_;_39==Accessoires_;_40==Duft_;_41==Geschenkideen_;_42==Haarstyling_;_45==Rêve de Miel - Honigtraum Linie_;_46==Trockene Haut_;_47==Accessoires_;_48==Haarpflege_;_49==um/ab 30 (erste Fältchen)_;_50==Profi-Tools_;_51==Reinigen  tonisieren_;_52==Tonific Linie_;_53==Abba_;_55==um/ab 40_;_56==Canadian Dental Cream_;_57==um/ab 50_;_58==Caudalie_;_61==Crazy Libellule_;_62==De Laurier_;_66==Dr. Zenker Cosmetics_;_67==Evian_;_72==Garancia_;_73==Halawa_;_74==Hei Poa_;_76==Fragrances of Ireland_;_77==Institut Très Bien_;_78==Koh_;_81==Les Bains du Marais_;_83==Mathias_;_85==Nuxe_;_87==Odile Lecoin_;_88==Omoyé_;_89==Opalis_;_90==Pangea Organics_;_91==Pure Altitude_;_92==Rubis_;_94==Secrets du Potager_;_95==Shunga Erotic Art_;_96==Smith´s Rosebud_;_97==StriVectin_;_98==T. LeClerc_;_99==Talika_;_100==Voya_;_101==Veld´s_;_102==Vitry_;_103==JadRoll_;_104==Zeno_;_105==Anti-Aging_;_107==Bad  Spa_;_108==Düfte / Parfums_;_109==Gesichtspflege_;_110==Haarpflege_;_112==Haarentfernung_;_113==Körperpflege_;_114==Männerpflege_;_115==Make-Up_;_116==Schönheit von innen/Detox_;_117==Sonnenpflege_;_118==Spa @ home_;_229==Gefärbtes Haar_;_322==Mathias_;_609==Gesichtpflege_;_341==Geschenke bis 100 EUR_;_535==Handwaschgel_;_536==Bade-Essenz_;_633==Fushi by Eva_;_634==Luminaris_;_635==Lilas Blanc_;_509==Pure Altitude Bio Organic_;_195==Trockene Haut_;_196==Reife / anspruchsvolle Haut_;_197==Empfindliche Haut_;_447==Gesichtspflege_;_418==Merveillance Linie_;_419==Nirvanesque Linie_;_545==Sensitive Control_;_227==Feines Haar_;_539==Haarpflege_;_337==Geschenke bis 15 EUR_;_303==Ben Nye_;_131==Parfums_;_225==Trockenes Haar_;_143==Dr. Zenker_;_690==Neu bei Kenmei Do_;_216==Pflege_;_217==Styling_;_647==Körperpflege_;_530==Körperbutter_;_700==Schnäppchen 30%_;_602==After- Sun_;_603==Für das Haar_;_604==UV Schutz_;_605==Selbstbräuner_;_606==Getönte Tagescreme_;_263==Cremes_;_558==Delarom_;_444==Gesichtspflege_;_529==Körperpeeling_;_492==Styling Produkte_;_472==Steffen Schraut_;_474==Extreme Treatment Rot_;_475==Gentle Treatment Silber_;_476==Pure Freshness Blau_;_639==Elisabeth Arden_;_587==Pflanzenwässer_;_397==Düfte / Parfum_;_132==Tee_;_135==Caudalie_;_136==Pure Altitude_;_138==Nuxe_;_140==StriVectin_;_696==Schnäppchen 30%_;_697==SteamCream_;_706==Neu bei Greenlife value_;_198==Mischhaut_;_199==Reinigen und tonisieren_;_200==Caudalie_;_202==Fermes de Marie_;_686==Neu bei Cellosome_;_688==Cellosome_;_665==Körperpflege_;_681==Cellosome_;_682==Gesichtspflege_;_683==Haarpflege_;_721==Cleansing Plus_;_712==Neu bei Koh_;_261==Peeling_;_262==Straffend_;_494==Graues, weißes Haar_;_590==Kultprodukte_;_636==Lilas Blanc_;_640==Beautyblender_;_641==Nuxe_;_642==Binella_;_643==Make Up For Ever_;_644==Teint_;_645==Lippen_;_646==Augen_;_663==Lippen_;_232==Kur_;_485==Feines Haar_;_486==Haarausfall_;_488==Kopfhaut/Haar_;_489==Schuppen_;_396==Gesichtspflege_;_588==Basisöle_;_346==Fudge_;_206==StriVectin_;_207==Talika_;_228==Lockiges Haar_;_446==Fushi by Eva_;_467==IcyBeauty_;_549==Sun Fun_;_572==Cleansing Special_;_573==Cleansing Special_;_574==Cleansing Special_;_575==Cleansing Special_;_576==Cleansing Special_;_577==Bade_;_679==Neu bei Caudalie_;_546==Cell Repair_;_547==Pro Lift_;_171==Hauttypen_;_648==Make Up For Ever_;_660==Neu bei Red Water_;_662==Augen_;_384==Getönte Creme_;_554==Pre Aging_;_555==Anti Aging_;_556==Age Protect_;_410==Étincelante Linie_;_412==Aroma- Vaillance Linie_;_224==Tiefenreiniger_;_443==Fushi by Eva_;_402==Accessoires_;_729==Körperpflege_;_649==Recht-Regulat_;_325==Voya_;_326==Caudalie_;_152==Voya_;_716==Pflege Set_;_717==Medical Beauty_;_718==Genistein Plus_;_638==Kusmi_;_129==Raumdüfte_;_518==Binella_;_519==Age Control_;_650==Teint_;_730==Erotic Art_;_320==Les Bains du Marais_;_172==Augen_;_689==Kenmei Do_;_691==Embryolisse_;_694==Schnäppchen 20%_;_695==Schnäppchen 50%_;_674==Garancia_;_653==Neu bei Elisabeth Arden_;_656==Neu bei Kusmi Tee_;_658==Neu bei Make Up For Ever_;_560==Gesichtspflege_;_321==De Laurier_;_151==Pangea Organics_;_557==After Sun_;_497==Alle Haartypen_;_504==Gatineau Paris_;_448==Körperpflege_;_610==Körperpflege_;_589==Rechts-Regulat_;_426==Gutscheine_;_234==MK-Heads_;_512==Anti Frizz_;_537==Massageöl_;_538==Gesichtspflege_;_357==Topseller_;_415==Prodigieux Linie_;_416==3 Rosen Reinigungs-Pflege_;_417==Phytochoc Linie_;_470==Steffen Schraut_;_698==Neu bei SteamCream_;_701==Pflege-Sets_;_702==Bio Organic_;_385==Caudalie_;_455==IcyBeauty_;_664==Gesichtpflege_;_541==by Fermes de Marie_;_592==Elisabeth Arden_;_525==Badeöle_;_526==Duschgel_;_527==Bomb Organic_;_329==JadRoll_;_568==Schön Wohnen_;_563==Ausgleichende Pflege_;_564==Spezialpflege_;_565==Pflegecremes_;_477==Pro Youth_;_478==Furterer René_;_482==Sensible Kopfhaut_;_493==Coloriertes Haar_;_705==Greenlife value_;_715==Neu bei Beautyblender_;_328==Nuxe_;_672==Pure Altitude_;_542==LiftAlpes_;_543==Sebum Control_;_544==Hydro Control_;_126==Magische Kosmetik_;_621==Voya_;_622==Pangea Organics_;_623==Caudalie_;_153==Caudalie_;_693==Schnäppchen 30%_;_561==Reinigungsprodukte_;_395==Haarpflege_;_595==Reisegröße_;_596==Binella_;_597==Binella_;_423==Opalis_;_424==Pangea Organics_;_425==Nach Altersgruppe_;_441==Neuheiten_;_442==Andere Kategorien_;_264==Öle_;_678==Neu bei Nuxe_;_668==Pure Altitude_;_669==Delarom_;_670==Primavera_;_671==Red Water_;_713==Neu bei Fragrances of Ireland_;_354==Beautyblender_;_578==Primavera_;_366==Alle Hauttypen_;_569==Pro Youth Essence Pur_;_570==Pro Youth Hautvital Kapseln_;_571==Cleansing Special_;_215==Shampoo_;_521==Lipid Control_;_230==Anti-Schuppen_;_231==Spülung_;_624==Nuxe_;_625==Fermes de Marie_;_626==Halawa_;_627==Hei Poa_;_628==Veld´s_;_629==René Furterer_;_630==Omoyé_;_631==Primavera_;_632==Binella_;_360==Normale Haut_;_305==T. Leclerc_;_323==Secrets du Potager_;_205==Nuxe_;_340==Geschenke ab 100 EUR_;_524==Bomb Organic_;_338==Geschenke bis 25 EUR_;_567==Die Marken_;_500==fettige Kopfhaut/Haar_;_501==fettige Kopfhaut/sehr trockenes Haar_;_502==trockene Kopfhaut/Haar_;_503==sehr trockene Kopfhaut/Haar_;_495==Glanz  Volumen_;_496==Sonnen Schutz_;_237==Hände_;_238==Nägel_;_607==Binella_;_608==Binella_;_128==Zahnpflege_;_123==Erotische Kosmetik_;_150==Nuxe_;_382==Velds_;_593==Red Water_;_594==Körperpflege_;_233==Haar-Öle_;_226==Fettiges Haar_;_562==Masken und Peelings_;_367==Bodyspray_;_194==Sehr trockene Haut_;_559==Körperpflege_;_513==Junge Haut_;_514==1ste Falten_;_515==Tiefe Falten_;_516==Pigmentflecken_;_517==Aroma Perfection Linie_;_550==Omoyé Bio_;_601==Sonnenschutz_;_566==Orthocos_;_359==Longcils Boncza_;_520==Basic Control_;_145==Odile Lecoin_;_119==Alle Marken_;_120==Beauty Tools_;_580==Körperpflege_;_581==Gesichtspflege_;_582==Schön Wohnen_;_583==Wellness_;_586==Spezialpflege_;_613==Naturkosmetik_;_614==Abba_;_615==Bomb Organic_;_616==Delarom_;_617==Pure Altitude Bio Organic_;_618==Omoyé Bio_;_620==Red Water_;_339==Geschenke bis 50 EUR_;_445==Sonnenpflege_;_450==Micro Cell_;_463==Luminaris_;_358==Outlet_;_498==Nahrungsergänzung_;_491==Basispflege_;_553==Bio- Naturkosmetik_;_612==Biokosmetik_;_409==Crème Fraîche Linie_;_422==Talika_;_449==Rasierbedarf_;_413==Nuxuriance Linie_;_353==Swissdent_;_146==Lumedia_;_147==De Laurier_;_149==Les Bains du Marais_;_173==Lippen_;_371==Longcils Boncza_;_374==Normales Haar_;_378==Talika_;_380==Velds_;_719==Hydro Lift Plus_;_720==Caviar Plus_;_727==Welliges Haar_;_728==Neu bei Furterer René_;_731==Fußpflege_;_732==Schön Wohnen_;_733==I Coloniali_;_734==Rituale des Bades_;_735==Rituale für den Körper_;_736==Rituale für das Gesicht_;_737==Rituale der Frische_;_738==Neu bei Micro Cell_;_739==Rituale des Mannes_;_740==Spirit of Africa';
			var aCatList = sCatList.split("_;_");
			var oCatList = new Array();
			for(var i=0; i<aCatList.length; i++){
				oCatList[i] = aCatList[i].split("==");
			};
			sHTMLb += '<td class="LIDiscTabBody">';
			sHTMLb += '<p><UL>';
			for(var i=0; i<aStffC.length; i++){
				for(var j=0; j<aCatList.length; j++){
					if(aStffC[i]==oCatList[j][0]){
						aStffC[i] = oCatList[j][1];
						break;
					};
				};
				sHTMLb += '<LI>' + aStffC[i] + '</LI>';
			};
			sHTMLb += '</UL></p>';
			sHTMLb += '</td>';
		};
		if(sStffP!="none"){
			var aStffP = sStffP.split(", ");
			sHTMLb += '<td class="LIDiscTabBody">';
			sHTMLb += '<p><UL>';
			for(var i=0; i<aStffP.length; i++){
				sHTMLb += '<LI>' + aStffP[i] + '</LI>';
			};
			sHTMLb += '</UL></p>';
			sHTMLb += '</td>';
		};
		sHTMLb += '</tr>';
		sHTMLb += '</table></div>';
		document.write(sHTMLb);
	};

	return(true);
};

function printLoginDiscountsSummary(sLink){
	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;');
	};
	try {
		sData = SMShop.getAttribute("UserDiscount");
	} catch(e) { };
	if((sData.length==0) || (sData=="false") || (sData==false)){
		try {
			sData = SMShop.getAttribute("StffDiscount");
		} catch(e) { };
		if(sData.length>0){
			if(getUserDiscountText("bool")){
				document.write("<br>&nbsp;<br>Sie erhalten auf verschiedene Hersteller, Kategorien oder Produkte gesonderte Rabattstaffeln. Diese werden bei den entsprechenden Produkten angezeigt. Details finden Sie auch auf der Login-Seite.");
			};
			return(false);
		} else {
			document.write(sHTMLb);
			return(false);
		};
	};
	var aDiscounts = sData.split("_;_");
	if(aDiscounts.length == 1){
		var aFields = aDiscounts[0].split("|");
		if(aFields[4] == 0){
			if(getUserDiscountText("bool")){
				document.write(sHTMLb);
			};
			return(false);
		};
	};
	if(!getUserDiscountText("bool")){
		return(false);
	};
	var	sHTMLb = '';
	sHTMLb += '<br>Sie erhalten folgende Rabatte:';
	for(var i=0; i<aDiscounts.length; i++){
		var aFields = aDiscounts[i].split("|");
		var aRule = aFields[0].split("==");
		aFields[2] = cprimary.format(aFields[2], SM_CGROUP + SM_CSYMBOL);
		aFields[2] = aFields[2].replace("&nbsp;", " ");
		if(String(aFields[3]) == "1"){
			aFields[4] = cprimary.format(aFields[4], SM_CGROUP + SM_CSYMBOL);
			aFields[4] = aFields[4].replace("&nbsp;", " ");
		} else if(String(aFields[3]) == "2"){
			aFields[4] = cprimary.format(aFields[4]) + "%";
		/* Tecberlin */
		} else if(parseInt(aFields[3],10) >= 4 && parseInt(aFields[3],10) <= 7){
			aFields[4] = cprimary.format(aFields[4]) + "% (Stufe " + String(parseInt(aFields[3],10) - 3) + ")";
		/* Tecberlin */
		};
		if(aRule[0]=="manufacturer"){
			sHTMLb += '<p>' + aFields[5] + ': ' + aFields[4] + '</p>';
		} else if(aRule[0]=="category"){
			sHTMLb += '<p>' + aFields[5] + ': ' + aFields[4] + '</p>';
		} else if(aRule[0]=="product"){
			sHTMLb += '<p>' + aFields[5] + ': ' + aFields[4] + '</p>';
		} else if(aRule[0]=="product-new-price"){
			sHTMLb += '<p>' + aFields[5] + ': ' + aFields[4] + '</p>';
		} else if(aRule[0]=="product-price-sug"){
			sHTMLb += '<p>' + aFields[5] + '</p>';
		} else if(aRule[0]=="spaceline"|| aRule[0]=="spaceline2" || aRule[0]=="spaceline3"){
			sHTMLb += '';
		} else {
			sHTMLb += '<p>' + aFields[5] + ':<br>ab ' + aFields[2] + ' Warenwert: ' + aFields[4] + '</p>';
		};
	};
	sData = SMShop.getAttribute("StffDiscount");
	if(sData.length>0 && sData!="false"){
		sHTMLb += '<p>Sie erhalten auf verschiedene Hersteller, Kategorien oder Produkte gesonderte Rabattstaffeln. Diese werden bei den entsprechenden Produkten angezeigt. Details finden Sie auch auf der Login-Seite.</p>';
	};
	document.write(sHTMLb);
	return(true);
};

// <- M **

// ** L ->

cSMVariants.prototype.updateLI=function(iNewPrice2){
	var $g=this,$1c=$g.base,$1k=$g.xml,$38=null,$39=null,$3a=null,$1V=$g.parent,$2P=0,$3b=false,$3c=null;
	if($1c.raiseEvent(4,true,true,$g)){
		$39=$g.getActVariant();
		if($39!=null){
			$38=$39.xml;
			$38.setAttribute(_SMAPrice,iNewPrice2);
		};
	}else $1c.raiseEvent(6,false,null,$g)
};

function CheckVariants(){
	var sResult = 'NO_VARIANTS';
	var iCntForms = document.forms.length;
	var sFormName = '';
	var i = 0;
	while (i < iCntForms) {
  	sFormName = document.forms[i].name;
  	if(sFormName.indexOf("PD") == 0 && sFormName.indexOf("variants") > 0){
  		sResult = sFormName;
  		break;
  	};
  	i++;
	};
	return(sResult);
};

function reinitVariants(sFormName){
	var frm1 = document[sFormName];
	if(frm1!=null){
 		for(var i=0; i<frm1.elements.length; i++){
		  var elem1 = frm1.elements[i];
  	 	if(elem1.type=="select-one"){
  	 		var sFunc = String(elem1.onchange);
  	 		var iFunc = sFunc.indexOf("{");
  	 		sFunc = sFunc.substr(iFunc + 1);
  	 		iFunc = sFunc.lastIndexOf("}");
  	 		sFunc = sFunc.substring(0, iFunc);
  	 		eval('elem1.onchange = function(){MakeLIPriceReset();' + sFunc + ';MakeLIPriceReinit();};');
  		};
  	};
  	return(sFunc);
 	} else {
 		return('NO_VARIANTS');
 	};
};

function resetVariants(sFormName,sFunc){
	var frm1 = document[sFormName];
	if(frm1!=null){
 		for(var i=0; i<frm1.elements.length; i++){
		  var elem1 = frm1.elements[i];
  	 	if(elem1.type=="select-one"){
  	 		eval('elem1.onchange = function(){' + sFunc + ';};');
  		};
  	};
  	return('OK');
 	} else {
 		return('NO_VARIANTS');
 	};
};

function MakeLIPrice_init(){
	try {
		if(arguments.length > 0){
			var $g = arguments[0];
		} else {
			var $g = SMProductLI;
		};
	} catch(e) { };	
	var iCatDiscount = parseFloat($g.getAttribute(_SMAPrdDiscount));
	if(isNaN(iCatDiscount)){iCatDiscount = 0;};
	if(iCatDiscount > 0){
		$g.setAttribute("CatDiscount",iCatDiscount);
		$g.setAttribute(_SMAPrdDiscount,0);
		$g.update();
	};
	var iOrgPrice = $g.getPrice();
	//var iOrgPrice = $g.getAttribute(_SMAPrice);
	if(bInGross() != bOutGross()){
		var iTax = getVAT($g);
		if(!bInGross()){
			iOrgPrice = iOrgPrice / (1 + iTax);
		} else {
			iOrgPrice = iOrgPrice * (1 + iTax);
		};
	};
	$g.setAttribute("OrgPriceLI",iOrgPrice);
	$g.setAttribute("VeryOrgPriceLI",iOrgPrice);
	$g.update();
};

function MakeLIPriceReset(){
	var $g=SMProductLI;
	var iOrgPrice = $g.getAttribute("VeryOrgPriceLI");
	var iOrgDisc = $g.getAttribute("CatDiscount");
	$g.setAttribute(_SMAPrice,iOrgPrice);
	$g.setAttribute(_SMAPrdDiscount,iOrgDisc);
	$g.variants.updateLI(iOrgPrice);
	$g.update();
};

function MakeLIPriceReinit(){
	var $g=SMProductLI;
	var iCatDiscount = parseInt($g.getAttribute(_SMAPrdDiscount), 10);
	if(isNaN(iCatDiscount)){iCatDiscount = 0;};
	if(iCatDiscount > 0){
		$g.setAttribute("CatDiscount",iCatDiscount);
		$g.setAttribute(_SMAPrdDiscount,0);
		$g.update();
	};
	var iOrgPrice = $g.getPrice();
	//var iOrgPrice = $g.getAttribute(_SMAPrice);
	if(bInGross() != bOutGross()){
		var iTax = getVAT($g);
		if(!bInGross()){
			iOrgPrice = iOrgPrice / (1 + iTax);
		} else {
			iOrgPrice = iOrgPrice * (1 + iTax);
		};
	};
	$g.setAttribute("OrgPriceLI",iOrgPrice);
	$g.setAttribute("VeryOrgPriceLI",iOrgPrice);
	$g.update();
	MakeLIPrice(true);
};

function MakeLIPrice(bProductHasVariants){
	var $g = SMProductLI;
	//var iOrgPrice = $g.getPrice();
	var iNewPrice = getProdLIDiscount();
	if(iNewPrice < 0){
		var iOrgDisc = $g.getAttribute("CatDiscount");
		$g.setAttribute(_SMAPrdDiscount,iOrgDisc);
		$g.update();
		displayProductProperties($g);
		return(false);
	};
	$g.setAttribute(_SMAPrice,iNewPrice);
	if(bProductHasVariants){$g.variants.updateLI(iNewPrice);};
	$g.update();
	displayProductProperties($g);
	var iOrgPrice = parseFloat($g.getAttribute("VeryOrgPriceLI"));
	if(bInGross() != bOutGross()){
		var iTax = getVAT($g);
		if(!bInGross()){
			iOrgPrice = iOrgPrice * (1 + iTax);
		} else {
			iOrgPrice = iOrgPrice / (1 + iTax);
		};
	};
	var sOrgPrice = cprimary.format(iOrgPrice, SM_CGROUP + SM_CSYMBOL);
	var sHTML = sHTMLOrg = sHTMLDisc = '';
	if(document.getElementById("product_original_price")){
		showIdTag("product_original_price",sOrgPrice);
	} else {
		sHTMLOrg = document.getElementById("product_price").innerHTML;
		sHTML = '<div class="t-small t-em" style="text-decoration:line-through;" id="product_original_price">' + sOrgPrice + '</div>';
		sHTML += sHTMLOrg;
		document.getElementById("product_price").innerHTML = sHTML;
	};
	return(true);
};

function MakeLIPricePL(){
	var $g = arguments[0];
	var iNewPrice = getProdLIDiscount($g,arguments[1]);
	if(iNewPrice < 0){
		var iOrgDisc = $g.getAttribute("CatDiscount");
		$g.setAttribute(_SMAPrdDiscount,iOrgDisc);
		$g.update();
		return(false);
	};
	$g.setAttribute(_SMAPrice,iNewPrice);
	if(arguments[2] == true) $g.variants.updateLI(iNewPrice);
	$g.update();
	return(true);
};

function showIdTag(sTag,sCont){
	var oElem = document.getElementById(sTag);
	if(oElem){
		oElem.style.display = "inline";
		oElem.style.visibility = "visible";
		if(sCont.length>0) oElem.innerHTML = sCont;
	};
};

function hideIdTag(sTag,sCont){
	var oElem = document.getElementById(sTag);
	if(oElem){
		oElem.style.display = "none";
		oElem.style.visibility = "hidden";
		if(sCont.length>0) oElem.innerHTML = sCont;
	};
};

function getProdLIDiscount(){
	var sLogin = initLogin();
	if(sLogin != 'OK'){return(-1);};
	try {
		if(arguments.length > 0){
			var $g = arguments[0];
			var sProdNumber1 = RemoveSpecialSigns(arguments[1]);
		} else {
			var $g = SMProductLI;
			var sProdNumber1 = RemoveSpecialSigns($g.orgCode);
		}
	} catch(e) { };
	var iProdPrice = $g.getAttribute("OrgPriceLI");
	var iCatDiscount = parseFloat($g.getAttribute("CatDiscount"));
	if(isNaN(iCatDiscount)){iCatDiscount = 0;};
	var sProdManu = RemoveSpecialSigns(SX_uEsc($g.manufactName));
	//var sProdNumber1 = RemoveSpecialSigns($g.orgCode);
	var sProdNumber2 = RemoveSpecialSigns($g.getAttribute(_SMACode));
	var sData = SMShop.getAttribute("UserDiscount");
	var aDiscounts = sData.split("_;_");
	var aFields = new Array();
	var bIsDiscounted = false;
	var bDiscountDone = false;
	var bProdNewPrice = false;
	var iProdNewPrice = 0;
	var iDiscAmntTyp1 = 0;
	var iDiscAmntTyp2 = 0;
	/* Tecberlin */
	var iDiscAmntTyp4 = 0;
	var iDiscAmntTyp5 = 0;
	var iDiscAmntTyp6 = 0;
	var iDiscAmntTyp7 = 0;
	/* Tecberlin */
	iDiscAmntTyp2 += iCatDiscount;
	for(var i=0; i<aDiscounts.length; i++){
		aFields[i] = aDiscounts[i].split("|");
		if(aFields[i][0].length>0){
			var aRule = aFields[i][0].split("==");

			if(aRule[0] == 'manufacturer' && aRule[1] == sProdManu){
				bIsDiscounted = true;
			};
			if(aRule[0] == 'product' && (aRule[1] == sProdNumber1 || aRule[1] == sProdNumber2)){
				bIsDiscounted = true;
			};
			if(aRule[0] == 'category'){
				var aCat = sProdToParentCats.split("_;_");
				var aCatDisc = new Array();
				for(var j=0; j<aCat.length; j++){
					aCatDisc[j] = aCat[j].split("_=_");
				};
				for(var j=0; j<aCat.length; j++){
					if(aRule[1] == aCatDisc[j][0] || aRule[1] == aCatDisc[j][1]){
						bIsDiscounted = true;
						break;
					};
				};
			};
			// Summiere Einzeldiskounts
			if(bIsDiscounted){
				// DiscountTyp, DiscountValue
				// Typ: 1=Fix
				//      2=%
				var iDiscType = aFields[i][3];
				var iDiscAmou = aFields[i][4];
				iDiscAmou = iDiscAmou.replace(",",".");
				iDiscAmou = parseFloat(iDiscAmou);
				if(isNaN(iDiscAmou)){iDiscAmou = 0;};
				if(iDiscType == 1){
					iDiscAmntTyp1 += iDiscAmou;
				};
				if(iDiscType == 2){
					iDiscAmntTyp2 += iDiscAmou;
				};
				/* Tecberlin */
				if(iDiscType == 4){
					iDiscAmntTyp4 += iDiscAmou;
				};
				if(iDiscType == 5){
					iDiscAmntTyp5 += iDiscAmou;
				};
				if(iDiscType == 6){
					iDiscAmntTyp6 += iDiscAmou;
				};
				if(iDiscType == 7){
					iDiscAmntTyp7 += iDiscAmou;
				};
				/* Tecberlin */
			};
			bIsDiscounted = false;
		};
	};
	// Typ: 1=Fix
	//      2=%
	if(iDiscAmntTyp1 > 0){
		if(bInGross() != bOutGross()){
			var iTax = getVAT($g);
			if(!bInGross()){
				iProdPrice = iProdPrice * (1 + iTax);
			} else {
				iProdPrice = iProdPrice / (1 + iTax);
			};
		};
		iProdPrice = iProdPrice - iDiscAmntTyp1;
		if(bInGross() != bOutGross()){
			var iTax = getVAT($g);
			if(!bInGross()){
				iProdPrice = iProdPrice / (1 + iTax);
			} else {
				iProdPrice = iProdPrice * (1 + iTax);
			};
		};
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	if(iDiscAmntTyp2 > 0){
		//iProdPrice = Math.round((iProdPrice*((100 - iDiscAmntTyp2) / 100)) / 0.01) * 0.01;
		iProdPrice = iProdPrice * ((100 - iDiscAmntTyp2) / 100);
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	/* Tecberlin */
	if(iDiscAmntTyp4 > 0){
		//iProdPrice = Math.round((iProdPrice*((100 - iDiscAmntTyp4) / 100)) / 0.01) * 0.01;
		iProdPrice = iProdPrice * ((100 - iDiscAmntTyp2) / 100);
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	if(iDiscAmntTyp5 > 0){
		//iProdPrice = Math.round((iProdPrice*((100 - iDiscAmntTyp5) / 100)) / 0.01) * 0.01;
		iProdPrice = iProdPrice * ((100 - iDiscAmntTyp2) / 100);
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	if(iDiscAmntTyp6 > 0){
		//iProdPrice = Math.round((iProdPrice*((100 - iDiscAmntTyp6) / 100)) / 0.01) * 0.01;
		iProdPrice = iProdPrice * ((100 - iDiscAmntTyp2) / 100);
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	if(iDiscAmntTyp7 > 0){
		//iProdPrice = Math.round((iProdPrice*((100 - iDiscAmntTyp7) / 100)) / 0.01) * 0.01;
		iProdPrice = iProdPrice * ((100 - iDiscAmntTyp2) / 100);
		if(iProdPrice < 0){iProdPrice = 0;};
		bDiscountDone = true;
	};
	/* Tecberlin */
	if(bProdNewPrice){
		iProdPrice = iProdNewPrice;
		bDiscountDone = true;
	};
	if(bDiscountDone){
		return(iProdPrice);
	} else {
		return(-1);
	};
};

// <- L **
