//
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/bulletcat1st.gif" width="13" height="14" alt="Bullet.gif" 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" bgcolor="#D8C7A3" cellpadding="1" cellspacing="1" >';
		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="14" alt="BulletCatAct.gif" 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="14" alt="BulletCat1stCls.gif" 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="14" alt="BulletCat1st.gif" 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,"Stoffe","pi1197895575.htm",null,"01");
navigation[1] = new navElem(1,"Mohair bis 10 mm&nbsp(117)","pi-939309172.htm",0,"1-a");
navigation[2] = new navElem(2,"Mohair von 11 bis 20 mm&nbsp(137)","pi1104894877.htm",0,"1-b");
navigation[3] = new navElem(3,"Mohair von 21 bis 30 mm&nbsp(115)","pi1042163866.htm",0,"1-c");
navigation[4] = new navElem(4,"Mohair über 30 mm&nbsp(21)","pi-1471709421.htm",0,"1-f");
navigation[5] = new navElem(5,"Baumwollstoffe&nbsp(15)","pi1987864664.htm",0,"1-g");
navigation[6] = new navElem(6,"Viskose&nbsp(12)","pi-140679303.htm",0,"1-h");
navigation[7] = new navElem(7,"Synthetische Stoffe&nbsp(19)","pi853665350.htm",0,"1-i");
navigation[8] = new navElem(8,"Alpaka&nbsp(29)","pi-1709679025.htm",0,"1-j");
navigation[9] = new navElem(9,"Schafwolle&nbsp(5)","pi1136889316.htm",0,"1-k");
navigation[10] = new navElem(10,"Ministoffe&nbsp(52)","pi-1613051627.htm",0,"1-l");
navigation[11] = new navElem(11,"Suédine&nbsp(32)","pi1180579506.htm",0,"1-m");
navigation[12] = new navElem(12,"Wollfilz&nbsp(13)","pi-1238136501.htm",0,"1-n");
navigation[13] = new navElem(13,"Sonderstoffe&nbsp(5)","pi1861404110.htm",0,"1-o");
navigation[14] = new navElem(14,"Stoff stückchen&nbsp(97)","pi693044335.htm",0,"1-q");
navigation[15] = new navElem(15,"Augen","pi-126665721.htm",null,"02");
navigation[16] = new navElem(16,"Glasaugen&nbsp(6)","pi1391449916.htm",15,"2-a");
navigation[17] = new navElem(17,"Kunststoffaugen&nbsp(6)","pi-1299661427.htm",15,"2-b");
navigation[18] = new navElem(18,"Positionsaugen&nbsp(4)","pi-1634336822.htm",15,"2-c");
navigation[19] = new navElem(19,"Nasen&nbsp(5)","pi615346819.htm",null,"03");
navigation[20] = new navElem(20,"Scheiben/Gelenke&nbsp(10)","pi-1726033144.htm",null,"04");
navigation[21] = new navElem(21,"Eisenwaren&nbsp(8)","pi906250345.htm",null,"05");
navigation[22] = new navElem(22,"Werkzeuge&nbsp(9)","pi621744246.htm",null,"06");
navigation[23] = new navElem(23,"Scheren&nbsp(5)","pi1542449343.htm",null,"06-a");
navigation[24] = new navElem(24,"Garne","pi1762100116.htm",null,"07");
navigation[25] = new navElem(25,"Perlé Nasengarne&nbsp(8)","pi931731717.htm",24,"7-a");
navigation[26] = new navElem(26,"Nähgarne&nbsp(4)","pi-673979422.htm",24,"7-b");
navigation[27] = new navElem(27,"Augengarne&nbsp(5)","pi1568414395.htm",24,"7-c");
navigation[28] = new navElem(28,"Füllmaterialien&nbsp(15)","pi915715296.htm",null,"08");
navigation[29] = new navElem(29,"Bastelpackungen/Schnitte","pi178588513.htm",null,"09");
navigation[30] = new navElem(30,"Bastelpackungen","pi-629398002.htm",29,"9-a");
navigation[31] = new navElem(31,"Bären Bastelpackungen&nbsp(49)","pi1279015466.htm",30,"9-a1");
navigation[32] = new navElem(32,"Sonstige Bastelpackungen&nbsp(27)","pi-1151863453.htm",30,"9-a2");
navigation[33] = new navElem(33,"Schnitte&nbsp(52)","pi-1350351753.htm",29,"9-b");
navigation[34] = new navElem(34,"Schnittbücher/Zeitschriften","pi-1436828803.htm",null,"10");
navigation[35] = new navElem(35,"Schnittbücher&nbsp(3)","pi-1965931782.htm",34,"10-a");
navigation[36] = new navElem(36,"ältere Zeitschriften&nbsp(4)","pi-1415421453.htm",34,"10-b");
navigation[37] = new navElem(37,"aktuelle Zeitschriften&nbsp(3)","pi223054264.htm",34,"10c");
navigation[38] = new navElem(38,"Sonstiges&nbsp(14)","pi1602184870.htm",null,"12");
navigation[39] = new navElem(39,"Neuheiten&nbsp(25)","pi723398447.htm",null,"13");

// 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.htm";
		};
	};
// activates entries for categories
activateItem(getParameterFromURL("categoryId"));

