//
function miniCart(){
var prdCount = 0, prdString = "", subTotal = (xmlConfig.cartSubTotal > 0)?xmlConfig.cartSubTotal:0;
	if(xmlOHeader.childNodes.length==0) subTotal = 0;
	for(var i=0;i<xmlOHeader.childNodes.length;i++){
		prdCount = prdCount+(parseInt(xmlOHeader.childNodes[i].QuantityAmount));
		};
	prdString += "Produkte:<strong>&nbsp;" + prdCount + "</strong><br>";
	prdString += "Summe:<strong>&nbsp;" + TFormatCurrency(subTotal, objPriCurrency) + "</strong><br><br>";
	prdString += "<a class=\"WAGRUNAV\" href=\"orderform." + xmlConfig.fileExtension + "\">";
	prdString += "<strong>" + '<img src="assets/images/bullet.gif" width="13" height="10" border="0" align="absmiddle" hspace="0" vspace="0" class="catnav">' + "Zum Bestellschein</strong></a>";
	return(prdString);
	};
//
var TNavDropDownIndent = ".."
//
function NavLinkedDropDownList(){
	return(TNavDropDownList(true));
	};
//
function NavDropDownList(){
	return(TNavDropDownList(false));
	};
//
function storeSearchParameters(optionValueArray){
var xmlSearchEngine = xmlConfig.getFirstItem("SearchEngine");
	if(optionValueArray[0]!="null"&&optionValueArray[0]!="nada"){
		xmlSearchEngine.categoryIndex = optionValueArray[0];
		xmlSearchEngine.categoryId = optionValueArray[2];
		xmlSearchEngine.ByCategory = "1";
		}
	else{
		xmlSearchEngine.categoryIndex = "null";
		xmlSearchEngine.categoryId = "null";
		xmlSearchEngine.ByCategory = "0";
		};
	};
//
function TNavDropDownList(asLink){
var rString = "";
var myNavIndex = "";
	if(asLink) myNavIndex = xmlConfig.navIndex;
	else myNavIndex = xmlConfig.getFirstItem("SearchEngine").categoryIndex;
	if(!(myNavIndex=="null"||myNavIndex=="")){ navigation[parseInt(myNavIndex)].active = true; };
	if(asLink) rString += "<select name=\"navselect\" onChange=\"changeLoc(this[this.selectedIndex].value.split(';;')[0],this[this.selectedIndex].value.split(';;')[1])\">"
	else rString += "<select name=\"navselect\" onChange=\"storeSearchParameters(this[this.selectedIndex].value.split(';;'))\">";
	rString += "<option value=\"nada;;start.htm;;null\">Produktübersicht</option>";
	for(var i=0; i<navigation.length; i++){
		if(navigation[i].parentId==null){
			rString += TNavDropDownItem(navigation[i], "");
			};
		};
	rString += "</select>";
	return(rString);
	};
//
function TNavDropDownItem(navItem, cptPreFix){
var rString = "";
	rString += "<option value=\"" + navItem.id + ";;" + navItem.linkUrl + ";;" + navItem.categoryId + "\"";
	if(navItem.active) rString += " selected";
	rString += ">" + cptPreFix + navItem.caption + "</option>";
	for(var i=0; i<navigation.length;i++) if(navigation[i].parentId==navItem.id) rString += TNavDropDownItem(navigation[i], cptPreFix + TNavDropDownIndent);
	return(rString);	
	};
//
	function openItem(itemId){
	var objActiveItem = null;
		if(itemId!=null){
			objActiveItem = navigation[itemId];
			if(objActiveItem!=null){
				objActiveItem.open = true;
				openItem(objActiveItem.parentId);
				};
			};
		};
		
	function activateItem(itemId){
	var objActiveItem = null;
		if(itemId!=null){
			objActiveItem = navigation[itemId];
			if(objActiveItem!=null){
				objActiveItem.active = true;
				openItem(objActiveItem.parentId);
				};
			};
		};
		
	function itemHasSubelems(itemId){
		for(var i=0; i<navigation.length;i++) if(navigation[i].parentId==itemId) return(true);
		return(false);
		};
	
	function TNavLinkList(){
	var strHTML = "";
		for(var i=0; i<navigation.length; i++) if(navigation[i].parentId==null) strHTML += printItem(navigation[i], 0);
		return(strHTML);
		};	
		
	function printItem(navItem, depth){
	var strHTML = "";
	var elemWidth = 1;
		strHTML += '<table width="100%" class="CATLINKS1STPARENT" border="0" cellpadding="0" cellspacing="0" >';
		strHTML += "<tr>"
		for(var i=0; i<depth; i++){
			strHTML += "<td";
			if(navItem.active) strHTML += " class=\"ACTIVECATEGORY\""
			else strHTML += " class=\"CATLINKS1STBULLET\"";
			strHTML += ' width="1%"><img src="assets/images/spacer.gif" width="13" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bulletcatact.gif" width="13" height="10" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else if(navItem.open&&itemHasSubelems(navItem.id)) strHTML += '<td width="1%" class="CATLINKS1STBULLET"><img src="assets/images/bulletcat1stcls.gif" width="13" height="10" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else strHTML += '<td width=\"1%\"><img src="assets/images/bulletcat1st.gif" width="13" height="10" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		strHTML += "<td";
		if(navItem.active) strHTML += " class=\"ACTIVECATEGORY\""
		else strHTML += " class=\"CATLINKS1STBULLET\"";
		strHTML += "width=\"" + ( 100 - ( depth + 1 ) ) + "%\">"
			+ "<a href=\"" + navItem.linkUrl + "?categoryId=" + escape(navItem.id) + "\" class=\"WAGRUNAV\">"
			+ navItem.caption
			+ "</a>"
			+ "</td>";
		strHTML += "</tr>"
		strHTML += "</table>"
		depth++;
		if(navItem.active||navItem.open){
			for(var i=0; i<navigation.length;i++) if(navigation[i].parentId==navItem.id) strHTML += printItem(navigation[i], depth);
			};
		return(strHTML);
		};


//

// navElem
	function navElem(id,caption,linkUrl,parentId,categoryId){
		this.id = id;
		this.caption = caption;
		this.linkUrl = linkUrl;
		this.parentId = parentId;
		this.active = false;
		this.open = true;
		this.categoryId = categoryId;
		};
// navigation
var navigation = new Array();
//
navigation[0] = new navElem(0,"Ätherische Öle","pi-410653426.html",null,"05");
navigation[1] = new navElem(1,"Ätherische Öle","pi651830060.html",0,"0502");
navigation[2] = new navElem(2,"Ätherische Duftmischungen","pi-1099609005.html",0,"0501");
navigation[3] = new navElem(3,"Das Wäscheparfüm!","pi2073282600.html",null,"010366");
navigation[4] = new navElem(4,"Das Raumparfum","pi1208882009.html",null,"010422");
navigation[5] = new navElem(5,"HOBBYTHEK-Produkte","pi-795723038.html",null,"01");
navigation[6] = new navElem(6,"Emulgatoren","pi1027792846.html",5,"010101");
navigation[7] = new navElem(7,"Feine Pflanzenöle","pi1196714807.html",5,"010102");
navigation[8] = new navElem(8,"Konsistenzgeber, Wachse","pi1558856364.html",5,"010103");
navigation[9] = new navElem(9,"Selbstbräuner, Sonnenschutz","pi-1081730886.html",5,"010107");
navigation[10] = new navElem(10,"Peelingzusätze","pi333368018.html",5,"010126");
navigation[11] = new navElem(11,"Vitamine, Zusatz- und Wirkstoffe","pi-1769843336.html",5,"010110");
navigation[12] = new navElem(12,"Antifaltensubstanzen, Liposome","pi826897587.html",5,"010108");
navigation[13] = new navElem(13,"Lebensmittelfarben","pi-1025355029.html",5,"010127");
navigation[14] = new navElem(14,"Pigmente, Perlglanzpigmente","pi-1816996327.html",5,"010114");
navigation[15] = new navElem(15,"Konservierungsstoffe","pi1812600934.html",5,"010115");
navigation[16] = new navElem(16,"Pflanzenextrakte, flüssig","pi-1422791185.html",5,"010118");
navigation[17] = new navElem(17,"Öle mit Wirkstoffen","pi72060164.html",5,"010121");
navigation[18] = new navElem(18,"Zuckeraustauschstoffe, Süss-Stoff","pi-948690849.html",5,"010465");
navigation[19] = new navElem(19,"Gelbildner, Haarfestiger-Substanzen","pi206232574.html",5,"010205");
navigation[20] = new navElem(20,"spezielle Haarpflegemittel","pi-196157529.html",5,"010206");
navigation[21] = new navElem(21,"Alkohole, kosmetische Wässer","pi-1249027492.html",5,"010209");
navigation[22] = new navElem(22,"natürliche Haarfarben","pi-1274574291.html",5,"010216");
navigation[23] = new navElem(23,"Tenside für Shampoos, Duschgel, etc.","pi-709380118.html",5,"010220");
navigation[24] = new navElem(24,"Lebensmittel und -Zusätze","pi-1060233463.html",5,"010425");
navigation[25] = new navElem(25,"Vitamine, Mineralstoffe","pi1767738006.html",5,"010430");
navigation[26] = new navElem(26,"Blütenwasser","pi-822517323.html",5,"010124");
navigation[27] = new navElem(27,"Parfümöle","pi1689426341.html",5,"010611");
navigation[28] = new navElem(28,"Waschmittel-Baukasten, flüssig","pi-1995993053.html",5,"010339");
navigation[29] = new navElem(29,"Zubehör und Verpackung","pi1209396688.html",null,"0106");
navigation[30] = new navElem(30,"Waschnüsse","pi-55846901.html",null,"09");
navigation[31] = new navElem(31,"Wassersprudler & Co.","pi-652515909.html",null,"02");
navigation[32] = new navElem(32,"Limonaden-Konzentrate","pi-932450816.html",31,"020334");
navigation[33] = new navElem(33,"Kohlensäurezylinder","pi1842351195.html",31,"020233");

// getNavElementByCatID
function getNavElementByCatID(categoryId){
	for(var i=0; i<navigation.length; i++){
		if(navigation[i].categoryId==categoryId){
			return(navigation[i]);
			break;
			};
		};
		return(null);
	};
// changeLoc
function changeLoc(id,linkUrl){
	if(id!="nada"){
		xmlConfig.navIndex = id.toString();
		if(xmlConfig.getFirstItem("SearchEngine").ByCategory == "1"){
			if(id=="null") xmlConfig.getFirstItem("SearchEngine").categoryId = "null"
			else xmlConfig.getFirstItem("SearchEngine").categoryId = navigation[id].categoryId;
			xmlConfig.getFirstItem("SearchEngine").categoryIndex = id;
			}
		else{
			xmlConfig.getFirstItem("SearchEngine").categoryId = "null";
			xmlConfig.getFirstItem("SearchEngine").categoryIndex = "null";
			};
		safeData();
		location.href = linkUrl + "?categoryId=" + id.toString();
		};
	};
// searchOnEnterNavi
function searchOnEnterNavi(){
	if(window.event.keyCode==13){
		xmlConfig.getFirstItem('SearchEngine').term=document.searchEngine.searchTerm.value;
		location.href = "search.html";
		};
	};
// activates entries for categories
activateItem(getParameterFromURL("categoryId"));

