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,"Mafell","pi304413439.php",null,"1035");
navigation[1] = new navElem(1,"Sägen","pi779906136.php",0,"1035_1");
navigation[2] = new navElem(2,"Pendelhub-Stichsäge","pi1396054905.php",1,"1035_1_1");
navigation[3] = new navElem(3,"Kapp-Sägesystem","pi2121370182.php",1,"1035_1_2");
navigation[4] = new navElem(4,"Platten-Sägesystem","pi-273665457.php",1,"1035_1_3");
navigation[5] = new navElem(5,"Tauchsäge","pi-1209282076.php",1,"1035_1_4");
navigation[6] = new navElem(6,"Handkreissäge","pi939965717.php",1,"1035_1_5");
navigation[7] = new navElem(7,"Zubehör","pi-2091902286.php",6,"1035_1_5_Z");
navigation[8] = new navElem(8,"Zimmerei-Kettensäge","pi-1081041589.php",1,"1035_1_6");
navigation[9] = new navElem(9,"Zubehör","pi1245006209.php",8,"1035_1_6_Z");
navigation[10] = new navElem(10,"Handbandsäge","pi-1250097104.php",1,"1035_1_7");
navigation[11] = new navElem(11,"Unterflur-Zugsäge","pi1482002545.php",1,"1035_1_8");
navigation[12] = new navElem(12,"Zubehör","pi235923934.php",11,"1035_1_8_Z");
navigation[13] = new navElem(13,"Tisch- und Formatkreissäge","pi1718194183.php",1,"1035_1_9");
navigation[14] = new navElem(14,"Sägeblätter","pi-155935940.php",1,"1035_1_Z");
navigation[15] = new navElem(15,"Bohren","pi1144467853.php",0,"1035_2");
navigation[16] = new navElem(16,"DuoDübler","pi-159882294.php",15,"1035_2_1");
navigation[17] = new navElem(17,"Akku-Bohrschrauber","pi-45021565.php",15,"1035_2_2");
navigation[18] = new navElem(18,"Bohrmaschine","pi1256269660.php",15,"1035_2_3");
navigation[19] = new navElem(19,"Zimmerei-Bohrmaschine","pi2132933737.php",15,"1035_2_4");
navigation[20] = new navElem(20,"Zubehör","pi-1358973834.php",19,"1035_2_4_Z");
navigation[21] = new navElem(21,"Bohrstation","pi-829113153.php",15,"1035_2_5");
navigation[22] = new navElem(22,"Schleifen","pi-1502034028.php",0,"1035_3");
navigation[23] = new navElem(23,"Exzenterschleifer","pi-947254011.php",22,"1035_3_1");
navigation[24] = new navElem(24,"Triset-Exzenterschleifer","pi53921762.php",22,"1035_3_2");
navigation[25] = new navElem(25,"Feinschleifer","pi-692703557.php",22,"1035_3_3");
navigation[26] = new navElem(26,"Zubehör","pi-1279117088.php",22,"1035_3_Z");
navigation[27] = new navElem(27,"Hobeln","pi-264421535.php",0,"1035_4");
navigation[28] = new navElem(28,"Handhobel","pi-185251314.php",27,"1035_4_1");
navigation[29] = new navElem(29,"Zimmerei-Hobel","pi757504119.php",27,"1035_4_2");
navigation[30] = new navElem(30,"Abricht- und Dickenhobel","pi-1484540180.php",27,"1035_4_3");
navigation[31] = new navElem(31,"Zubehör","pi-411095171.php",27,"1035_4_Z");
navigation[32] = new navElem(32,"Fräsen","pi608544506.php",0,"1035_5");
navigation[33] = new navElem(33,"Lamellen-Nutfräse","pi1354954227.php",32,"1035_5_1");
navigation[34] = new navElem(34,"Oberfräse","pi1493011896.php",32,"1035_5_2");
navigation[35] = new navElem(35,"Nutfräse","pi1206204761.php",32,"1035_5_3");
navigation[36] = new navElem(36,"Schlosskastenstemmer","pi-300873050.php",32,"1035_5_4");
navigation[37] = new navElem(37,"Kervenfräse","pi336593711.php",32,"1035_5_5");
navigation[38] = new navElem(38,"Kettenstemmer","pi174901572.php",32,"1035_5_6");
navigation[39] = new navElem(39,"Zubehör","pi-1896711947.php",38,"1035_5_6_Z");
navigation[40] = new navElem(40,"Schlitzgerät","pi764109074.php",32,"1035_5_7");
navigation[41] = new navElem(41,"Zapfenfräse","pi-1523172309.php",32,"1035_5_8");
navigation[42] = new navElem(42,"Spezialmaschinen","pi945239440.php",0,"1035_6");
navigation[43] = new navElem(43,"Fugenfräse","pi-713831855.php",42,"1035_6_1");
navigation[44] = new navElem(44,"Elektro-Kreismesser","pi1281316414.php",42,"1035_6_2");
navigation[45] = new navElem(45,"Absauggerät","pi-306324249.php",42,"1035_6_3");
navigation[46] = new navElem(46,"Ersatzteile","pi1435983516.php",0,"1035_E");
navigation[47] = new navElem(47,"Zubehör","pi-89200597.php",0,"1035_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"));

