var miniCartAvail = "X";
//
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 += "Warenkorb:&nbsp;<strong>" + prdCount + "&nbsp;";
    if(prdCount==1){
        prdString += "Produkt";
    }
    else{
        prdString += "Produkte";
    };
    prdString += "</strong>,&nbsp;Summe:&nbsp;<strong>" + TFormatCurrency(subTotal, objPriCurrency) + "</strong>";
	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\">Katalog</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="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="9" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bulletact.gif" width="9" height="9" 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/bulletwgr.gif" width="9" height="9" alt="BulletCat1stCls.gif" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else strHTML += '<td width=\"1%\"><img src="assets/images/bulletnor.gif" width="9" height="9" 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 = true;
		this.categoryId = categoryId;
		};
// navigation
var navigation = new Array();
//
navigation[0] = new navElem(0,"Lamello","pi1150628448.php",null,"1037");
navigation[1] = new navElem(1,"Holzverbindungs-System","pi1150628994.php",0,"1037_1");
navigation[2] = new navElem(2,"Nutfräsmaschinen","pi837224155.php",1,"1037_1_1");
navigation[3] = new navElem(3,"Verbindungselemente","pi92599936.php",1,"1037_1_2");
navigation[4] = new navElem(4,"Leimgeräte","pi-1915333503.php",1,"1037_1_3");
navigation[5] = new navElem(5,"Spanngeräte","pi-640106322.php",1,"1037_1_4");
navigation[6] = new navElem(6,"Fräswerkzeuge","pi1303786135.php",1,"1037_1_5");
navigation[7] = new navElem(7,"Zubehör","pi1295683212.php",1,"1037_1_6");
navigation[8] = new navElem(8,"Ersatzteile","pi375183005.php",1,"1037_1_7");
navigation[9] = new navElem(9,"Holzflick-System","pi-1386035302.php",0,"1037_2");
navigation[10] = new navElem(10,"Minispotfräsmaschinen","pi-1640926701.php",9,"1037_2_1");
navigation[11] = new navElem(11,"Flickfräsmaschine","pi-1595007144.php",9,"1037_2_2");
navigation[12] = new navElem(12,"Astspotfräsmaschine","pi1476694649.php",9,"1037_2_3");
navigation[13] = new navElem(13,"Minispotflicke","pi-1784253114.php",9,"1037_2_4");
navigation[14] = new navElem(14,"Astspots","pi1327464783.php",9,"1037_2_5");
navigation[15] = new navElem(15,"Bündigfräsmaschine","pi1064744164.php",9,"1037_2_6");
navigation[16] = new navElem(16,"Fräswerkzeuge","pi-1822252011.php",9,"1037_2_7");
navigation[17] = new navElem(17,"Ersatzteile","pi-469649998.php",9,"1037_2_8");
navigation[18] = new navElem(18,"Spezialmaschinen","pi269147211.php",0,"1037_3");
navigation[19] = new navElem(19,"Trennfräsmaschinen","pi1871977264.php",18,"1037_3_1");
navigation[20] = new navElem(20,"Bündigfräsmaschinen","pi-1988761743.php",18,"1037_3_2");
navigation[21] = new navElem(21,"Belagbündigfräsmaschinen","pi2129212638.php",18,"1037_3_3");
navigation[22] = new navElem(22,"Profilfräsmaschinen","pi905821959.php",18,"1037_3_4");
navigation[23] = new navElem(23,"Schattenfugenfräse","pi1442504252.php",18,"1037_3_5");
navigation[24] = new navElem(24,"Zubehör","pi-473761651.php",18,"1037_3_6");
navigation[25] = new navElem(25,"Ersatzteile","pi1456758474.php",18,"1037_3_7");
navigation[26] = new navElem(26,"LK Leimauftrags-System","pi1358833027.php",0,"1037_4");
navigation[27] = new navElem(27,"Leimgeräte","pi-1541387768.php",26,"1037_4_1");
navigation[28] = new navElem(28,"Leimpistolen","pi909128553.php",26,"1037_4_2");
navigation[29] = new navElem(29,"Leimdüsen","pi1642684278.php",26,"1037_4_3");
navigation[30] = new navElem(30,"PUR Leimauftrags-System","pi-246821953.php",26,"1037_4_4");
navigation[31] = new navElem(31,"Zubehör","pi734423700.php",26,"1037_4_5");
navigation[32] = new navElem(32,"Ersatzteile","pi-1230916603.php",26,"1037_4_6");
navigation[33] = new navElem(33,"Diverse Produkte","pi174662370.php",0,"1037_5");
navigation[34] = new navElem(34,"Frässchablonen","pi408038843.php",33,"1037_5_1");
navigation[35] = new navElem(35,"Feuchtemessgeräte","pi591924192.php",33,"1037_5_2");
navigation[36] = new navElem(36,"Schleifscheiben","pi-2041227679.php",33,"1037_5_3");
navigation[37] = new navElem(37,"Schleifmittel","pi-1143253746.php",33,"1037_5_4");
navigation[38] = new navElem(38,"Sonstiges Zubehör","pi-1854371977.php",0,"1037_6");
navigation[39] = new navElem(39,"Fräswerkzeuge","pi-1499153940.php",38,"1037_6_1");
navigation[40] = new navElem(40,"Absaugzubehör","pi687781501.php",38,"1037_6_2");
navigation[41] = new navElem(41,"Zubehör Maschinen","pi-84254214.php",38,"1037_6_3");
navigation[42] = new navElem(42,"INVIS - System","pi763344996.php",0,"1037_7");

// 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.php";
		};
	};
// activates entries for categories
activateItem(getParameterFromURL("categoryId"));

