function setState(form,val){
    //var form_name = form; //set this on each form, or pass as arg
    var country = Array("840", "826", "124", "36");
    var options = new Array();
    /* USA states*/
    options[0] = new Array("","AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY");
    /* UK */
    options[1] = new Array("","Aberdeen","Belfast","Birmingham","Brighton","Bristol","Cambridge","Cardiff","Devon & Cornwall","East Anglia","East Midlands","Edinburgh","Glasgow","Hampshire","Leeds","Liverpool","London","Manchester","Newcastle","Oxford","Sheffield");
	
    /* Canada Provinces*/
    options[2] = new Array("","Barrie","Calgary","Edmonton","Halifax","Hamilton-Burlington","Kamloops","Kelowna","Kingston","Kitchener-Waterloo-Cambridge","London","Montreal","Nanaimo","New Brunswick","Newfoundland","Niagara","Ottawa-Hull-Gatineau","Peterborough","Prince Edward Island","Prince George","Quebec City","Saskatchewan","Sherbrooke","Sudbury","Thunder Bay","Toronto","Vancouver","Victoria","Windsor","Winnipeg");
	
    /* Austrialia */
    options[3] = new Array("","Adelaide","Brisbane","Melbourne","Perth","Sydney");
	
    if(val != ''){
        n = 0;
        for(i=0; i<country.length; i++){
            if(val == country[i]){
                //	document.forms[form].state.options.length = 0;
                $(form).state.options.length = 0;
                //	document.forms[form].state.options[0] = new Option('----select----','');
                $(form).state.options[0] = new Option('----select----','');
                for(c=1;c<options[i].length;c++){
                    //					document.forms[form].state.options[c] = new Option(options[i][c],options[i][c]);
                    $(form).state.options[c] = new Option(options[i][c],options[i][c]);
                }
                n++;
            }
        }
    }else{
        document.venue_edit.state.options.length =0;
    }
}
function initState(form,val,sval){
	
    var country = Array("840", "826", "124", "36");
    var options = new Array();
    /* USA states*/
    options[0] = new Array("","AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY");
    /* UK */
    options[1] = new Array("","Aberdeen","Belfast","Birmingham","Brighton","Bristol","Cambridge","Cardiff","Devon & Cornwall","East Anglia","East Midlands","Edinburgh","Glasgow","Hampshire","Leeds","Liverpool","London","Manchester","Newcastle","Oxford","Sheffield");
	
    /* Canada Provinces*/
    options[2] = new Array("","Barrie","Calgary","Edmonton","Halifax","Hamilton-Burlington","Kamloops","Kelowna","Kingston","Kitchener-Waterloo-Cambridge","London","Montreal","Nanaimo","New Brunswick","Newfoundland","Niagara","Ottawa-Hull-Gatineau","Peterborough","Prince Edward Island","Prince George","Quebec City","Saskatchewan","Sherbrooke","Sudbury","Thunder Bay","Toronto","Vancouver","Victoria","Windsor","Winnipeg");
	
    /* Austrialia */
    options[3] = new Array("","Adelaide","Brisbane","Melbourne","Perth","Sydney");
    //var v=document.forms[form].country.length;
 
    var v=$(form).country.length;
    if(val != ''){

        for (j = 0; j <= v ; j++)
        {
						
            //	if (val== document.forms[form].country[j].value)
            if (val== $(form).country[j].value)
            {
                //		document.forms[form].country[j].selected=true;
                $(form).country[j].selected=true;
                break;
            }
        }
        n = 0;
        for(i=0; i<country.length; i++){
            if(val == country[i]){
                //document.forms[form].state.options.length = 0;
                //document.forms[form].state.options[0] = new Option('----select----','');
                $(form).state.options.length = 0;
                $(form).state.options[0] = new Option('----select----','');
                for(c=1;c<options[i].length;c++){
                    if(sval == options[i][c]){
                       
                        $(form).state.options[c] = new Option(options[i][c],options[i][c],true);
                      
                        $(form).state.options[c].selected=true;
                    // document.forms[form].state.options[c] = new Option(options[i][c],options[i][c],true);
                    //document.forms[form].state.options[c].selected=true;
                    }else{
                        $(form).state.options[c] = new Option(options[i][c],options[i][c]);
                    //document.forms[form].state.options[c] = new Option(options[i][c],options[i][c]);
                    }
                }
                n++;
            }
        }
    }else{
        //document.forms[form].state.options.length = 0;
        $(form).state.options.length = 0;
    }
	
}


function populate_cities(f){
            if ($(f).country.value !='' && $(f).state.value != ''){
            new Ajax.Updater('ajaxcity','/Ajax/updateCities',
                {parameters:{country:$(f).country.value,
                             state:$(f).state.value},
                  asynchronous:true});

}
}
function set_city(f, val){
        

    var v=$(f).city.length;

    if(val != ''){
        for (j=0;j < v ; j++)
        {
            if (val== $(f).city[j].value)
            {
                $(f).city[j].selected=true;
                break;
            }
        }
    }

}
         


