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,"Flex","pi-1479039076.php",null,"1002");
navigation[1] = new navElem(1,"Winkel- und Geradschleifer","pi1141596198.php",0,"1002_1");
navigation[2] = new navElem(2,"Einhandwinkelschleifer","pi-102626641.php",1,"1002_1_1");
navigation[3] = new navElem(3,"Zweihandwinkelschleifer","pi-2095768892.php",1,"1002_1_2");
navigation[4] = new navElem(4,"Geradschleifer","pi-574501771.php",1,"1002_1_3");
navigation[5] = new navElem(5,"Zubehör Winkel-/Geradschleifer","pi-1392374126.php",1,"1002_1_Z");
navigation[6] = new navElem(6,"Oberflächenbearbeitung","pi-1930183765.php",0,"1002_2");
navigation[7] = new navElem(7,"Metallbearbeitung","pi-1791779056.php",6,"1002_2_1");
navigation[8] = new navElem(8,"Zubehör Metall","pi251352529.php",6,"1002_2_2");
navigation[9] = new navElem(9,"Holzbearbeitung","pi-1870144578.php",6,"1002_2_3");
navigation[10] = new navElem(10,"Zubehör Holz","pi818828391.php",6,"1002_2_4");
navigation[11] = new navElem(11,"Polierer","pi1255759900.php",0,"1002_3");
navigation[12] = new navElem(12,"Polierzubehör","pi-275837715.php",11,"1002_3_Z");
navigation[13] = new navElem(13,"Sägen","pi-66964566.php",0,"1002_4");
navigation[14] = new navElem(14,"Säbelsägen","pi1598935267.php",13,"1002_4_1");
navigation[15] = new navElem(15,"Metall: Band- / Kreissägen","pi-1273386520.php",13,"1002_4_2");
navigation[16] = new navElem(16,"Holz: Stich- / Kreissägen","pi-1456910903.php",13,"1002_4_3");
navigation[17] = new navElem(17,"Zubehör Sägen","pi493175382.php",13,"1002_4_4");
navigation[18] = new navElem(18,"Rühren","pi-1947865825.php",0,"1002_5");
navigation[19] = new navElem(19,"Zubehör Rühren","pi389318772.php",18,"1002_5_Z");
navigation[20] = new navElem(20,"Boden- und Wandbearbeitung","pi534000741.php",0,"1002_6");
navigation[21] = new navElem(21,"Betonschleifer","pi530576322.php",20,"1002_6_1");
navigation[22] = new navElem(22,"Zubehör Betonschleifer","pi-358734565.php",21,"1002_6_1_Z");
navigation[23] = new navElem(23,"Giraffe","pi1390593984.php",20,"1002_6_2");
navigation[24] = new navElem(24,"Zubehör Giraffe","pi-2125226815.php",23,"1002_6_2_Z");
navigation[25] = new navElem(25,"Mauerschlitzer","pi96990190.php",20,"1002_6_3");
navigation[26] = new navElem(26,"Zubehör Mauerschlitzer","pi2127410391.php",25,"1002_6_3_Z");
navigation[27] = new navElem(27,"Stockmaschinen","pi1566700492.php",20,"1002_6_4");
navigation[28] = new navElem(28,"Schrauben Bohren Hämmern","pi1648435933.php",0,"1002_7");
navigation[29] = new navElem(29,"Akkumaschinen","pi-251285798.php",28,"1002_7_1");
navigation[30] = new navElem(30,"Bohrmaschinen-/hämmer","pi1838651475.php",28,"1002_7_2");
navigation[31] = new navElem(31,"Zubehör Bohren","pi742414488.php",28,"1002_7_Z");
navigation[32] = new navElem(32,"Kernbohrtechnik","pi-991419719.php",0,"1002_8");
navigation[33] = new navElem(33,"Kernbohreinheiten","pi-46116730.php",32,"1002_8_1");
navigation[34] = new navElem(34,"Zubehör Kernbohrtechnik","pi1344703375.php",32,"1002_8_Z");
navigation[35] = new navElem(35,"Saugen/Reinigen","pi283705892.php",0,"1002_9");
navigation[36] = new navElem(36,"Zubehör","pi635549781.php",35,"1002_9_Z");
navigation[37] = new navElem(37,"Messtechnik","pi-1601583886.php",0,"1002_A");
navigation[38] = new navElem(38,"Zubehör Messtechnik","pi27855499.php",37,"1002_A_Z");
navigation[39] = new navElem(39,"Steinbearbeitung","pi1441774704.php",0,"1002_B");
navigation[40] = new navElem(40,"Nass-Schleifer","pi1785774001.php",39,"1002_B_1");
navigation[41] = new navElem(41,"Kantenfräser","pi961198110.php",39,"1002_B_2");
navigation[42] = new navElem(42,"Steintrenner","pi621629767.php",39,"1002_B_3");
navigation[43] = new navElem(43,"Zubehör Steinbearbeitung","pi-1457712260.php",39,"1002_B_Z");
navigation[44] = new navElem(44,"Ersatzteile","pi1285412045.php",0,"1002_E");
navigation[45] = new navElem(45,"Zubehör allgemein","pi925799946.php",0,"1002_Z");

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


