//<!-- hide from old browsers...



var info
var initVal = "please select"



function createArray() {

    info = new Array(
initVal + "*Any",
"United Kingdom*Any|Angus|Antrim|Argyll and Bute|Armagh|Avon|Ayrshire|Bedfordshire|Berkshire|Blaenau Gwent|Birmingham|Borders|Bridgend|Bristol|Buckinghamshire|Caerphilly|Cambridgeshire|Cardiff|Carmarthenshire|Central|Ceredigion|Channel Islands|Cheshire|Clwyd|Conwy|Cornwall|County Durham|Cumbria|Denbighshire|Derbyshire|Devon|Dorset|Dumfries and Galloway|Down|Dyfed|East Sussex|East Yorkshire|Edinburgh|Essex|Fermanagh|Fife|Flintshire|Galway|Glasgow|Gloucestershire|Grampian|Greater Manchester|Gwent|Gwynedd|Hampshire|Herefordshire|Hertfordshire|Highland|Isle of Anglesey|Isle of Man|Isle of Wight|Kent|Lanarkshire|Lancashire|Leicestershire|Lincolnshire|London|Londonderry|Lothian|Merseyside|Merthyr Tydfil|Middlesex|Mid Glamorgan|Monmouthshire|Neath Port Talbot|Newport|Norfolk|North Yorkshire|Northamptonshire|Northumberland|Nottinghamshire|Orkney|Oxfordshire|Pembrokeshire|Powys|Rhondda Cynon Taf|Shetland|Shropshire|Somerset|South Glamorgan|South Yorkshire|Staffordshire|Strathclyde|Suffolk|Surrey|Swansea|Tayside|Torfaen|Tyne and Wear|Tyrone|Vale of Glamorgan|Warwickshire|West Midlands|West Sussex|West Yorkshire|Western Isles|West Glamorgan|Wiltshire|Worcestershire|Wrexham"
);

}


createArray()

function updateMenus(what){
    var ctry = what.value;
    var tmp, arr, found
    
    found = false
    for (c=0; c<info.length; c++){
        tmp = info[c]
        if (tmp.split('*')[0] == ctry){
            arr = tmp.split('*')[1].split('|')
            found = true
            break
        }
    }

    if (found){
        document.getElementById("frm_town").options.length = arr.length;

        for ( var i = 0; i < arr.length; i++ ) {
            document.getElementById("frm_town").options[i].text  = arr[i];
            document.getElementById("frm_town").options[i].value = arr[i];
        }
        document.getElementById("frm_town").selectedIndex=0;
    }
    setState()
}

function setCountry(country) {
    var dd_country = document.getElementById("frm_country")
    for ( var c = 0; c < dd_country.options.length; c++ ) {
        if (country == document.getElementById("frm_country").options[c].text){
            dd_country.selectedIndex=c
            updateMenus(dd_country)
        }
    }
    setState()
}



function setRegion(region){
    var dd_region
    var dd_country = document.getElementById("frm_country")
    updateMenus(dd_country)
    dd_region = document.getElementById("frm_town")
    for ( var c = 0; c < dd_region.options.length; c++ ) {
        if (region == document.getElementById("frm_town").options[c].text){
            dd_region.selectedIndex=c
        }
    }
    setState()
}


function setState(){
    var ctry

    if (document.getElementById("td_region")){
        ctry = document.getElementById("frm_country").value
        
        document.getElementById("td_region").innerHTML = "<b>Region</b>"
        
        if (ctry == "United States")document.getElementById("td_region").innerHTML = "<b>State</b>"
        if (ctry == "United Kingdom")document.getElementById("td_region").innerHTML = "<b>County</b>"
    
    }   
}



function showIncBox(obj) {

    if (obj.value != '') {
        document.getElementById("tr_incBox").style.display = "block"
    } else {
        document.getElementById("tr_incBox").style.display = "none"
    }
}


// end of hiding -->