/* $Header: /home/web/cvsroot/es62_heine/hf_app_shop/staticfiles/cartridge/static/default/js/detailview.js,v 1.34 2010/05/12 09:59:30 shagner Exp $ */

// Verfügbarkeit
availability = {


slbMessage_fr: "Livrable immédiatement",
niliMessage_fr: "Malheureusement, les stocks sont épuisés",
naliMessage_fr: ["L'article sera livré plus tard",
		"Livraison jusqu'à début janvier",
		"Livraison jusqu'à la mi-janvier",
		"Livraison jusqu'à fin janvier",
		"Livraison jusqu'à janvier",
		"Livraison en janvier",
		"Livraison jusqu'à début février",
		"Livraison jusqu'à la mi-février",
		"Livraison jusqu'à fin février",
		"Livraison jusqu'à février",
		"Livraison en février",
		"Livraison jusqu'à début mars",
		"Livraison jusqu'à la mi-mars",
		"Livraison jusqu'à fin mars",
		"Livraison jusqu'à mars",
		"Livraison en mars",
		"Livraison jusqu'à début avril",
		"Livraison jusqu'à la mi-avril",
		"Livraison jusqu'à fin avril",
		"Livraison jusqu'à avril",
		"Livraison en avril",
		"Livraison jusqu'à début mai",
		"Livraison jusqu'à la mi-mai",
		"Livraison jusqu'à fin mai",
		"Livraison jusqu'à mai",
		"Livraison en mai",
		"Livraison jusqu'à début juin",
		"Livraison jusqu'à la mi-juin",
		"Livraison jusqu'à fin juin",
		"Livraison jusqu'à juin",
		"Livraison en juin",
		"Livraison jusqu'à début juillet",
		"Livraison jusqu'à la mi-juillet",
		"Livraison jusqu'à fin juillet",
		"Livraison jusqu'à juillet",
		"Livraison en juillet",
		"Livraison jusqu'à début août",
		"Livraison jusqu'à la mi-août",
		"Livraison jusqu'à fin août",
		"Livraison jusqu'à août",
		"Livraison en août",
		"Livraison jusqu'à début septembre",
		"Livraison jusqu'à la mi-septembre",
		"Livraison jusqu'à fin septembre",
		"Livraison jusqu'à septembre",
		"Livraison en septembre",
		"Livraison jusqu'à début octobre",
		"Livraison jusqu'à la mi-octobre",
		"Livraison jusqu'à fin octobre",
		"Livraison jusqu'à octobre",
		"Livraison en octobre",
		"Livraison jusqu'à début novembre",
		"Livraison jusqu'à la mi-novembre",
		"Livraison jusqu'à fin novembre",
		"Livraison jusqu'à novembre",
		"Livraison en novembre",
		"Livraison jusqu'à début décembre",
		"Livraison jusqu'à la mi-décembre",
		"Livraison jusqu'à fin décembre",
		"Livraison jusqu'à décembre",
		"Livraison en décembre",
		"L'article sera livré avant Noël",
		"L'article sera livré avant Pâques",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"L'article sera livré plus tard",
		"Livraison dans une semaine",
		"Livraison dans deux semaines",
		"Livraison dans trois semaines",
		"Livraison dans quatre semaines",
		"Livraison dans cinq semaines",
		"Livraison dans six semaines",
		"Livraison dans sept semaines",
		"Livraison dans huit semaines",
		"Livraison dans neuf semaines",
		"Livraison dans dix semaines",
		"Livraison dans onze semaines",
		"Livraison dans douze semaines",
		"Livraison dans 13 semaines",
		"Livraison dans 14 semaines",
		"Livraison dans 15 semaines",
		"Livraison dans 16 semaines",
		"L'article sera livré plus tard"],


slbMessage_nl: "Direct leverbaar",
niliMessage_nl: "Dit artikel is helaas uitverkocht.",
naliMessage_nl: ["Dit artikel wordt nageleverd",
		"Levering tot begin januari",
		"Levering tot medio januari",
		"Levering tot eind januari",
		"Levering tot januari",
		"Levering in januari",
		"Levering tot begin februari",
		"Levering tot medio februari",
		"Levering tot eind februari",
		"Levering tot februari",
		"Levering in februari",
		"Levering tot begin maart",
		"Levering tot medio maart",
		"Levering tot eind maart",
		"Levering tot maart",
		"Levering in maart",
		"Levering tot begin april",
		"Levering tot medio april",
		"Levering tot eind april",
		"Levering tot april",
		"Levering in april",
		"Levering tot begin mei",
		"Levering tot medio mei",
		"Levering tot eind mei",
		"Levering tot mei",
		"Levering in mei",
		"Levering tot begin juni",
		"Levering tot medio juni",
		"Levering tot eind juni",
		"Levering tot juni",
		"Levering in juni",
		"Levering tot begin juli",
		"Levering tot midden juli",
		"Levering tot eind juli",
		"Levering tot juli",
		"Levering in juli",
		"Levering tot begin augustus",
		"Levering tot medio augustus",
		"Levering tot eind augustus",
		"Levering tot augustus",
		"Levering in augustus",
		"Levering tot begin september",
		"Levering tot medio september",
		"Levering tot eind september",
		"Levering tot september",
		"Levering in september",
		"Levering tot begin oktober",
		"Levering tot medio oktober",
		"Levering tot eind oktober",
		"Levering tot oktober",
		"Levering in oktober",
		"Levering tot begin november",
		"Levering tot midden november",
		"Levering tot eind november",
		"Levering tot november",
		"Levering in november",
		"Levering tot begin december",
		"Levering tot medio december",
		"Levering tot eind december",
		"Levering tot december",
		"Levering in december",
		"Levering tot kerst.",
		"Levering tot Pasen.",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Dit artikel wordt nageleverd",
		"Levering binnen een week",
		"Levering binnen twee weken",
		"Levering binnen drie weken",
		"Levering binnen vier weken",
		"Levering binnen vijf weken",
		"Levering binnen zes weken",
		"Levering binnen zeven weken",
		"Levering binnen acht weken",
		"Levering binnen negen weken",
		"Levering binnen tien weken",
		"Levering binnen elf weken",
		"Levering binnen twaalf weken",
		"Levering binnen 13 weken",
		"Levering binnen 14 weken",
		"Levering binnen 15 weken",
		"Levering binnen 16 weken",
		"Dit artikel wordt nageleverd"],	
	
	
slbMessage: "Sofort lieferbar",
niliMessage: "Dieser Artikel ist leider ausverkauft.",
naliMessage: ["Artikel wird nachgeliefert",
		"Lieferung bis Anfang Januar",
		"Lieferung bis Mitte Januar",
		"Lieferung bis Ende Januar",
		"Lieferung bis Januar",
		"Lieferung im Januar",
		"Lieferung bis Anfang Februar",
		"Lieferung bis Mitte Februar",
		"Lieferung bis Ende Februar",
		"Lieferung bis Februar",
		"Lieferung im Februar",
		"Lieferung bis Anfang März",
		"Lieferung bis Mitte März",
		"Lieferung bis Ende März",
		"Lieferung bis März",
		"Lieferung im März",
		"Lieferung bis Anfang April",
		"Lieferung bis Mitte April",
		"Lieferung bis Ende April",
		"Lieferung bis April",
		"Lieferung im April",
		"Lieferung bis Anfang Mai",
		"Lieferung bis Mitte Mai",
		"Lieferung bis Ende Mai",
		"Lieferung bis Mai",
		"Lieferung im Mai",
		"Lieferung bis Anfang Juni",
		"Lieferung bis Mitte Juni",
		"Lieferung bis Ende Juni",
		"Lieferung bis Juni",
		"Lieferung im Juni",
		"Lieferung bis Anfang Juli",
		"Lieferung bis Mitte Juli",
		"Lieferung bis Ende Juli",
		"Lieferung bis Juli",
		"Lieferung im Juli",
		"Lieferung bis Anfang August",
		"Lieferung bis Mitte August",
		"Lieferung bis Ende August",
		"Lieferung bis August",
		"Lieferung im August",
		"Lieferung bis Anfang September",
		"Lieferung bis Mitte September",
		"Lieferung bis Ende September",
		"Lieferung bis September",
		"Lieferung im September",
		"Lieferung bis Anfang Oktober",
		"Lieferung bis Mitte Oktober",
		"Lieferung bis Ende Oktober",
		"Lieferung bis Oktober",
		"Lieferung im Oktober",
		"Lieferung bis Anfang November",
		"Lieferung bis Mitte November",
		"Lieferung bis Ende November",
		"Lieferung bis November",
		"Lieferung im November",
		"Lieferung bis Anfang Dezember",
		"Lieferung bis Mitte Dezember",
		"Lieferung bis Ende Dezember",
		"Lieferung bis Dezember",
		"Lieferung im Dezember",
		"Artikel wird bis Weihnachten geliefert.",
		"Artikel wird bis Ostern geliefert.",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Artikel wird nachgeliefert",
		"Lieferung in einer Woche",
		"Lieferung in zwei Wochen",
		"Lieferung in drei Wochen",
		"Lieferung in vier Wochen",
		"Lieferung in fünf Wochen",
		"Lieferung in sechs Wochen",
		"Lieferung in sieben Wochen",
		"Lieferung in acht Wochen",
		"Lieferung in neun Wochen",
		"Lieferung in zehn Wochen",
		"Lieferung in elf Wochen",
		"Lieferung in zwölf Wochen",
		"Lieferung in 13 Wochen",
		"Lieferung in 14 Wochen",
		"Lieferung in 15 Wochen",
		"Lieferung in 16 Wochen",
		"Artikel wird nachgeliefert"]
};


var WebRoot = "/is-bin/intershop.static/WFS/Helline-HellineFr-Site/-/fr_FR/";
var imageServer = "http://image01.otto.de/pool";
var zoomImageServer = "http://zoomcache-cdn-eu03.fsi-viewer.com";
var videoServer = "http://video.heine.de";
var currentLocale = "Helline-HellineFr-Site";

if(window.location.protocol == "https:"){
	imageServer = "https://image01.otto.de/pool";
}



function DetailViewController(){
	
	this.currentStyle = new Style();
	this.selectedColor = null;
	this.selectedDim3 = null;
	this.selectedSize = null;
	this.selectedVariation = null;
	this.kalResponse = "";
	this.currentKalRequest = null;
	this.orderActive = false;	
	this.sid = null;
	
	
	
	this.setCurrentStyle = function(sku) {
		for(var i=0; i<bundle.styles.length; i++){
			if(sku == bundle.styles[i].SKU){
				this.currentStyle = bundle.styles[i];
				this.updateAllFields();
				this.startJCarouselScrolling();
			}	
		}	
	}
	
	this.setSID = function(sid){
		this.sid = sid;	
	}
	
	this.setCurrentLocale = function(loc){
		currentLocale = loc;	
		if(currentLocale == "Heine-HeineCh-Site"){
			WebRoot = "/is-bin/intershop.static/WFS/Heine-HeineCh-Site/-/de_CH/";
		}
		if(currentLocale == "Heine-HeineAt-Site"){
			WebRoot = "/is-bin/intershop.static/WFS/Heine-HeineAt-Site/-/de_AT/";
		}
		if(currentLocale == "Heine-HeineNL-Site"){
			WebRoot = "/is-bin/intershop.static/WFS/Heine-HeineNL-Site/-/nl_NL/";
		}
		if(currentLocale == "Helline-HellineFr-Site"){
			WebRoot = "/is-bin/intershop.static/WFS/Helline-HellineFr-Site/-/fr_FR/";
		}		
	}
	
	/*Update all fields*/
	this.updateAllFields = function(){
		this.updateKalInformation();
		this.updateShortDesription();
		//this.updateProductPrices();		
		this.updateManufacturer();
		this.updateProductFlags();
		this.updateMainImage();		// ToDo: Onclick -> weitere Ansichten, Style corsor:pointer
		this.updateColorChooser();
		this.updateLongDescription();	// ToDo: Styles für Glossar analog alte DetailView (JSP)
		this.updateMaterialFlags();
		this.updateServiceFlags();
		this.updateSpecialLabelFlag();
		this.updateRecommendationAtPI();
		this.initVariationSelectors();
		this.updateDependendFields();
		this.updateProductImages();
		this.updateRecommendationIFrame();
		this.updateGender();
		this.updateSkuReCookie();	
	}
	
	this.updateSkuReCookie = function(){
		
		/* handle cookie for RE */
		var sku = this.currentStyle.SKU.split("-")[0];
		var rrsc = this.readSkuReCookie()
		if(rrsc != null){
			var reElements = rrsc.split("|");
			var addSKU = true;
			
			for(var i=0; i<reElements.length; i++){	//Gleiche Ergebnisse kommen nicht in die Liste
				if(sku == reElements[i]){
					addSKU = false;
					break;	
				}			
			}
			if(addSKU){				
				if(reElements.length < 5){
					document.cookie = "reSkuCookie=" + sku +"|"+rrsc+";path=/";
				}
				else{
					var temp = sku+"|"+rrsc;
					reElements = temp.split("|");
					reElements.pop();
					document.cookie = "reSkuCookie="+reElements.join("|")+";path=/";
				}				
			}
		}
		else{
			document.cookie = "reSkuCookie="+sku+";path=/";
		}
	
	
	
	}
	this.readSkuReCookie = function () {
	    var cContent = document.cookie.split(";");
	    for (i = 0; i < cContent.length; i++) {
	        cParts = cContent[i].split("=");
	        if (cParts[0].charAt(0) == " ") {
	            cParts[0] = cParts[0].substring(1, cParts[0].length);
	        }
	        if (cParts[0] == "reSkuCookie") {
	            return unescape(cParts[1]);
	        }
	    }
	    return null;
	}
	
	
	this.updateSpecialLabelFlag = function() {
		var specialLabelDiv = document.getElementById("specialLabel")
		
		
		
		if(specialLabelDiv){			
			var temp = "";
			var variationPriceOldExists = false;
			if(this.currentStyle.specialLabel != null){
				
				var variations = this.currentStyle.getVariationsByColor(this.selectedColor);				
				
				for(var i=0; i<variations.length; i++){
					if(variations[i].priceOld != null){
						variationPriceOldExists = true;	
						break;
					}
				}
				
				
				if(!variationPriceOldExists){					
					
					//var img = new Image();					
					//img.src = WebRoot + "imagesOnline/productdetail/"+this.currentStyle.specialLabel +"224.gif";					
					//specialLabelDiv.appendChild(img);
					
					this.addSpecialLongDescription(this.currentStyle.specialLabel);
					this.addSpecialShortDescription(this.currentStyle.specialLabel);
				}
				else{
					specialLabelDiv.innerHTML = "";
				}
			} else {
				specialLabelDiv.innerHTML = "";
			}
		}
		
	}
	
	this.addSpecialShortDescription = function(label) {
	
		var longDescription = this.currentStyle.description.replace(/<A HREF=/g, "<A class=\"service2\" HREF=");
		var serviceDescription = "";
		var serviceFlags = this.currentStyle.getServiceFlags();
		
		for (var i = 0; i < serviceFlags.length; i++) {
			serviceDescription += "<img title=\""+getStyleFlagImageMapping(serviceFlags[i], currentLocale)+"\" onclick=\"showProductInformation();\" style=\"cursor:pointer;\" src=\""+WebRoot+"/imagesOnline/detailview/"+getStyleFlagMapping(serviceFlags[i])+"\"> ";
		}
		
		if (serviceFlags.length > 0) {
			serviceDescription = "<br>"+ serviceDescription;
		}
		
		
		var cutLD = "";
		if((cutLD = cutLongDescription(longDescription, 25)) != null){
			cutLD +="<div style=\"cursor:pointer;text-decoration:underline;\" onclick=\"showProductInformation();showLPDlong();\"> <b>"+getLocByDomain("loc0", currentLocale)+"</b></div>"+ serviceDescription;			
		}
		else{			
			cutLD  = longDescription+"<br>"+serviceDescription;			
		}
		
		
		var newTABLE = document.createElement("table");
		newTABLE.setAttribute("width", "224");
		newTABLE.setAttribute("border", "0");
		newTABLE.setAttribute("cellpadding", "0");
		newTABLE.setAttribute("cellspacing", "0");
		
		var newTR0 = document.createElement("tr");
		var newTD0 = document.createElement("td");
		var spldTop = new Image();
		spldTop.style.width = "224px";
		spldTop.src = WebRoot + "imagesOnline/productdetail/psd_"+label+"_top.jpg";
		newTD0.appendChild(spldTop);
		newTABLE.appendChild(newTR0.appendChild(newTD0));
		
		
		var newTR1 = document.createElement("tr");
		var newTD1 = document.createElement("td");
		
		newTD1.style.borderLeft = "1px solid #fada8a";
		newTD1.style.borderRight = "1px solid #fada8a";
		newTD1.style.padding = "10px";
		if (serviceFlags.length > 0) {
			newTD1.style.paddingBottom = "0px";
		}
		
		
		newTD1.style.backgroundColor = "#fefbf2";

		newTD1.innerHTML = cutLD;
		newTR1.appendChild(newTD1);
		newTABLE.appendChild(newTR1);
		
		
		var newTR2 = document.createElement("tr");
		var newTD2 = document.createElement("td");
		var spldBottom = new Image();
		spldBottom.style.width = "224px"
		spldBottom.src = WebRoot + "imagesOnline/productdetail/psd_bottom.jpg";
		newTD2.appendChild(spldBottom);
		newTABLE.appendChild(newTR2.appendChild(newTD2));


		var element = document.createElement("div");
		element.appendChild(newTABLE.cloneNode(true));
		
		
		document.getElementById("productinformationDescription").innerHTML = "";
		if(currentLocale == "Heine-HeineCh-Site"){
			document.getElementById("productinformationDescription").innerHTML =  char2Swiss(element.innerHTML);
		}
		else{
			document.getElementById("productinformationDescription").innerHTML = element.innerHTML;
		}
	
	
	}
	
	
	this.addSpecialLongDescription = function(label) {
		
		var ldTitle = '<span class="variationTitle">'+getLocByDomain("loc2", currentLocale)+'</span><br><br>'
		var longDescription =  this.currentStyle.description.replace(/<A HREF=/g, "<A class=\"service2\" HREF=");
		var cutLD = "";
		if((cutLD = cutLongDescription(longDescription, 25)) != null){
			cutLD +="<div style=\"cursor:pointer;text-decoration:underline;text-align:right;\" onclick=\"showProductInformation();showLPDlong();\"> <b>"+getLocByDomain("loc0", currentLocale)+"</b></div>";
		}
		else{			
			cutLD  = longDescription			
		}
		
		
		var newTABLE = document.createElement("table");
		newTABLE.setAttribute("width", "348");
		newTABLE.setAttribute("border", "0");
		newTABLE.setAttribute("cellpadding", "0");
		newTABLE.setAttribute("cellspacing", "0");
		
		var newTR0 = document.createElement("tr");
		var newTD0 = document.createElement("td");
		var spldTop = new Image();
		spldTop.src = WebRoot + "imagesOnline/productdetail/pld_"+label+"_top.jpg";
		newTD0.appendChild(spldTop);
		newTABLE.appendChild(newTR0.appendChild(newTD0));
		
		
		var newTR1 = document.createElement("tr");
		var newTD1 = document.createElement("td");
		
		newTD1.style.borderLeft = "1px solid #fada8a";
		newTD1.style.borderRight = "1px solid #fada8a";
		newTD1.style.padding = "10px";
		newTD1.style.backgroundColor = "#fefbf2";
		newTD1.innerHTML = ldTitle + cutLD;
		newTR1.appendChild(newTD1);
		newTABLE.appendChild(newTR1);
		
		
		var newTR2 = document.createElement("tr");
		var newTD2 = document.createElement("td");
		var spldBottom = new Image();
		spldBottom.src = WebRoot + "imagesOnline/productdetail/pld_bottom.jpg";
		newTD2.appendChild(spldBottom);
		newTABLE.appendChild(newTR2.appendChild(newTD2));


		document.getElementById("productLongDescription").innerHTML = "";
		document.getElementById("artDescriptionTitle").style.display = "none";		
		
		//Mit "Mehr"
		var element = document.createElement("div");
		element.appendChild(newTABLE.cloneNode(true));
		
		if(currentLocale == "Heine-HeineCh-Site"){			
			document.getElementById("productLongDescription").innerHTML = char2Swiss(element.innerHTML);	
		}
		else{
			document.getElementById("productLongDescription").innerHTML = element.innerHTML;	
		}
		document.getElementById("productLongDescription").style.display = "block";
		
		//Mit "Weniger"
		newTD1.innerHTML = ldTitle + longDescription + "<div style=\"cursor:pointer;text-decoration:underline;text-align:right;margin-top:2px;\" onclick=\"showLPDshort();\"> <b>"+getLocByDomain("loc1", currentLocale)+"</b></div>"; 
		var element1 = document.createElement("div");
		element1.appendChild(newTABLE.cloneNode(true));
		
		if(currentLocale == "Heine-HeineCh-Site"){			
			document.getElementById("productinformationDescriptionLong").innerHTML = char2Swiss(element1.innerHTML);	
		}
		else{
			document.getElementById("productinformationDescriptionLong").innerHTML = element1.innerHTML;	
		}		
		document.getElementById("productinformationDescriptionLong").style.display = "none";
		
	}
	
	
	this.updateGender = function() {
		var element;

		// Unser Styling-Tipp
		this.setHeadline1(document.getElementById("tipheadline1a"));
		this.setHeadline1(document.getElementById("tipheadline1b"));
		this.setHeadline1(document.getElementById("tipheadline1c"));
		
		// Die Styles im Einzelnen
		this.setHeadline2(document.getElementById("tipheadline2a"));
		this.setHeadline2(document.getElementById("tipheadline2b"));
		this.setHeadline2(document.getElementById("tipheadline2c"));
		
		// Weitere Looks
		this.setHeadline3(document.getElementById("tipheadline3a"));
		this.setHeadline3(document.getElementById("tipheadline3b"));
		this.setHeadline3(document.getElementById("tipheadline3c"));
		
		//Beratung & Service
		this.updateAdviceByGender();
		this.updateServiceByGender();
		
	}
	
	this.updateAdviceByGender = function() {
		if(this.currentStyle.gender == "male"){			
			document.getElementById("adviceFemale").style.display = "none";			
			document.getElementById("adviceNeutral").style.display = "none";
			document.getElementById("adviceMale").style.display = "block";
		}
		else if(this.currentStyle.gender == "neutral"){
			document.getElementById("adviceFemale").style.display = "none";
			document.getElementById("adviceMale").style.display = "none";
			document.getElementById("adviceNeutral").style.display = "block";
		}
		else{			
			document.getElementById("adviceMale").style.display = "none";
			document.getElementById("adviceNeutral").style.display = "none";
			document.getElementById("adviceFemale").style.display = "block";
		}
			
	}
	
	this.updateServiceByGender = function() {
		if(this.currentStyle.gender == "neutral"){
			document.getElementById("serviceFemaleAndMale").style.display = "none";
			document.getElementById("serviceNeutral").style.display = "block";
		}
		else{			
			document.getElementById("serviceNeutral").style.display = "none";
			document.getElementById("serviceFemaleAndMale").style.display = "block";						
		}
	
	}
	
	
	this.setHeadline1 = function(element) {
		if (element != null) {
			if (this.currentStyle.gender == "neutral")
				element.innerHTML = getLocByDomain("loc3", currentLocale);
			else
				element.innerHTML = getLocByDomain("loc4", currentLocale);
		}
	}
	
	this.setHeadline2 = function(element) {
		if (element != null) {
			if (this.currentStyle.gender == "neutral")
				element.innerHTML = getLocByDomain("loc6", currentLocale);
			else
				element.innerHTML = getLocByDomain("loc5", currentLocale);
		}
	}
	
	this.setHeadline3 = function(element) {
		if (element != null) {
			if (this.currentStyle.gender == "neutral")
				element.innerHTML = getLocByDomain("loc7", currentLocale);
			else
				element.innerHTML = getLocByDomain("loc8", currentLocale);
		}
	}

	this.updateRecommendationIFrame = function(){		
		updateReIFrame(this.currentStyle.SKU);
	}
	
	/* Update Template dv_productimages.isml*/
	this.updateProductImages = function() {
		this.updateVideoButton();	
	}
	
	this.updateVideoButton = function() {
		var videoButtonDiv = document.getElementById("videoButton");
		var zoomVideoButton = document.getElementById("zoomVideoButton");
		
		videoButtonDiv.innerHTML = "";
		zoomVideoButton.style.display = "none";
		
		var playerVersion = swfobject.getFlashPlayerVersion();
		if((playerVersion.major == 0) && (playerVersion.minor == 0)&& (playerVersion.release == 0)){
			//Kein Flash
			return false;
		}
		
		if (this.currentStyle.video != null) {			
			var img = new Image();
			img.src = WebRoot + "imagesOnline/productdetail/video.gif";
			img.style.cursor = "pointer";
			img.onclick = function(){
					showzoombg();
					resetZoomVideoLayer('on');
					viewController.updateVideoLayer();
				      };
			videoButtonDiv.appendChild(img);			
			zoomVideoButton.style.display = "block";			
		}			
	}
	
	this.updateVideoLayer = function(){
		if (this.currentStyle.video != null) {			
			//Mehrere Videos können kommasepariert geliefert werden, es wird nur das 1. angezeigt:
			
			if(this.currentStyle.video.indexOf(',') != -1){
				var videos = this.currentStyle.video.split(",");			
				showVideoLayer(videos[0]+".flv");
				
				var temp = "";
				for(var i=0; i<videos.length; i++){
					cv = videos[i] + ".flv";
					temp += "<div style=\"cursor:pointer;\" onclick=\"showVideoLayer('"+cv+"')\"><img src=\""+WebRoot+"imagesOnline/productdetail/video"+(i+1)+".jpg\" border=\"0\"></div><br>";							
				}								
				document.getElementById("videoFlashListe").innerHTML = temp;	
				document.getElementById("playAgainButton").style.display = "none";
				document.getElementById("videoFlashListe").style.display = "block";
			}		
			else{
				document.getElementById("videoFlashListe").style.display = "none";				
				document.getElementById("playAgainButton").style.display = "block";
				showVideoLayer(this.currentStyle.video+".flv")
			}
			
		}
		
	}
	
	
	
	this.updateZoomLayer = function() {
		temp = "";
		var imagesBySelectedVariation 	= new Set();		
		var zoomBySelectedVariation 	= new Set();

		var minLength = bundle.mainImages.length()<bundle.mainImagesZoom.length()?bundle.mainImages.length():bundle.mainImagesZoom.length();
		for(var i=0; i<minLength; i++){
			imagesBySelectedVariation.add(bundle.mainImages.elementAt(i));
			ind = bundle.mainImagesZoom.elementAt(i).indexOf(".");
			tifPicture = bundle.mainImagesZoom.elementAt(i).substr(0, ind);
  			//tifPicture = bundle.mainImagesZoom.elementAt(i).substr(0, ind) + ".tif";
			zoomBySelectedVariation.add(tifPicture);
		}
		
		minLength = bundle.multiImages.length()<bundle.multiImagesZoom.length()?bundle.multiImages.length():bundle.multiImagesZoom.length();
		for(var i=0; i<minLength; i++){
			imagesBySelectedVariation.add(bundle.multiImages.elementAt(i));
			ind = bundle.multiImagesZoom.elementAt(i).indexOf(".");  
			tifPicture = bundle.multiImagesZoom.elementAt(i).substr(0, ind);
	  		//tifPicture = bundle.multiImagesZoom.elementAt(i).substr(0, ind) + ".tif";
			zoomBySelectedVariation.add(tifPicture);			
		}		
		
		minLength = this.currentStyle.mainImages.length()<this.currentStyle.mainImagesZoom.length()?this.currentStyle.mainImages.length():this.currentStyle.mainImagesZoom.length();
		for(var i=0; i<minLength; i++){
			imagesBySelectedVariation.add(this.currentStyle.mainImages.elementAt(i));
			ind = this.currentStyle.mainImagesZoom.elementAt(i).indexOf(".");  
			tifPicture = this.currentStyle.mainImagesZoom.elementAt(i).substr(0, ind);
  			//tifPicture = this.currentStyle.mainImagesZoom.elementAt(i).substr(0, ind) + ".tif";
			zoomBySelectedVariation.add(tifPicture);
		}
		
		minLength = this.currentStyle.multiImages.length()<this.currentStyle.multiImagesZoom.length()?this.currentStyle.multiImages.length():this.currentStyle.multiImagesZoom.length();
		for(var i=0; i<minLength; i++){
			imagesBySelectedVariation.add(this.currentStyle.multiImages.elementAt(i));			
			ind = this.currentStyle.multiImagesZoom.elementAt(i).indexOf(".");  
			tifPicture = this.currentStyle.multiImagesZoom.elementAt(i).substr(0, ind);
			//tifPicture = this.currentStyle.multiImagesZoom.elementAt(i).substr(0, ind) + ".tif";
			zoomBySelectedVariation.add(tifPicture);
		}
		
		//Artikelbilder vom aktueller Farbe
		var variations = this.currentStyle.getVariationsByColor(this.selectedColor);
		if(variations[0].mainImages != null){
			minLength = variations[0].mainImages.length()<variations[0].mainImagesZoom.length()?variations[0].mainImages.length():variations[0].mainImagesZoom.length();
			for(var i=0; i<minLength; i++){				
				imagesBySelectedVariation.add(variations[0].mainImages.elementAt(i));
				ind = variations[0].mainImagesZoom.elementAt(i).indexOf(".");  
	  			tifPicture = variations[0].mainImagesZoom.elementAt(i).substr(0, ind);
	  			//tifPicture = variations[0].mainImagesZoom.elementAt(i).substr(0, ind) + ".tif";
				zoomBySelectedVariation.add(tifPicture);
			}
		}
		
		if(variations[0].multiImages != null){
			minLength = variations[0].multiImages.length()<variations[0].multiImagesZoom.length()?variations[0].multiImages.length():variations[0].multiImagesZoom.length();
			for(var i=0; i<minLength; i++){				
				imagesBySelectedVariation.add(variations[0].multiImages.elementAt(i));
				ind = variations[0].multiImagesZoom.elementAt(i).indexOf(".");  
	  			tifPicture = variations[0].multiImagesZoom.elementAt(i).substr(0, ind);
	  			//tifPicture = variations[0].multiImagesZoom.elementAt(i).substr(0, ind) + ".tif";
				zoomBySelectedVariation.add(tifPicture);
				
			}
		}
		
		//Artikelbilder von saemtlichen Variationen hinzufuegen:		
		var variations = this.currentStyle.getVariationsByColor(null);
		
		
		for(var k=0; k<variations.length; k++){
			if(variations[k].mainImages != null){
				minLength = variations[k].mainImages.length()<variations[k].mainImagesZoom.length()?variations[k].mainImages.length():variations[k].mainImagesZoom.length();
				for(var i=0; i<minLength; i++){				
					imagesBySelectedVariation.add(variations[k].mainImages.elementAt(i));
					ind = variations[k].mainImagesZoom.elementAt(i).indexOf(".");  
		  			tifPicture = variations[k].mainImagesZoom.elementAt(i).substr(0, ind);
		  			//tifPicture = variations[k].mainImagesZoom.elementAt(i).substr(0, ind) + ".tif";
					zoomBySelectedVariation.add(tifPicture);
				}
			}
		
			if(variations[k].multiImages != null){
				minLength = variations[k].multiImages.length()<variations[k].multiImagesZoom.length()?variations[k].multiImages.length():variations[k].multiImagesZoom.length();
				for(var i=0; i<minLength; i++){				
					imagesBySelectedVariation.add(variations[k].multiImages.elementAt(i));
					ind = variations[k].multiImagesZoom.elementAt(i).indexOf(".");  
		  			tifPicture = variations[k].multiImagesZoom.elementAt(i).substr(0, ind);
		  			//tifPicture = variations[k].multiImagesZoom.elementAt(i).substr(0, ind) + ".tif";
					zoomBySelectedVariation.add(tifPicture);
					
				}
			}	
		}
		
		
		
		if(zoomBySelectedVariation.length() != 0){
			temp += "<ul id=\"zoomcarousel\" class=\"jcarousel jcarousel-skin-zoom\">";
		
			for(var i=0; i<imagesBySelectedVariation.length(); i++){			
				temp += "<li><table cellpadding=\"0\" cellspacing=\"0\" width=\"104\" border=\"0\" style=\"cursor:pointer;\" onclick=\"showZoomImage('"+zoomBySelectedVariation.elementAt(i)+"','http://image01.otto.de/pool/format_hv_ea_1/"+imagesBySelectedVariation.elementAt(i)+"');\"><tr height=\"115\"><td width=\"9\" class=\"bge6e6e6\">&nbsp;</td><td width=\"86\"><img src=\""+imageServer+"/format_hv_ea_5/"+imagesBySelectedVariation.elementAt(i)+"\" width=\"86\" alt=\"\" /></td><td width=\"9\" class=\"bge6e6e6\">&nbsp;</td></tr></table></li>";		
			}
			temp +="</ul>";
			
			document.getElementById("articleImagesLayer").innerHTML = temp;	
			this.updateZoomFlashPlayer();
			
			jQuery('#zoomcarousel').jcarousel({
				vertical: true,
				scroll: 1
			});
			
			if(zoomBySelectedVariation.length() == 1)
				document.getElementById("textZoomButton").style.visibility = 'hidden';
			else
				document.getElementById("textZoomButton").style.visibility = 'visible';	
			
			document.getElementById("imageZoomButton").style.visibility = 'visible';	
		}
		else{
			document.getElementById("textZoomButton").style.visibility = 'hidden';	
			document.getElementById("imageZoomButton").style.visibility = 'hidden';		
		}
			
	}
	
	this.updateZoomFlashPlayer = function() {
		var temp = this.currentStyle.getMainImageZoom();
		var temp2 = this.currentStyle.getMainImage();
		
		if (this.selectedVariation != null) {
			temp = this.selectedVariation.getMainImageZoom();
			temp2 = this.selectedVariation.getMainImage();
		} else if (this.selectedColor != null) {
			var variations = this.currentStyle.getVariationsByColor(this.selectedColor);
			if (variations.length > 0){
				temp = variations[0].getMainImageZoom();
				temp2 = variations[0].getMainImage();
			}
		}		
		ind = temp.indexOf(".");
		ind2 = temp2.indexOf(".");
	  	tifPicture = temp.substr(0, ind);
	  	jpgPicture = temp2.substr(0, ind2) + ".jpg";		
		showZoomImage(tifPicture,'http://image01.otto.de/pool/format_hv_ea_1/'+jpgPicture);
	}
	
	
	/* Update KAL availability information */
	this.updateKalInformation = function() {
		// cancel a possibly active AJAX request
		if (this.currentKalRequest != null)
			this.currentKalRequest.cancel();

		if (!this.currentStyle.hasKalUpdates) {
			var kalRequestString;
			if(currentLocale == "Helline-HellineFr-Site"){
				kalRequestString = this.currentStyle.toKalRequestHelline();
			}
			else{
				kalRequestString = this.currentStyle.toKalRequest();
			}
			
			this.currentKalRequest = new KalRequest();
			this.currentKalRequest.initiate(this, kalRequestURL, kalRequestString);
		}
	}
	
	this.onKalSuccess = function(xml) {
		
		viewController.currentStyle.hasKalUpdates = true;
		viewController.kalResponse = xml;
		var articleNotAvailableSet = new Set();

		if (viewController.currentStyle.variations.length > 0) {			
			// update availability for each product variation			
			for (var i = 0; i < viewController.currentStyle.variations.length; i++) {				
				if(currentLocale == "Helline-HellineFr-Site"){
					var splitSKU_helline = viewController.currentStyle.variations[i].SKU.split("-");
					var articleNo_helline = splitSKU_helline[0];
					var promo_helline = splitSKU_helline[0].substr(6);
					if (viewController.currentStyle.variations[i].originalSize) {
						var size_helline = viewController.currentStyle.variations[i].originalSize;
					} else {
						var size_helline = splitSKU_helline[1];
					}
					var SKU_helline = articleNo_helline +"-"+size_helline+"-"+splitSKU_helline[2];
					viewController.currentStyle.variations[i].availability = getDeliveryDesignation(xml, SKU_helline);
					if(viewController.currentStyle.variations[i].availability == 2){
						
						viewController.currentStyle.variations[i].availabilityStatement = getDeliveryStatement(xml, SKU_helline);	
					}
					
					var temp_X = articleNo_helline + '+' +viewController.currentStyle.variations[i].availability;
					articleNotAvailableSet.add(temp_X);
				}
				else{
					viewController.currentStyle.variations[i].availability = getDeliveryDesignation(xml, viewController.currentStyle.variations[i].SKU);
					if(viewController.currentStyle.variations[i].availability == 2){
						
						viewController.currentStyle.variations[i].availabilityStatement = getDeliveryStatement(xml, viewController.currentStyle.variations[i].SKU);	
					}
				}
			}
		} else {
			// update availability information for style
			viewController.currentStyle.availability = getDeliveryDesignation(xml, viewController.currentStyle.SKU);
			if(viewController.currentStyle.availability == 2){
				viewController.currentStyle.availabilityStatement = getDeliveryStatement(xml, viewController.currentStyle.SKU);				
			}
		}
		if(requestJunior)
			viewController.sendNotAvailableOnRecommendation(articleNotAvailableSet);
		viewController.updateDependendFields();
	}
	
	this.onKalError = function() {
		// Error handling (usually noop)
	}
	
	
	
	this.sendNotAvailableOnRecommendation = function(articleNotAvailableSet){		
		var tempReString = "";		
		var tempSet = new Set();


		//alle LIB oder NALI
		var allAvailable = true;
		for (var i = 0; i < articleNotAvailableSet.length(); i++) {
			var elementI = articleNotAvailableSet.elementAt(i).split('+');
			if(elementI[1] == '1'){
				allAvailable = false;
				break;
			}				
		}

		if(allAvailable)
			return false;

		//Set beinhaltet NILI
		for (var i = 0; i < articleNotAvailableSet.length(); i++) {
			var setElementI = articleNotAvailableSet.elementAt(i).split('+');
			
			if(setElementI[1] == '1'){
				if(articleNotAvailableSet.contains(setElementI[0] +'+0') || articleNotAvailableSet.contains(setElementI[0] +'+2')){}
				else{
					tempSet.add(setElementI[0]);
				}			
			}
		}
		
		if(tempSet.length() != 0){
			for (var i = 0; i < tempSet.length(); i++) {
				tempReString += tempSet.elementAt(i) + ',';
			}		
			var outputArtNo = tempReString.substring(0, tempReString.length-1);
			var reAjaxUrl = '';
			reAjaxUrl += ajaxRecomURL + "&avalability=false&sku=" +outputArtNo;
			//alert(reAjaxUrl);

			jQuery.ajax({
				cache: false,
				error: function(){},
				processData: false,
				success: function(){},
				url: reAjaxUrl
			});
		}
	}
	
	
	
	
	/* Update all fields that depend on variation selection */
	this.updateDependendFields = function() {
		this.selectedVariation = null;
		var variations = this.currentStyle.getVariationsByColor(this.selectedColor);
		
		for (var i = 0; i < variations.length; i++) {
			if ((variations[i].dim3 == this.selectedDim3) &&
			    (variations[i].size == this.selectedSize)) {
				this.selectedVariation = variations[i];
				break;
			}
		}
		
		this.updateArticleNumber();
		this.updatePrice();
		this.updateAvailability();
		this.updateMainImage();
		this.updateZoomLayer();
	}
	
	/* Initialize variation selection boxes */
	this.initVariationSelectors = function() {
		if (this.currentStyle.colors.length() > 0) {
			var colorSelectBox = document.getElementById("colorSelection");
			colorSelectBox.innerHTML = "";
			this.currentStyle.colors.each(function(color){
				var opt = new Option();
				opt.text = entity2char(color);
				if(currentLocale == "Heine-HeineCh-Site"){
					opt.text = char2Swiss(entity2char(color));
				}
				
				opt.value = color;
				try {
					colorSelectBox.add(opt, null);
				} catch (ex) {
					colorSelectBox.add(opt);
				}
			});
			
			var currentColorIndex = 0;
			
			//Farbe wird anhand der ersten mit der passenden Farbe gefundenen Variation gesetzt, 
			//erfordert übergabe der ArticleNo:
			var queryVariation = this.currentStyle.getVariationByArticleNo(queryArticleNo);
			if(queryVariation != null){				
				for(var i=0; i< this.currentStyle.colors.length(); i++){
					//alert(this.currentStyle.colors.elementAt(i) +" | "+ queryVariation.color)
					if(this.currentStyle.colors.elementAt(i) == queryVariation.color){
						currentColorIndex = i;	
						break;					
					}
				}
			}
			
			colorSelectBox.selectedIndex = currentColorIndex;
			highlightMiniColor(currentColorIndex, "on");
			
			//Reset ArticleNo für weitere Styles?
			//queryArticleNo = null;
			this.selectedColor = this.currentStyle.colors.elementAt(currentColorIndex);
			document.getElementById("colorSelector").style.display = "block";
			document.getElementById("colorChooser").style.display = "block";
			this.updateDim3Selector(this.selectedColor);
		} else {
			document.getElementById("colorSelector").style.display = "none";
			document.getElementById("colorChooser").style.display = "none";
			this.selectedColor = null;
			
			this.updateDim3Selector(null);
		}
	}
	
	/* Update Dim3 selection box dependent on chosen color */
	this.updateDim3Selector = function(color) {
		var variations = this.currentStyle.getVariationsByColor(color);
		this.selectedDim3 = null;
		
		if (variations.length == 0) {
			document.getElementById("dim3Selector").style.display = "none";
			document.getElementById("sizeSelector").style.display = "none";
			return;
		}
		
		if (variations[0].dim3 == null) {
			document.getElementById("dim3Selector").style.display = "none";
			
			this.updateSizeSelector(color, null);
		} else {
			var dim3SelectBox = document.getElementById("dim3Selection");
			dim3SelectBox.innerHTML = "";
			
			var dim3Set = new Set();
			for (var i = 0; i < variations.length; i++) {
				if ((color == null) || (variations[i].color == color))
					dim3Set.add(variations[i].dim3);
			}
			
			var opt = new Option();
			opt.text = getLocByDomain("loc35", currentLocale);
			opt.value = "null";
			try {
				dim3SelectBox.add(opt, null);
			} catch (ex) {
				dim3SelectBox.add(opt);
			}
			
			dim3Set.sort();
			dim3Set.each(function(dim3){
				opt = new Option();
				opt.text = entity2char(dim3);
				if(currentLocale == "Heine-HeineCh-Site"){
					opt.text = char2Swiss(entity2char(dim3));
				}
				opt.value = dim3;
				try {
					dim3SelectBox.add(opt, null);
				} catch (ex) {
					dim3SelectBox.add(opt);
				}
			});
			dim3SelectBox.selectedIndex = 0;
			document.getElementById("dim3Selector").style.display = "block";
			
			this.updateSizeSelector(color, null);
		}
	}
	
	this.updateDim3SelectorFromSize = function(color) {
		var variations = this.currentStyle.getVariationsByColor(color);
		var dim3SelectBox = document.getElementById("dim3Selection");
		
		if ((variations.length > 0) && variations[0].dim3) {
			var newDim3 = null;
			for (var i = 0; i < variations.length; i++) {
				if (variations[i].size == this.selectedSize) {
					newDim3 = variations[i].dim3;
					if (variations[i].dim3 == this.selectedDim3)
						break;
				}
			}
			
			for (var i = 0; i < dim3SelectBox.options.length; i++) {
				if (dim3SelectBox.options[i].value == newDim3) {
					dim3SelectBox.selectedIndex = i;
					break;
				}
			}
			
			this.selectedDim3 = newDim3;
		}
	}
	
	/* Update size selection box dependent on chosen color and Dimension3 */
	this.updateSizeSelector = function(color, dim3) {
		this.selectedSize = null;
		var variations = this.currentStyle.getVariationsByColor(color);
		
		if (variations.length == 0) {
			document.getElementById("dim3Selector").style.display = "none";
			document.getElementById("sizeSelector").style.display = "none";
			return;
		}
		
		if (variations[0].size == null) {
			document.getElementById("sizeSelector").style.display = "none";
			return;
		}
		else{			
			document.getElementById("sizeSelector").style.display = "block";
		}
		
		var sizeSelectBox = document.getElementById("sizeSelection");
		sizeSelectBox.innerHTML = "";
		
		var sizeSet = new Set();

		for (var i = 0; i < variations.length; i++) {
			if ((dim3 == null) || (variations[i].dim3 == dim3))
				sizeSet.add(variations[i].size);
		}
		var opt = new Option();		
		opt.text = getLocByDomain("loc9", currentLocale);
		opt.value = "null";
		try {
			sizeSelectBox.add(opt, null);
		} catch (ex) {
			sizeSelectBox.add(opt);
		}

		sizeSet.sort();
		sizeSet.each(function(size){
			opt = new Option();
			opt.text = entity2char(size);
			opt.value = size;
			try {
				sizeSelectBox.add(opt, null);
			} catch (ex) {
				sizeSelectBox.add(opt);
			}
		});
	}
	
	this.updateShortDesription = function(){
		var temp = "";
		if(currentLocale == "Heine-HeineCh-Site"){
			temp += char2Swiss(this.currentStyle.name);
		}
		else{
			temp += this.currentStyle.name;
		}
		temp +='<div id="productPrices">';
		if(this.currentStyle.priceOld != null)
			temp += "<span class=\"productOldPrice\"><strike>"+this.currentStyle.priceOld+"</strike></span>&nbsp;";
		if(this.currentStyle.priceNew != null)
			temp += "<span class=\"productMinPrice\">"+this.currentStyle.priceNew+"</span>&nbsp;";
		if(this.currentStyle.priceOld != null)
			temp += "<span class=\"productReduce\">"+getLocByDomain("loc10", currentLocale)+" "+this.currentStyle.priceDifference+"!</span>&nbsp;";
		temp += '</div>';
		document.getElementById("productShortDecsription").innerHTML = temp;
		
		
	}
	
	this.updateProductPrices = function(){
		var temp = "";
		if(this.currentStyle.priceOld != null)
			temp += "<span class=\"productOldPrice\"><strike>"+this.currentStyle.priceOld+"</strike></span>&nbsp;";
		if(this.currentStyle.priceNew != null)
			temp += "<span class=\"productMinPrice\">"+this.currentStyle.priceNew+"</span>&nbsp;";
		if(this.currentStyle.priceOld != null)
			temp += "<span class=\"productReduce\">"+getLocByDomain("loc10", currentLocale)+" "+this.currentStyle.priceDifference+"!</span>&nbsp;";
		
		if(document.getElementById("productPrices") != null){
			document.getElementById("productPrices").innerHTML = temp;
		}
	}
	
	this.updateProductFlags = function() {
		var productFlagsDiv = document.getElementById("productFlags");
		if (productFlagsDiv == null)
			return;
		
		productFlagsDiv.innerHTML = "";
		
		// TODO: Neu
		
		// Nur Online!
		if (this.currentStyle.isExclusive()) {
			var img = new Image();
			img.src = WebRoot + "imagesOnline/productdetail/nur_online.gif";
			img.alt = getLocByDomain("loc11", currentLocale);
			productFlagsDiv.appendChild(img);
			productFlagsDiv.style.display = "block";
			if(document.getElementById("productShortDecsription") != null){
				document.getElementById("productShortDecsription").style.marginTop = "0px";
			}
		}
		else{
			productFlagsDiv.style.display = "none";
			if(document.getElementById("productShortDecsription") != null){
				document.getElementById("productShortDecsription").style.marginTop = "-3px";
			}
		}
	}
	
	this.updateManufacturer =function(){
		var temp = getManufacturerMapping(this.currentStyle.manufacturer);
		if (temp != "")
			document.getElementById("productManufacturer").innerHTML = "<img src=\""+WebRoot+"imagesOnline/detailview/manufacturer/"+temp+"\" alt=\""+temp+"\">";
		else
			document.getElementById("productManufacturer").innerHTML = "";
	}
	
	this.updateMainImage = function(){
		var temp = this.currentStyle.getMainImage();
		
		if (this.selectedVariation != null) {
			temp = this.selectedVariation.getMainImage();
		} else if (this.selectedColor != null) {
			var variations = this.currentStyle.getVariationsByColor(this.selectedColor);
			if (variations.length > 0)
				temp = variations[0].getMainImage();
		}
		
		document.getElementById("productMainImage").innerHTML = "<img name=\"defaultBild\" src=\""+imageServer+"/format_hv_ea_2/"+temp+"\" alt=\"\" border=\"0\">";
		
	}
	
	this.updateColorChooser = function(){
	
		var temp = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
		temp +="<tr><td><img src=\""+WebRoot+"imagesOnline/productdetail/colorchooser_top.gif\"></td></tr>";
		temp +="<tr><td align=\"left\" valign=\"top\" class=\"colorChooser\">";
		temp +=getLocByDomain("loc38", currentLocale);
		temp +="<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin-top:5px;\">";
		temp +="<tr height=\"40\" valign=\"top\">";
		
		this.currentStyle.getVariationsByColor();
		
		for(var i=0; i< this.currentStyle.colors.length(); i++){

			var miniColor = getSearchColor(this.currentStyle.colorMapping[this.currentStyle.colors.elementAt(i)], "gross");
			var miniColorTitle = this.currentStyle.colors.elementAt(i);
			if(currentLocale == "Heine-HeineCh-Site"){
				miniColorTitle = char2Swiss(miniColorTitle);
			}
			
			//show first colorSample, miniColor is default
			miniColorURL = WebRoot+"imagesOnline/productdetail/farbflecken/"+miniColor;
			if(this.currentStyle.colorSamples.elementAt(i) != null){				
				miniColorURL = imageServer+ "/formatSonstiges/hv_colorsamplethumb/" +this.currentStyle.colorSamples.elementAt(i);
			}
			
			temp += "<td width=\"32\"><div class=\"minicolor\" id=\"mc"+i+"\"><img title=\""+miniColorTitle+"\" class=\"minicolorimg\" src=\"" +miniColorURL+ "\" width=\"25\" height=\"25\" onmouseover=\"highlightMiniColor(" + i + ", 'on')\" onmouseout=\"highlightMiniColor(" + i + ", 'off')\" onclick=\"updateColorSample(" + i + ")\"><img id=\"mca"+i+"\" src=\""+WebRoot+"imagesOnline/productdetail/farbflecken/leer.gif\"></div></td>";
			
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==0)){}
			else if((i+1)%6==0){
				temp += "<tr height=\"40\" valign=\"top\">";
			}				
			else{}
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==1)){
				temp += "<td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td>";				
			}								
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==2)){
				temp += "<td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td>";				
			}
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==3)){
				temp += "<td width=\"32\"></td><td width=\"32\"></td><td width=\"32\"></td>";				
			}
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==4)){
				temp += "<td width=\"32\"></td><td width=\"32\"></td>";				
			}
			if((i==(this.currentStyle.colors.length()-1)) && ((i+1)%6==5)){
				temp += "<td width=\"32\"></td>";				
			}
		}
		
		temp +="</tr></table></td></tr>";
		temp +="<tr><td><img src=\""+WebRoot+"imagesOnline/productdetail/colorchooser_bottom.gif\"></td></tr></table>";
		
		document.getElementById("colorChooser").innerHTML = temp;		
	
	}
	
	
	this.updateLongDescription = function(){
		
		/*Aus der MMDB kommen Javascript-Links auf Glossar hart reinkodiert mit
		(<A HREF="Javascript:OpenGlossar(1862);"><ovs>Figurbetonte Form<ovi></A>)
		diese fuer die Weiterleitung entfernt
		*/
		
		
		var serviceDescription = "";
		var serviceFlags = this.currentStyle.getServiceFlags();
		
		for (var i = 0; i < serviceFlags.length; i++) {
			serviceDescription += "<img title=\""+getStyleFlagImageMapping(serviceFlags[i], currentLocale)+"\" onclick=\"showProductInformation();\" style=\"cursor:pointer;\" src=\""+WebRoot+"/imagesOnline/detailview/"+getStyleFlagMapping(serviceFlags[i])+"\"> ";
		}
		
		if (serviceFlags.length > 0) {
			serviceDescription = "<br>"+ serviceDescription;
		}
		
		var longDescription = this.currentStyle.description.replace(/<A HREF=/g, "<A class=\"service2\" HREF=");
		if((cutLD = cutLongDescription(longDescription, 25)) != null){
			productinformationDescriptionInnerHTML = cutLD +"<div style=\"cursor:pointer;text-decoration:underline;\" onclick=\"showProductInformation();showLPDlong();\"> <b>"+getLocByDomain("loc0", currentLocale)+"</b></div>"+ serviceDescription;
			if(currentLocale == "Heine-HeineCh-Site"){
				productinformationDescriptionInnerHTML = char2Swiss(productinformationDescriptionInnerHTML);
			}
			document.getElementById("productinformationDescription").innerHTML = productinformationDescriptionInnerHTML;
						
			productLongDescriptionInnerHTML = cutLD+ "<div style=\"cursor:pointer;text-decoration:underline;text-align:right;\" onclick=\"showLPDlong();\"> <b>"+getLocByDomain("loc0", currentLocale)+"</b></div>";
			if(currentLocale == "Heine-HeineCh-Site"){
				productLongDescriptionInnerHTML = char2Swiss(productLongDescriptionInnerHTML);
			}
			document.getElementById("productLongDescription").innerHTML = productLongDescriptionInnerHTML;
			
			productinformationDescriptionLongInnerHTML = longDescription+ "<div style=\"cursor:pointer;text-decoration:underline;text-align:right;\" onclick=\"showLPDshort();\"> <b>"+getLocByDomain("loc1", currentLocale)+"</b></div>"
			if(currentLocale == "Heine-HeineCh-Site"){
				productinformationDescriptionLongInnerHTML = char2Swiss(productinformationDescriptionLongInnerHTML);
			}
			document.getElementById("productinformationDescriptionLong").innerHTML = productinformationDescriptionLongInnerHTML;
		}
		else{			
			productLongDescriptionInnerHTML = longDescription+"<br>"+serviceDescription;
			if(currentLocale == "Heine-HeineCh-Site"){
				productLongDescriptionInnerHTML = char2Swiss(productLongDescriptionInnerHTML);
			}			
			document.getElementById("productinformationDescription").innerHTML  = productLongDescriptionInnerHTML;
			
			productLongDescriptionInnerHTML = longDescription;
			if(currentLocale == "Heine-HeineCh-Site"){
				productLongDescriptionInnerHTML = char2Swiss(productLongDescriptionInnerHTML);
			}			
			document.getElementById("productLongDescription").innerHTML = productLongDescriptionInnerHTML;
			
			productinformationDescriptionLongInnerHTML = longDescription;
			if(currentLocale == "Heine-HeineCh-Site"){
				productinformationDescriptionLongInnerHTML = char2Swiss(productinformationDescriptionLongInnerHTML);
			}
			document.getElementById("productinformationDescriptionLong").innerHTML = productinformationDescriptionLongInnerHTML;
		}
		document.getElementById("artDescriptionTitle").style.display = "block";		
	}	
	
	this.updateArticleNumber = function(){
		
		if (this.selectedVariation != null) {
			var artno = this.selectedVariation.SKU.split("-")[0];
			document.getElementById("productArticleNo").innerHTML = artno.slice(0, 3) +" "+artno.slice(3, 6)+" "+artno.slice(6, artno.length);
		} else {
			var variations = this.currentStyle.getVariationsByColor(this.selectedColor);
			
			var filteredVariations = [];
			if (this.selectedDim3 == null) {
				filteredVariations = variations;
			} else {
				for (var i = 0; i < variations.length; i++) {
					if (this.selectedDim3 == variations[i].dim3)
						filteredVariations.push(variations[i]);
				}
			}
			
			var lastArticleNo = filteredVariations[0].SKU.split('-')[0];
			for (var i = 0; i < filteredVariations.length; i++) {
				if (lastArticleNo != filteredVariations[i].SKU.split('-')[0]) {
					document.getElementById("productArticleNo").innerHTML = "";
					return;
				}
			}
			document.getElementById("productArticleNo").innerHTML = lastArticleNo.slice(0, 3) +" "+lastArticleNo.slice(3, 6)+" "+lastArticleNo.slice(6, lastArticleNo.length);;
		}		
	}
	
	this.updatePrice = function() {
		if (this.selectedVariation != null) {
			document.getElementById("priceOfSelection").innerHTML = this.selectedVariation.price;
		} else {
			document.getElementById("priceOfSelection").innerHTML = "";
		}
	}
	
	this.updateAvailability = function() {
		
		if (this.selectedVariation != null) {
			
			switch (this.selectedVariation.availability) {
				case 0:					
					if(currentLocale == "Heine-HeineNL-Site"){
						document.getElementById("deliveryState").innerHTML = availability.slbMessage_nl;	
					}
					else if(currentLocale == "Helline-HellineFr-Site"){
						document.getElementById("deliveryState").innerHTML = availability.slbMessage_fr;	
					}
					else{
						document.getElementById("deliveryState").innerHTML = availability.slbMessage;
					}
					document.getElementById("deliveryState").style.color = "#06A102";
					break;
				
				case 1:
					
					if(currentLocale == "Heine-HeineNL-Site"){
						document.getElementById("deliveryState").innerHTML = availability.niliMessage_nl;	
					}
					else if(currentLocale == "Helline-HellineFr-Site"){
						document.getElementById("deliveryState").innerHTML = availability.niliMessage_fr;	
					}
					else{
						document.getElementById("deliveryState").innerHTML = availability.niliMessage;
					}					
					document.getElementById("deliveryState").style.color = "red";
					break;
				
				case 2:
					
					if (this.selectedVariation.parent.hasKalUpdates) {
						// TODO: KAL Auskunft auslesen
						//alert(this.kalResponse);
						
						var statementCode = this.selectedVariation.availabilityStatement;
						
						if (statementCode)
							if(currentLocale == "Heine-HeineNL-Site"){
								document.getElementById("deliveryState").innerHTML = availability.naliMessage_nl[statementCode];
							}
							else if(currentLocale == "Helline-HellineFr-Site"){
								document.getElementById("deliveryState").innerHTML = availability.naliMessage_fr[statementCode];	
							}
							else{
								document.getElementById("deliveryState").innerHTML = availability.naliMessage[statementCode];
							}
							
							
					} else {
						if(currentLocale == "Heine-HeineNL-Site"){
							document.getElementById("deliveryState").innerHTML = availability.naliMessage_nl[0];
						}
						else if(currentLocale == "Helline-HellineFr-Site"){
							document.getElementById("deliveryState").innerHTML = availability.naliMessage_fr[0];
						}
						else{
							document.getElementById("deliveryState").innerHTML = availability.naliMessage[0];
						}
					}
					document.getElementById("deliveryState").style.color = "#dc7700";
					break;
			}
		} else {
			document.getElementById("deliveryState").innerHTML = "";
		}
	}
	
	
	this.updateServiceFlags = function(){
		
		var temp = "";
		var serviceFlags = this.currentStyle.getServiceFlags();
		
		if(serviceFlags.length > 0){
			temp = "<div class=\"divider1\">";
			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
			temp += "<tr>";
			temp += "<td class=\"variationTitle\" width=\"84\" valign=\"top\">"+getLocByDomain("loc12", currentLocale)+"</td>";
			temp += "<td align=\"left\">";
			temp += "<table>";
			
			for(var i=0; i<serviceFlags.length; i++){
				
				temp += "<tr height=\"37\">";					
				temp += "<td valign=\"top\"><img onclick=\"selectDetailTab2('detailTab2');\" style=\"cursor:pointer;\" src=\""+WebRoot+"/imagesOnline/detailview/"+getStyleFlagMapping(serviceFlags[i])+"\"></td>";
				temp += "<td class=\"verdana11pxnormal\" onclick=\"selectDetailTab2('detailTab2');\" style=\"padding-left:5px;cursor:pointer;\">"+getStyleFlagImageMapping(serviceFlags[i], currentLocale)+"</td>";
				temp += "</tr>";				
			}
			
			temp += "</table>";
			temp += "</td>";
			temp += "</tr>";
			temp += "</table>";
			temp += "</div>";
		}
		
		productServiceFlagsInnerHTML = temp;
		if(currentLocale == "Heine-HeineCh-Site"){
			productServiceFlagsInnerHTML = char2Swiss(productServiceFlagsInnerHTML);
		}		
		document.getElementById("productServiceFlags").innerHTML = productServiceFlagsInnerHTML;
			
	}
	
	this.updateMaterialFlags = function(){
		
		var temp = "";
		if(this.currentStyle.materialFlags.length() > 0){
			temp += "<div class=\"divider1\">";
			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
			temp += "<tr>";
			temp += "<td class=\"variationTitle\" width=\"84\" valign=\"top\">"+getLocByDomain("loc13", currentLocale)+"</td>";
			temp += "<td align=\"left\">";
			temp += "<table>";
						
			for (var i=0; i<this.currentStyle.materialFlags.length(); i++){
			
				var matImage = getMaterialImageMapping(this.currentStyle.materialFlags.elementAt(i));
				var matText = getDetailViewMaterialTextMapping(this.currentStyle.materialFlags.elementAt(i), currentLocale);
				temp += "<tr height=\"37\"><td valign=\"top\"><img src=\""+WebRoot+"imagesOnline/detailview/"+matImage+"\"></td><td class=\"verdana11pxnormal\" style=\"padding-left:5px;\">"+matText+"</td></tr>"
			}
			
			temp += "</table>";
			temp += "</td>";
			temp += "</tr>";
			temp += "</table>";
			temp += "</div>";
			document.getElementById("productMaterialFlags").innerHTML = temp;
		} else {
			document.getElementById("productMaterialFlags").innerHTML = "";
		}
							
	}
	
	
	this.updateRecommendationAtPI = function(){
		this.updateRecPIBundleImage();
		//this.updateRecPIStyleSlider();
	}
	
	this.updateRecPIBundleImage = function(){
		if(document.getElementById("recPIBundleImageA"))
			document.getElementById("recPIBundleImageA").innerHTML = "<img src=\""+imageServer+"/format_home_sorti_2/"+bundle.getMainImage()+"\" width=\"154\">";
		if(document.getElementById("recPIBundleImageB"))
			document.getElementById("recPIBundleImageB").innerHTML = "<img src=\""+imageServer+"/format_home_sorti_2/"+bundle.getMainImage()+"\" width=\"154\">";
		if(document.getElementById("recPIBundleImageC"))
			document.getElementById("recPIBundleImageC").innerHTML = "<img src=\""+imageServer+"/format_home_sorti_2/"+bundle.getMainImage()+"\" width=\"154\">";
	}
	
	
	
	this.updateRecPIStyleSlider = function(){

		var temp = "";
		if(bundle.styles.length != 0){
			//temp += "<ul id=\"styleCarousel\" class=\"styleCarousel jcarousel-skin-style\">";
			for(var i=0; i<bundle.styles.length; i+=4){
				temp += "<li>"  
				temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"249\" height=\"295\">";
				
				for(var k=i; k<i+4; k+=2){
	
					var styleName = "";
					var stylePrice = "";
					var styleImage = "";
					
					temp += "<tr valign=\"top\" height=\"147\">";	
					temp += "<td width=\"50%\" align=\"center\">";
		    				    			
		    			if(bundle.styles[k] != null){
		    				//Element k
			    			styleName = wbr(bundle.styles[k].name);
			    			if(bundle.styles[k].priceOld != null)
			    				stylePrice = "<strike>"+bundle.styles[k].priceOld+"</strike> "+bundle.styles[k].priceNew;
			    			else
			    				stylePrice = bundle.styles[k].priceNew;			    			
			    			styleImage = imageServer+"/format_home_sorti_1/"+bundle.styles[k].getMainImage();
			    			
			    			
			    			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"110\" style=\"cursor:pointer;\" onclick=\"updateControllerByStyleNumber("+k+");window.scrollTo(0,0);\">";
		    				temp += "<tr><td height=\"110\" background=\""+WebRoot+"/imagesOnline/productdetail/formatbackground.gif\" align=\"center\" onmouseover=\"document.getElementById('stylecelltext"+k+"').innerHTML = '"+stylePrice+"'\" onmouseout=\"document.getElementById('stylecelltext"+k+"').innerHTML = '"+styleName+"'\"><img src=\""+styleImage+"\" border=\"0\"></a></td></tr>";
		    				temp += "<tr><td align=\"center\" valign=\"top\"><div id=\"stylecelltext"+k+"\" class=\"stylecelltext\">"+styleName+"</div></td></tr>";
		    				temp += "</table>";
			    			temp += "</td>";
			    			temp += "<td width=\"50%\" align=\"center\">";
		    			}
		    			
		    			if(bundle.styles[k+1] != null){
		    				//Element k
				    		
			    			styleName = wbr(bundle.styles[k+1].name);
			    			if(bundle.styles[k+1].priceOld != null)
			    				stylePrice = "<strike>"+bundle.styles[k+1].priceOld+"</strike> "+bundle.styles[k+1].priceNew;
			    			else
			    				stylePrice = bundle.styles[k+1].priceNew;
			    			styleImage = imageServer+"/format_home_sorti_1/"+bundle.styles[k+1].getMainImage();
			    			
			    			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"110\" style=\"cursor:pointer;\" onclick=\"updateControllerByStyleNumber("+(k+1)+");window.scrollTo(0,0);\">";
		    				temp += "<tr><td height=\"110\" background=\""+WebRoot+"/imagesOnline/productdetail/formatbackground.gif\" align=\"center\" onmouseover=\"document.getElementById('stylecelltext"+(k+1)+"').innerHTML = '"+stylePrice+"'\" onmouseout=\"document.getElementById('stylecelltext"+(k+1)+"').innerHTML = '"+styleName+"'\"><img src=\""+styleImage+"\" border=\"0\"></a></td></tr>";
		    				temp += "<tr><td align=\"center\" valign=\"top\"><div id=\"stylecelltext"+(k+1)+"\" class=\"stylecelltext\">"+styleName+"</div></td></tr>";
		    				temp += "</table>";
		    			}
		    			
		    			
		    			temp += "</td>";
					temp += "</tr>";
						
				}
				
				temp += "</table>";
				temp += "</li>"
			}
			//temp += "</ul>"
			
			
			
			tempA = "<ul id=\"styleCarouselA\" class=\"styleCarouselA jcarousel-skin-style\">"+temp+"</ul>"
			tempB = "<ul id=\"styleCarouselB\" class=\"styleCarouselB jcarousel-skin-style\">"+temp+"</ul>"
			
			
			document.getElementById("recPIStyleCarouselA").innerHTML = tempA;
			document.getElementById("recPIStyleCarouselB").innerHTML = tempB;			
		}
	}
	
	
	this.fireRecommendationPixel = function(){
		
		var serverName = "http://recommender.helline.fr";			
		var frameSrc = serverName + "/RecEngineService/RecEngineService?";
		
		frameSrc += "&sid=" +this.sid;	
		
		if(this.currentStyle.SKU.lastIndexOf('-') != -1){ 
	    		frameSrc += "&sku=" +this.currentStyle.SKU.substring( 0, this.currentStyle.SKU.lastIndexOf('-')); 
		}
		else{
			frameSrc += "&sku=" +this.currentStyle.SKU;
		}
		
		frameSrc += "&e=basket";		
		frameSrc += "&max=" +parseInt(document.getElementById("quantitySelection").value);
		frameSrc += "&recTyp=JSONHandler";
		frameSrc += "&shop=" +currentLocale;		
		
		
		var recommendationPixel = null;
		if(document.getElementById('recommendationPixel') != null){
			recommendationPixel = document.getElementById('recommendationPixel')
		}
		else{
			recommendationPixel = document.createElement("IFRAME");
			recommendationPixel.id = "recommendationPixel";	
			document.body.appendChild(recommendationPixel);
		}
		recommendationPixel.setAttribute("src", frameSrc);
		recommendationPixel.style.border = 0;
		recommendationPixel.style.width = "1px";
		recommendationPixel.style.height = "1px";
			
	}
	
	this.updateRecPIStyleSliderByTab = function(activeLayerTab){
	
		var temp = "";
		if(activeLayerTab == "layerTab0"){
			tabLetter = "a";
		}
		
		else if(activeLayerTab == "layerTab3"){
			tabLetter = "c";
		}
	
		if(bundle.styles.length != 0){
			for(var i=0; i<bundle.styles.length; i+=4){
				temp += "<li>"  
				temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"249\" height=\"295\">";
				
				for(var k=i; k<i+4; k+=2){
	
					var styleName = "";
					var stylePrice = "";
					var styleImage = "";
					
					temp += "<tr valign=\"top\" height=\"147\">";	
					temp += "<td width=\"50%\" align=\"center\">";
		    				    			
		    			if(bundle.styles[k] != null){
		    				//Element k
			    			styleName = wbr(bundle.styles[k].name);
			    			if(currentLocale == "Heine-HeineCh-Site"){
								styleName = char2Swiss(wbr(bundle.styles[k].name));
							}
			    			
			    			if(bundle.styles[k].priceOld != null)
			    				stylePrice = "<strike>"+bundle.styles[k].priceOld+"</strike> "+bundle.styles[k].priceNew;
			    			else
			    				stylePrice = bundle.styles[k].priceNew;			    			
			    			styleImage = imageServer+"/format_home_sorti_1/"+bundle.styles[k].getMainImage();
			    			
			    			
			    			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"110\" style=\"cursor:pointer;\" onclick=\"updateControllerByStyleNumber("+k+");window.scrollTo(0,0);\">";
		    				temp += "<tr><td height=\"110\" background=\""+WebRoot+"/imagesOnline/productdetail/formatbackground.gif\" align=\"center\" onmouseover=\"document.getElementById('stylecelltext"+tabLetter+k+"').innerHTML = '"+stylePrice+"'\" onmouseout=\"document.getElementById('stylecelltext"+tabLetter+k+"').innerHTML = '"+styleName+"'\"><img src=\""+styleImage+"\" border=\"0\"></a></td></tr>";
		    				temp += "<tr><td align=\"center\" valign=\"top\"><div id=\"stylecelltext"+tabLetter+k+"\" class=\"stylecelltext\">"+styleName+"</div></td></tr>";
		    				temp += "</table>";
			    			temp += "</td>";
			    			temp += "<td width=\"50%\" align=\"center\">";
		    			}
		    			
		    			if(bundle.styles[k+1] != null){
		    				//Element k
				    		
			    			styleName = wbr(bundle.styles[k+1].name);
			    			if(currentLocale == "Heine-HeineCh-Site"){
								styleName = char2Swiss(wbr(bundle.styles[k+1].name));
							}
			    			if(bundle.styles[k+1].priceOld != null)
			    				stylePrice = "<strike>"+bundle.styles[k+1].priceOld+"</strike> "+bundle.styles[k+1].priceNew;
			    			else
			    				stylePrice = bundle.styles[k+1].priceNew;
			    			styleImage = imageServer+"/format_home_sorti_1/"+bundle.styles[k+1].getMainImage();
			    			
			    			temp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"110\" style=\"cursor:pointer;\" onclick=\"updateControllerByStyleNumber("+(k+1)+");window.scrollTo(0,0);\">";
		    				temp += "<tr><td height=\"110\" background=\""+WebRoot+"/imagesOnline/productdetail/formatbackground.gif\" align=\"center\" onmouseover=\"document.getElementById('stylecelltext"+tabLetter+(k+1)+"').innerHTML = '"+stylePrice+"'\" onmouseout=\"document.getElementById('stylecelltext"+tabLetter+(k+1)+"').innerHTML = '"+styleName+"'\"><img src=\""+styleImage+"\" border=\"0\"></a></td></tr>";
		    				temp += "<tr><td align=\"center\" valign=\"top\"><div id=\"stylecelltext"+tabLetter+(k+1)+"\" class=\"stylecelltext\">"+styleName+"</div></td></tr>";
		    				temp += "</table>";
		    			}
		    			
		    			
		    			temp += "</td>";
					temp += "</tr>";
						
				}
				
				temp += "</table>";
				temp += "</li>"
			}
			
			if(activeLayerTab == "layerTab0"){
				tempA = "<ul id=\"styleCarouselA\" class=\"styleCarouselA jcarousel-skin-style\">"+temp+"</ul>"	
				document.getElementById("recPIStyleCarouselA").innerHTML = tempA;
			}
			
			else if(activeLayerTab == "layerTab3"){
				tempB = "<ul id=\"styleCarouselC\" class=\"styleCarouselC jcarousel-skin-style\">"+temp+"</ul>"
				document.getElementById("recPIStyleCarouselC").innerHTML = tempB;
			}
			
			/*
			tempA = "<ul id=\"styleCarouselA\" class=\"styleCarouselA jcarousel-skin-style\">"+temp+"</ul>"
			tempB = "<ul id=\"styleCarouselB\" class=\"styleCarouselB jcarousel-skin-style\">"+temp+"</ul>"
			document.getElementById("recPIStyleCarouselA").innerHTML = tempA;
			document.getElementById("recPIStyleCarouselB").innerHTML = tempB;			
			*/
			this.startJCarouselScrolling();
		}
	}
	
	
	
	
	
	this.startJCarouselScrolling = function(){
		jQuery(document).ready(function() {  			
  			jQuery('.styleCarouselA').jcarousel({
  				scroll: 1
			});
			jQuery('.styleCarouselB').jcarousel({
  				scroll: 1
			});
			jQuery('.styleCarouselC').jcarousel({
  				scroll: 1
			});
			jQuery('.xprecCarouselA').jcarousel({
				scroll: 1
	  		});
	  		jQuery('.xprecCarouselB').jcarousel({
				scroll: 1
	  		});
	  		jQuery('#zoomcarousel').jcarousel({
				vertical: true,
				scroll: 1
			});
		});	
		
	}
	
}

	
function wbr(text){
	return text.replace(/-/g, "-<wbr>");	
}



function updateControllerByStyleNumber(styleNumber){	
	//viewController = new DetailViewController();
	viewController.setCurrentStyle(bundle.styles[styleNumber].SKU);	
	viewController.updateRecPIStyleSliderByTab(currentActiveLayerTab);
	showLPDshort();
}


function setupEventHandlers(controller) {
	document.getElementById("colorSelection").onchange = function() {
		var oldIndex = 0;
		for (var i = 0; i < viewController.currentStyle.colors.length(); i++) {
			if (viewController.selectedColor == viewController.currentStyle.colors.elementAt(i)) {
				oldIndex = i;
				break;
			}
		}
		highlightMiniColor(this.selectedIndex, "on");
		viewController.selectedColor = this.options[this.selectedIndex].value;
		highlightMiniColor(oldIndex, "off");
		viewController.updateDim3Selector(viewController.selectedColor);
		viewController.updateDependendFields();
	};
	document.getElementById("dim3Selection").onchange = function() {
		viewController.selectedDim3 = this.options[this.selectedIndex].value;
		if (viewController.selectedDim3 == "null")
			viewController.selectedDim3 = null;
		viewController.updateSizeSelector(viewController.selectedColor, viewController.selectedDim3);	
		viewController.updateDependendFields();
	}
	document.getElementById("sizeSelection").onchange = function() {
		viewController.selectedSize = this.options[this.selectedIndex].value;
		if (viewController.selectedSize == "null")
			viewController.selectedSize = null;
		
		viewController.updateDim3SelectorFromSize(viewController.selectedColor);
		
		viewController.updateDependendFields();
	}
}

function updateColorSample(index) {
	viewController.selectedColor = viewController.currentStyle.colors.elementAt(index);
	highlightMiniColor(document.getElementById("colorSelection").selectedIndex, "off");
	document.getElementById("colorSelection").selectedIndex = index;
	highlightMiniColor(index, "on");
	viewController.updateDim3Selector(viewController.selectedColor);
	viewController.updateDependendFields();
}

function highlightMiniColor(index, action){
	if (viewController.selectedColor != viewController.currentStyle.colors.elementAt(index)) {
		if(action == "on"){
			document.getElementById("mc" + index).style.border="1px solid #c0c0c0";
			document.getElementById("mca" + index).src = WebRoot + "imagesOnline/productdetail/farbflecken/pfeil_oben.gif";
		}
		else{
			document.getElementById("mc" + index).style.border="0px";
			document.getElementById("mca" + index).src = WebRoot + "imagesOnline/productdetail/farbflecken/leer.gif";
		}
	}
}

/**
 * Determine delivery designation by sku from an AJAX XML response
 */
function getDeliveryDesignation(xml, sku) {
		var splitSKU = sku.split("-");
		var articleNo = splitSKU[0];
		var size = splitSKU[1];
		var allArticles = xml.getElementsByTagName('Article');

		try {
			for (var i = 0; i < allArticles.length; i++) {
				var itemNo = allArticles[i].getElementsByTagName("CompleteCatalogItemNo")[0].childNodes[0].nodeValue;
				var itemSize = allArticles[i].getElementsByTagName("SizeAlphaText")[0].childNodes[0].nodeValue;
				if (articleNo == itemNo && size == itemSize) {
					var designationString = allArticles[i].getElementsByTagName("DeliveryDesignation")[0].childNodes[0].nodeValue;
					return parseInt(designationString);
				}
			}
		} catch (err) {
			return null;
		}
}

function getDeliveryStatement(xml, sku) {
	var splitSKU = sku.split("-");
	var articleNo = splitSKU[0];
	var size = splitSKU[1];
	var allArticles = xml.getElementsByTagName('Article');

	try {
		for (var i = 0 ; i < allArticles.length ; i++) {
			var itemNo = allArticles[i].getElementsByTagName("CompleteCatalogItemNo")[0].childNodes[0].nodeValue;
			var itemSize = allArticles[i].getElementsByTagName("SizeAlphaText")[0].childNodes[0].nodeValue;
			if (articleNo == itemNo && size == itemSize) {
				return allArticles[i].getElementsByTagName("DeliveryStatement")[0].childNodes[0].nodeValue;
			}
		}
	} catch (err) {
		return false;
	}
}


function showLPDlong(){
	document.getElementById("productLongDescription").style.display = "none";
	document.getElementById("productinformationDescriptionLong").style.display = "block";
}

function showLPDshort(){
	document.getElementById("productLongDescription").style.display = "block";
	document.getElementById("productinformationDescriptionLong").style.display = "none";
}


function showProductInformation() {	
	selectDetailTab2("detailTab1");
	
	var tempTop = 0;
	var tempElement = document.getElementById("detailTab1");
	while (tempElement) {
		tempTop += tempElement.offsetTop;
		tempElement = tempElement.offsetParent;
	}
	
	document.body.scrollTop = tempTop;
}

function showZoomLayerMulti() {
	setLandmark("page","&pc=shop_detailansicht_ansichten");
	document.getElementById("imagesZoomLayer").style.visibility = "visible";
}

function showZoomLayer(){
	createZoomIFrame();	
	setLandmark("page","&pc=shop_detailansicht_zoom");
	document.getElementById("imagesVideoLayer").style.zIndex = 400;
	document.getElementById("imagesZoomLayer").style.zIndex = 60002;
	document.getElementById("imagesZoomLayer").style.display = "block";
	document.getElementById("imagesZoomLayer").style.visibility = "visible";
}

function hideZoomLayer(){
	removeZoomIFrame();
	document.getElementById("imagesZoomLayer").style.visibility = "hidden";
}

function showVideoLayer(videoName){	
	createZoomIFrame();
	document.getElementById("imagesVideoLayer").style.zIndex = 60002;
	document.getElementById("imagesZoomLayer").style.zIndex = 60001;
	if(document.getElementById("videoFlashPlayer")){
		setLandmark("page","&pc=shop_detailansicht_video"); 
		document.getElementById("imagesVideoLayer").style.visibility = "visible";
		//var so = new SWFObject(videoServer+"/shopmovies/einzelvideos/"+videoName+"", "", "320", "430", "7", "", "noscale");
		var videopfad = videoServer+"/shopmovies/einzelvideos/"+videoName;
		var so = new SWFObject("/is-bin/intershop.static/WFS/Helline-HellineFr-Site/-/de_DE/imagesOnline/_storefront/videoContainer.swf", "headline", "320", "430", "8", "", "noscale");
		so.addParam("flashvars", "file="+videopfad+"&originalSizes=false&soundButton=true");
		so.addParam("allowScriptAccess","always");
		so.addParam("wmode", "transparent");
		so.addParam("loop", "false");
		so.write("videoFlashPlayer");
	}
	
}

function hideVideoLayer(){
	//Film loeschen: BugFix fuer Musik (leere Datei wird eingebunden)
	if(document.getElementById("videoFlashPlayer")){		
		document.getElementById("videoFlashPlayer").innerHTML = "";
	}
	
	removeZoomIFrame();
	document.getElementById("imagesVideoLayer").style.visibility = "hidden";
}


function createZoomIFrame(){

	if(!document.getElementById("iFrameLayerZoom")){
		var iFrameLayerZoom = document.createElement("IFRAME");
		iFrameLayerZoom.setAttribute("src", "");
		iFrameLayerZoom.setAttribute( "id", "iFrameLayerZoom" );
		iFrameLayerZoom.style.position="absolute";
		iFrameLayerZoom.style.zIndex="0";
		iFrameLayerZoom.style.top = "177px";
		iFrameLayerZoom.style.left = "700px";
		iFrameLayerZoom.style.border = 0;
		iFrameLayerZoom.style.width = document.getElementById("imagesZoomLayer").offsetWidth - 480 + "px";
		iFrameLayerZoom.style.height = document.getElementById("imagesZoomLayer").offsetHeight  + "px";
		document.body.appendChild(iFrameLayerZoom);
	}	
}

function removeZoomIFrame(){
	var iFrameLayerZoom = document.getElementById("iFrameLayerZoom");
	if(iFrameLayerZoom){
		document.body.removeChild(iFrameLayerZoom);
	}

}
 
function showZoomImage(imageName, fallbackURL){	
	if(document.getElementById("zoomFlashPlayer")){		
		var playerVersion = swfobject.getFlashPlayerVersion();
		if((playerVersion.major == 0) && (playerVersion.minor == 0)&& (playerVersion.release == 0)){
			//Kein Flash
			var noFlashBGurl = WebRoot + "imagesOnline/productdetail/zoomnoflashbg.gif";
			var noFlashBG = '';//'<img src="'+noFlashBGurl+'" border="0">';
			
			noFlashBG +='<table width="502" height="600" cellpadding="0" cellspacing="0" background="'+noFlashBGurl+'" style="overflow:hidden;">';
				noFlashBG +='<tr>';
				noFlashBG +='<td align="center" valign="middle"><img src="'+fallbackURL+'" border="0"><td>';
				noFlashBG +='</tr>';
			noFlashBG +='</table>';
			
			document.getElementById("zoomFlashPlayer").innerHTML = noFlashBG;
		}
		else{
	   	  var ZV_clientID = 6529;
   		  var ZV_serverName = "http://helline.zoomoviewer.com";
   		  var ZV_language = "fr_FR";
		  var ZV_width = 530; 
		  var ZV_height = 578;
		  var ZV_skin = "gui_heine";
		  var ZV_imageName = imageName;
		  var ZV_fallbackURL = fallbackURL;
		  
	      	  var parameter = 'imageURL=' + escape( ZV_serverName + '/servlet/ImageData?clientId=' + ZV_clientID + '&image=' + ZV_imageName + '&url=' + ZV_fallbackURL );
	          parameter += '&loadAni=none&plugIns=' + ZV_serverName + '/html/zoomapp/plugins/' + ZV_skin + '&languageCode=' + ZV_language;

	          var so = new SWFObject(ZV_serverName+"/html/zoomapp/zoomo07.swf?"+parameter, "ZoomoViewer", "530", "578", "6", "#FFFFFF");
	          so.addParam("allowScriptAccess","always");
	          so.addParam("bgcolor","FFFFFF");
	          so.addParam("flashvars","' + parameter + '");
	          so.addParam("movie","'+ ZV_serverName + '/html/zoomapp/zoomo07.swf");
	          so.addParam("quality","high");
	          so.write("zoomFlashPlayer");
	          
	        }
	          
	          
	          
	          
	}
	
}

//Hack für IE, Buttons werden nicht klickbar wegen Layers
//Layer Zoom und Video sind im unsichtbaren Berich, wenn ausgeblendet:

function resetZoomVideoLayer(action){
	if(action == "on"){	
		createZoomIFrame();
		document.getElementById("imagesZoomLayer").style.top = "176";
		document.getElementById("imagesVideoLayer").style.top = "176";
	}
	else if(action == "off"){
		removeZoomIFrame();
		document.getElementById("imagesZoomLayer").style.top = "-800";
		document.getElementById("imagesVideoLayer").style.top = "-800";
		hideZoomLayer();
		hideVideoLayer();
	}
	else{}
}


function treatmentHandlerDoNothing() {
  // nothing to do, but we have to pass a function to avoid that the default is showing up 
}

function order_start( price ) {
	if (viewController.selectedVariation == null) {
		var variations = viewController.currentStyle.getVariationsByColor(viewController.selectedColor);
		var dim3SelectBox = document.getElementById("dim3Selection");
		var sizeSelectBox = document.getElementById("sizeSelection");
		
		if (variations[0].dim3 && (dim3SelectBox.options[dim3SelectBox.selectedIndex].value == "null")) {
			alert(getLocByDomain("loc14", currentLocale));
			return false;
		}
		
		if (variations[0].size && (sizeSelectBox.options[sizeSelectBox.selectedIndex].value == "null")) {
			alert(getLocByDomain("loc15", currentLocale));
			return false;
		}
		
		alert(getLocByDomain("loc102", currentLocale));
		return false;
	}
	
	if (viewController.selectedVariation.availability == 1) {
		var errorMsg = null;
		if (viewController.selectedVariation.color) {
			errorMsg = getLocByDomain("loc18", currentLocale)+"\"" + entity2char(viewController.selectedVariation.color) + "\"";
			if(currentLocale == "Heine-HeineCh-Site"){
				errorMsg = char2Swiss(errorMsg);
			}			
		}
		if (viewController.selectedVariation.dim3) {
			if (errorMsg) {
				errorMsg += getLocByDomain("loc19", currentLocale)+"\"" + entity2char(viewController.selectedVariation.dim3) + "\"";
				if(currentLocale == "Heine-HeineCh-Site"){
					errorMsg = char2Swiss(errorMsg);
				}
			} else {
				errorMsg = getLocByDomain("loc19", currentLocale)+"\"" + entity2char(viewController.selectedVariation.dim3) + "\"";
				if(currentLocale == "Heine-HeineCh-Site"){
					errorMsg = char2Swiss(errorMsg);
				}
			}
		}
		if (viewController.selectedVariation.size) {
			if (errorMsg) {
				errorMsg += getLocByDomain("loc22", currentLocale)+"\"" + entity2char(viewController.selectedVariation.size) + "\"";
				if(currentLocale == "Heine-HeineCh-Site"){
					errorMsg = char2Swiss(errorMsg);
				}
			} else {
				errorMsg = getLocByDomain("loc23", currentLocale)+"\"" + entity2char(viewController.selectedVariation.size) + "\"";
				if(currentLocale == "Heine-HeineCh-Site"){
					errorMsg = char2Swiss(errorMsg);
				}				
			}
		}
		
		if (errorMsg)
			alert(getLocByDomain("loc16", currentLocale) + errorMsg + getLocByDomain("loc17", currentLocale));
		else
			alert(getLocByDomain("loc24", currentLocale));
		return false;
	}
	
	viewController.fireRecommendationPixel();
	show_basket_page();
	
}

function show_basket_dropdown() {
	var quantity = parseInt(document.getElementById("quantitySelection").value);
	if (!isFinite(quantity) || (quantity < 1)) {
		alert(getLocByDomain("loc25", currentLocale));
		return false;
	}
	
	// prevent double purchase
	disable_shoppingcart_buttons();
	
	var productref = viewController.selectedVariation.SKU + "@" + orderDomain;
	var ajaxUrl = orderUrl + "&ProductRefID=" + productref + "&Quantity=" + quantity;
	var basketAjax = new BasketAjax();
	basketAjax.init(ajaxUrl, orderReloadUrl, "ajax_wklayer", "basketAjax", null, true);
}

function show_basket_page() {
	var quantity = parseInt(document.getElementById("quantitySelection").value);
	if (!isFinite(quantity) || (quantity < 1)) {
		alert(getLocByDomain("loc25", currentLocale));
		return false;
	}
	
	// prevent double purchase
	disable_shoppingcart_buttons();
	
	var productref = viewController.selectedVariation.SKU + "@" + orderDomain;
	var ajaxUrl = orderUrl + "&ProductRefID=" + productref + "&Quantity=" + quantity;
	
	//Check ArticlePromo
	if((viewController.selectedVariation.SKU.substring(0,6) == searchArticleNo) &&
	   (searchArticlePromo.length > 0) &&
	   (! viewController.selectedVariation.parent.styleFlags.contains("prompreis"))){
		//Artikel aus der Suche mit Promo
		
		var paramOrder 		= viewController.selectedVariation.SKU.substring(0,6)+""+searchArticlePromo;
		var paramQuantity 	= quantity;
		var paramSize		= viewController.selectedVariation.SKU.split("-")[1];
		//alert("Mit Promo:\r\nOrder= "+paramOrder+"\r\nAnzahl="+paramQuantity+"\r\nSize= "+paramSize);
		
		ajaxUrl = orderUrlPromo + "&OrderNr=" + paramOrder + "&Quantity=" + paramQuantity + "&Size=" +paramSize;
		
	}

	jQuery.ajax({
		cache: false,
		error: function(){},
		processData: false,
		success: updatePliCounter,
		url: ajaxUrl
	});
	
	

	// create background layer if it doesn't exist
	if (!document.getElementById("orderpagebg")) {
		var pageDiv = document.createElement("div");
		pageDiv.id = "orderpagebg";
		document.body.appendChild(pageDiv);
	}
	
	orderpagebgHeight = document.getElementById("lay_main").offsetHeight + document.getElementById("footertext").offsetHeight + document.getElementById("lay_header").offsetHeight + 70 + "px";
	orderpagebgWidth = document.getElementById("lay_header").offsetWidth;
	document.getElementById("orderpagebg").style.height = orderpagebgHeight;
	document.getElementById("orderpagebg").style.width = orderpagebgWidth + 15 + "px";
	document.getElementById("orderpagebg").style.visibility = "visible";
	document.getElementById("orderpagebg").style.display = "block";
	// create content layer if it doesn't exist
	if (!document.getElementById("orderpagecontent")) {
		var pageDiv = document.createElement("div");
		pageDiv.id = "orderpagecontent";
		pageDiv.style.left = findPosX(530) + "px";
		pageDiv.style.top = "200px";
		
		document.body.appendChild(pageDiv);
	}
	document.getElementById("orderpagecontent").innerHTML = create_basket_page(quantity);
	document.getElementById("orderpagecontent").style.visibility = "visible";
	


	
	
	
}

function continue_shopping() {
	if (document.getElementById("orderpagecontent")) {
		document.getElementById("orderpagecontent").style.visibility = "hidden";
	}
	if (document.getElementById("orderpagebg")) {
		document.getElementById("orderpagebg").style.visibility = "hidden";
		document.getElementById("orderpagebg").style.display = "none";	
	}
}

function create_basket_page(quantity) {
	
	var tdwidth = 57;
	if(currentLocale == "Helline-HellineFr-Site"){
		tdwidth = 70;
	}
	var html = '<table cellpadding="0" cellspacing="0" border="0" width="531" height="245">';
	html += '<tr>';
	html += '<td width="24">&nbsp;</td>';
	html += '<td valign="top">';
	html += '<div class="addtobaskettitle">'+getLocByDomain("loc26", currentLocale)+'</div>';
	html += '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="110">';
	html += '<tr><td width="110">';
	html += '<table height="110" cellpadding="0" cellspacing="0">';
	html += '<tr>';
	html += '<td class="addtobasketartimagecell">';
	html += '<div id="addtobasketartimage"><img src="'+imageServer+'/format_home_sorti_1/' + viewController.selectedVariation.getMainImage() + '" alt=""/></div>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</td>';
	html += '<td width="15">&nbsp;</td>';
	html += '<td valign="bottom">';
	if(currentLocale == "Heine-HeineCh-Site"){		
		html += '<div id="addtobasketartname">' + char2Swiss(viewController.currentStyle.name) + '</div>';
	}
	else{
		html += '<div id="addtobasketartname">' + viewController.currentStyle.name + '</div>';
	}
	if (viewController.currentStyle.colors.length() > 0) {
		html += '<div id="addtobasketcolor">';
		html += '<table class="addtobasketparameters" cellpadding="0" cellspacing="0">';
		if(currentLocale == "Heine-HeineCh-Site"){
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc27", currentLocale)+'</td><td>' + char2Swiss(viewController.selectedVariation.color) + '</td></tr>';
		}
		else{
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc27", currentLocale)+'</td><td>' + viewController.selectedVariation.color + '</td></tr>';
		}
		html += '</table>';
		html += '</div>';
	}
	if (viewController.selectedVariation.size) {
		html += '<div id="addtobasketsize">';
		html += '<table class="addtobasketparameters" cellpadding="0" cellspacing="0">';
		if(currentLocale == "Heine-HeineCh-Site"){			
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc28", currentLocale)+'</td><td>' + char2Swiss(viewController.selectedVariation.size) + '</td></tr>';
		}
		else{
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc28", currentLocale)+'</td><td>' + viewController.selectedVariation.size + '</td></tr>';
		}
		html += '</table>';
		html += '</div>';
	}
	if (viewController.selectedVariation.dim3) {
		html += '<div id="addtobasketvariation">';
		html += '<table class="addtobasketparameters" cellpadding="0" cellspacing="0">';
		if(currentLocale == "Heine-HeineCh-Site"){			
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc29", currentLocale)+'</td><td>' + char2Swiss(viewController.selectedVariation.dim3) + '</td></tr>';
		}
		else{
			html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc29", currentLocale)+'</td><td>' + viewController.selectedVariation.dim3 + '</td></tr>';
		}
		html += '</table>';
		html += '</div>';
	}
	html += '<div id="addtobasketuantity">';
	html += '<table class="addtobasketparameters" cellpadding="0" cellspacing="0">';
	html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc30", currentLocale)+'</td><td>' + quantity + '</td></tr>';
	html += '</table>';
	html += '</div>';
	html += '<div id="addtobasketprice">';
	html += '<table class="addtobasketparameters" cellpadding="0" cellspacing="0">';
	html += '<tr><td width="'+tdwidth+'">'+getLocByDomain("loc31", currentLocale)+'</td><td>' + viewController.selectedVariation.price + '</td></tr>';
	html += '</table>';
	html += '</div>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<div class="addtobasketnavi">';
	html += '<table cellpadding="0" cellspacing="0" width="100%" border="0">';
	html += '<tr>';
	html += '<td width="294" align="right">';
	html += '<a href="javascript:continue_shopping()" class="blacklink"><span class="but">'+getLocByDomain("loc32", currentLocale)+'</span><span class="but2"></span></a>';
	html += '</td>';
	html += '<td id="orderpagecart" align="right">';
	if (viewController && viewController.orderActive) {
		html += '<a href="#" onclick="return false;" class="blacklink"><span class="but" style="color: gray; cursor: default;">'+getLocByDomain("loc33", currentLocale)+'</span><span class="but2grey"></span></a>';
	} else {
		html += '<a href="' + basketUrl + '" class="blacklink"><span class="but">'+getLocByDomain("loc34", currentLocale)+'</span><span class="but2"></span></a>';
	}
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</div>';
	html += '</td>';
	html += '<td width="24" align="right" valign="top"><a href="javascript:continue_shopping()"><img border="0" src="' + WebRoot + 'imagesOnline/detailview/close.gif"></a></td>';
	html += '</tr>';
	html += '</table>';
	return html;
}

function updatePliCounter(str) {
	// parse number of PLIs
	var splitstart = str.search(/plicount:/);
	if (splitstart < 0)
		return;
	var splitend = str.search(/:plicount/);
	if (splitend < 0)
		return;
	var plicount = str.substring(Number(splitstart + 9), splitend);
	
	var html = str.slice(0, splitstart);
	html += str.slice(Number(splitend + 9), str.length);
	
	// update HMTL element (plicounter)
	if (document.getElementById("plicount")) {
		document.getElementById("plicount").style.fontWeight = "bold";
		document.getElementById("plicount").innerHTML = "("+plicount+")";
	}
	
	// update HTML element (basket layer)
	if (document.getElementById("ajax_wklayer")) {
		document.getElementById("ajax_wklayer").innerHTML = html;
	}

	// re-enable buttons
	enable_shoppingcart_buttons();
}

function updateShoppingList() {
	if (viewController.selectedVariation == null) {
		var variations = viewController.currentStyle.getVariationsByColor(viewController.selectedColor);
		var dim3SelectBox = document.getElementById("dim3Selection");
		var sizeSelectBox = document.getElementById("sizeSelection");
		
		if (variations[0].dim3 && (dim3SelectBox.options[dim3SelectBox.selectedIndex].value == "null")) {
			alert(getLocByDomain("loc14", currentLocale));
			return false;
		}
		
		if (variations[0].size && (sizeSelectBox.options[sizeSelectBox.selectedIndex].value == "null")) {
			alert(getLocByDomain("loc15", currentLocale));
			return false;
		}
		
		alert(getLocByDomain("loc102", currentLocale));
		return false;
	}
	
	
	var productref = "";	
	if (viewController.selectedVariation != null) {
		productref = viewController.selectedVariation.SKU + "@" + orderDomain;
	} else {
		productref = viewController.currentStyle.SKU + "@" + orderDomain;
	}
	var shlUrl = shoppingListUrl + "&ProductRef=" + productref;
	document.location.href = shlUrl;
}


function cutLongDescription(txt, maxlength){

	var debugDIV = document.createElement("div");
	debugDIV.innerHTML = txt;
	
	var splitText = new Array();
	for(var i=0; i<debugDIV.childNodes.length; i++ ){
		if(debugDIV.childNodes[i].nodeType == 1){
			obj = debugDIV.childNodes[i];
			element = document.createElement("div");	
	      		element.appendChild(obj.cloneNode(true));	
			splitText.push(element.innerHTML);		
		}
		else{
			splitText = splitText.concat((debugDIV.childNodes[i].data).split(" "));						
		}
		
	}
	
	var outputArray = new Array();
	for(var i=0; i< splitText.length; i++){		
		if(splitText[i] != ""){
			outputArray.push(splitText[i] + " ");		
		}		
	}
	
	if(outputArray.length > maxlength){
		var output = "";
		for(var i=0; i< maxlength; i++){		
			output += outputArray[i];		
		}
		return output;
	}
	else{
		return null;
	}	
	
}

/*
 * Disable shopping cart buttons to prevent double purchase and errors in
 * the order process
 */
function disable_shoppingcart_buttons() {
	if (typeof(viewController) != 'undefined') {
		viewController.orderActive = true;
	}

	// basket layer
	var layerLink1 = document.getElementById("basketLayerLink1");
	var layerLinkText1 = document.getElementById("basketLayerLinkText1");
	var layerLink2 = document.getElementById("basketLayerLink2");
	var layerLinkText2 = document.getElementById("basketLayerLinkText2");
	
	if (layerLink1) {
		layerLink1.onclick = function() {return false;};
		//layerLinkText1.innerHTML = "Bitte warten";
	}
	
	if (layerLink2 && layerLinkText2) {
		layerLink2.onclick = function() {return false;};
		layerLinkText2.innerHTML = "Bitte warten";
	}
	
	// Jetzt bestellen (big)
	disable_button(document.getElementById("orderButton1"), "bitte_warten_gr.gif")
	// Jetzt bestellen (small)
	disable_button(document.getElementById("orderButton2"), "bitte_warten.gif")
	// In den Warenkorb legen (big)
	disable_button(document.getElementById("orderButton3"), "bitte_warten_gr.gif")
	// In den Warenkorb legen (small)
	disable_button(document.getElementById("orderButton4"), "bitte_warten.gif")
	// Warenkorb ansehen (small)
	disable_button(document.getElementById("checkout_button_img"), "bitte_warten.gif")
}

/*
 * Re-enable shooping cart buttons
 */
function enable_shoppingcart_buttons() {
	if (typeof(viewController) != 'undefined') {
		viewController.orderActive = false;
	}
	
	// order page
	var orderpageButton = document.getElementById("orderpagecart");
	if (orderpageButton) {
		orderpageButton.innerHTML = '<a href="' + basketUrl + '" class="blacklink"><span class="but">'+getLocByDomain("loc34", currentLocale)+'</span><span class="but2"></span></a>';
	}
	
	// basket layer 
	var layerLink1 = document.getElementById("basketLayerLink1");
	var layerLink2 = document.getElementById("basketLayerLink2");
	var layerLinkText2 = document.getElementById("basketLayerLinkText2");

	if (layerLink1) {
		layerLink1.onclick = null;
		//layerLinkText1.innerHTML = "Warenkorb";
	}

	if (layerLink2 && layerLinkText2) {
		layerLink2.onclick = null;
		layerLinkText2.innerHTML = getLocByDomain("loc34", currentLocale);
	}
	
	// Jetzt bestellen (big)
	enable_button(document.getElementById("orderButton1"), "jetzt_bestellen_gr.gif")
	// Jetzt bestellen (small)
	enable_button(document.getElementById("orderButton2"), "jetzt_bestellen.gif")
	// In den Warenkorb legen (big)
	enable_button(document.getElementById("orderButton3"), "in_den_warenk_legen_gr.gif")
	// In den Warenkorb legen (small)
	enable_button(document.getElementById("orderButton4"), "in_den_warenk_legen.gif")
	// Warenkorb ansehen (small)
	enable_button(document.getElementById("checkout_button_img"), "warenkorb_ansehen.gif")
}

/*
 * Unlinks onclick on a graphical button and replaces its image source
 */
function disable_button(button, image) {
	if (button) {
		button.oldOnclick = button.onclick;
		button.onclick = function(){};
		button.style.cursor = "auto";
		button.src = WebRoot + "imagesOnline/productdetail/" + image;
	}
}

/*
 * Re-links onclick on a graphical button and replaces its image source
 */
function enable_button(button, image) {
	if (button) {
		button.onclick = button.oldOnclick;
		button.oldOnclick = null;
		button.style.cursor = "pointer";
		button.src = WebRoot + "imagesOnline/productdetail/" + image;
	}
}

function hidezoombg() {
	if (document.getElementById("imagesZoomLayer")) {
		hideZoomLayer();
	}
	if (document.getElementById("lightboxerbg")) {
		document.body.removeChild(lightboxer);
	}
}

function showzoombg() {
		lightboxer = document.createElement("div");
		lightboxer.id = "lightboxerbg";
		document.body.appendChild(lightboxer);
		mainheight = document.getElementById("lay_main").offsetHeight + document.getElementById("footertext").offsetHeight + document.getElementById("lay_header").offsetHeight + 70 + "px";
		mainwidth = document.getElementById("lay_header").offsetWidth + 15 + "px";
		document.getElementById("lightboxerbg").style.height = mainheight;
		document.getElementById("lightboxerbg").style.width = mainwidth;
		document.getElementById("lightboxerbg").style.display = "block";
		document.getElementById("imagesZoomLayer").style.display = "block";
}
