//
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="20" height="20" 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\">Gesamtkatalog</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="1" 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="20" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bulletcatact.gif" width="20" height="20" 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="20" height="20" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else strHTML += '<td width=\"1%\"><img src="assets/images/bulletcat1st.gif" width="20" height="20" 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 = false;
		this.categoryId = categoryId;
		};
// navigation
var navigation = new Array();
//
navigation[0] = new navElem(0,"Lutz Mauder Verlag","pi-2102536478.html",null,"002");
navigation[1] = new navElem(1,"Gedeckter Tisch /Wohnen","pi1060764581.html",0,"013");
navigation[2] = new navElem(2,"Kindergarten/Schule","pi767126116.html",1,"M-001");
navigation[3] = new navElem(3,"Gedeckter Tisch","pi-1823977459.html",1,"M-002");
navigation[4] = new navElem(4,"Wohnen","pi2445094.html",1,"M-003");
navigation[5] = new navElem(5,"Geburtstag","pi-125528081.html",0,"9");
navigation[6] = new navElem(6,"Hess","pi359391200.html",null,"005");
navigation[7] = new navElem(7,"CD","pi1155203076.html",null,"1");
navigation[8] = new navElem(8,"Ed Hardy","pi1286658713.html",null,"112");
navigation[9] = new navElem(9,"Schnuller","pi1847580938.html",8,"1115");
navigation[10] = new navElem(10,"Flaschen","pi-1994906941.html",8,"1116");
navigation[11] = new navElem(11,"Lätzchen","pi-365343160.html",8,"1117");
navigation[12] = new navElem(12,"Sonstiges","pi-764972375.html",8,"1118");
navigation[13] = new navElem(13,"Schleich","pi-927210778.html",null,"113");
navigation[14] = new navElem(14,"Farm Life","pi1566362398.html",13,"1111");
navigation[15] = new navElem(15,"Wild Life","pi2035066951.html",13,"1112");
navigation[16] = new navElem(16,"Bayala","pi543776380.html",13,"1113");
navigation[17] = new navElem(17,"Sonstige","pi-1872165939.html",13,"1114");
navigation[18] = new navElem(18,"Schlümpfe","pi-1562147326.html",13,"S003");
navigation[19] = new navElem(19,"Berenguer","pi-171163280.html",null,"15");
navigation[20] = new navElem(20,"Sterntaler","pi1301682282.html",null,"2");
navigation[21] = new navElem(21,"Mini Spieluhren","pi1185694645.html",20,"001");
navigation[22] = new navElem(22,"Bekleidung","pi1533280080.html",20,"004");
navigation[23] = new navElem(23,"Kopfbedeckungen","pi328591187.html",22,"K01");
navigation[24] = new navElem(24,"Sommer","pi998577702.html",23,"S1");
navigation[25] = new navElem(25,"Winter","pi1405814959.html",23,"S2");
navigation[26] = new navElem(26,"Strumpfwaren","pi-1796326504.html",22,"K02");
navigation[27] = new navElem(27,"Schuhe","pi627771833.html",22,"K03");
navigation[28] = new navElem(28,"Sommer","pi1678441077.html",27,"S3");
navigation[29] = new navElem(29,"Winter","pi-2026691438.html",27,"S4");
navigation[30] = new navElem(30,"Schmusetücher","pi887633406.html",20,"006");
navigation[31] = new navElem(31,"Greiffiguren / Kuscheltiere","pi-74300324.html",30,"007");
navigation[32] = new navElem(32,"Schlafsäcke","pi2052090863.html",20,"02");
navigation[33] = new navElem(33,"Kissen / Herzton Figuren","pi1185808637.html",20,"14");
navigation[34] = new navElem(34,"Schnullerkette","pi1714502654.html",20,"ST-001");
navigation[35] = new navElem(35,"Nestchen","pi-629923046.html",20,"ST-002");
navigation[36] = new navElem(36,"Kaufladen / Kinderküche","pi-46830300.html",null,"24");
navigation[37] = new navElem(37,"Kuscheltiere","pi97617571.html",null,"3");
navigation[38] = new navElem(38,"Puppenwagen und Zubehör","pi674276404.html",null,"4");

// 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"));


