//
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/bullet.gif" width="11" height="14" 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" cellpadding="1" cellspacing="0" >';
		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="14" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bulletcatact.gif" width="11" height="14" 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="14" height="11" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else strHTML += '<td width=\"1%\"><img src="assets/images/bulletcat1st.gif" width="11" height="14" 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,"Kundeninfo","pi1248020401.htm",null,"1214552112");
navigation[1] = new navElem(1,"Versandkosten","pi1248867193.htm",0,"555666");
navigation[2] = new navElem(2,"Batterieverordnung","pi624411206.htm",0,"5556667");
navigation[3] = new navElem(3,"Widerruf","pi1262352420.htm",0,"954");
navigation[4] = new navElem(4,"Luftgewehre","pi1051304407.htm",null,"100");
navigation[5] = new navElem(5,"Weihrauch ","pi1139404461.htm",4,"155");
navigation[6] = new navElem(6,"Diana","pi1052425272.htm",4,"2");
navigation[7] = new navElem(7,"Komplettsets","pi1158397820.htm",4,"9000");
navigation[8] = new navElem(8,"Gamo","pi1140863035.htm",4,"100200");
navigation[9] = new navElem(9,"Beretta","pi1212422386.htm",4,"9008");
navigation[10] = new navElem(10,"Ruger","pi1225903641.htm",4,"331133");
navigation[11] = new navElem(11,"Schalldämpfer","pi272242762.htm",4,"122");
navigation[12] = new navElem(12,"Austauschläufe","pi1118314403.htm",4,"Austauschl");
navigation[13] = new navElem(13,"Zweibeine","pi1376666011.htm",4,"505");
navigation[14] = new navElem(14,"Norconia","pi-1024057674.htm",4,"1111123");
navigation[15] = new navElem(15,"Luftpistolen","pi-1881435752.htm",null,"110");
navigation[16] = new navElem(16,"Einschießbock","pi-2091507045.htm",null,"1245");
navigation[17] = new navElem(17,"Sonderangebote","pi-303677239.htm",null,"133");
navigation[18] = new navElem(18,"CO2-Waffen","pi353914427.htm",null,"120");
navigation[19] = new navElem(19,"Beretta CO2-Waffen","pi860799584.htm",18,"1");
navigation[20] = new navElem(20,"Colt CO2-Waffen","pi1294323477.htm",18,"30");
navigation[21] = new navElem(21,"Gamo CO2-Waffen","pi1762409822.htm",18,"14441");
navigation[22] = new navElem(22,"Walther CO2-Waffen","pi1061117226.htm",18,"20");
navigation[23] = new navElem(23,"Walther CP88 Zubehör spezial","pi1571502091.htm",22,"101011");
navigation[24] = new navElem(24,"Zubehör für CO2-Waffen","pi1483141394.htm",18,"50");
navigation[25] = new navElem(25,"Paintball","pi1159124173.htm",null,"10000");
navigation[26] = new navElem(26,"Softair","pi1055074806.htm",null,"130");
navigation[27] = new navElem(27,"Zubehör Softairwaffen","pi-1457635574.htm",26,"121416");
navigation[28] = new navElem(28,"Gaspistolen","pi1061492341.htm",null,"140");
navigation[29] = new navElem(29,"Gasrevolver in Top Qualität","pi1065028741.htm",28,"145");
navigation[30] = new navElem(30,"Walther Gaspistolen","pi1064332709.htm",29,"141");
navigation[31] = new navElem(31,"Colt Gaspistolen","pi1265539418.htm",28,"12");
navigation[32] = new navElem(32,"Gaspistolen von Browning","pi1064341387.htm",28,"142");
navigation[33] = new navElem(33,"Ersatzteile für Gaspistolen","pi1224843530.htm",28,"230");
navigation[34] = new navElem(34,"Erstzteile Gaspistole Walther P99","pi-596096317.htm",33,"240");
navigation[35] = new navElem(35,"Ersatzmagazine","pi-1937229071.htm",28,"220");
navigation[36] = new navElem(36,"Schalldämpfer für Gaspistolen","pi1254769296.htm",28,"56458");
navigation[37] = new navElem(37,"Holster","pi1109070795.htm",null,"1005");
navigation[38] = new navElem(38,"Munition für Gaspistolen Platzpatronen","pi-1223846163.htm",null,"200");
navigation[39] = new navElem(39,"Gaspatronen","pi-469837731.htm",38,"205");
navigation[40] = new navElem(40,"Feuerwerk für Gaspistolen","pi1062269065.htm",null,"250");
navigation[41] = new navElem(41,"Munition für Luftdruckwaffen","pi2041144051.htm",null,"210");
navigation[42] = new navElem(42,"Kugelfänge Schießkästen Zielscheiben","pi1412846883.htm",null,"500");
navigation[43] = new navElem(43,"Zielfernrohre und Red Dot","pi238901506.htm",null,"600");
navigation[44] = new navElem(44,"Entfernungsmesser","pi-2040860427.htm",null,"9001");
navigation[45] = new navElem(45,"Taschenlampen von Walther","pi1245504767.htm",null,"121515");
navigation[46] = new navElem(46,"Ferngläser","pi1257097215.htm",null,"12522");
navigation[47] = new navElem(47,"GPS","pi1223716920.htm",null,"GPS");
navigation[48] = new navElem(48,"Luftgewehr-Taschen/Waffenkoffer","pi-335038229.htm",null,"265");
navigation[49] = new navElem(49,"Reinigung Pflege Wartung","pi-1470020109.htm",null,"700");
navigation[50] = new navElem(50,"Ersatzteile","pi1088603728.htm",null,"100100");
navigation[51] = new navElem(51,"Dichtungen","pi1088681158.htm",50,"100101");
navigation[52] = new navElem(52,"Ersatzkolben","pi944985273.htm",50,"100104");
navigation[53] = new navElem(53,"Ersatzteile für Luftgewehr HW35","pi1193610859.htm",50,"80000");
navigation[54] = new navElem(54,"Ersatzteile Luftgewehr HW80","pi-1620921215.htm",50,"111");
navigation[55] = new navElem(55,"Ersatzteile das Luftgewehr Diana Mod.35","pi1200956570.htm",50,"999");
navigation[56] = new navElem(56,"Ersatzteile Luftgewehr Diana Mod.27","pi-485753701.htm",50,"11111");
navigation[57] = new navElem(57,"Ersatzteile Diana Mod.30","pi1204371859.htm",50,"1400001");
navigation[58] = new navElem(58,"Abzüge","pi1202071081.htm",50,"101010");
navigation[59] = new navElem(59,"Visiere für Luftgewehre","pi1202125674.htm",50,"11221122");
navigation[60] = new navElem(60,"Exportfedern","pi1060885539.htm",null,"800");
navigation[61] = new navElem(61,"Selbstschutz/Security/Polizeiausrüstung","pi1064567628.htm",null,"900");
navigation[62] = new navElem(62,"Pfefferspray","pi-1185227683.htm",61,"951");
navigation[63] = new navElem(63,"Elektroschocker","pi1171045197.htm",61,"170");
navigation[64] = new navElem(64,"Schlag und Abdrängstöcke","pi-1488313899.htm",61,"952");
navigation[65] = new navElem(65,"Kompasse","pi1152963333.htm",null,"40000");
navigation[66] = new navElem(66,"Sonderangebote","pi1065640039.htm",null,"2000");
navigation[67] = new navElem(67,"Info-Material","pi1061834627.htm",null,"850");
navigation[68] = new navElem(68,"Bundeswehrausrüstung","pi-2055884.htm",null,"611");
navigation[69] = new navElem(69,"Leuchtstäbe","pi-1179178240.htm",68,"111111");
navigation[70] = new navElem(70,"Barettabzeichen","pi1223492201.htm",68,"111112");
navigation[71] = new navElem(71,"Messer","pi1181992276.htm",null,"110011");
navigation[72] = new navElem(72,"&#0034;RESTPOSTEN&#0034;","pi1225547632.htm",null,"112211");
navigation[73] = new navElem(73,"Neu im Februar","pi836398293.htm",null,"13");
navigation[74] = new navElem(74,"Neu im März","pi-650830716.htm",null,"45466");
navigation[75] = new navElem(75,"Neu im April","pi1173055238.htm",null,"507");
navigation[76] = new navElem(76,"Neu im Juni/Juli","pi1275221352.htm",null,"1235456");
navigation[77] = new navElem(77,"Neu im Shop","pi1312572021.htm",null,"0");

// 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"));


