country = new Array()

region = new Array()

town = new Array()

country[1]='Ireland';
region['Ireland']='...,Co.Carlow,Co.Clare,Co.Cork,Co.Donegal,Co.Galway,Co.Kerry,Co.Limerick,Co.Mayo,Co.Sligo,Co.Tipperary,Co.Waterford,Co.Wexford,Co.Wicklow';
town['Co.Carlow']='...,Carlow';
town['Co.Clare']='...,Ballyvaughan,Bodyke,Doolin,Kilkee,Kilrush,Lahinch,Mountshannon,O Briens Bridge';
town['Co.Cork']='...,Ardgroom,Ballyhass Lake,Baltimore,Blarney,Castletownbere,Clonakilty,Dunmanway,Glengarriff,Schull,Shangarry,Youghal';
town['Co.Donegal']='...,Bundoran';
town['Co.Galway']='...,Clifden';
town['Co.Kerry']='...,Ballydavid,Banna Beach,Caherdaniel,Dingle,Kenmare,Killarney,Killorglin,Sneem,Valentia Island';
town['Co.Limerick']='...,Castleconnell,Limerick';
town['Co.Mayo']='...,Achill Island,Louisburg,Westport';
town['Co.Sligo']='...,Enniscrone,Sligo';
town['Co.Tipperary']='...,Ballykisteen,The Glen of Aherlow';
town['Co.Waterford']='...,Tramore,Waterford';
town['Co.Wexford']='...,Courtown,Rosslare Strand';
town['Co.Wicklow']='...,Ashford,Wicklow';

function changeregion() {
        obj = document.form_search;
        var country_now  = obj.tara.options[obj.tara.selectedIndex].value;
    if ( (country_now != '...') && (country_now != '0')) {
           
            var region_array = region[country_now].split(',');
            obj.regiunea.length=0;
            obj.town.length=0;
            for (var i=0; i < region_array.length; i++) {
                    obj.regiunea.options[i] = new Option(region_array[i], region_array[i], 0, 0);
                    obj.regiunea.options[0].selected =  true;
            }
    }else{
            obj.regiunea.length=0;
            obj.town.length=0;
    }
}
function changetown() {
        obj = document.form_search;
        var town_now  = obj.regiunea.options[obj.regiunea.selectedIndex].value;
    if (town_now != '...') {
            var town_array =  town[town_now].split(',');
            obj.town.length=0;
            for (var i=0; i < town_array.length; i++) {
                    obj.town.options[i] = new Option(town_array[i], town_array[i], 0, 0);
                    obj.town.options[0].selected =  true;
            }
    }else{
            obj.town.length=0;
    }
}

function addEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function reset_myform() { 
// document.form_search.reset();
document.form_search.regiunea.value = '...';
document.form_search.town.value = '...';

}