/* Ladezeitmessung Start: */
var timeStart = new Date().getTime();
/* Ladezeitmessung Start */
var maxCG = 5; /* Maximale Anzahl der ContentGruppen Einträge */
var webtrekk = new Object();
var spvWTStatus = 'view';
webtrekk.trackDomain = 'esprit01.webtrekk.net';
webtrekk.trackId = '182920392988439';
webtrekk.domain = 'REGEXP:esprit\\.[be|com|dk|fr|nl|fi|se]|espritshop\\.[at|ch|co\\.uk|com|cz|pl|ca]|esprit\\-club\\.com|esprit\\-online\\.com|edc\\.com|club\\-edc\\.com|esprit\\.de';
/*Die wtContentGrpBlacklist bestimmt abwelchem Begriff in der contentId abgebrochen wird die ContentGruppen zubefüllen */
var wtContentGrpBlacklist = new Array();
wtContentGrpBlacklist[wtContentGrpBlacklist.length] = 'detail';
wtContentGrpBlacklist[wtContentGrpBlacklist.length] = 'weltTitle';
wtContentGrpBlacklist[wtContentGrpBlacklist.length] = 'startseite_men';
wtContentGrpBlacklist[wtContentGrpBlacklist.length] = 'startseite';
webtrekk.contentId = "";
if(typeof FrameStart == 'undefined' || typeof top.FrameStart == 'undefined' || !opener) {
	webtrekk.contentId =  "us.noframeset.";
}

function sWebtrekkContentGroups(sendPixel,altContentId, maxCGlength) {
	//sendPixel:'true' wenn wt_sendinfo ausfuehren | 'false'/leer wenn kein wt_sendinfo ausfuehren
	//altContentId: alternative ContentId, wenn etwas abweichendes als im webtrekkVars-Element gebildet werden soll
	if (typeof(sendPixel)=='undefined') { sendPixel=false; }
	if ((document.getElementById("webtrekkVars")) || (typeof(altContentId) != 'undefined')) {
		setContentId((typeof(altContentId) == 'undefined') ? document.getElementById("webtrekkVars").value : altContentId, false);
	}
	else {
		webtrekk.contentId = "";
		if ((sendPixel==true) && (typeof(wt_sendinfo) != "undefined")) {
			wt_sendinfo();
			
		}
		return;
	}
	if(typeof maxCGlength == 'undefined') {
		getContentGrp();
	} else {
		getContentGrp(maxCGlength);
	}
/*	webtrekk.contentGroup	= new Array();
	for (var i=0; i<webtrekk.contentId.split(".").length; i++) {		//Content Gruppen parallel zu ContentId
		webtrekk.contentGroup[i+1]=webtrekk.contentId.split(".")[i];	//mit Index=1 beginnen
	}*/
	if ((sendPixel==true) && (typeof(wt_sendinfo) != "undefined")) {
		wt_sendinfo();
	}
}

function wtLoadingTime(){
   var timeStop = new Date().getTime();
   var lt = timeStop - timeStart;
   wt_sendinfo("loading_time", "click", "ck1="+lt);
}

function setContentId(contentIDStr, widthMasterFrame)
{
	contentIDStr = contentIDStr.replace('.undefined', '');
	webtrekk.contentId = contentIDStr.replace('undefined', 'us');

	if(widthMasterFrame) {
		top.webtrekk.contentId = webtrekk.contentId;	
	}
}

var baseNysContentId;
function nysBaseContentId(contentidStr)
{
	baseNysContentId	 = contentidStr;
	webtrekk.contentId = contentidStr;
}

function nysContentId(stepStr)
{
	webtrekk.contentId = baseNysContentId + stepStr;
	wt_sendinfo();	
}

/*function wtGetScrollPos() {
	var Y = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
	if (Y > wt_scrollpos_y) {
	        wt_scrollpos_y = Math.round(Y / wt_rowHeight);;
	}
}*/

function wtGetScrollPos() {
  var Y = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
  if (Y > wt_scrollpos_y) {
          wt_scrollpos_y = Y;
  }
}

/*function wtSendScrollPos() {
	wt_unregisterEvent(window, (wt_browserNameIE && wt_typeof(window.onbeforeunload)) ? "beforeunload" : "unload", wtSendScrollPos);
	if (!wt_scrollSent) {
	        wt_sendinfo('ScrollPosition', 'click', 'cp3=' + wt_scrollpos_y);
	}
	wt_scrollSent = true;
}*/

function wtSendScrollPos() {
	wt_unregisterEvent(window, (wt_browserNameIE && wt_typeof(window.onbeforeunload)) ? "beforeunload" : "unload", wtSendScrollPos);
	if (!wt_scrollSent) {
	        wt_sendinfo('ScrollPosition', 'click', 'cp3=' + Math.round(wt_scrollpos_y / wt_rowHeight));
	}
	wt_scrollSent = true;
}


function getContentGrp(maxCGlength)
{
	webtrekk.contentGroup = new Array();
	var tmpContGrpArr = webtrekk.contentId.split('.');
	if(typeof maxCGlength == 'undefined') {
		var anzahl = tmpContGrpArr.length;
		if(tmpContGrpArr.length > maxCG) {
			anzahl = maxCG;
		}		
	} else {
		if(maxCGlength > maxCG) {
			anzahl = maxCG;
		} else {
			anzahl = maxCGlength;
		}
	}
	for(var i=0; i < anzahl; ++i) {
		if(isOnCGBlacklist(tmpContGrpArr[i])) {
			break;	
		} else {
			webtrekk.contentGroup[(i + 1)] = 	tmpContGrpArr[i];
		}
	}	
}

function isOnCGBlacklist(testStr)
{
	for(var z=0; z < wtContentGrpBlacklist.length; ++z) {
		if(testStr == wtContentGrpBlacklist[z]) {
			return true;	
		}
	}
	return false;	
}

function wtClickPixel(parmAdd)
{
	var pixelToSend = webtrekk.contentId + '.' +parmAdd;
	pixelToSend = pixelToSend.replace('..', '.');
	wt_sendinfo(pixelToSend, 'click');
}

function Pixel(PixelWerte)
{ 
	setWTCustomParameter(PixelWerte);
	wt_sendinfo();
}
/* Grundentwicklung*/
function sendProductView(pStatus)
{
			webtrekk.product						= '';
			webtrekk.productCategory			= new Array();
			webtrekk.productCategory[1]		= '';
			webtrekk.productCategory[2] 	= '';
			webtrekk.productQuantity			= '';
			webtrekk.productCost				= '';
			webtrekk.productStatus				= '';
			webtrekk.productParameter		= new Array();
			webtrekk.productParameter[1] 	= '';	
			webtrekk.productParameter[2] 	= '';
			webtrekk.productParameter[3] 	= '';			
			webtrekk.productParameter[4] 	= ''; 		
	  		webtrekk.product						= StyleNumber;
	  		webtrekk.productParameter[1] 	= (PriceBasic / 100 * (PriceBasic - PriceNew)).toString();
	  		webtrekk.productParameter[2] 	= NewSale;
			webtrekk.productParameter[3]	= ColorNumber;
			webtrekk.productParameter[4] 	= Size; 	
			webtrekk.productParameter[7] 	= StyleName;
			webtrekk.productCost				= PriceNew;
			if(typeof Qty != 'object') {
				if(typeof Qty != 'undefined') {
					webtrekk.productQuantity 			= Qty;
				}
			}
			webtrekk.productStatus				= pStatus;		
				
}

function setWTCustomParameter(paramWert) {
	if(typeof webtrekk.customParameter == 'undefined') {
		webtrekk.customParameter = new Array();
	}
	if(typeof webtrekk.customParameter[1] != 'undefined') {
		if(webtrekk.customParameter[1].indexOf(paramWert) == -1) {
			webtrekk.customParameter[1] += ',' + paramWert;
		}
	} else {
		webtrekk.customParameter[1] = paramWert;
	}	
}

function resetWTCustomParameter(paramWert) {
	if((typeof webtrekk.customParameter != 'undefined') && (typeof webtrekk.customParameter[1] != 'undefined')) {
		webtrekk.customParameter[1] = webtrekk.customParameter[1].replace(',' + paramWert, '').replace(paramWert, '');
	}
}	

function sendSPVPixel() { wt_sendinfo(); }

function setWeltTitlePixel(){

			
var contentIDStr = top.Lng +'.';
	if(typeof top.FrameLogo.currendWelt != 'undefined') {
		contentIDStr += replaceUmlaute(top.FrameLogo.currendWelt);
	}
	if(typeof top.FrameStart.FrameMainNavi.menudownwelt != 'undefined') {
		contentIDStr += '.' + replaceUmlaute(top.FrameStart.FrameMainNavi.menudownwelt);
	}
	if(typeof top.FrameStart.FrameMainNavi.page != 'undefined') {
		contentIDStr += '.' + replaceUmlaute(top.FrameStart.FrameMainNavi.page);
	}
	contentIDStr += '.weltTitle';
	contentIDStr = contentIDStr.replace('..', '.');
	setContentId(contentIDStr, true); // content id
	getContentGrp();
}

function replaceDoppelPlatzierung(tmpArr)
{
	tmpArr = tmpArr.replace(' , ', ',').replace(', ', ',').replace(' ,', ',').toLowerCase();
	tmpArr=(tmpArr.indexOf(',') > 0) ? tmpArr.split(',') : tmpArr;
	var documentName = document.location.href;
	documentName = documentName.replace(document.location.hash, '').replace(document.location.search, '');
	if(typeof tmpArr == 'string') {
		return tmpArr;	
	} else {
		for(var i=0; i < tmpArr.length; ++i) {
			var testStr = tmpArr[i].replace(/ß/gi, "ss").replace(/ü/gi,"ue").replace(/ä/gi,"ae").replace(/\//gi,"_").replace(/\-/gi,"_").replace(/ö/gi,"oe").replace(/\s/gi,"_");
			if(documentName.indexOf(testStr) != -1) {
				return tmpArr[i];	
			}
		}
	}
}
function replaceUmlaute(tmpStr) { try { return tmpStr.replace(/ß/gi, "ss").replace(/ü/gi,"ue").replace(/ä/gi,"ae").replace(/ö/gi,"oe"); } catch(e) { return ''; } }

function wtGetBrowserResolution(){var h=0;if (!document.layers&&document.getElementById){eval("try {h = top.window.innerHeight;}catch(e){};");}else{h=top.window.innerHeight;}if(!h)eval("try {h = top.document.body.clientHeight;}catch(e){};");if(!h)eval("try {h = top.document.documentElement.clientHeight;}catch(e){};");var w=0;if(!document.layers && document.getElementById){eval("try {w = top.window.innerWidth;}catch(e){};");}else{w=top.window.innerWidth;}if(!w)eval("try {w = top.document.body.clientWidth;}catch(e){};");if(typeof(w)=='undefined')w=-1;if(typeof(h)=='undefined')h=-1;webtrekk.customParameter[4]=w+"x"+h;}
