//
function miniCart(){
var prdCount = 0, prdString = "", subTotal = (xmlConfig.cartSubTotal > 0)?xmlConfig.cartSubTotal:0;
var tmpVariants = "", strVariants = "";
var mbullet = '<img src="assets/images/bullet.gif" width="11" height="14" border="0" align="absmiddle" hspace="0" vspace="0" class="catnav">';
	if(xmlOHeader.childNodes.length==0) subTotal = 0;
	for(var i=0;i<xmlOHeader.childNodes.length;i++){
		prdCount = prdCount+(parseInt(xmlOHeader.childNodes[i].QuantityAmount));
		};
	prdString += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">";
		if(prdCount > 0){
		prdString += "<tr>"
			+ "<td colspan=\"2\">"
				+ "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">"
						+ "<td align=\"right\" nowrap=\"true\" width=\"20\">#&nbsp;</td>"
						+ "<td><strong>Bezeichnung</strong></td>"
						+ "<td align=\"center\" width=\"40\" nowrap=\"true\"><strong>Preis</strong></td>"
					+ "</tr>";
				for(var i=0;i<xmlOHeader.childNodes.length;i++){
				tmpVariants = xmlOHeader.childNodes[i].getFirstItem("Internal").variants.split("@");
				if(tmpVariants.length>1){
					for(var j=0;j<tmpVariants.length-1;j++){
						tmpElement = tmpVariants[j].split(";");
						strVariants += "search" + j + "_EQ_" + tmpElement[1] + "_AND_";
						};
					strVariants += "{EOL}";
					};
					prdString += "<tr valign=\"top\">"
						+ "<td align=\"right\">" + xmlOHeader.childNodes[i].QuantityAmount + "&nbsp;</td>"
						+ "<td>"
							+ "<a href=\"" + xmlOHeader.childNodes[i].getFirstItem("Internal").address + "?defaultVariants=" + strVariants + "&categoryId=" + xmlOHeader.childNodes[i].getFirstItem("Internal").navIndex + "\">"
							+ xmlOHeader.childNodes[i].Name
						+ "</a></td>"
						+ "<td align=\"right\" nowrap=\"true\">" + (parseFloat(xmlOHeader.childNodes[i].PriceGrossLineTotalLC).toFixed(2)).toString().replace('.',',') + "</td>"
						+ "</tr>";
					};
	prdString += "</table><br>"	
			+ "</td>"
		+ "</tr>"
		+ "<tr>"
			+ "<td align=\"right\" nowrap=\"true\" width=\"20\"><strong>" + prdCount + "</strong>&nbsp;</td>"
			+ "<td align=\"right\"><strong>&nbsp;" + TFormatCurrency(subTotal, objPriCurrency) + "</strong><td>"
		+ "</tr>"
		+ "<tr align=\"right\">"
			+ "<td colspan=\"2\"><a class=\"WAGRUNAV\" href=\"orderform." + xmlConfig.fileExtension + "\">"
			+ mbullet + "<strong>Zum Bestellschein</strong></a>"
			+ "</td>"
		+ "</tr>";
	}
	else{
		prdString += "<tr>"
			+ "<td>"
			+ "<td>Ihr Bestellschein ist leer...</td>"
			+ "</tr>";
		};
	prdString += "</table>";
	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="14" 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="14" 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="14" 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,"Sortiment Neodym","pi494712397.htm",null,"00025");
navigation[1] = new navElem(1,"Rundmagnete Neodym","pi1109932761.htm",null,"00001");
navigation[2] = new navElem(2,"Magnet 1x1","pi-794329091.htm",1,"0010");
navigation[3] = new navElem(3,"Magnet 2x1","pi-122761862.htm",1,"0020");
navigation[4] = new navElem(4,"Magnet 3x1","pi1070971507.htm",1,"0030");
navigation[5] = new navElem(5,"Magnet 5x2","pi-606791624.htm",1,"0040");
navigation[6] = new navElem(6,"Magnet 6x2","pi1213781290.htm",1,"0041");
navigation[7] = new navElem(7,"Magnet 6x2,5","pi1198745191.htm",1,"0045");
navigation[8] = new navElem(8,"Magnet 5x4","pi693647493.htm",1,"54644");
navigation[9] = new navElem(9,"Magnet 10x1","pi1117531897.htm",1,"444");
navigation[10] = new navElem(10,"Magnet 8x4","pi238522841.htm",1,"0050");
navigation[11] = new navElem(11,"Magnet 10x5","pi1712167206.htm",1,"0060");
navigation[12] = new navElem(12,"Magnet 14x5","pi863768495.htm",1,"0070");
navigation[13] = new navElem(13,"Magnet 18x4","pi-1392304923.htm",1,"0080");
navigation[14] = new navElem(14,"Magnet 19,5x7","pi1134951364.htm",1,"0090");
navigation[15] = new navElem(15,"Magnet 20x5","pi559896949.htm",1,"0100");
navigation[16] = new navElem(16,"Magnet 30x3","pi1549916050.htm",1,"0110");
navigation[17] = new navElem(17,"Magnet 30x5 Bohrung","pi-1352658773.htm",1,"0120");
navigation[18] = new navElem(18,"Hakenmagnet","pi-550399292.htm",1,"0130");
navigation[19] = new navElem(19,"Quadermagnete Neodym","pi1110018190.htm",null,"00005");
navigation[20] = new navElem(20,"Magnet 1x1x1","pi1173778082.htm",19,"1001");
navigation[21] = new navElem(21,"Magnet 2x2x1","pi873282976.htm",19,"1002");
navigation[22] = new navElem(22,"Magnet 3x3x1","pi1404146977.htm",19,"1003");
navigation[23] = new navElem(23,"Magnet 4x4x1","pi-1519199026.htm",19,"1004");
navigation[24] = new navElem(24,"Magnet 5x5x1","pi916230160.htm",19,"1010");
navigation[25] = new navElem(25,"Magnet 4x4x2","pi-151801135.htm",19,"1020");
navigation[26] = new navElem(26,"Magnet 7x3x2","pi1213943847.htm",19,"1025");
navigation[27] = new navElem(27,"Magnet 30x4x1","pi-1161939778.htm",19,"1030");
navigation[28] = new navElem(28,"Magnet 10x7x3","pi1171612476.htm",19,"1035");
navigation[29] = new navElem(29,"Magnet 20x10x3","pi-1336805017.htm",19,"1040");
navigation[30] = new navElem(30,"Magnet 40x10x5","pi993747228.htm",19,"1050");
navigation[31] = new navElem(31,"Magnet 35x20x5","pi538451114.htm",19,"1070");
navigation[32] = new navElem(32,"Magnet 50x20x5","pi-1501706781.htm",19,"1080");
navigation[33] = new navElem(33,"Zylindermagnete Neodym","pi217397642.htm",null,"00030");
navigation[34] = new navElem(34,"Magnet 3x10","pi-1070681165.htm",33,"1300");
navigation[35] = new navElem(35,"Magnet 5x10","pi1802004600.htm",33,"1310");
navigation[36] = new navElem(36,"Magnet 5x15","pi451929953.htm",33,"1320");
navigation[37] = new navElem(37,"Kugelmagnet Neodym","pi-813918985.htm",null,"00010");
navigation[38] = new navElem(38,"Magnet-Kugel 12,7","pi1110203702.htm",37,"1100");
navigation[39] = new navElem(39,"Klebstoffe/Zubehör","pi1192091968.htm",null,"00012");
navigation[40] = new navElem(40,"Magnet-Pin","pi-361848475.htm",null,"00013");
navigation[41] = new navElem(41,"Magnetspielzeug","pi1110043388.htm",null,"00020");
navigation[42] = new navElem(42,"Snaprod","pi1208760613.htm",null,"0033");
navigation[43] = new navElem(43,"Magnethaftender Wandbelag","pi1242732093.htm",null,"0037");
navigation[44] = new navElem(44,"Magnetträger","pi-830252708.htm",null,"0056");

// 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"));


