function acc_getChildren(parent_id){

	var tmp = new Array();

	for(var i=0; i < Acco.length; i++ ){
		var title = Acco[i][2];

		if(Acco[i][1] == parent_id){
			tmp[tmp.length] = new Option(title,Acco[i][0]);
		}
	}

	return tmp;
}

function acc_init(selectid1,selectid2,selectid3){

	selectref1 = document.getElementById(selectid1);
	selectref2 = document.getElementById(selectid2);
	selectref3 = document.getElementById(selectid3);

	var children = acc_getChildren(0);

	ftdc_accommodationsearch_populate(selectref1,children,"Select a region...");

	selectref2.style.display="none";
	selectref3.style.display="none";
}

function ftdc_acco_clickmap(flag,thisref,nextid,nextnextid){
	var parent_id = thisref.options[thisref.selectedIndex].value;

	if (parent_id == -1){ return; }

	var children = acc_getChildren(parent_id);

	if(children.length == 0){

		if(flag == "accommodations"){
			ftdc_accommodationsearch_destination_id = parent_id;
		}
                 else{
                        ftdc_headersearch_destination_id = parent_id;
                         document.location.href = "/guide/overview/" + ftdc_headersearch_destination_id + "/";
                }
		if(typeof nextid != "undefined"){
			var selectref = document.getElementById(nextid);
			selectref.style.display = "none";
		}

		if(typeof nextnextid != "undefined"){
			var selectref2 = document.getElementById(nextnextid);
			selectref2.style.display = "none";
		}
	}
	else{

		if(flag == "accommodations"){
			ftdc_accommodationsearch_destination_id = -1;
		}
		else{
			ftdc_headersearch_destination_id = -1;
		}

		if(typeof nextid != "undefined"){
			var selectref = document.getElementById(nextid);
			var children = acc_getChildren(parent_id);
			ftdc_accommodationsearch_populate(selectref,children,"Select a subregion...");
			selectref.style.display = "inline";
		}

		if(typeof nextnextid != "undefined"){
			var selectref2 = document.getElementById(nextnextid);
			selectref2.options.length=0;
			selectref2.style.display = "none";
		}
	}

	if(flag == "accommodations"){
		ftdc_accommodationsearch_setPriceform();
	}
};