//
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 += "Produse in cos:<strong>&nbsp;" + prdCount + "</strong><br>";
	prdString += "Subtotal:<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="15" height="11" alt="Bullet.gif" border="0" align="absmiddle" hspace="0" vspace="0" class="catnav">' + "Cosul de cumparaturi</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\">Categorii</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="11" 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/bulletcat1stcls.gif" width="14" height="11" alt="BulletCat1stCls.gif" 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="11" 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,"20% Pret Redus","pi-1113243429.htm",null,"oferta");
navigation[1] = new navElem(1,"40% Pret Redus","pi-429428773.htm",null,"40%");
navigation[2] = new navElem(2,"AUTOart Design","pi-1046291636.htm",null,"AUTOartDes");
navigation[3] = new navElem(3,"Cadouri si accesorii","pi1159485996.htm",2,"Cadouri si");
navigation[4] = new navElem(4,"Automodele","pi-1910127682.htm",null,"Automodeli");
navigation[5] = new navElem(5,"Automodele Electrice","pi1674535544.htm",4,"Electrice");
navigation[6] = new navElem(6,"Automodele Termice","pi602677017.htm",4,"termic");
navigation[7] = new navElem(7,"Piese de rezerva","pi2108812646.htm",4,"piese");
navigation[8] = new navElem(8,"Attacker 1/10","pi-593491017.htm",7,"Attacker");
navigation[9] = new navElem(9,"C18 1/18","pi-1639698212.htm",7,"C18");
navigation[10] = new navElem(10,"Envoy 1/8","pi533614230.htm",7,"Envoy 1/8");
navigation[11] = new navElem(11,"FMH 1/18","pi14827181.htm",7,"FMH 1/18");
navigation[12] = new navElem(12,"H-8860 1/10","pi412131481.htm",7,"8860");
navigation[13] = new navElem(13,"H-8963 1/8","pi-1526342961.htm",7,"8963");
navigation[14] = new navElem(14,"Iwaver 1/28","pi1215095817.htm",7,"Iwaver");
navigation[15] = new navElem(15,"KL-06 1/10","pi1772834977.htm",7,"kl-06");
navigation[16] = new navElem(16,"KL-07 1/10","pi1195037885.htm",7,"Kl-07");
navigation[17] = new navElem(17,"LRP Electronic","pi1237283487.htm",7,"LRP Electr");
navigation[18] = new navElem(18,"Monitor 1/10","pi1087230542.htm",7,"monitor 1/");
navigation[19] = new navElem(19,"REVO, Jato Traxxas","pi14917537.htm",7,"Revo");
navigation[20] = new navElem(20,"Robitronic","pi1239620278.htm",7,"Robitronic");
navigation[21] = new navElem(21,"Spurt 1/8","pi761821484.htm",7,"Spurt 1/8");
navigation[22] = new navElem(22,"Machete 1/43, 1/32, 1/24","pi-864874143.htm",null,"machete");
navigation[23] = new navElem(23,"Machete auto 1/18 ","pi-1716505219.htm",null,"Machete au");
navigation[24] = new navElem(24,"AUTOart ","pi-1092335899.htm",23,"Autoart");
navigation[25] = new navElem(25,"Bauer","pi195646197.htm",23,"Bauer");
navigation[26] = new navElem(26,"BBR","pi1129198726.htm",23,"BBR");
navigation[27] = new navElem(27,"BBurago","pi-1973602430.htm",23,"BBUrago");
navigation[28] = new navElem(28,"Beanstalk","pi-877545600.htm",23,"Beanstalk");
navigation[29] = new navElem(29,"Car Garage","pi730019070.htm",23,"Car Garage");
navigation[30] = new navElem(30,"CMC","pi1118618027.htm",23,"CMC");
navigation[31] = new navElem(31,"ERTL","pi-1646875167.htm",23,"ERTL");
navigation[32] = new navElem(32,"Exact Detail","pi779806681.htm",23,"Exact Deta");
navigation[33] = new navElem(33,"Exoto","pi1195305333.htm",23,"Exoto");
navigation[34] = new navElem(34,"Franklin Mint","pi1205175176.htm",23,"Franklin M");
navigation[35] = new navElem(35,"GMP","pi1228486937.htm",23,"GMP");
navigation[36] = new navElem(36,"Greenlight","pi-1772356610.htm",23,"Greenlight");
navigation[37] = new navElem(37,"Guiloy","pi1149978139.htm",23,"Guiloy");
navigation[38] = new navElem(38,"Highway 61","pi1141166477.htm",23,"Highway 61");
navigation[39] = new navElem(39,"Hotwheels ","pi-1824109640.htm",23,"machete 1");
navigation[40] = new navElem(40,"Hotwheels Elite","pi621160148.htm",23,"Hotwheels ");
navigation[41] = new navElem(41,"IstModels","pi330638302.htm",23,"IstModels");
navigation[42] = new navElem(42,"JadaToys ","pi-838929164.htm",23,"Jadatoys");
navigation[43] = new navElem(43,"KYOSHO","pi1241473582.htm",23,"Kyosho");
navigation[44] = new navElem(44,"Maisto","pi1921776182.htm",23,"Maisto");
navigation[45] = new navElem(45,"MINICHAMPS","pi1120418359.htm",23,"Minichamps");
navigation[46] = new navElem(46,"Mondo Motors","pi-516788825.htm",23,"Mondo");
navigation[47] = new navElem(47,"Motorcityclassics","pi315454646.htm",23,"MotorcityC");
navigation[48] = new navElem(48,"MotorMax","pi-1149988992.htm",23,"MotorMax");
navigation[49] = new navElem(49,"MRC","pi1563549221.htm",23,"MRC");
navigation[50] = new navElem(50,"NOREV","pi1134514735.htm",23,"Norev");
navigation[51] = new navElem(51,"Otto","pi498973110.htm",23,"Otto");
navigation[52] = new navElem(52,"Powco","pi1254481270.htm",23,"Powco");
navigation[53] = new navElem(53,"Revell","pi-1072899433.htm",23,"Revell");
navigation[54] = new navElem(54,"Ricko","pi1092304459.htm",23,"Ricko");
navigation[55] = new navElem(55,"Road Signature","pi1104743291.htm",23,"Road Legen");
navigation[56] = new navElem(56,"Schuco","pi1227706643.htm",23,"Schuco");
navigation[57] = new navElem(57,"Shelby Collectibles","pi1418220897.htm",23,"shelby");
navigation[58] = new navElem(58,"Signature Models","pi1127483478.htm",23,"Signature");
navigation[59] = new navElem(59,"SOLIDO","pi1146089597.htm",23,"Solido");
navigation[60] = new navElem(60,"SUNSTAR","pi-280539548.htm",23,"Sunstar");
navigation[61] = new navElem(61,"Welly","pi-377408127.htm",23,"Welly");
navigation[62] = new navElem(62,"Machete motorsport","pi-781577675.htm",null,"Machete Mo");
navigation[63] = new navElem(63,"Formula 1","pi1105117531.htm",62,"Formula 1");
navigation[64] = new navElem(64,"LeMans, DTM","pi1664954882.htm",62,"DTM");
navigation[65] = new navElem(65,"WRC","pi1664063067.htm",62,"WRC");
navigation[66] = new navElem(66,"Motociclete","pi-2115506320.htm",null,"Motociclet");
navigation[67] = new navElem(67,"1/10","pi-148162172.htm",66,"1/10");
navigation[68] = new navElem(68,"1/12","pi-488393039.htm",66,"1/12");
navigation[69] = new navElem(69,"1/18","pi1122384845.htm",66,"moto");
navigation[70] = new navElem(70,"Tancuri avioane si elicoptere","pi-1068692043.htm",null,"Tancuri 1/");
navigation[71] = new navElem(71,"1/16","pi-1687711320.htm",70,"1/16");
navigation[72] = new navElem(72,"1/32","pi-2056719027.htm",70,"1/32");
navigation[73] = new navElem(73,"1/35","pi1208179768.htm",70,"1/35");
navigation[74] = new navElem(74,"1/48","pi1731162179.htm",70,"1/48");
navigation[75] = new navElem(75,"1/72","pi1377193098.htm",70,"1/72");
navigation[76] = new navElem(76,"Utilaje de constructii","pi-485506224.htm",null,"Utilaje");

// 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"));

