




	
searchbox=new Array(
new Array(new Array('293', 'Caribbean'),new Array(new Array('701', 'St. Lucia', new Array(new Array('10124', 'Raffles'),new Array('10075', 'The Landings'),new Array('10074', 'The Reserve'),new Array('9248', 'Zara Villas'),new Array('9249', 'Villas on the Green'),new Array('9250', 'Ocean Breeze'),new Array('9251', 'BayView'),new Array('11244', 'Villas of Le Sport'),new Array('11243', 'Gateway Villas'),new Array('11242', 'Lapa'),new Array('11241', 'Villas at Jalousie'),new Array('11237', 'Mount Du Cap'),new Array('11238', 'Allamanda'),new Array('11239', 'Cap Maison'),new Array('11240', 'Cap Estate'),new Array('11236', 'The Seaside'),new Array('11091', 'Tradewinds Golf Villas'),new Array('11245', 'Oasis Spa Suites'),new Array('11246', 'Le Paradis'),new Array('11247', 'Discovery at Marigot Bay'))),new Array('702', 'Barbados', new Array())))

);
currency=new Array(new Array('1', 'GBP United Kingdom Pounds'),new Array('2', 'USD United States Dollars'),new Array('3', 'EUR Euros'),new Array('1134', 'CAD Canada Dollars'));
propertytypes=new Array(new Array('1', 'Apartment/Condo'),new Array('2', 'Detached Villa'),new Array('3', 'Town Home'),new Array('4', 'Semi-Detached Villa'),new Array('5', 'Penthouse'),new Array('10', 'Plot/Land'),new Array('19', 'Water Chalet'),new Array('46', 'Villa'));

function init_searchbox(countryselectid,regionselectid,devselectid,currencyselectid,proptypeselectid) {

	if (countryselectid!=''){
countryselect=document.getElementById(countryselectid);
countryselect.length=0;

countryselect.options[0] = new Option('Any');
countryselect.options[0].value = '0';

for (i=0; i<searchbox.length;i++){

countryselect.options[i+1] = new Option(searchbox[i][0][1]);
countryselect.options[i+1].value = i.toString()+'_'+searchbox[i][0][0];
//countryselect.setAttribute('onchange', 'set_searchbox_regions("'+ countryselectid +'","'+regionselectid+'","'+ devselectid +'","'+parseInt(i)+'")');

countryselect.onchange = function() {
	set_searchbox_regions(countryselectid,regionselectid, devselectid ,parseInt(i));
}

}
	}

if (regionselectid!=''){
regionselect = document.getElementById(regionselectid);
regionselect.length=0;

regionselect.options[0] = new Option('Any');
regionselect.options[0].value = '0';
}


if (devselectid!=''){
devselect=document.getElementById(devselectid);
devselect.length=0;

devselect.options[0] = new Option('Any');
devselect.options[0].value = '0';
}


if (currencyselectid!=''){
currencyselect =document.getElementById(currencyselectid);
currencyselect.length=0;

for (i=0; i<currency.length;i++){

currencyselect.options[i] = new Option(currency[i][1]);
currencyselect.options[i].value = currency[i][0];
}
}

if (proptypeselectid!=''){
proptypeselect =document.getElementById(proptypeselectid);
proptypeselect.length=0;

proptypeselect.options[0] = new Option('Any');
proptypeselect.options[0].value = '0';

for (i=0; i<propertytypes.length;i++){

proptypeselect.options[i+1] = new Option(propertytypes[i][1]);
proptypeselect.options[i+1].value = propertytypes[i][0];
}
}







}
function set_searchbox_regions(countryselectid,regionselectid,devselectid,countryref) {
	
if (countryselectid!=''){
countryselect=document.getElementById(countryselectid);
cvalue=countryselect.options[countryselect.selectedIndex].value
_ref = cvalue.split('_');
cref =_ref[0];

if (cvalue!='0'){
if (regionselectid!=''){
	regionselect.length=1;
for (i=0; i<searchbox[cref][1].length;i++){

regionselect.options[i+1] = new Option(searchbox[cref][1][i][1]);
regionselect.options[i+1].value = i.toString()+'_'+searchbox[cref][1][i][0];
regionselect.setAttribute('onchange', 'set_searchbox_developments("'+ countryselectid +'","'+regionselectid+'","'+ devselectid +'","'+parseInt(i)+'")');
}
}
}else{
	regionselect.length=1;
}
}

}
function set_searchbox_developments(countryselectid,regionselectid, devselectid,regionref) {
	
if (countryselectid!=''){
countryselect=document.getElementById(countryselectid);
cvalue=countryselect.options[countryselect.selectedIndex].value
_ref = cvalue.split('_');
cref =_ref[0];
}

if (regionselectid!=''){
regionselect = document.getElementById(regionselectid);
rvalue= regionselect.options[regionselect.selectedIndex].value
_ref = rvalue.split('_');
rref=_ref[0];
}


if (devselectid!=''){
for (i=0; i<searchbox[cref][1][rref][2].length;i++){


devselect.options[i+1] = new Option(searchbox[cref][1][rref][2][i][1]);
devselect.options[i+1].value = searchbox[cref][1][rref][2][i][0];

}
}}function showReference() {

c_obj = document.getElementById('searchbox_country');
ctvalue=c_obj.options[c_obj .selectedIndex].value;
if (ctvalue!='0') {
x = ctvalue.split('_');
ctvalue=x[1];
}

r_obj = document.getElementById('searchbox_region');
rgvalue=r_obj.options[r_obj .selectedIndex].value;
if (rgvalue!='0') {
x = rgvalue.split('_');
rgvalue =x[1];
}

d_obj = document.getElementById('searchbox_dev');
devvalue=d_obj.options[d_obj.selectedIndex].value;

cr_obj = document.getElementById('searchbox_currency');
currvalue=cr_obj.options[cr_obj.selectedIndex].value;

pt_obj = document.getElementById('searchbox_types');
typevalue=pt_obj.options[pt_obj.selectedIndex].value;

alert('Country: ' + ctvalue +' | Region: '+ rgvalue + ' | Development: '+ devvalue + ' | Currency: ' + currvalue + '| Property Type: '+ typevalue);
}
function setSelected(obj,key){
	if (obj!=''){
	sel=document.getElementById(obj);
	for(i=0;i<sel.options.length;i++){
		if (sel.options[i].value==key){
			sel.selectedIndex=i;
		}
	}
	}
}
