//
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 += "Amount of Products:<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/bulletcat1stcls.gif" width="1" height="1" alt="Bullet.gif" border="0" align="absmiddle" hspace="0" vspace="0" class="catnav">' + "Go to the Orderform</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\"></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(start,end){
var strHTML="";
for(var i=start;i<Math.min(end+1,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" cellpadding="2" 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="7" height="1" height="1" alt="" border="0"></td>';
			};
		if(navItem.active) strHTML += '<td width="1%" class="ACTIVECATEGORY"><img src="assets/images/bullet.gif" width="11" height="14" 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/bullet.gif" width="7" 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/bulletcat1stcls.gif" width="1" height="1" 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,"Attars & Purfumes","pi-1206128479.htm",null,"02");
navigation[1] = new navElem(1,"Audio & Video","pi-1498790070.htm",null,"13");
navigation[2] = new navElem(2,"Clocks & Watches","pi1160312006.htm",null,"11");
navigation[3] = new navElem(3,"Compasses & Tasbihs","pi-1170623901.htm",null,"08");
navigation[4] = new navElem(4,"Digital Qurans","pi342887210.htm",null,"12");
navigation[5] = new navElem(5,"Electronics","pi1646409193.htm",null,"09");
navigation[6] = new navElem(6,"Footwear","pi1311975869.htm",null,"21");
navigation[7] = new navElem(7,"Gifts & Ornaments","pi289217009.htm",null,"01");
navigation[8] = new navElem(8,"Hajj & Umrah","pi-1036262826.htm",null,"06");
navigation[9] = new navElem(9,"Health & Beauty","pi1369726640.htm",null,"05");
navigation[10] = new navElem(10,"Incenses & Burners","pi1203866102.htm",null,"22");
navigation[11] = new navElem(11,"Islamic Softwares","pi679150595.htm",null,"14");
navigation[12] = new navElem(12,"Jewellery","pi-2125053821.htm",null,"25");
navigation[13] = new navElem(13,"Kids Products","pi1159622089.htm",null,"03");
navigation[14] = new navElem(14,"Books","pi-1811238212.htm",13,"0301");
navigation[15] = new navElem(15,"Clothes","pi-1518972147.htm",13,"0302");
navigation[16] = new navElem(16,"Educational Activities","pi-837667449.htm",13,"0303");
navigation[17] = new navElem(17,"Educational Games","pi1951143262.htm",13,"0304");
navigation[18] = new navElem(18,"Nasheeds","pi-1615890076.htm",null,"04");
navigation[19] = new navElem(19,"Prayer Mats & Rugs","pi1499467039.htm",null,"07");
navigation[20] = new navElem(20,"All Books","pi-1409525049.htm",null,"15");
navigation[21] = new navElem(21,"Arabic & Dictionaries","pi1214064460.htm",20,"1502");
navigation[22] = new navElem(22,"Belief & Faith","pi782688289.htm",20,"1522");
navigation[23] = new navElem(23,"Biographies & Companions","pi1236922429.htm",20,"1507");
navigation[24] = new navElem(24,"Dawah - Propagation","pi-544394846.htm",20,"1505");
navigation[25] = new navElem(25,"Death & Hereafter","pi1937333731.htm",20,"1515");
navigation[26] = new navElem(26,"Ettiquete & Manners","pi763973643.htm",20,"1519");
navigation[27] = new navElem(27,"Family & Marriage","pi-1722091816.htm",20,"1512");
navigation[28] = new navElem(28,"Fiqh, Fatawa & Shariah","pi535730473.htm",20,"1504");
navigation[29] = new navElem(29,"General Books","pi-729512902.htm",20,"1518");
navigation[30] = new navElem(30,"Hadith & Sunnah","pi153991328.htm",20,"1506");
navigation[31] = new navElem(31,"Hajj, Umrah & Zakah","pi-808557881.htm",20,"1503");
navigation[32] = new navElem(32,"Jinns & Devils","pi-909672906.htm",20,"1521");
navigation[33] = new navElem(33,"Men, Women & Children","pi883899483.htm",20,"1511");
navigation[34] = new navElem(34,"Prophets (PBUT)","pi1221376722.htm",20,"1508");
navigation[35] = new navElem(35,"Salah & Prayers","pi1849936476.htm",20,"1509");
navigation[36] = new navElem(36,"Signs, Warnings & Trials","pi1659265432.htm",20,"1516");
navigation[37] = new navElem(37,"Sins, Punishment & Rewards","pi1791816688.htm",20,"1520");
navigation[38] = new navElem(38,"Qurans & Translations","pi388827193.htm",20,"1501");
navigation[39] = new navElem(39,"Ramadhan","pi556079364.htm",20,"1523");
navigation[40] = new navElem(40,"Tafsir & Quran Related","pi333575345.htm",20,"1517");
navigation[41] = new navElem(41,"Zakah & Charity","pi1733381867.htm",20,"1524");
navigation[42] = new navElem(42,"Childrens Books","pi2083081576.htm",null,"16");
navigation[43] = new navElem(43,"Mens Clothes","pi1474956850.htm",null,"17");
navigation[44] = new navElem(44,"Womens Clothes","pi-815437109.htm",null,"18");
navigation[45] = new navElem(45,"Abayas & Jilbabs","pi-827637077.htm",44,"1802");
navigation[46] = new navElem(46,"Dresses","pi1211830674.htm",44,"1801");
navigation[47] = new navElem(47,"Hijabs & Nikabs","pi397292283.htm",44,"1804");
navigation[48] = new navElem(48,"Tunics","pi-944098095.htm",44,"1803");
navigation[49] = new navElem(49,"Childrens Clothes","pi-1903810640.htm",null,"19");
navigation[50] = new navElem(50,"Modesty Essential","pi865791984.htm",null,"30");
navigation[51] = new navElem(51,"Inaya","pi474786930.htm",null,"27");
navigation[52] = new navElem(52,"Sara","pi1055439883.htm",null,"29");
navigation[53] = new navElem(53,"Silk Route","pi406420900.htm",null,"26");
navigation[54] = new navElem(54,"Special Offers","pi1203867170.htm",null,"23");
navigation[55] = new navElem(55,"Multi Buys","pi-516388869.htm",null,"24");
navigation[56] = new navElem(56,"Wholesale","pi1210359239.htm",null,"35");

// 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"));

