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,"Festool","pi-1365176191.php",null,"1006");
navigation[1] = new navElem(1,"Bohren/Schrauben","pi-1862487356.php",0,"1006_1");
navigation[2] = new navElem(2,"Bits","pi1644659829.php",1,"1006_1_1");
navigation[3] = new navElem(3,"Bohrer","pi-1869388142.php",1,"1006_1_2");
navigation[4] = new navElem(4,"Sägen","pi579875755.php",0,"1006_2");
navigation[5] = new navElem(5,"Tauchsägen","pi1971631888.php",4,"1006_2_1");
navigation[6] = new navElem(6,"Pendelstichsägen","pi1489800657.php",4,"1006_2_2");
navigation[7] = new navElem(7,"Zug-Kappsägen","pi-2103528514.php",4,"1006_2_3");
navigation[8] = new navElem(8,"Pendelhaubensägen","pi1155681383.php",4,"1006_2_4");
navigation[9] = new navElem(9,"Baustoffsägen","pi-1020528612.php",4,"1006_2_5");
navigation[10] = new navElem(10,"Kapex","pi-1494481940.php",4,"1006_2_6");
navigation[11] = new navElem(11,"Zubehör","pi1252246765.php",4,"1006_2_Z");
navigation[12] = new navElem(12,"Sägezubehör","pi-1678341206.php",11,"1006_2_Z_1");
navigation[13] = new navElem(13,"Sägeblätter","pi72435939.php",11,"1006_2_Z_2");
navigation[14] = new navElem(14,"Stichsägeblätter","pi-746208792.php",11,"1006_2_Z_3");
navigation[15] = new navElem(15,"Säbelsägeblätter","pi1287226825.php",11,"1006_2_Z_4");
navigation[16] = new navElem(16,"Fräsen/Hobeln","pi1880037974.php",0,"1006_3");
navigation[17] = new navElem(17,"Fräser","pi-1412373217.php",16,"1006_3_Z_1");
navigation[18] = new navElem(18,"Fräszubehör","pi-833478540.php",16,"1006_3_Z_2");
navigation[19] = new navElem(19,"Hobelzubehör","pi-426251163.php",16,"1006_3_Z_3");
navigation[20] = new navElem(20,"Oberflächenbearbeitung","pi-413709374.php",0,"1006_4");
navigation[21] = new navElem(21,"Linearschleifer","pi-1092051685.php",20,"1006_4_1");
navigation[22] = new navElem(22,"Rotex","pi-1949704256.php",20,"1006_4_2");
navigation[23] = new navElem(23,"Exzenterschleifer","pi562222273.php",20,"1006_4_3");
navigation[24] = new navElem(24,"Rutscher","pi-1704670226.php",20,"1006_4_4");
navigation[25] = new navElem(25,"Feinschliff","pi-2005947177.php",24,"1006_4_4_1");
navigation[26] = new navElem(26,"Grobschliff","pi-1817539636.php",24,"1006_4_4_2");
navigation[27] = new navElem(27,"Bandschleifer","pi630446813.php",20,"1006_4_5");
navigation[28] = new navElem(28,"Planex","pi-542965441.php",20,"1006_4_6");
navigation[29] = new navElem(29,"Zubehör","pi-416517290.php",28,"1006_4_6_Z");
navigation[30] = new navElem(30,"Rotationsschleifer","pi-1746925862.php",20,"1006_4_7");
navigation[31] = new navElem(31,"Polierer","pi-318173101.php",20,"1006_4_8");
navigation[32] = new navElem(32,"Dreieckschleifer","pi-2063437672.php",20,"1006_4_9");
navigation[33] = new navElem(33,"Zubehör","pi-1063888199.php",20,"1006_4_Z");
navigation[34] = new navElem(34,"Sonstige Schleifmittel","pi-1053808506.php",33,"1006_4_Z_1");
navigation[35] = new navElem(35,"Schleifzubehör","pi1029669775.php",33,"1006_4_Z_2");
navigation[36] = new navElem(36,"Polierzubehör","pi-222520796.php",33,"1006_4_Z_3");
navigation[37] = new navElem(37,"RS1../2.. 115x228","pi-224169899.php",33,"1006_4_Z_4");
navigation[38] = new navElem(38,"RS3.. 93x178","pi-1444471566.php",33,"1006_4_Z_5");
navigation[39] = new navElem(39,"RS4.. 80x133","pi-2078178677.php",33,"1006_4_Z_6");
navigation[40] = new navElem(40,"Dreieck / Delta","pi-2131962768.php",33,"1006_4_Z_7");
navigation[41] = new navElem(41,"Bänder / Hülsen","pi1551759281.php",33,"1006_4_Z_8");
navigation[42] = new navElem(42,"Scheiben Ø115 / Ø180","pi-1511157730.php",33,"1006_4_Z_9");
navigation[43] = new navElem(43,"Scheiben Ø125","pi-1950529209.php",33,"1006_4_Z_A");
navigation[44] = new navElem(44,"Scheiben Ø150","pi-824464516.php",33,"1006_4_Z_B");
navigation[45] = new navElem(45,"Rollenware","pi1182116152.php",33,"1006_4_Z_C");
navigation[46] = new navElem(46,"Basis+/Führungssysteme","pi732859597.php",0,"1006_5");
navigation[47] = new navElem(47,"CMS (Basis Plus)","pi1919872522.php",46,"1006_5_1");
navigation[48] = new navElem(48,"Führungsschienen","pi-1747135549.php",46,"1006_5_2");
navigation[49] = new navElem(49,"Multifunktionstisch","pi2043833160.php",46,"1006_5_3");
navigation[50] = new navElem(50,"Zubehör","pi-530609239.php",46,"1006_5_Z");
navigation[51] = new navElem(51,"Rühren/Sanieren","pi-1517985098.php",0,"1006_6");
navigation[52] = new navElem(52,"Rührzubehör","pi-1901994497.php",51,"1006_6_Z");
navigation[53] = new navElem(53,"Druckluftwerkzeuge","pi1151803348.php",0,"1006_7");
navigation[54] = new navElem(54,"Arbeitsplatzorganisation","pi150540357.php",0,"1006_8");
navigation[55] = new navElem(55,"Systainer","pi-794437086.php",54,"1006_8_1");
navigation[56] = new navElem(56,"Systainerzubehör","pi228713467.php",55,"1006_8_1_Z");
navigation[57] = new navElem(57,"Absaugarme","pi805868832.php",54,"1006_8_2");
navigation[58] = new navElem(58,"Sauger","pi-813893983.php",0,"1006_9");
navigation[59] = new navElem(59,"Saugzubehör","pi30146638.php",58,"1006_9_Z");
navigation[60] = new navElem(60,"Vakuumtechnik","pi1857040854.php",0,"1006_A");
navigation[61] = new navElem(61,"Ersatzteile","pi-1499323977.php",0,"1006_E");
navigation[62] = new navElem(62,"Zubehör","pi260724524.php",0,"1006_Z");
navigation[63] = new navElem(63,"Zubehör","pi1279452903.php",62,"1006_Z_2");

// 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"));


