//
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="18" height="12" 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\">Eisenbahnliteratur  Gliederung</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="22" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bulletcatact.gif" width="22" height="13" 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="22" height="13" border="0" align="bottom" hspace="0" vspace="0" class="catnav"></td>'
		else strHTML += '<td width=\"1%\"><img src="assets/images/bulletcat1st.gif" width="22" height="13" 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,"Vorankündigungen","pi-1035978423.htm",null,"99-00");
navigation[1] = new navElem(1,"Neuerscheinungen 2012","pi1328180621.htm",null,"0-0009");
navigation[2] = new navElem(2,"Neuerscheinungen 2011","pi1294479136.htm",null,"0-0008");
navigation[3] = new navElem(3,"Neuerscheinungen 2010","pi1262597688.htm",null,"0-0007");
navigation[4] = new navElem(4,"Sonderangebote","pi-1350593722.htm",null,"0-01");
navigation[5] = new navElem(5,"Eisenbahn-Fachbuch","pi1138266347.htm",null,"0-0003");
navigation[6] = new navElem(6,"Technik, Bau und Betrieb","pi1185132765.htm",null,"1-04");
navigation[7] = new navElem(7,"Schmalspurbahnen","pi-404089324.htm",null,"5-035");
navigation[8] = new navElem(8,"Feldbahnen / Waldbahnen","pi1661378807.htm",7,"1-034");
navigation[9] = new navElem(9,"Bahnhöfe, Bahnanlagen","pi126367084.htm",null,"1-05");
navigation[10] = new navElem(10,"Militäreisenbahnen, Eisenbahn und Krieg","pi-806749324.htm",null,"1-06");
navigation[11] = new navElem(11,"Bahnpost","pi1255168847.htm",null,"1-061");
navigation[12] = new navElem(12,"Firmenschriften - Kataloge -  Biographien","pi1821393586.htm",null,"1-07");
navigation[13] = new navElem(13,"Eisenbahn Gesetze, Dienstvorschriften","pi572929989.htm",null,"1-08");
navigation[14] = new navElem(14,"Zeitschriften - Periodika - Sonderhefte","pi-1426469258.htm",null,"9-00");
navigation[15] = new navElem(15,"Eisenbahn Deutschland allgemein","pi1078936718.htm",null,"1-00");
navigation[16] = new navElem(16,"Schleswig-Holstein / Hamburg","pi1451772282.htm",15,"1-10");
navigation[17] = new navElem(17,"Niedersachsen / Bremen","pi-1695578841.htm",15,"1-20");
navigation[18] = new navElem(18,"Nordrhein-Westfalen","pi880505308.htm",15,"1-30");
navigation[19] = new navElem(19,"Hessen","pi1291758509.htm",15,"1-40");
navigation[20] = new navElem(20,"Rheinland-Pfalz","pi-1589535894.htm",15,"1-50");
navigation[21] = new navElem(21,"Saarland","pi-1834381917.htm",15,"1-60");
navigation[22] = new navElem(22,"Baden-Württemberg","pi-1764862040.htm",15,"1-70");
navigation[23] = new navElem(23,"Bayern","pi-2029627255.htm",15,"1-80");
navigation[24] = new navElem(24,"Berlin","pi-1528257002.htm",15,"1-90");
navigation[25] = new navElem(25,"Neue Bundesländer - ehem. DDR","pi-1717766689.htm",15,"1-100");
navigation[26] = new navElem(26,"Mecklenburg-Vorpommern","pi1648202292.htm",15,"1-110");
navigation[27] = new navElem(27,"Sachsen-Anhalt","pi523070245.htm",15,"1-120");
navigation[28] = new navElem(28,"Thüringen","pi427758466.htm",15,"1-130");
navigation[29] = new navElem(29,"Sachsen","pi2103261659.htm",15,"1-140");
navigation[30] = new navElem(30,"Brandenburg","pi991817088.htm",15,"1-150");
navigation[31] = new navElem(31,"ehem. Ostgebiete","pi665042817.htm",15,"1-101");
navigation[32] = new navElem(32,"Jahrbücher, Reiseführer, Nachschlagewerke, Atlanten","pi823562158.htm",null,"1-300");
navigation[33] = new navElem(33,"Kursbücher, Fahrpläne, Karten, Zugbildungspläne, Buchfahrpläne","pi-343042665.htm",null,"1-310");
navigation[34] = new navElem(34,"Fahrzeuge allgemein","pi1325987212.htm",null,"1-320");
navigation[35] = new navElem(35,"Dampflokomotiven","pi-1741753955.htm",34,"1-321");
navigation[36] = new navElem(36,"Elektrolokomotiven","pi59999898.htm",34,"1-322");
navigation[37] = new navElem(37,"Diesellokomotiven","pi1348273427.htm",34,"1-323");
navigation[38] = new navElem(38,"Triebwagen","pi-660015528.htm",34,"1-324");
navigation[39] = new navElem(39,"Kleinlokomotiven","pi-1056547463.htm",34,"1-325");
navigation[40] = new navElem(40,"Bahndienstfahrzeuge","pi1733895238.htm",34,"1-326");
navigation[41] = new navElem(41,"Triebfahrzeugtechnik","pi1958888527.htm",34,"1-327");
navigation[42] = new navElem(42,"Personenwagen, Gepäckwagen, Postwagen","pi213210290.htm",34,"1-340");
navigation[43] = new navElem(43,"Güterwagen, Sonder- und Privatwagen","pi1484246859.htm",34,"1-350");
navigation[44] = new navElem(44,"Berühmte Züge / Luxuszüge / Zuggattungen","pi-666567708.htm",34,"1-328");
navigation[45] = new navElem(45,"Nahverkehr - Strassenbahn, U-Bahn, O-Busse","pi739775089.htm",null,"1-360");
navigation[46] = new navElem(46,"Museumsbahnen","pi-2012429346.htm",null,"1-370");
navigation[47] = new navElem(47,"Literatur - Erzählungen, Humor, Prosa, Malerei","pi-81459908.htm",null,"1-390");
navigation[48] = new navElem(48,"Modellbahn / Modellbau","pi-2085101049.htm",null,"1-380");
navigation[49] = new navElem(49,"Drehen - Fräsen - Modellbau","pi-860325757.htm",null,"1-402");
navigation[50] = new navElem(50,"Österreich","pi1290227391.htm",null,"2-00");
navigation[51] = new navElem(51,"Bahn im Bild","pi1156839299.htm",50,"3-001");
navigation[52] = new navElem(52,"Schweiz","pi-1977060972.htm",null,"3-00");
navigation[53] = new navElem(53,"Europa allgemein","pi165052898.htm",null,"5-00");
navigation[54] = new navElem(54,"Bulgarien","pi1508157736.htm",53,"5-104");
navigation[55] = new navElem(55,"Frankreich","pi1088415913.htm",53,"5-108");
navigation[56] = new navElem(56,"Italien","pi799259574.htm",53,"5-111");
navigation[57] = new navElem(57,"Jugoslawien","pi282169577.htm",53,"5-114");
navigation[58] = new navElem(58,"Polen","pi925966548.htm",53,"5-118");
navigation[59] = new navElem(59,"Portugal","pi-1876045444.htm",53,"5-117");
navigation[60] = new navElem(60,"Rumänien","pi-400474811.htm",53,"5-119");
navigation[61] = new navElem(61,"Russland (UdSSR)","pi1815301816.htm",53,"5-120");
navigation[62] = new navElem(62,"Schweden","pi-1039710419.htm",53,"5-122");
navigation[63] = new navElem(63,"Tschechien / Slowakei","pi756668667.htm",53,"5-124");
navigation[64] = new navElem(64,"Ungarn","pi-201118765.htm",53,"5-126");
navigation[65] = new navElem(65,"Baltikum (Lettland - Estland - Litauen)","pi-1103321568.htm",53,"5-127");
navigation[66] = new navElem(66,"Übersee","pi31842491.htm",null,"6-00");
navigation[67] = new navElem(67,"Nord-Amerika","pi-706088031.htm",66,"6-100");
navigation[68] = new navElem(68,"Eisenbahn international","pi-1525644576.htm",null,"7-00");
navigation[69] = new navElem(69,"Antiquariat","pi578622804.htm",null,"10-00");

// 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"));


