var runner = 0;
var theBuffer;
var theBuffer2;
var dataSentMain = false;
var dataSentBasket = false;
var dataSentReminder = false;
var dataSentNav = false;
var refreshDelay = 40;
var maxRefresh=1000;
var retryCount = 0;
var fakeId=0;
var divElement;
r=0;
b=0,
g=0;
var targetElementLev2;


//call this function in page onload event handler
function initialize()
{
	theBuffer = new exchanger();
}
function initialize2()
{
	theBuffer2 = new exchanger();
}

//call this function when data needs to be sent to server
function sendDataToServer(data)
{
	theBuffer.sendData("../../ar02/templates/xxxxxConfiguratorReceiver.jsp?" + data);
}
function sdts(data)
{
	theBuffer2.sendData("../../ar03/templates/xxxxxBasketReceiver.jsp?" + data);
	// fakeId++;
}

//call this function to check what the server returns.
function showReturnData(id)
{
	alert(theBuffer.retrieveData(id));
}
function showReturnData2(id)
{
	alert(theBuffer2.retrieveData(id));
}

var selectedValues = null;
var selectedValuesColumn = null;
var activeL1=null;
var activeL2=null;
var countl1=-1;
var countl2=-1;
var navLev4I="";
var navLev4I1=null;
var navLev4IP=null;
var spareNavLev4I1=null;
var navLev4I3="";
var navLev4I4="";
var language;
var organisation;
var navSeq;
var imageHiSel = new Image();
imageHiSel.src = '../../images/imgTemplates/produktkonfigurator_pfeil_a.gif';
var imageLoSel = new Image();
imageLoSel.src = '../../images/imgTemplates/produktkonfigurator_pfeil_i.gif';
function clearStatics()
{
	dataSentMain = false;
	dataSentNav = false;
	retryCount = 0;
	navLev4I1=null;
}

function hss(event)
{
	if(navLev4I1!=null && navLev4I1 == this)
	{
		return;
	}
	assignedP = this.getAttribute("assignedPic");
	assignedA = this.getAttribute("assignedA");
	document.getElementById(assignedP).src=imageHiSel.src;
	document.getElementById(assignedA).className="navLeftSubSubActive";

}
function lss(event)
{
	if(navLev4I1!=null && navLev4I1 == this)
	{
		return;
	}
	assignedP = this.getAttribute("assignedPic");
	assignedA = this.getAttribute("assignedA");
	if(assignedP == navLev4IP)
	{
		return;
	}
	document.getElementById(assignedP).src=imageLoSel.src;
	document.getElementById(assignedA).className="navLeftSubSubInactive";
}
function lssi(id)
{
	tE = document.getElementById(id);

	assignedP = tE.getAttribute("assignedPic");
	assignedA = tE.getAttribute("assignedA");

	document.getElementById(assignedP).src=imageLoSel.src;
	document.getElementById(assignedA).className="navLeftSubSubInactive";
}


function generateSelectorA(n, l, o)
{
	if (targetElementLev2 && divElement)
	{
		targetElementLev2.removeChild(divElement);
		divElement = null;
	}
	checkVar = null;
	if(!dataSentMain)
	{
		sendDataToServer("cmd=lA&navSeq="+n+"&language="+l+"&organisation="+o);
		dataSentMain = true;
	}
	checkVar = theBuffer.retrieveData("navSeqCheck");
	if(checkVar==null||checkVar!=n)
	{
		if(retryCount==maxRefresh)
		{
			alert("TIMEOUT");
			clearStatics();
			return;
		}
		window.setTimeout("generateSelectorA("+n+",'"+l+"','"+o+"')",refreshDelay);
		retryCount++;
		return;
	}
else
	{
		dataSentMain = false;
	}
	language=l;
	organisation=o;
	navSeq=n;
	localDataSet = new Array();
	localDataSet = theBuffer.retrieveData("dataset");
	theBuffer = new exchanger();
	if(localDataSet.length>0)
	{
		var targetElement = document.getElementById("selectorContent");
		checkExistantTable = document.getElementById("prodSelContent");
		if(checkExistantTable!=null)
		{
			targetElement.removeChild(checkExistantTable);
		}
		var actualElement = document.createElement("table");
		actualElement.setAttribute("width","80%");
		actualElement.setAttribute("border","0");
		actualElement.setAttribute("cellSpacing","1");
		actualElement.setAttribute("cellPadding","2");
		actualElement.setAttribute("id","prodSelContent");
		targetElement.appendChild(actualElement);
		tableElement = actualElement;
		var myTbody = document.createElement("tbody");
		for (var i=0;i<localDataSet.length; i++)
		{
			parm1 = 'na'+i;
			parm2 = 'sI'+i;
			trElement = document.createElement("tr");
			targetElement = trElement;

			actualElement = document.createElement("td");
			actualElement.setAttribute("id","std"+i);
			actualElement.setAttribute("align","left");
			actualLinkElement = document.createElement("a");
			actualTextElement = document.createTextNode(localDataSet[i]["sN"]);
			actualLinkElement.appendChild(actualTextElement);
			actualLinkElement.setAttribute("href","#");
			actualLinkElement.setAttribute("id","na"+i);
			actualLinkElement.setAttribute("idTd","std"+i);
			actualLinkElement.setAttribute("idSi","stdI"+i);
			actualLinkElement.setAttribute("idTdd","tdd"+i);
			//actualLinkElement.setAttribute("idD",i);
			actualLinkElement.setAttribute("assignedPic",parm2);
			actualLinkElement.setAttribute("assignedA",parm1);
			actualLinkElement.setAttribute("value",localDataSet[i]["sV"]);
			actualLinkElement.setAttribute("l1",i);
			actualLinkElement.onmouseover = hss;
			actualLinkElement.onmouseout = lss;
			actualLinkElement.onclick = ssl1;
			//actualLinkElement.setAttribute("class","navLeftSubSubInactive");
			actualLinkElement.className = "navLeftSubSubInactive";
			actualElement.appendChild(actualLinkElement);
			targetElement.appendChild(actualElement);

			actualElement = document.createElement("td");
			actualElement.setAttribute("align","left");
			actualElement.setAttribute("width","5");
			//actualTextElement = document.createTextNode(" ");
			//actualElement.appendChild(actualTextElement);
			targetElement.appendChild(actualElement);

			actualElement = document.createElement("td");
			actualElement.setAttribute("align","right");
			actualElement.setAttribute("id","tdd"+i);
			/*
			actualLinkElement = document.createElement("a");
			actualElement.appendChild(actualLinkElement);
			actualTextElement = document.createTextNode(localDataSet[i]["sN"]);
			actualLinkElement.setAttribute("id","psasv"+i);
			actualLinkElement.setAttribute("href","#");
			actualLinkElement.setAttribute("assignedPic",parm2);
			actualLinkElement.setAttribute("assignedA",parm1);
			actualLinkElement.setAttribute("id","va"+i);
			actualLinkElement.setAttribute("idTd","std"+i);
			actualLinkElement.setAttribute("value",localDataSet[i]["sV"]);
			actualLinkElement.setAttribute("level",i);
			actualLinkElement.onmouseover = hss;
			actualLinkElement.onmouseout = lss;
			actualLinkElement.onclick = ssl1;
			*/
			actualTextElement = document.createTextNode(" - ");
			//actualLinkElement.appendChild(actualTextElement);
			//actualLinkElement.className = "navLeftSubSubInactive";
			actualElement.appendChild(actualTextElement);
			targetElement.appendChild(actualElement);

			actualElement = document.createElement("td");
			actualElement.setAttribute("width","5");
			actualElement.setAttribute("id","stdI"+i);
			//actualLinkElement = document.createElement("a");
			//actualElement.appendChild(actualLinkElement);
			actualImageElement = document.createElement("img");
			actualImageElement.setAttribute("src","../../images/imgTemplates/produktkonfigurator_pfeil_i.gif");
			actualImageElement.setAttribute("id","sI"+i);
			actualImageElement.setAttribute("border","0");
			actualImageElement.setAttribute("width","5");
			actualImageElement.setAttribute("height","9");
			/*
			actualLinkElement.setAttribute("id","pf"+i);
			actualLinkElement.setAttribute("idTd","std"+i);
			actualLinkElement.setAttribute("level",i);
			actualLinkElement.setAttribute("value",localDataSet[i]["sV"]);
			actualLinkElement.setAttribute("href","#");
			actualLinkElement.setAttribute("assignedPic",parm2);
			actualLinkElement.setAttribute("assignedA",parm1);
			*/
			//actualLinkElement.onmouseover = hss;
			//actualLinkElement.onmouseout = lss;
			//actualLinkElement.onclick = ssl1;
			//actualLinkElement.appendChild(actualImageElement);

			actualElement.appendChild(actualImageElement);
			targetElement.appendChild(actualElement);

			myTbody.appendChild(trElement);
		}
		countl1 = i;
		tableElement.appendChild(myTbody);
		clearStatics();
		var targetLayer  =document.getElementById("configurator");
		targetLayer.style.visibility="visible";
		selectedValues = new Array();
		selectedValuesColumn = new Array();
	}
}
var dataSentMain2 = false;

function clearStatics2()
{
	dataSentMain2 = false;
	dataSentNav = false;
	retryCount = 0;
}

function generateSelectorB(nV, idTdd, lev1)
{
	checkVar2 = null;
	if(!dataSentMain2)
	{
		sendDataToServer("cmd=lB&navSeq="+navSeq+"&language="+language+"&organisation="+organisation+"&q="+nV+"&sC="+selectedValuesColumn+"&sV="+selectedValues);
		dataSentMain2 = true;
	}
	checkVar2 = theBuffer.retrieveData("qChk");
	if(checkVar2==null||checkVar2!=nV)
	{
		if(retryCount==maxRefresh)
		{
			alert("TIMEOUT2");
			clearStatics2();
			return;
		}
		window.setTimeout("generateSelectorB('"+nV+"','"+idTdd+"','"+lev1+"')",refreshDelay);
		retryCount++;
		return;
	}
else
	{
		dataSentMain2 = false;
	}
	localDataSet = new Array();
	localDataSet = theBuffer.retrieveData("dataset");
	theBuffer = new exchanger();
	targetElementMain = document.getElementById("l2Subdisp");
	checkExistantTable = document.getElementById("ps2C");
	if(checkExistantTable!=null)
	{
		targetElementMain.removeChild(checkExistantTable);
	}

	var actualElement = document.createElement("table");
	//actualElement.setAttribute("width","120");
	actualElement.setAttribute("border","0");
	actualElement.setAttribute("cellSpacing","0");
	actualElement.setAttribute("cellPadding","2");
	actualElement.setAttribute("id","ps2C");
	tableElement = actualElement;
	var myTbody = document.createElement("tbody");
	for (var i=0;i<localDataSet.length; i++)
	{
		/*
		trElement = document.createElement("tr");
		actualElement = document.createElement("td");
		actualElement.setAttribute("id","s2td"+i);
		actualElement.setAttribute("align","left");
		actualTextElement = document.createTextNode("Auswahl");
		actualElement.appendChild(actualTextElement);
		trElement.appendChild(actualElement);
		myTbody.appendChild(trElement);
		*/


		trElement = document.createElement("tr");
		targetElement = trElement;
		actualElement = document.createElement("td");
		actualElement.setAttribute("id","s2td"+i);
		actualElement.setAttribute("align","left");
		actualLinkElement = document.createElement("a");
		actualTextElement = document.createTextNode(localDataSet[i]["s2N"]);
		actualLinkElement.appendChild(actualTextElement);
		actualLinkElement.setAttribute("href","#");
		actualLinkElement.setAttribute("id","na2"+i);
		actualLinkElement.setAttribute("idTd","s2td"+i);
		actualLinkElement.setAttribute("idTdd",idTdd);
		actualLinkElement.setAttribute("assignedPic",parm2);
		actualLinkElement.setAttribute("assignedA",parm1);
		actualLinkElement.setAttribute("l2",i);
		actualLinkElement.setAttribute("l1",lev1);
		actualLinkElement.setAttribute("sC",nV);
		actualLinkElement.setAttribute("value",localDataSet[i]["s2V"]);
		actualLinkElement.setAttribute("text",localDataSet[i]["s2N"]);
		//actualLinkElement.onmouseover = hiliteSubSelector;
		//actualLinkElement.onmouseout = loliteSubSelector;
		actualLinkElement.onclick = ssl2;
		//actualLinkElement.setAttribute("class","navLeftSubSubInactive");
		actualLinkElement.className = "navLeftSubSubInactive";
		actualElement.appendChild(actualLinkElement);
		trElement.appendChild(actualElement);
		myTbody.appendChild(trElement);

	}
	countl2=i;
	tableElement.appendChild(myTbody);
	targetElementMain.appendChild(tableElement);
	targetElementMain.style.visibility="visible";
	clearStatics2();

}


function ssl1(event)
{
	//assignedP = this.getAttribute("assignedPic");
	//assignedA = this.getAttribute("assignedA");
	var level = this.getAttribute("l1");
	activeL1 = level;
	if(navLev4I1!=null && navLev4I1!=this)
	{
		//(spareNavLev4I1 = navLev4I1;
		lssi(navLev4I1.getAttribute("id"));
	}
	if(navLev4I1!=null && navLev4I1==this)
	{
		return;
	}

	navLev4I1 = this;
	navLev4I1P = this.getAttribute("assignedPic");
	//spareNavLev4I1 = this;
	//targetElementLev2 = document.getElementById("configurator");
	targetElementLev2 = document.body;
	//var targetElement = document.getElementById("leftnavigation");
	if(divElement && divElement!=null)
	{
		targetElementLev2.removeChild(divElement);
		divElement = null;
	}
	divElement = document.createElement("div");
	//alert("divElement");
	targetElementLev2.appendChild(divElement);
	divElement.setAttribute("id","l2Subdisp");
	//alert(this.getAttribute("l1"));
	generateSelectorB(this.getAttribute("value"),this.getAttribute("idTdd"), this.getAttribute("l1"));
	//alert("generated");
	divStyle = divElement.style;
	divStyle.position = "absolute";
	//divStyle.width="100";
	//divElement.style.height="100";
	//divElement.style.color="#ffff00";
	divStyle.visibility="hidden";
	divStyle.border="1px solid black";
	divStyle.left="110";
	//divElement.style.zIndex="10";
	divStyle.backgroundColor = "#AECDCC";
	divStyle.padding="2px";
	divStyle.width="";
	divStyle.zIndex="100";
	var parentTargetPos = document.getElementById("configurator");
	var targetHeightElement = document.getElementById(this.getAttribute("idTd"));
	var targetWidthElement = document.getElementById(this.getAttribute("idSi"));
	//divElement.style.top=targetHeightElement.offsetTop;
	var offsetYAxis = 19+targetHeightElement.offsetTop;
	var offsetXAxis = 11+targetWidthElement.offsetLeft;
	
	//var targetWidthElement = document.getElementById(this.getAttribute("idSi"));
	offsetYAxis = offsetYAxis+ parentTargetPos.offsetTop;
	offsetXAxis = offsetXAxis+parentTargetPos.offsetLeft;
	divElement.style.top=offsetYAxis;
	divElement.style.left=offsetXAxis;
	/*
	actualTextElement = document.createTextNode(targetHeightElement.offsetTop);
	divElement.appendChild(actualTextElement);
	divElement.appendChild(document.createElement("br"));
	actualTextElement = document.createTextNode(targetHeightElement);
	divElement.appendChild(actualTextElement);
	*/
}
function ssl2(event)
{
	var level = this.getAttribute("l2");
	var xRun = this.getAttribute("l1");
	//alert(this.getAttribute("l1"));
	selectedValues[xRun] = this.getAttribute("value");
	selectedValuesColumn[xRun] = this.getAttribute("sC");
	targetObject = document.getElementById(this.getAttribute("idTdd"));
	targetObject.removeChild(targetObject.firstChild);
	targetObject.appendChild(document.createTextNode(this.getAttribute("text")));
	while(selectedValues.length-1>(xRun))
	{
		selectedValues.pop();
		selectedValuesColumn.pop();
	}
	xRun++;
	//alert(this.getAttribute("tdd")+xRun);
	targetObject = document.getElementById("tdd"+xRun);
	//alert(targetObject);
	while(targetObject!=null)
	{
		//alert(targetObject);
		targetObject.removeChild(targetObject.firstChild);
		targetObject.appendChild(document.createTextNode(" - "));
		
		xRun++;
		//targetObject = document.getElementById(this.getAttribute("tdd")+xRun);
		targetObject = document.getElementById("tdd"+xRun);

	}


	document.body.removeChild(divElement);
	//divElement.style.visibility="hidden"
	divElement=null;
	if(navLev4I1!=null)
	{
		//(spareNavLev4I1 = navLev4I1;
		lssi(navLev4I1.getAttribute("id"));
		navLev4IP="";
		navLev4I1 = null;
	}
}
function ssl2_ORG(event)
{
	var level = this.getAttribute("l2");
	var xRun = this.getAttribute("l1");
	//alert(this.getAttribute("l1"));
	selectedValues[xRun] = this.getAttribute("value");
	selectedValuesColumn[xRun] = this.getAttribute("sC");
	targetObject = document.getElementById(this.getAttribute("idTdd"));
	targetObject.removeChild(targetObject.firstChild);
	targetObject.appendChild(document.createTextNode(this.getAttribute("text")));
	while(selectedValues.length>=(xRun+1))
	{
		selectedValues.pop();
		selectedValuesColumn.pop();
	}
	xRun++;
	//alert(this.getAttribute("tdd")+xRun);
	targetObject = document.getElementById("tdd"+xRun);
	//alert(targetObject);
	while(targetObject!=null)
	{
		//alert(targetObject);
		targetObject.removeChild(targetObject.firstChild);
		targetObject.appendChild(document.createTextNode(" - "));
		
		xRun++;
		//targetObject = document.getElementById(this.getAttribute("tdd")+xRun);
		targetObject = document.getElementById("tdd"+xRun);

	}


	document.body.removeChild(divElement);
	//divElement.style.visibility="hidden"
	divElement=null;
	if(navLev4I1!=null)
	{
		//(spareNavLev4I1 = navLev4I1;
		lssi(navLev4I1.getAttribute("id"));
		navLev4IP="";
		navLev4I1 = null;
	}
}
var retryCount3=0;
function udb(language, organisation, navSeq)
{
	navSeqCheck = null;
	if(!dataSentBasket)
	{
		sdts("navSeq="+navSeq+"&language="+language+"&organisation="+organisation);
		dataSentBasket = true;
	}
	navSeqCheck = theBuffer2.retrieveData("navSeqCheck");
	if(navSeqCheck==null||navSeqCheck!=navSeq)
	{
		if(retryCount3==maxRefresh)
		{
			alert("TIMEOUT3");
			clearStatics3();
			return;
		}
		window.setTimeout("udb('"+language+"','"+organisation+"','"+navSeq+"')",refreshDelay);
		retryCount3++;
		return;
	}
else
	{
		dataSentBasket = false;
	}
	localDataSet = new Array();
	localDataSet = theBuffer2.retrieveData("dataset");
	theBuffer2 = new exchanger();
	targetElementMain = document.getElementById("basketContentTabTr1");
	while(targetElementMain.hasChildNodes())
	{
		targetElementMain.removeChild(targetElementMain.firstChild);
	}

	

	/*actualElement = document.createElement("td");
	actualElement.setAttribute("width","5");
	imgElement = document.createElement("img");
	imgElement.setAttribute("src","../../images/imgTemplates/blank.gif");
	imgElement.setAttribute("width","5");
	imgElement.setAttribute("height","1");
	imgElement.setAttribute("alt","");
	imgElement.setAttribute("border","0");
	actualElement.appendChild(imgElement);
	targetElementMain.appendChild(actualElement);*/
	
	// Text 'Positionen'
	/*actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "fpnGreen8";
	actualTextElement = document.createTextNode(localDataSet[0]["tIText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);*/
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "contentbox";
	actualTextElement = document.createTextNode(localDataSet[0]["tIText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	//Anzahl Positionen
	/*actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "fpnGreen8";
	actualTextElement = document.createTextNode(localDataSet[0]["tI"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);*/
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "contentboxright";
	actualTextElement = document.createTextNode(localDataSet[0]["tI"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	targetElementMain = document.getElementById("basketContentTabTr2");
	while(targetElementMain && targetElementMain!=null && targetElementMain.hasChildNodes())
	{
		targetElementMain.removeChild(targetElementMain.firstChild);
	}

	//Netto-Preis
	/*actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "fpnGreen8";
	actualTextElement = document.createTextNode(localDataSet[0]["tCText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);*/
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "contentbox";
	actualTextElement = document.createTextNode(localDataSet[0]["tCText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	/*actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "fpnGreen8";
	actualTextElement = document.createTextNode(localDataSet[0]["tC"]+"\u00a0"+localDataSet[0]["tCC"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);*/
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "contentboxright";
	actualTextElement = document.createTextNode(localDataSet[0]["tC"]+"\u00a0"+localDataSet[0]["tCC"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);
	
	//Button 'zum Warenkorb bzw. zur Kasse'
	/*actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.setAttribute("width","23");
	hrefElement = document.createElement("a");
	hrefElement.setAttribute("href","../../ar03/templates/xxxxxAr03Warenkorb.jsp?language="+language+"&organisation="+organisation+"");
	hrefElement.setAttribute("target","_self");
	imgElement = document.createElement("img");
	imgElement.setAttribute("src","../../images/imgTemplates/einkaufswagen_2.gif");
	imgElement.setAttribute("width","23");
	imgElement.setAttribute("height","16");
	imgElement.setAttribute("alt","");
	imgElement.setAttribute("border","0");
	hrefElement.appendChild(imgElement);
	actualElement.appendChild(hrefElement);
	targetElementMain.appendChild(actualElement);*/

	}


function udbax(localDataSet )
{
	
	// Text 'Positionen'
	targetElementMain = document.getElementById("basketContentTabTr1");
	while(targetElementMain.hasChildNodes())
	{
		targetElementMain.removeChild(targetElementMain.firstChild);
	}
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "contentbox";
	actualTextElement = document.createTextNode(localDataSet[0]["tIText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	//Anzahl Positionen
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "contentboxright";
	actualTextElement = document.createTextNode(localDataSet[0]["tI"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	targetElementMain = document.getElementById("basketContentTabTr2");
	while(targetElementMain && targetElementMain!=null && targetElementMain.hasChildNodes())
	{
		targetElementMain.removeChild(targetElementMain.firstChild);
	}

	//Netto-Preis
	actualElement = document.createElement("td");
	actualElement.setAttribute("align","left");
	actualElement.setAttribute("width","10");
	actualElement.className = "contentbox";
	actualTextElement = document.createTextNode(localDataSet[0]["tCText"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);

	actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.className = "contentboxright";
	actualTextElement = document.createTextNode(localDataSet[0]["tC"]+"\u00a0"+localDataSet[0]["tCC"]);
	actualElement.appendChild(actualTextElement);
	targetElementMain.appendChild(actualElement);
	

	if(localDataSet[0]["tCCrn"]!=null)
	{
		var x = new Date().getTime();
	
		$('body').append("<div id=\"wkReminder"+x+"\" class=\"bito\">"+localDataSet[0]["tCCrn"]+"</div>");
		$("#wkReminder"+x).dialog({
			width: 	260,
			height:	140
			
	});
	}
	if(localDataSet[0]["tCCbl"]!=null && $('#tCCbl').length==0)
	{
		blText = '<tr id="tCCbl"><td colspan="2" align="right">';
		blText += '<table cellspacing="0" cellpadding="0" border="0" class="wkttCCbltab"><tr><td class="wktCCbl"><a href="xxxxxAr03Warenkorb.jsp?language='+localDataSet[0]["tClng"]+'&organisation='+localDataSet[0]["tCorg"]+'">'+localDataSet[0]["tCCbl"];
		blText += '<img width="17" height="18" border="0" align="absmiddle" alt="" src="../../images/imgTemplates/button_toBasketOrange.gif"/></a></td></tr></table>';
		blText += '</td></tr>';
		$(targetElementMain).parent().append(blText);
		
	}
}

function reminderDisplay()
{
	
}

function reminderHide()
{
	
	
}

function clearStatics3()
{
	dataSentBasket = false;
	retryCount3 = 0;
}
function clearStatics4()
{
	dataSentReminder = false;
	retryCount3 = 0;
}

function displayConfig()
{
	if(selectedValuesColumn.length>0)
	{
		self.location.href="xxxxxAr03ShopMain.jsp?navSeq="+navSeq+"&language="+language+"&organisation="+organisation+"&sC="+selectedValuesColumn+"&sV="+selectedValues;
	}
else
	{
		self.location.href="xxxxxAr03ShopMain.jsp?navSeq="+navSeq+"&language="+language+"&organisation="+organisation+"&sA=1";
	}

	//alert(selectedValues+"\n"+selectedValuesColumn+"\n"+navSeq+"\n"+language+"\n"+organisation);
}
function displayAll()
{
	//alert(selectedValues+"\n"+selectedValuesColumn+"\n"+navSeq+"\n"+language+"\n"+organisation);
	self.location.href="xxxxxAr03ShopMain.jsp?navSeq="+navSeq+"&language="+language+"&organisation="+organisation+"&sA=1";
}

function changeOrg(orgShort)
{
	self.location.href="xxxxxAr03Home.jsp?organisation="+orgShort;
}

function directOrderSubmit()
{
	formObj1 = document.getElementById("dof");
	if (IFrameObj1.contentDocument) {
		docObj = IFrameObj1.contentDocument;
	} else {
		if (IFrameObj1.contentWindow) {
			docObj = IFrameObj1.contentWindow.document;
		} else {
			if (IFrameObj1.document) {
				docObj = IFrameObj1.document;
			}
		}
	}
	//alert(formObj1.dirOrdSearch.value);
	//docObj = document.frames[0].document;//theBuffer2.returnDocument();
	//docObj = document;
	formObj = docObj.createElement("form");
	formObj.setAttribute("action","xxxxxBasketReceiver.jsp");
	formObj.setAttribute("method","post");
	formObj.setAttribute("name","xP");
	formObj.setAttribute("id","xp1");

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","language");
	//inputElement.value="<%= language %>";
	inputElement.setAttribute("value",formObj1.language.value);


	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","cM");
	inputElement.setAttribute("value","dO");
	//inputElement.value="uB";
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","organisation");
	inputElement.setAttribute("value",formObj1.organisation.value);
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","navSeq");
	inputElement.setAttribute("value",formObj1.navSeq.value);
	//inputElement.value="<%= organisation %>";
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","bN");
	inputElement.setAttribute("value",formObj1.dirOrdSearch.value);
	//inputElement.value=formObj1.dirOrdSearch.value;
	formObj.appendChild(inputElement);

	docObj.body.appendChild(formObj);
	formObj.submit();


}
function redirDo()
{
	formObj1 = document.getElementById("dof");

	//alert(formObj1.dirOrdSearch.value);
	//docObj = document.frames[0].document;//theBuffer2.returnDocument();
	docObj = document;
	formObj = docObj.createElement("form");
	formObj.setAttribute("action","xxxxxAr03Direktbestellung.jsp");
	formObj.setAttribute("method","post");
	formObj.setAttribute("name","xP");
	formObj.setAttribute("id","xp1");

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","language");
	//inputElement.value="<%= language %>";
	inputElement.setAttribute("value",formObj1.language.value);


	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","cM");
	inputElement.setAttribute("value","dO");
	//inputElement.value="uB";
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","organisation");
	inputElement.setAttribute("value",formObj1.organisation.value);
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","navSeq");
	inputElement.setAttribute("value",formObj1.navSeq.value);
	//inputElement.value="<%= organisation %>";
	formObj.appendChild(inputElement);
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","bN");
	inputElement.setAttribute("value",formObj1.dirOrdSearch.value);
	//inputElement.value=formObj1.dirOrdSearch.value;
	formObj.appendChild(inputElement);

	docObj.body.appendChild(formObj);
	formObj.submit();



}
function addToReminder()
{
	formObj1 = document.getElementById("dof");

	docObj = document;
	formObj = docObj.createElement("form");
	formObj.setAttribute("action","xxxxxBasketReceiver.jsp");
	formObj.setAttribute("method","get");
	formObj.setAttribute("name","xP");
	formObj.setAttribute("id","xp1");

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","language");
	inputElement.setAttribute("value",formObj1.language.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","cM");
	inputElement.setAttribute("value","rN");
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","organisation");
	inputElement.setAttribute("value",formObj1.organisation.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","nS");
	inputElement.setAttribute("value",formObj1.navSeq.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sA");
	inputElement.setAttribute("value",formObj1.sA.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sC");
	inputElement.setAttribute("value",formObj1.sC.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sV");
	inputElement.setAttribute("value",formObj1.sV.value);
	formObj.appendChild(inputElement);

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","ars");
	inputElement.setAttribute("value",formObj1.ars.value);
	formObj.appendChild(inputElement);

	//docObj.body.appendChild(formObj);
	$(formObj).ajaxSubmit({dataType:"script"});



}

function addToReminderProd(ars)
{
	formObj1 = document.getElementById("dof");

	
	docObj = document;
	formObj = docObj.createElement("form");
	formObj.setAttribute("action","xxxxxBasketReceiver.jsp");
	formObj.setAttribute("method","get");
	formObj.setAttribute("name","xP");
	formObj.setAttribute("id","xp1");

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","language");
	inputElement.setAttribute("value",formObj1.language.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","cM");
	inputElement.setAttribute("value","rNp");
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","organisation");
	inputElement.setAttribute("value",formObj1.organisation.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","nS");
	inputElement.setAttribute("value",formObj1.navSeq.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sA");
	inputElement.setAttribute("value",formObj1.sA.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sC");
	inputElement.setAttribute("value",formObj1.sC.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sV");
	inputElement.setAttribute("value",formObj1.sV.value);
	formObj.appendChild(inputElement);

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","ars");
	inputElement.setAttribute("value",ars);
	formObj.appendChild(inputElement);

	//docObj.body.appendChild(formObj);
	$(formObj).ajaxSubmit({dataType:"script"});
	//formObj.submit();
}

function addToReminderZoom(ars)
{
	formObj1 = document.getElementById("dof");

	
	docObj = document;
	formObj = docObj.createElement("form");
	formObj.setAttribute("action","xxxxxBasketReceiver.jsp");
	formObj.setAttribute("method","get");
	formObj.setAttribute("name","xP");
	formObj.setAttribute("id","xp1");

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","language");
	inputElement.setAttribute("value",formObj1.language.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","cM");
	inputElement.setAttribute("value","rNz");
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","organisation");
	inputElement.setAttribute("value",formObj1.organisation.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","nS");
	inputElement.setAttribute("value",formObj1.navSeq.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sA");
	inputElement.setAttribute("value",formObj1.sA.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sC");
	inputElement.setAttribute("value",formObj1.sC.value);
	formObj.appendChild(inputElement);
	
	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","sV");
	inputElement.setAttribute("value",formObj1.sV.value);
	formObj.appendChild(inputElement);

	inputElement = docObj.createElement("input");
	inputElement.setAttribute("type","hidden");
	inputElement.setAttribute("name","ars");
	inputElement.setAttribute("value",ars);
	formObj.appendChild(inputElement);

	docObj.body.appendChild(formObj);
	$('#xp1').ajaxSubmit({dataType:"script"});



}


var retryCount4=0;
var timeNow = "";
function udr(language, organisation)
{
	$.getJSON("../../ar03/templates/xxxxxBasketReceiver.jsp?navSeq="+timeNow+"&cM=rNu&language="+language+"&organisation="+organisation,function(localDataSet){
	targetElementMain = document.getElementById("cbgpr");
	
	
	var tableElementDiv = document.createElement("table");
	tableElementDiv.setAttribute("border","0");
	tableElementDiv.setAttribute("width","156");
	tableElementDiv.setAttribute("height","100%");
	tableElementDiv.setAttribute("cellSpacing","0");
	tableElementDiv.setAttribute("cellPadding","0");
	var myTbodyDiv = document.createElement("tbody");
	var trElementDiv = document.createElement("tr");
	var tdElementDiv = document.createElement("td");
	tdElementDiv.setAttribute("width","156");
	
	while(targetElementMain.hasChildNodes())
	{
		targetElementMain.removeChild(targetElementMain.firstChild);
	}

	//Links
	tableElement = document.createElement("table");
	tableElement.setAttribute("align","left");
	tableElement.setAttribute("border","0");
	tableElement.setAttribute("width","100%");
	tableElement.setAttribute("cellSpacing","0");
	tableElement.setAttribute("cellPadding","0");
	myTbody = document.createElement("tbody");
	
for (var i=0;i<localDataSet.length; i++)
{

	trElement = document.createElement("tr");

		tdElement = document.createElement("td");
		tdElement.setAttribute("valign","top");
		tdElement.style.paddingTop="5px";
		imgElement = document.createElement("img");
		imgElement.setAttribute("src","../../images/imgTemplates/selCountList.gif");
		imgElement.setAttribute("width","3");
		imgElement.setAttribute("height","3");
		imgElement.setAttribute("alt","");
		imgElement.setAttribute("border","0");
		tdElement.appendChild(imgElement);
		
		tdElement2 = document.createElement("td");
		tdElement2.style.paddingLeft="5px";
		hrefElement = document.createElement("a");
		hrefElement.className = "noticeText";
		
		hrefElement.setAttribute("href","javascript:dispRemNav("+localDataSet[i]["nS"]+",'"+localDataSet[i]["nT"]+"','"+localDataSet[i]["cS"]+"','"+localDataSet[i]["sA"]+"','"+localDataSet[i]["sC"]+"','"+localDataSet[i]["sV"]+"','"+localDataSet[i]["ars"]+"')");
		
		if(localDataSet[i]["sV"]!="")
			{
			$(hrefElement).append(localDataSet[i]["nN"]+" - "+localDataSet[i]["sV"]);
			tdElement2.appendChild(hrefElement);
			}
		else
			{
			$(hrefElement).append(localDataSet[i]["nN"]);
			tdElement2.appendChild(hrefElement);
			}
	trElement.appendChild(tdElement);
	trElement.appendChild(tdElement2);
	myTbody.appendChild(trElement);

}
	trElement = document.createElement("tr");

	actualElement = document.createElement("td");
	actualElement.setAttribute("align","right");
	actualElement.setAttribute("height","20");
	actualElement.setAttribute("valign","bottom");
	actualElement.setAttribute("colSpan","2");

	tableElement2 = document.createElement("table");
	tableElement2.setAttribute("border","0");
	tableElement2.setAttribute("align","right");
	tableElement2.setAttribute("cellSpacing","0");
	tableElement2.setAttribute("cellPadding","0");
	myTbody2 = document.createElement("tbody");
	trElement2 = document.createElement("tr");

	actualElement2 = document.createElement("td");
	actualElement2.setAttribute("align","right");
	hrefElement2 = document.createElement("a");
	hrefElement2.setAttribute("href","javascript:addToReminder()");
	hrefElement2.className = "noticeText";
	actualTextElement2 = document.createTextNode(localDataSet[0]["lT"]);
	hrefElement2.appendChild(actualTextElement2);
	actualElement2.appendChild(hrefElement2);
	trElement2.appendChild(actualElement2);
	
	actualElement2 = document.createElement("td");
	actualElement2.style.paddingLeft="5px";
	imgElement2 = document.createElement("img");
	imgElement2.setAttribute("src","../../images/imgTemplates/button_search.gif");
	imgElement2.setAttribute("width","17");
	imgElement2.setAttribute("height","18");
	imgElement2.setAttribute("alt","");
	imgElement2.setAttribute("border","0");
	hrefElement2 = document.createElement("a");
	hrefElement2.setAttribute("href","javascript:addToReminder()");
	hrefElement2.appendChild(imgElement2);
	
	actualElement2.appendChild(hrefElement2);
	trElement2.appendChild(actualElement2);
	myTbody2.appendChild(trElement2);
	tableElement2.appendChild(myTbody2);
	
	actualElement.appendChild(tableElement2);


	trElement.appendChild(actualElement);
	myTbody.appendChild(trElement);
	
	tableElement.appendChild(myTbody);
	tdElementDiv.appendChild(tableElement);
	
	trElementDiv.appendChild(tdElementDiv);
	myTbodyDiv.appendChild(trElementDiv);
	tableElementDiv.appendChild(myTbodyDiv);
	
	
	targetElementMain.appendChild(tableElementDiv);
	});
}