// avclub/home.js
/*
htmlReady(function(){
});
*/

$(document).ready(function() {     /* todo, move this to htmlReady when it works again */
    /* display comment counts on recent feature callouts */
    afns_makeCommentable("feature_listing");
    afns_makeCommentable("most_talked_about");
    afns_makeCommentable("tvclub");
    afns_makeCommentable("video");
    

    if (afns_avlocal_city == "national" || afns_avlocal_city == "" || afns_avlocal_city == null || afns_avlocal_city == undefined) {
	// no city selected, just leave at the first
    }
    else {
	$("#localcity_select").val("callout_"+afns_avlocal_city);
    }

    /* show only the current city in the local section, set up onchange handler to show selected */
    $("#localcity_select").change(function(event) { 
	    $(".callout_city").hide();
	    $("."+$(this).val()).show();
	});
    $("#localcity_select").change(); //init
    /* set up a second change handler on localcity_select to set the location for the user */
    $("#localcity_select").change(function(event) {
	    var city_name = $(this).val().substr(8);
	    afns_setLocation(city_name);
	    $("#local_nav").html(city_name);
	    $("#local_nav").attr("href", "/" + city_name);
	});
});
