function genTop() {
	//ajaxLoader("html_web/xml/site.xml", navPaser);
	tempHtml = '';
	tempHtml += '<div style="position:absolute;">';
	tempHtml += '	<script language="JavaScript">';
	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		tempHtml += '		genFlash("'+path+'images/swf/nav.swf", 970, 176, "nav", "path=../&xmlPath=../../xml/&loc='+location+'");';
	}
	else
	{
		tempHtml += '		genFlash("'+path+'images/swf/nav.swf", 970, 220, "nav", "path=../&xmlPath=../../xml/&loc='+location+'");';
	}
	tempHtml += '	</script>';
	tempHtml += '</div>';
	
	document.write(tempHtml);
}

function genTreelink() {
	var tree = siteObj["getIndex"];
	
	var slash = '		<td><img src="'+path+'images/treelink/slash.gif" width="6" height="16" hspace="6"></td>';
	
	tempHtml = '';
	tempHtml += '<table border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '	<tr valign="bottom">';
	for (var link=0; link<tree.length; link++)
		{
			if (tree[link].name == "others") continue;
			
			var tnam = tree[link].name.split("?")[0];
			
			if (link < (tree.length-1))
				{
					//tempHtml += '		<td><a href="'+tree[link].name+'"><img src="'+path+'images/treelink/'+tree[link].name+'.gif" alt="Shopping" border="0"></a></td>';
					//tempHtml += '		<td><a href="./"><img src="'+path+'images/treelink/'+tree[link].name+'.gif" alt="Shopping" border="0"></a></td>';
					//tempHtml += '		<td><img src="'+path+'images/treelink/'+tnam+'.gif" alt="'+tnam+'" border="0"></td>';
					tempHtml += '		<td><img src="'+path+'images/treelink/'+tnam+'.gif" border="0"></td>';
					if (tree[link].name == tree[(link+1)].name) break;
					tempHtml += slash;
				}
			else
				{
					//tempHtml += '		<td><img src="'+path+'images/treelink/'+tnam+'.gif" alt="'+tnam+'" border="0"></td>';
					tempHtml += '		<td><img src="'+path+'images/treelink/'+tnam+'.gif" border="0"></td>';
				}
		}
		
	tempHtml += '	</tr>';
	tempHtml += '</table>';
	
	document.write(tempHtml);
}
function genFooter(pad) {
	tempHtml = '';
	
	if (pad) {
		var str = pad;
	} else {
		var str = 0;
	}
	tempHtml += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '	<tr>';
	tempHtml += '		<td style="padding:30px 0px 20px 0px;"><table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">';
	tempHtml += '			<tr valign="top">';
	tempHtml += '				<td><table width="50" border="0" cellspacing="0" cellpadding="0"><tr valign="top"><td align="left"><img src="'+path+'images/common/footer_contact_01.gif" alt="Location: 1 Austin Road West, Kowloon, Hong Kong. | Service Hotline: 2735 5234 | Leasing Hotline : 2993 3920 | Leasing Email : elelease@mtr.com.hk"></td><td align="left"><a href="mailto:elelease@mtr.com.hk"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'footer_email\',\'\',\''+path+'images/common/footer_contact_02_over.gif\',1)"><img src="'+path+'images/common/footer_contact_02.gif" name="footer_email" alt="Location: 1 Austin Road West, Kowloon, Hong Kong. | Service Hotline: 2735 5234 | Leasing Hotline : 2993 3920 | Leasing Email : elelease@mtr.com.hk" border = "0"></a></td></tr></table></td>';
	tempHtml += '			</tr>';
	tempHtml += '			<tr valign="bottom">';
	tempHtml += '				<td><table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '					<tr>';
	tempHtml += '						<td width="245"><img src="'+path+'images/common/footer_copy.gif" alt="Copyright &copy; 2009 MTR Corporation. All rights reserved." width="245" height="10"></td>';
	tempHtml += '						<td width="15" align="center"><img src="'+path+'images/common/footer_line.gif" width="1" height="11" hspace="7"></td>';
	tempHtml += '						<td width="63"><a href="javascript:NewWindow(\''+path+'others/policy.htm\',\'footer_policy\',\'500\',\'500\',\'yes\',\'no\');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'footer_policy\',\'\',\''+path+'images/common/footer_policy_f2.gif\',1)"><img src="'+path+'images/common/footer_policy.gif" alt="Privacy Policy" name="footer_policy" width="63" height="10" border="0"></a></td>';
	tempHtml += '						<td width="15" align="center"><img src="'+path+'images/common/footer_line.gif" width="1" height="11" hspace="7"></td>';
	tempHtml += '						<td width="73"><a href="javascript:NewWindow(\''+path+'others/important.htm\',\'footer_important\',\'500\',\'300\',\'yes\',\'no\');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'footer_important\',\'\',\''+path+'images/common/footer_important_f2.gif\',1)"><img src="'+path+'images/common/footer_important.gif" alt="Important Notice" name="footer_important" width="73" height="10" border="0"></a></td>';
	tempHtml += '						<td width="15" align="center"><img src="'+path+'images/common/footer_line.gif" width="1" height="11" hspace="7"></td>';
	tempHtml += '						<td><a href="'+path+'others/sitemap.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'footer_sitemap\',\'\',\''+path+'images/common/footer_sitemap_f2.gif\',1)"><img src="'+path+'images/common/footer_sitemap.gif" alt="Site map" name="footer_sitemap" width="39" height="10" border="0"></a></td>';
	tempHtml += '					</tr>';
	tempHtml += '				</table></td>';
	tempHtml += '			</tr>';
	tempHtml += '		</table></td>';
	tempHtml += '		<td width="101" style="padding:30px 0px 20px 0px;" align="right"><img src="'+path+'images/common/logo_mtr.gif"></td>';
	tempHtml += '	</tr>';
	tempHtml += '</table>';
	
	document.write(tempHtml);
	
}



function addCatListItem(title, id)
{
	var str = "";
	str += '<tr valign="top">';
	str += '	<td class="white" style="padding:0px 0px 0px 10px;"><a href="javascript:updateShopListByMainCat(\''+title+'\','+id+');" class="white"><nobr>'+title+'</nobr></a></td>';
	str += '</tr>';
	return str;
}



function addListItem(title, catid, subcatid)
{
	var str = "";
	str += '<tr valign="top">';
	str += '	<td class="white" style="padding:0px 0px 0px 10px;"><a href="javascript:updateShopListByCat(\''+title+'\','+catid+','+subcatid+');" class="white"><nobr>'+title+'</nobr></a></td>';
	str += '</tr>';
	return str;
}

function updateIndexingChar()
{
	tempHtml = '';
	
	var listIndexShop = new Object();
	var shops = shopsObj["shops"];
	
	var letters = ["#", "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
	listIndexShop["#"] = new Object();
	for (var i=0; i<letters.length; i++)
		{
			for (var shop in shops)
				{
					var s = shops[shop];
					var c = s.getName().slice(0,1).toLowerCase();
					if (letters[i] == c)
						{
							if (!(listIndexShop[c]))
								{
									listIndexShop[c] = new Object();
								}
						}
				}
		}
			
	for (var item in listIndexShop)
		{
			tempHtml += '<a href="javascript:updateShopListByChar(\''+item+'\');" class="black">'+item.toUpperCase()+'</a> ';
		}
	
	document.getElementById("indexingChar").innerHTML = tempHtml;
}


function updateShopList(shops)
{
	currentList = shops;
	var i = 0;
	var k = 0;
	var list = new Object();
	var nameList = new Array();
	
	tempHtml = '';
	tempHtml += '<table id="sortableTable" width="100%" border="0" cellspacing="0" cellpadding="2" class="tableList">';
	tempHtml += '	<tr>';
	tempHtml += '		<th class="shop shopname">'+((isFiveZone)?'':'<input name="radio" id="shop" type="radio" value=""   checked="yes">  ') +'<label for="shop">Shop Name</label></th>';
	tempHtml += '		<th class="sorttable_nosort">Floor Location</th>';
	tempHtml += '		<th class="sorttable_nosort">Telephone</th>';
	tempHtml += '		<th class="categoryname">'+((isFiveZone)?'':'<input name="radio" id="category" type="radio" value="">  ') +'<label for="category">Category</label></th>';
	tempHtml += '		<th class="zoneName">'+((isFiveZone)?'':'<input name="radio" id="zone" type="radio" value=""> ') +'<label for="zone">Zone</label></th>';
	tempHtml += '	</tr>';
	
	for (var shop in shops)
		{
			var s = shops[shop];
			var location = s.getLoc();
//			if (list[s.getName()]) location = list[s.getName()].loc+" & "+location;
//			list[s.getName()] = {locid:s.getLoc(),loc:location,subcat:s.getSubCat()};
			var listSID = s.getName().toLowerCase();
			if (list[listSID]) location = list[listSID].loc+" & "+location;
			list[listSID] = {nam:s.getName(), locid:s.getLoc(),loc:location,subcat:s.getSubCat(),catid:s.getCatID(),subcatid:s.getSubCatID(),zone:s.getZoneList(),tel:s.getTel()};
			
			var dup = false;
			for (var m=0; m<nameList.length; m++)
				{
					if (listSID == nameList[m])
						{
							dup = true;
							break;;
						}
				}
			if (dup) continue;
			nameList[k++] = listSID;
		}
		
	nameList.sort();
		
	var zoneOrder = new Object();
	zoneOrder['metal'] = 0;
	zoneOrder['wood'] = 1;
	zoneOrder['water'] = 2;
	zoneOrder['fire'] = 3;
	zoneOrder['earth'] = 4;
		
//	for (var shop in list)
	for (var k=0; k<nameList.length; k++)
		{
			var s = list[nameList[k]];
			var shop = nameList[k];
			//tempHtml += '<tr class="rowColor1" ';
			tempHtml += (!(k%2))?'<tr class="rowColor1" ':'<tr class="rowColor2" ';
			//"this.style.backgroundColor='#E1EAFE'"
			tempHtml += 'onMouseOver="this.className=\'rowColorHighlight\'" ';

			if (i%2)
				{
					tempHtml += 'onMouseOut="this.className=\'rowColor2\'" ';
				}
			else
				{
					tempHtml += 'onMouseOut="this.className=\'rowColor1\'" ';
				}
			
			var tempLocid = (s.locid == "G/F")?"GF":s.locid;
			
			tempHtml += (i++%2)?' class="rowColor2" ':' ';
			tempHtml += 'onclick="javascript:focusShop(\''+tempLocid+'\');"';
			tempHtml += '>';
			tempHtml += '		<td class="shop">'+s.nam+'</td>';
			tempHtml += '		<td>'+s.loc+'</td>';
			tempHtml += '		<td>'+s.tel+'</td>';
			tempHtml += '		<td sorttable_customkey="'+s.subcat+'">'+s.subcat+'</td>';
			
			var tempZoneList = s.zone.split(',');
			
			tempHtml += '		<td sorttable_customkey="'+zoneOrder[tempZoneList[tempZoneList.length-1]]+'">';
			//for (var m=0; m<tempZoneList.length; m++)
			for (var m=(tempZoneList.length-1); m>=0; m--)
			{
				tempHtml += '<img src="'+path+'images/icon_'+tempZoneList[m]+'.gif" alt="'+tempZoneList[m]+'"/>'
			}
			tempHtml += '</td>';
			
			tempHtml += '	</tr>';
		}
	
	tempHtml += '</table>';
	
	document.getElementById("shopListTable").innerHTML = tempHtml;
	sorttable.init();
}

function updateShopListByChar(cha)
{
	var list = new Object();
	var letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
	
	if (document.getElementById("catSelected"))
	{
		document.getElementById("catSelected").innerHTML = '<strong>' + 'All' + '</strong>';
	}
	if (document.getElementById("subCatSelected"))
	{
		document.getElementById("subCatSelected").innerHTML = '<strong>' + 'All' + '</strong>';
	}
	
	var shops = shopsObj["shops"];
	for (var shop in shops)
		{
			var s = shops[shop];
			var c = s.getName().slice(0,1).toLowerCase();
			if (c == cha)
				{
					if (isFiveZone && (s.zone != currentZone)) continue;
					list[shop] = s;
				}
			else if (cha == "#")
				{
					var isChar = false;
					for (var i=0; i<letters.length; i++)
						{
							if (c == letters[i]) isChar = true;
						}
					if (!isChar)
						{
							if (isFiveZone && (s.zone != currentZone)) continue;
							list[shop] = s;
						}
				}
		}
	updateShopList(list);
}

function updateShopListByMainCat(title, catid)
{
	if (title == 'All')
	{
		title = 'All';
	}
	if (document.getElementById("catSelected"))
	{
		document.getElementById("catSelected").innerHTML = '<strong>' + title + '</strong>';
	}

	updateShopListByCat('All', catid, null, true);
}

function updateShopListByCat(title, catid, subcatid, isFirstLv)
{
	if (title == 'All')
	{
		title = 'All';
	}
//alert(catid + " : " + typeof(catid));
	var list = new Object();
	
	/*var tempcatid = catid.split(",");
	var tempsubcatid = subcatid.split(",");
	catid = tempcatid[0];
	subcatid = tempsubcatid[0];*/
	
	if (document.getElementById("catSelected"))
	{
		updateSubCatByCat(catid);
	}
	
	if (document.getElementById("subCatSelected"))
	{
		
		document.getElementById("subCatSelected").innerHTML = '<strong>' + title + '</strong>';
	}
	
	var shops = shopsObj["shops"];
	var isAll = (((catid==0) && (subcatid==0)) || ((catid==0) && isFirstLv));
	
	if (isAll)
		{
			updateIndexingChar();
			updateShopList(shops);
			return;
		}

	for (var shop in shops)
		{
			var s = shops[shop];
			if (isAll)
				{
					list[shop] = s;
				}
			else
				{
					var scid = s.catid.split(",");
					var sscid = s.subcatid.split(",");
					
					//alert('scid : ' + scid);
					
					for (var i=0; i<scid.length; i++)
						{
							if (scid[i] == catid)
								{
									for (var k=0; k<sscid.length; k++)
										{
											if ((sscid[k] == subcatid) || (subcatid == null))
												{
													list[shop] = s;
												}
										}
								}
						}
				}
			
/*			if ((s.catid == catid)
			&& (s.subcatid == subcatid))
				{
					list[shop] = s;
				}*/
		}
	updateIndexingChar();
	updateShopList(list);
}

function updateShopListByZone(zone)
{
	var list = new Object();
	
	var shops = shopsObj["shops"];
	for (var shop in shops)
	{
		var s = shops[shop];
		if (s.zone != zone) continue;
		list[shop] = s;
	}
	updateIndexingChar();
	updateShopList(list);
}


function genCategory(gen) {
	
	if (gen) {
		tempHtml = '<div style="position:absolute;">';
	} else {
		tempHtml += '<div style="position:absolute;">';
	}
	tempHtml += '<div class="pullmenuContainer1" id="categoryMenu" onMouseOver="categoryMenuOver(1, 1);" onMouseOut="categoryMenuOver(1, 0);">';
	tempHtml += '	<table id="menuContentTable1" width="100%" cellpadding="0" cellspacing="0" border="0">';
	tempHtml += '		<tr>';
	tempHtml += '			<td><img src="'+path+'images/common/spacer.gif" width="1" height="21"></td>';
	tempHtml += '		</tr>';
	tempHtml += '		<tr>';
	tempHtml += '			<td class="pullmenu">';
	tempHtml += '				<table width="100%" height="38" cellpadding="0" cellspacing="0" border="0">';
	tempHtml += '					<tr>';
	tempHtml += '						<td rowspan="2" valign="top" style="padding:0px 5px 0px 0px;">';
	tempHtml += '							<div class="menuContent1" id="categoryContent">';
	tempHtml += '							</div>';
	tempHtml += '						</td>';
	tempHtml += '					</tr>';
	tempHtml += '				</table>';
	tempHtml += '			</td>';
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
	tempHtml += '</div>';
	tempHtml += '</div>';

	
	if (gen)	document.write(tempHtml);
}


function genSubCategory(gen) {
	if (gen) {
		tempHtml = '<div style="position:absolute;">';
	} else {
		tempHtml += '<div style="position:absolute;">';
	}

	tempHtml += '<div class="pullmenuContainer2" id="subCategoryMenu" onMouseOver="subCategoryMenuOver(1, 1);" onMouseOut="subCategoryMenuOver(1, 0);">';
	tempHtml += '	<table width="100%" cellpadding="0" cellspacing="0" border="0">';
	tempHtml += '		<tr>';
	tempHtml += '			<td><img src="'+path+'images/common/spacer.gif" width="1" height="21"></td>';
	tempHtml += '		</tr>';
	tempHtml += '		<tr>';
	tempHtml += '			<td class="pullmenu">';
	tempHtml += '				<table id="menuContentTable2" width="100%" height="116" cellpadding="0" cellspacing="0" border="0">';
	tempHtml += '					<tr>';
	tempHtml += '						<td rowspan="2" valign="top" style="padding:0px 5px 0px 0px;">';
	tempHtml += '							<div class="menuContent1" id="subCategoryContent">';
	//cat list
	//tempHtml += addListItem("Confectionary & Gifts", "link");
	// end of cat list
	tempHtml += '							</div>';
	tempHtml += '						</td>';
	tempHtml += '						<td width="20" valign="top" style="padding-top:1px;"><a href="javascript:;" onMouseDown="scrollStart(\'subCategoryContent\', -3);" onMouseOut="scrollStop();" onMouseUp="scrollStop();"><img src="'+path+'images/common/arrow_up.gif" border="0" id="arrow_up"></a></td>';
	tempHtml += '					</tr>';
	tempHtml += '					<tr>';
	tempHtml += '						<td valign="bottom" style="padding-bottom:1px;"><a href="javascript:;" onMouseDown="scrollStart(\'subCategoryContent\', 3);" onMouseOut="scrollStop();" onMouseUp="scrollStop();"><img src="'+path+'images/common/arrow_down.gif" border="0" id="arrow_down"></a></td>';
	tempHtml += '					</tr>';
	tempHtml += '				</table>';
	tempHtml += '			</td>';
	tempHtml += '		</tr>';
	tempHtml += '	</table>';
	tempHtml += '</div>';
	tempHtml += '</div>';
	
	if (gen)	document.write(tempHtml);
}

function categoryMenuOver(i, over) {
	if (over == 1) {
		document.getElementById('categoryMenu').style.visibility = 'visible';
	} else {
		document.getElementById('categoryMenu').style.visibility = 'hidden';
	}
}

function subCategoryMenuOver(i, over) {
	if (over == 1) {
		document.getElementById('subCategoryMenu').style.visibility = 'visible';
	} else {
		document.getElementById('subCategoryMenu').style.visibility = 'hidden';
	}
}


function focusShop(id)
{
	var newp = '';
	if (location.toString().indexOf('five')!=-1)
	{
		newp = '../shopping/';
	}	
	
	if (id == '2048-55')
	{
		return;
	}
	
	location.href = newp + 'search_detail.htm?loc='+id;
}

function genSiteMap()
{
	ajaxLoader("../../xml/site.xml", siteMapPaser);
}

function genShoppingCats()
{
	ajaxLoader("../../xml/shopping.xml", subCatPaser);
}

function genDiningCats()
{
	ajaxLoader("../../xml/shopping.xml", subDiningPaser);
}

var isFiveZone = false;
var currentZone = '';
function genFiveCats(zone)
{
	isFiveZone = true;
	currentZone = zone;
	ajaxLoader("../../xml/shopping.xml", subFivePaser);
}
function genFireCats()
{
	ajaxLoader("../../xml/shopping.xml", subFirePaser);
}
function genWaterCats()
{
	ajaxLoader("../../xml/shopping.xml", subWaterPaser);
}
function genWoodCats()
{
	ajaxLoader("../../xml/shopping.xml", subWoodPaser);
}
function genEarthCats()
{
	ajaxLoader("../../xml/shopping.xml", subEarthPaser);
}



function getShopByLoc(loc)
{
	var locs = loc.split("-");
	loc = locs[0];
	var tempLoc1 = loc.split("_");
	
	var shops = shopsObj["shops"];
	
	for (var shop in shops)
		{
			var s = shops[shop];
			var tempLoc2 = s.loc.split("-");
			var tempLoc3 = tempLoc2[0].split("_");
			//if (s.loc.indexOf(loc)!=-1)
			if (tempLoc1[0] == tempLoc3[0])
				{
					return s;
				}
		}
}

function genShop(shop)
{
	var locid = shopsObj.targetLoc;
	
	if (typeof(shop) == "undefined")
		{
			document.getElementById("shopDetails").innerHTML = "No information.";
			return;
		}
		
	var imageVar = "picPath=../images/shopping/photo/" + shop.getImage();	
	tempHtml = '';
	
	tempHtml += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '	<tr valign="top">';
	tempHtml += '		<td width="305" style="padding:0px 10px 0px 0px;">';
	//alert(imageVar);
	tempHtml += genFlashStr("../images/swf/photoframe.swf", 302, 265, "photoframe", imageVar);
	tempHtml += '		</td>';
	tempHtml += '		<td style="padding:10px 10px 0px 0px;">';
	tempHtml += '			<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	tempHtml += '				<tr>';
	tempHtml += '					<td colspan="2" style="padding:0px 0px 10px 0px;">';
	tempHtml += '						<img src="../images/shopping/logo/'+shop.getLogo()+'" alt="'+shop.getName()+'">';
	tempHtml += '					</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td width="30%" style="padding:0px 10px 0px 0px;" align="right" class="black" valign="top"><strong>Brand Name:</strong></td>';
	tempHtml += '					<td class="black">'+shop.getName()+'</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td style="padding:0px 10px 0px 0px;" class="black" align="right" valign="top"><strong>Location No.:</strong></td>';
	tempHtml += '					<td class="black">'+shop.getLocList()+'</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td style="padding:0px 10px 0px 0px;" class="black" align="right" valign="top"><strong>Telephone:</strong></td>';
	tempHtml += '					<td class="black">'+shop.getTel()+'</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td style="padding:0px 10px 0px 0px;" class="black" align="right" valign="top"><strong>Opening Time:</strong></td>';
	tempHtml += '					<td class="black">'+shop.getHours()+'</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td style="padding:0px 10px 0px 0px;" class="black" align="right" valign="top"><strong>Website URL:</strong></td>';
	tempHtml += '					<td class="black">'+shop.getURL()+'</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td colspan="2" style="padding:10px 0px 0px 0px;" class="black">';
	tempHtml += shop.getDesc();
	tempHtml += '					</td>';
	tempHtml += '				</tr>';
	tempHtml += '				<tr>';
	tempHtml += '					<td colspan="3" align="right" style="padding:12px 0px 0px 0px;">';
	if (shop.getDesc() == "")
		{
			tempHtml += '						<table border="0" cellspacing="0" cellpadding="0" style="padding:0px 50px 0px 0px;" align = "right">';
			tempHtml += '							<tr valign="top">';
			tempHtml += '								<td style="padding:2px 7px 0px 0px;"><a href="javascript:history.go(-1);"><img src="../images/common/arrow_black_l.gif" width="10" height="13" border="0"></a></td>';
			tempHtml += '								<td class="black" align="left"><a href="javascript:history.go(-1);" class="black"><strong>Back</strong></a></td>';
		}
	else
		{
			tempHtml += '						<table border="0" cellspacing="0" cellpadding="0" align = "right">';
			tempHtml += '							<tr valign="top">';
			tempHtml += '								<td style="padding:2px 0px 0px 0px;"><a href="javascript:history.go(-1);"><img src="../images/common/arrow_black_l.gif" width="10" height="13" border="0"></a></td>';
			tempHtml += '								<td class="black" style="padding:0px 0px 0px 7px;"><a href="javascript:history.go(-1);" class="black"><strong>Back</strong></a></td>';
		}

	tempHtml += '							</tr>';
	tempHtml += '						</table>';
	tempHtml += '					</td>';
	tempHtml += '				</tr>';
	tempHtml += '			</table>';
	tempHtml += '		</td>';
	tempHtml += '		<td width="314" style="padding:0px 0px 0px 0px;">';
	tempHtml += '			<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	
	
	var shops =shop.getShopsByName();
	
	var tempObj = new Object();
	var tempList = new Array();
	var t = 0;
	
	for (var item in shops)
		{
			tempList.unshift(item);
		}
	for (var t = 0; t<tempList.length; t++)
		{
			tempObj[tempList[t]] = shops[tempList[t]];
		}
	shops = tempObj;
	
	for (var s in shops)
		{
			var sid = shops[s].getLoc();
			sid = (sid == "G/F")?"GF":sid;
			var flashLoc = "locid=" + sid;

			tempHtml += '				<tr>';
			tempHtml += '					<td>';
			tempHtml += genFlashStr("../images/swf/floor.swf", 314, 185, "floor_"+sid, flashLoc);
			tempHtml += '					</td>';
			tempHtml += '				</tr>';
		}
	
	tempHtml += '				<tr>';
	tempHtml += '					<td>';
	tempHtml += genFlashStr("../images/swf/floorFooter.swf", 314, 27, "floorFooter", "");
	tempHtml += '					</td>';
	tempHtml += '				</tr>';
	tempHtml += '			</table>';
	tempHtml += '		</td>';
	tempHtml += '	</tr>';
	tempHtml += '</table>';
	
	document.getElementById("shopDetails").innerHTML = tempHtml;
}

function genShopDetail()
{
	shopsObj.targetLoc = GetParam("loc");
	ajaxLoader("../../xml/shopping.xml", shopPaser);
}


var zoneTarget = null;

function changeZone(target)
{
	if (zoneTarget == target)	return;
	var zoneDiv = document.getElementById('zone_'+target);
	var btn = document.getElementById('btn_'+target);
	
	if (zoneTarget) 
	{
		var zoneDiv2 = document.getElementById('zone_'+zoneTarget);
		var btn2 = document.getElementById('btn_'+zoneTarget);
		
		zoneDiv2.style.display = 'none';
		btn2.src = path+'images/elements/venue_btn_'+zoneTarget+'.gif';
	}
	
	if (zoneDiv.style.display != 'block') 
	{
		zoneDiv.style.display = 'block';
		btn.src = path+'images/elements/venue_btn_'+target+'_over.gif';
	}
	
	zoneTarget = target;
}

function navOver(target, over) {
	if (zoneTarget == target)	return;
	var btn = document.getElementById('btn_'+target);
	
	if (over == 1) {
		btn.src = path+'images/elements/venue_btn_'+target+'_over.gif';
		
	} else {
		btn.src = path+'images/elements/venue_btn_'+target+'.gif';
	}
}

function openMap()
{
	var w = 500;
	var h = 713;
	
	var winl = (document.body.clientWidth - w) / 2;
	var wint = (document.body.clientHeight - h) / 2;
	
	//alert(document.body.clientWidth);
	//alert(window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight);
	
	var mapDiv = document.getElementById('popupFlash');
	mapDiv.style.display = 'block';
	
	mapDiv.style.top = 70;	//wint;
	mapDiv.style.left = winl-280;
}


function hideMap()
{
	var mapDiv = document.getElementById('popupFlash');
	mapDiv.style.display = 'none';
}

var currentList = null;

function toggleSet(rad) 
{ 
  var type = rad.id; 
  //sortShopList(type);
  //for(var k=0,elm;elm=rad.form.elements[k];k++) 
    //if(elm.className=='item') 
      //elm.style.display = elm.id==type? 'inline':''; 
}

function focusKeyword(flag)
{
	var key = document.getElementById('keyword');
	if (flag)
	{
		if (key.value == 'Keyword')
		{
			key.value = '';
		}
	}
	else
	{
		if (key.value == '')
		{
			key.value = 'Keyword';
		}
	}
}

function keywordSearch()
{
	var key = document.getElementById('keyword');
	updateShopListByKeyword(key.value.toLowerCase());
}

function updateShopListByKeyword(keyword)
{
	if (keyword == 'keyword') return;
	//if (keyword == 'all') keyword = '';
	
	var list = new Object();
	var letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
	
	if (document.getElementById("catSelected"))
	{
		document.getElementById("catSelected").innerHTML = '<strong>' + 'All' + '</strong>';
	}
	if (document.getElementById("subCatSelected"))
	{
		document.getElementById("subCatSelected").innerHTML = '<strong>' + 'All' + '</strong>';
	}
	
	var shops = shopsObj["shops"];
	for (var shop in shops)
	{
		var s = shops[shop];
		var namList = s.getName().toLowerCase().split(' ');
		
		if (s.getHiddenName() != '')
		{
			namList.push(s.getHiddenName());
		}
		
		for (var i=0; i<namList.length; i++)
		{
			if (namList[i].indexOf(keyword)==0)
			{
				list[shop] = s;
			}
		}
	}
	updateShopList(list);
}
