function populate_genre(s, id)
{
// 's' should be a reference to 'idParentGenre' select node
if (s.options[s.selectedIndex].value == "")
return;
ajax.open("post", "inc/ajax/_getGenres.php", true);
ajax.send("idParent="+ s.options[s.selectedIndex].value);
var f_s = document.getElementById("idGenre"); // should be only 1
f_s.options.length = 0;
f_s.options[0] = new Option("Loading Music Genres For "+ s.options[s.selectedIndex].text +"....", null);
if (id != undefined)
ajax.idGenre = id;
ajax.onSuccess = function()
{
var i, len;
var arr = eval(this.data);
var f_s = document.getElementById("idGenre");
f_s.options.length = 0;
len = arr.length;
for (i = 0; i < len; i++)
{
f_s.options[i] = new Option(arr[i].name, arr[i].id);
if (this.idFormat != undefined && arr[i].id == this.idFormat)
f_s.options[i].selected = true;
}
if (this.idGenre != undefined)
this.idGenre = undefined;
else
f_s.focus(); // only focus the field if we're not reseting the form
}
}