function init(){
	PopulateLocations(CLoc);
	document.InputForm.LocationID.disabled = false;
	document.onkeypress = keypressed;
	MM_preloadImages(BaseThemeURL+"images/topleft.gif",BaseThemeURL+"images/topbg.gif",BaseThemeURL+"images/topright.gif",BaseThemeURL+"images/leftbg.gif",BaseThemeURL+"images/rightbg.gif",BaseThemeURL+"images/bottomleft.gif",BaseThemeURL+"images/bottombg.gif",BaseThemeURL+"images/bottomspace.gif",BaseThemeURL+"images/bottomright.gif",BaseThemeURL+"images/arrowbottom.gif", '/images/upover.gif');
	isReady = true;
	}
function PopulateLocations(Parent){
	document.InputForm.LocationID.length=0;					//Clear Location Drop
	var area = "ALL";
	if (Parent != 0){n = FindLocation(Parent);if(LocationHasChild(Parent)){area = "All " + LA[n][2]}else{area = LA[n][2]}}
	document.InputForm.LocationID.options[0]=new Option(area,Parent);
	var i=1;
	if (Parent == 0){document.InputForm.LocationID.options[i]=new Option("-------------------","NA");i++;document.InputForm.LocationID.options[i]=new Option("South Africa",10);i++;document.InputForm.LocationID.options[i]=new Option("-------------------","NA");i++;document.rollover_up.src="/images/updis.gif"}
	for ( var n = 0; n < LA.length ; n++ ){if(LA[n][1]==Parent){if((LA[n][0]!=10)||(Parent!=0)){document.InputForm.LocationID.options[i]=new Option(LA[n][2],LA[n][0]);i++;}}}
	document.InputForm.LocationID.selectedIndex = 0;
	document.InputForm.LocationID.options[i]=new Option("Can't find location?","TextSearch");
	if (Parent!=0){document.rollover_up.src="/images/up.gif"}
	}
function LocationHasChild(Location){
	for (var n = 0; n < LA.length ; n++){if(LA[n][1]==Location){return true}}
	return false;
	}
function FindLocation(Location){
	for (var n = 0; n < LA.length ; n++){if(LA[n][0]==Location){return n}}
	return null;
	}
function LocationChanged(InputForm){
	if (document.InputForm.LocationID.value == "NA"){document.InputForm.LocationID.selectedIndex=0}
	if (document.InputForm.LocationID.value != "TextSearch"){
		if ((document.InputForm.LocationID.selectedIndex!=0)&&(LocationHasChild(document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value))){
			PopulateLocations(document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value);
			document.InputForm.LocationID.selectedIndex=0;
			Locclick(LA[FindLocation(document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value)][2]);
			}
		}
	else if (document.InputForm.LocationID.value == "TextSearch"){
		PopulateLocations(0);
//		SmallWindow('LocationTextSearch.asp','LocationTextSearch','scrollbars=yes,resizable',500,400)
		GB_showCenter('Location Search', '/LocationTextSearch.asp', 400, 500, '')
		}
	}
function LocationUpLevel(){
	if (document.InputForm.LocationID.value == "TextSearch"){document.InputForm.LocationID.selectedIndex = 0}
	if (document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value!=0){
		PopulateLocations(LA[FindLocation(document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value)][1]);
		document.InputForm.LocationID.selectedIndex = 0;
		if (document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value==0){MM_swapImage('rollover_up','','/images/updis.gif',1);clrLocclick()}else{Locclick(LA[FindLocation(document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value)][2])}
		}
	}
function Locclick(LocationTxT){
	var Pos = new Array(findPos(MM_findObj("LocationID")));
	DIVtext ="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	DIVtext +="<tr><td width=\"16\" height=\"16\" valign=\"top\" background=\""+BaseThemeURL+"images/topleft.gif\"></td>";
	DIVtext +="<td width=\"150\" height=\"16\" valign=\"top\" background=\""+BaseThemeURL+"images/topbg.gif\"></td>";
	DIVtext +="<td width=\"16\" height=\"16\" valign=\"top\" background=\""+BaseThemeURL+"images/topright.gif\"></td></tr>";
	DIVtext +="<tr><td valign=\"top\" background=\""+BaseThemeURL+"images/leftbg.gif\">&nbsp;</td>";
	DIVtext +="<td width=\"150\" bgcolor=\"#FFFFFF\" class=\"smallplaintxt\">To search within "+LocationTxT+" click here again.</td>";
	DIVtext +="<td valign=\"top\" background=\""+BaseThemeURL+"images/rightbg.gif\">&nbsp;</td></tr>";
	DIVtext +="<tr><td width=\"16\" height=\"16\" valign=\"top\" background=\""+BaseThemeURL+"images/bottomleft.gif\"></td>";
	DIVtext +="<td valign=\"top\" align=\"center\" background=\""+BaseThemeURL+"images/bottombg.gif\">";
	DIVtext +="<table width=\"53\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";
   	DIVtext +="<td height=\"16\" background=\""+BaseThemeURL+"images/bottomspace.gif\"></td>";
    DIVtext +="</tr></table>";
	DIVtext +="<td width=\"16\" height=\"16\" valign=\"top\" background=\""+BaseThemeURL+"images/bottomright.gif\"></td></tr>";
	DIVtext +="<tr><td></td>";
	DIVtext +="<td valign=\"top\" align=\"center\"><img src=\""+BaseThemeURL+"images/arrowbottom.gif\" width=\"53\" height=\"42\" /></td>";
	DIVtext +="<td></td></tr>";
	DIVtext +="</table>";
	writeDIV(DIVtext,'locpop');
	ChangeStyle("locpop","position:absolute; left:"+(Pos[0][0]+150-66).toString()+"px; top:"+(Pos[0][1]-document.getElementById('locpop').offsetHeight).toString()+"px;");
	setTimeout('clrLocclick()',5000);
	}
function clrLocclick(){
	writeDIV('','locpop');
	writeDIV('','locpoparrow');
	}
function LocationUpOut(){
	if (document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value!=0){MM_swapImgRestore()}
	}
function LocationUpOver(){
	if (document.InputForm.LocationID.options[document.InputForm.LocationID.selectedIndex].value!=0){MM_swapImage('rollover_up','','/images/upover.gif',1)}
	}
function ChangeAction(){
	document.body.style.cursor = "wait";
	document.onkeypress = "";
	document.InputForm.Page.value = "1"
	document.InputForm.SearchS.value = 22;	
	document.InputForm.submit();
	}
function ResetForm(){
	document.InputForm.Keyword.value="";
	document.InputForm.FoodTypeID.selectedIndex=0;
	document.InputForm.AmbienceID.selectedIndex=0;
	document.InputForm.LocationID.selectedIndex=0;
	document.InputForm.Specials.checked=false;
	document.InputForm.VTour.checked=false;
 	CLoc=10;
	for (i=0;i<document.InputForm.CategoryID.length;i++){document.InputForm.CategoryID.item(i).checked=false}
	init();
	}
function keypressed(key){
	if(window.Event && key){if (key.which == "13"){ChangeAction();}}
	else if (event){if(event.keyCode=="13"){ChangeAction();}}
	}
function GotoMember(MemberID){
	window.location="member_details.asp?MemberID="+MemberID;
	}
if(document.getElementById){
	init();
	}