// Client functions integration library for smartAgent
// This computer source code is Copyright 2001-2008, Synthetix Ltd.

// Client-specific ACTIONS/FUNCTION CALLS
// **************************************
			
function find_leisure_hotel()
{
	regionA=new Array("London","N",
													"South East England","L",
													"Channel Islands","O",
													"South West England","M",
													"Central Scotland","B",
													"Heart of England","G",
													"East Midlands","J",
													"East of England","K",
													"North West England","E",
													"Yorkshire","F",
													"North East England","D",
													"North Wales","H",
													"South Wales","I",
													"South Scotland","C",
													"North Scotland","A");
				
	bw_break=vr('break');
	bw_break=bw_break.replaces(" and ","+%26+");
				
	bw_region=vr('region');
	if(bw_region=="asterisk") bw_region="*";
				
	for(x=0;x<regionA.length-1;x+=2)
		bw_region=bw_region.replaces(regionA[x],regionA[x+1]);
				
	bw_url="http://www.bestwestern.co.uk/Microsites/Activities/Participating-Hotels.aspx?text=&regionCode="+bw_region+"&Radius="+vr('radius')+"&Tag="+bw_break;
	parent_url(bw_url);
}
			
function find_business_hotel()
{
	regionA=new Array("London","N",
										"South East England","L",
										"Channel Islands","O",
										"South West England","M",
										"Central Scotland","B",
										"Heart of England","G",
										"East Midlands","J",
										"East of England","K",
										"North West England","E",
										"Yorkshire","F",
										"North East England","D",
										"North Wales","H",
										"South Wales","I",
										"South Scotland","C",
										"North Scotland","A");
				
	bw_break=vr('break');
	bw_break=bw_break.replaces(" and ","+%26+");
				
	bw_region=vr('region');
	if(bw_region=="asterisk") bw_region="*";
				
	for(x=0;x<regionA.length-1;x+=2)
		bw_region=bw_region.replaces(regionA[x],regionA[x+1]);
				
	bw_url="http://www.bestwestern.co.uk/Microsites/Activities/Participating-Hotels.aspx?text=&regionCode="+bw_region+"&Radius="+vr('radius')+"&Tag=Business";
	parent_url(bw_url);
}
			
function do_search()
{
	search_val=vr('search_val');
	search_val=remSpace(search_val.toUpperCase());
	search_val=remPunc(search_val);
	search_val=patSub(search_val,stopA,"g");
	search_val=remSpace(search_val);
	parent_url("http://www.bestwestern.co.uk/Search/Keywords-Results.aspx?keywords="+search_val);
}