var totalspot=18;
var spottitlearray=new Array(totalspot+1);
var spotdescarray=new Array(totalspot+1);

spottitlearray[0]="";
spottitlearray[1]="Avenue of Stars";
spottitlearray[2]="Hong Kong Disneyland";
spottitlearray[3]="Ocean Park Hong Kong";
spottitlearray[4]="The Peak";
spottitlearray[5]="Flagstaff House Museum of Tea Ware";
spottitlearray[6]="Hong Kong Cultural Centre";
spottitlearray[7]="Hong Kong Heritage Museum";
spottitlearray[8]="Hong Kong Museum of Art";
spottitlearray[9]="Hong Kong Museum of History";
spottitlearray[10]="Hong Kong Science Museum";
spottitlearray[11]="Hong Kong Wetland Park";
spottitlearray[12]="Ngong Ping 360";
spottitlearray[13]="Ngong Ping Fun Walk";
spottitlearray[14]="Ping Shan Tang Clan Gallery<br/>cum Heritage Trail Visitors Centre";
spottitlearray[15]="The Hong Kong Racing Museum";
spottitlearray[16]="MTR Tsim Sha Tsui Station";
spottitlearray[17]="Hong Kong Olympic Piazza(Olympic-themed piazza)";
spottitlearray[18]="Hong Kong Tourism Board<br/>Visitor Centre (Causeway Bay)";

spotdescarray[0]="";
spotdescarray[1]="Discover the stars that have made Hong Kong the 'Hollywood of the East' at this tribute to the territory's 100-year history of filmmaking at the Avenue of Stars.<br/><br/>Address: Tsim Sha Tsui promenade stretches along the waterfront from the southern end of Salisbury Garden to the New World Centre, Kowloon.<br/>Enquiry Hotline: 3118 3000<br/>Sticker Collection Point: Avenue of Stars Kiosk No. 2<br/>How To Get There: MTR East Tsim Sha Tsui Station Exit J, and follow the signs.";
spotdescarray[2]="Jump into Summer Action and be part of it all at Hong Kong Disneyland!<br/><br/>Address: Lantau Island<br/>Enquiry Hotline: 3550 3388<br/>Sticker Collection Point: City Hall on Main Street, U.S.A.<br/>How To Get There: MTR Disneyland Resort Station";
spotdescarray[3]="Ocean Park Hong Kong is a world-class theme park famous for marine life and animals. Some of the unique facilities include the Atoll Reef, Giant Panda Habitat, the Sea Jelly Spectacular, thrill rides and much more.<br/><br/>Address: Wong Chuk Hang Road, Aberdeen, Hong Kong<br/>Enquiry Hotline: 2552 0291<br/>Sticker Collection Point: Guest Relations Office<br/>How To Get There: Bus 629 from MTR Admiralty Station Exit B";
spotdescarray[4]="Looking down from The Peak, you'll be amazed by the world-famous Victoria Harbour, towering skyscrapers and spectacular city skyline.<br/><br/>HKTB Visitor Hotline: 2508 1234<br/>Sticker Collection Point: Hong Kong Tourism Board Visitor Centre (The Peak Piazza)<br/>How To Get There: Take the Peak Tram from the Lower Peak Tram Terminus on Garden Road (walk from MTR Central Station Exit J2).";
spotdescarray[5]="Flagstaff House Museum of Tea Ware is a historical treasure itself and houses Hong Kong's most prized and rare collection of ceramics.<br/><br/>Address: Cotton Tree Drive, Central, Hong Kong (inside Hong Kong Park)<br/>Enquiry Hotline: 2869 0690<br/>Sticker Collection Point: Enquiry Counter<br/>How To Get There: MTR Admiralty Station Exit C1, follow signs & take the escalator up to the entrance of Hong Kong Park.";
spotdescarray[6]="Located at the Tsim Sha Tsui waterfront, the Hong Kong Cultural Centre is the premier cultural venue in Hong Kong.<br/><br/>Address: 10 Salisbury Road, Tsim Sha Tsui, Kowloon<br/>Enquiry Hotline: 2734 2009   <br/>Sticker Collection Point: Enquiries Counter<br/>How To Get There: MTR Tsim Sha Tsui Station Exit E, walk towards Salisbury Road, turn right, take subway (pedestrian tunnel) next to YMCA to Hong Kong Cultural Centre.";
spotdescarray[7]="The changing thematic exhibitions, diversified programmes and the permanent galleries showcase the history and culture of the city.<br/><br/>Address: 1 Man Lam Road, Sha Tin, New Territories<br/>Enquiry Hotline: 2180 8188   <br/>Sticker Collection Point: Reception<br/>How To Get There: MTR Che Kung Temple Station Exit A and walk 5 minutes along the footbridge.";
spotdescarray[8]="The museum contains over 15,000 items in seven different galleries including Chinese Antiquities, Chinese Painting and Calligraphy, Contemporary Hong Kong Art, Historical Pictures and the Xubaizhai Collection of Chinese Painting and Calligraphy.<br/><br/>Address: 10 Salisbury Road, Tsim Sha Tsui, Kowloon<br/>Enquiry Hotline: 2721 0116   <br/>Sticker Collection Point: Information Counter at 1/F Lobby<br/>How To Get There: MTR Tsim Sha Tsui Station Exit E, walk towards Salisbury Road, turn right, take subway (pedestrian tunnel) next to YMCA to Hong Kong Museum of Art.";
spotdescarray[9]="The Hong Kong Story permanent exhibition reveals the ecology, customs and history of Hong Kong since the Devonian era some 400 million years ago.<br/><br/>Address: 100 Chatham Road South, Tsim Sha Tsui, Kowloon<br/>Enquiry Hotline: 2724 9042   <br/>Sticker Collection Point: 1/F, Main Lobby Enquiry Counter<br/>How To Get There: MTR Tsim Sha Tsui Station Exit B2 and walk 10 minutes along Cameron Road towards Tsim Sha Tsui East.";
spotdescarray[10]="The Science Museum has over 500 exhibits with 70% being hands-on items for visitors of all ages.<br/><br/>Address: 2 Science Museum Road, Tsim Sha Tsui East, Kowloon<br/>Enquiry Hotline: 2732 3232<br/>Sticker Collection Point: 1/F, Main Lobby Information Counter<br/>How To Get There: MTR Tsim Sha Tsui Station Exit B2 and walk 10 minutes along Cameron Road towards Tsim Sha Tsui East.";
spotdescarray[11]="The park includes a Wetland Reserve, a man-made wetland recreating the habitats for waterfowls and other wildlife. Visitors can also get close to nature at the Wetland Discovery Centre within the Reserve.    Address: Wetland Park Road, Tin Shui Wai, New Territories<br/><br/>Enquiry Hotline: 2708 8885<br/>Sticker Collection Point: Information Counter inside Visitor Centre<br/>How To Get There: MTR Tin Shui Wai Station Exit E, change to Light Rail (705 or 706) and get off at Wetland Park Station.";
spotdescarray[12]="Ngong Ping 360 combines a spectacular cable car journey on Asia's longest bi-cable ropeway with the culturally themed, Chinese-style Ngong Ping Village. You can also visit other Lantau attractions located not far from Ngong Ping 360, the gateway to a total Lantau experience.    Address: 11 Tat Tung Road, Tung Chung, Lantau Island<br/><br/>Enquiry Hotline: 2109 9898<br/>Sticker Collection Point: Ticketing offices at Tung Chung Cable Car Terminal, Ngong Ping Cable Car Terminal or Ngong Ping Village<br/>How To Get There: MTR Tung Chung Station Exit B and walk 5 minutes to the Tung Chung Cable Car Terminal.";
spotdescarray[13]="This walk takes about 45 minutes to complete and offers six attractions: Misty Lantau, Ancient Gateway, Tree Walk Exploration, Sunrise on Lantau, Scenery of Lakes and Tea Walk.   <br/><br/>Address: Lantau Island<br/>Enquiry Hotline: 2259 3916<br/>Sticker Collection Point: Ngong Ping Nature Centre<br/>How To Get There: Interchange for the Ngong Ping Cable Car at MTR Tung Chung Station Exit B. Get off the Cable Car, walk along the path that leads to the Tea Garden. At the end of the Tea Garden is a side path that heads to the left where the Fun Walk starts.";
spotdescarray[14]="The gallery displays various relics belonging to members of the Tang Clan whose descendants tell all about the family's history, customs and cultural life. The heritage trail leads visitors to various monuments and buildings in Ping Shan.<br/><br/>Address: Hang Tau Tsuen, Ping Shan, Yuen Long, New Territories (Old Ping Shan Police Station)<br/>Enquiry Hotline: 2617 1959<br/>Sticker Collection Point: Reception<br/>How To Get There: MTR Tin Shui Wai Station Exit E, follow the signs and walk for around 30 minutes.";
spotdescarray[15]="The Hong Kong Racing museum introduces the history of The Hong Kong Jockey Club and local horseracing. Thematic exhibitions are also staged on a regular basis.<br/><br/>Address: 2/F, Happy Valley Stand, Happy Valley, Hong Kong<br/>Enquiry Hotline: 2966 8065<br/>Sticker Collection Point: Service Counter<br/>How To Get There: MTR Causeway Bay Station Exit A and walk for 10 - 15 minutes.";
spotdescarray[16]="MTR offers commuters a pleasant journey with its efficient and reliable railway network.<br/><br/>Enquiry Hotline: 2881 8888<br/>Sticker Collection Point: Customer Service Centre (near Exit E)";
spotdescarray[17]="This Hong Kong Olympic Piazza will be the venue for a series of Olympic celebrations. Big TV screens will also bring you live coverage of this mega event.<br/><br/>Address: Hong Kong Cultural Centre Piazza, Tsim Sha Tsui, Kowloon (Open from 25 July to 24 August 2008)<br/>HKTB Visitor Hotline: 2508 1234<br/>Sticker Collection Point: Information Counter <br/>How To Get There: MTR Tsim Sha Tsui Station Exit E, walk towards Salisbury Road, turn right, take subway (pedestrian tunnel) next to YMCA to Hong Kong Cultural Centre.";
spotdescarray[18]="Hong Kong Tourism Board Visitor Centre provides comprehensive tourist information that can help tourists keep abreast of the latest happenings and attractions in this vibrant city.<br/><br/>Address: MTR Causeway Bay Station (near Exit F)<br/>HKTB Visitor Hotline: 2508 1234";

 


function pageination (_currentpage,_totalpage,_totalcell,_coloring)
{
	var fromcell=0;
	var tocell=0;
	var pageinationhtml="";
	var prepage=0;
	var nextpage=0;		
	var coloring="";
	coloring=_coloring;
	
	if (_currentpage==1||_currentpage==0)
		fromcell=0;
	else
		fromcell=((_currentpage-1)*6);
	
		
	tocell=fromcell+5;
	if (tocell>_totalcell-1)
		tocell=_totalcell-1;
	
	if (_currentpage>1)
		prepage=_currentpage-1;
	if (_currentpage+1<=_totalpage)
		nextpage=_currentpage+1;
		
	pageinationhtml+="";

			//Detemine to display "Previous" or not
			if (_currentpage>1)
				pageinationhtml+="<a class=\"previous\" href=\"javascript:pageination("+(_currentpage-1)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">上頁</a>";
			
			pageinationhtml+="第 ";
			
			//Display pattern for currentpage = the first page
			if (_currentpage==1)
			{
				//_currentpage
				pageinationhtml+="<a class=\"active\" href=\"#\">"+(_currentpage)+"</a>";

				for(var i = _currentpage+1;i<=_totalpage;i++)
				{
					pageinationhtml+="&nbsp;<a href=\"javascript:pageination("+(i)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">"+(i)+"</a>";				
				}
				
			}
			
			//Display pattern for currentpage = the last page
			if (_currentpage==_totalpage && _currentpage!=1)
			{
				for(var i = 1;i<=_currentpage-1;i++)
				{
					pageinationhtml+="<a href=\"javascript:pageination("+(i)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">"+(i)+"</a>&nbsp;";				
				}				
				//_currentpage
				pageinationhtml+="<a class=\"active\" href=\"#\">"+(_currentpage)+"</a>";				
			}
			
			//Display pattern for currentpage != the first/last page
			if (_currentpage>1 && _currentpage<_totalpage)
			{
				for(var i = 1;i<=_currentpage-1;i++)
				{
					pageinationhtml+="<a href=\"javascript:pageination("+(i)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">"+(i)+"</a>&nbsp;";				
				}
				/*if ((_currentpage-1)>0)
				{
					pageinationhtml+="<a href=\"javascript:pageination("+(_currentpage-1)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">"+(_currentpage-1)+"</a>";				
				}
				*/
				
				//_currentpage
				pageinationhtml+="<a class=\"active\" href=\"#\">"+(_currentpage)+"</a>";
				
				for(var i = _currentpage+1;i<=_totalpage;i++)
				{
					pageinationhtml+="&nbsp;<a href=\"javascript:pageination("+(i)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">"+(i)+"</a>";				
				}
			}
			
			pageinationhtml+=" 頁";
			//Detemine to display "Next" or not
			if (_currentpage+1<=_totalpage)
				pageinationhtml+="<a class=\"next\" href=\"javascript:pageination("+(_currentpage+1)+","+_totalpage+","+_totalcell+",&#34;"+coloring+"&#34;)\">下頁</a>";


	document.getElementById("pageOrder").innerHTML=pageinationhtml;	
	document.getElementById("pageOrderBottom").innerHTML=pageinationhtml;	
	hideAllCell(_totalcell);
	showCell(fromcell,tocell);
}

function hideAllCell(_totalcell)
{
	for(var i=0;i<_totalcell;i+=2)
	{
		document.getElementById("div_"+i).style.display="none";			

	}
}

function showCell(_fromCell,_toCell)
{	
	for(var i=_fromCell;i<=_toCell;i+=2)
	{
		document.getElementById("div_"+i).style.display="inline";					

	}
}

var pastAni=0;

function rotateBanner(_total)
{	
	
		var motionArray=setArray(_total);
		var randomNo;
		randomNo=0;
		
		if (motionArray.length>1)
			randomNo=makeRandom(pastAni,motionArray.length);	
			
		for (var i=0;i<motionArray.length;i++)
		{	
			if (i==randomNo)
				{
					document.getElementById(motionArray[i][0]).style.display="inline";						
					pastAni=i;
					setTimeout("rotateBanner("+_total+")",(motionArray[i][1]*1000));				
				}
			else
				document.getElementById(motionArray[i][0]).style.display="none";
		}
	
	
}

function makeRandom(_pastAni,arrayLength)
{
	
	var outputRan=0;
	ranNum=Math.floor(Math.random()*arrayLength);
	if (ranNum==_pastAni)
		makeRandom(_pastAni,arrayLength);
	else
		outputRan=ranNum;	
	return ranNum;
}

function setArray(_total)
{
	var total_banner=_total;
	var _ent0=new Array("rotimage_1","2");
	var _ent1=new Array("rotimage_2","2");
	var _ent2=new Array("rotimage_3","2");
	
	var motionArray=new Array();
	for (var i=0;i<=(total_banner-1);i++)
	{
		motionArray.push(eval("_ent"+i));
	}
	
	return motionArray;
}

function callgo(_url,_height) 
{
	var theURL;
	theURL = _url;
	window.open(theURL, 'popup', 'width=384,height='+_height+',scrollbars=0');	
	return;
}

function langchange(lang)
{
	var pageurl=location.href;
	if (lang=="tc")
	{	pageurl=pageurl.replace("/eng/","/tc/");}
	if (lang=="sc")
	{	pageurl=pageurl.replace("/eng/","/sc/");}	
	
	window.location=pageurl;
}

function changespot(id,totalpict)
{
	var outputString="";
	var imgvar="";
	if(id.length==1)
		imgvar="0"+id;
	else
		imgvar=id;
	
	outputString+="<table cellspacing='0' cellpadding='0' border='0' width='568' class='content' bgcolor='#F6B513' style='background-color:#F6B513;'>";
	outputString+="<tr>";
		outputString+="<td style='padding-left:8px;padding-right:8px;'>";
			outputString+="<table cellspacing='0' cellpadding='0' border='0' width='550' class='content' bgcolor='#F6B513' style='background-color:#F6B513;'>";
				outputString+="<tr>";
					outputString+="<td valign='top' width='105'><img src='images/exploring/spot/stamp/stamp_"+imgvar+".jpg'></td>";
					outputString+="<td valign='top' style='padding-left:8px;' width='420'>";
						outputString+="<table cellspacing='0' cellpadding='0' border='0' width='420' class='content'>";
							outputString+="<tr><td style='font-size:18px;font-family:Arial;color:#FFFFFF;font-weight:bold;'>No. "+id+"</td></tr>";
							outputString+="<tr><td style='font-size:14px;font-family:Arial;color:#FFFFFF;font-weight:bold;'>"+spottitlearray[id]+"</td></tr>";
							outputString+="<tr><td>";
								outputString+=spotdescarray[id];
							outputString+="</td></tr>";
							outputString+="<tr><td><img src='images/exploring/spot/spot_image/spot_"+imgvar+"_1.jpg' vspace='5'>";
							
							if (totalpict=="2")
								outputString+="<img src='images/exploring/spot/spot_image/spot_"+imgvar+"_2.jpg' vspace='5' hspace='8'></td></tr>";
								
						outputString+="</table>";
					outputString+="</td>";
				outputString+="</tr>";
				outputString+="<tr>";
					outputString+="<td><img src='images/spacer.gif' width='105' height='1'></td>";
					outputString+="<td><img src='images/spacer.gif' width='420' height='1'></td>";
				outputString+="</tr>";
			outputString+="</table>";
		outputString+="</td>";
	outputString+="</tr>";
	outputString+="</table>";
	
	document.getElementById("rallyspot").innerHTML=outputString;
	window.location.href='#spotcontent' ;
}

function changeIconOn(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace("_off","_on");	
}

function changeIconOff(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace("_on","_off");	
}







function changeDiscover_on(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace(".gif","b.gif");

}

function changeDiscover_off(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace("b.gif",".gif");	
}

function changeDiscover_onlang(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace("2.gif","1.gif");

}

function changeDiscover_offlang(_name)
{
	var imageName="";
	imageName=_name.src;	
	_name.src=imageName.replace("1.gif","2.gif");	
}

function highlightnavi(navi_no,total)
{
	for(var i=1;i<=total;i++)
	{
		if (navi_no!=i)
			document.getElementById("nav_"+i).src=document.getElementById("nav_"+i).src.replace("nav"+i+"b","nav"+i);
		else
			document.getElementById("nav_"+i).src=document.getElementById("nav_"+i).src.replace("nav"+i,"nav"+i+"b");
	}
}

//Modify by Jamie
function writeAtoZ(_current,_color)
{
	var atozArray=["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"];
	var outputStr="";
	for (var i=0;i<atozArray.length;i++)
	{
		if (_current==atozArray[i])
			outputStr+= "<div id='sort_"+atozArray[i]+"'><a class='active' href='index.jsp?sortorder="+atozArray[i]+"'>"+atozArray[i]+"</a><div class=\"sep3\"></div></div>";
		else
			outputStr+="<div id='sort_"+atozArray[i]+"'><a href='index.jsp?sortorder="+atozArray[i]+"'>"+atozArray[i]+"</a><div class=\"sep3\"></div></div>";
	}
	//outputStr+="";
	document.getElementById("alphaOrder").innerHTML=outputStr;	
}
function writeAtoZ2(_current,_color)
{
	var atozArray=["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"];
	var outputStr="";
	for (var i=0;i<atozArray.length;i++)
	{
		if (_current==atozArray[i])
			outputStr+= "<div id='sort_"+atozArray[i]+"'><a class='active' href='index.jsp?sortorder="+atozArray[i]+"'>"+atozArray[i]+"</a><div class=\"sep3\"></div></div>";
		else
			outputStr+="<div id='sort_"+atozArray[i]+"'><a href='index.jsp?sortorder="+atozArray[i]+"'>"+atozArray[i]+"</a><div class=\"sep3\"></div></div>";
	}
	//outputStr+="";
	document.getElementById("alphaOrder").innerHTML=outputStr;	
}

function disableSort(_disChar)
{
	var outputString="<a class=\"disable\" href=\"javascript:;\">"+_disChar+"</a><div class=\"sep3\"></div>";
	document.getElementById("sort_"+_disChar).innerHTML=outputString;			
}


