+function addTimerFormChangeChannel(newchannel) {
+ tvblist = addTimerEditFormArray.TVList;
+ radioblist = addTimerEditFormArray.RadioList;
+ if (newchannel == "<Currbouquet>" || newchannel == "<Bouquets>") {
+ // reset selection to last valid channel
+ for (i=0; i<$('channel').options.length; i++) {
+ if ($('channel').options[i].value == addTimerEditFormArray.channel) {
+ $('channel').options[i].selected = true;
+ break;
+ }
+ }
+ return;
+ }
+ found = false;
+ for(element in tvblist) {
+ if (element == newchannel) {
+ found = true;
+ addTimerEditFormArray.currBouquetName = tvblist[element];
+ addTimerEditFormArray.currBouquetList = {};
+ break;
+ }
+ }
+ if (!found) {
+ for(element in radioblist) {
+ if (element == newchannel) {
+ found = true;
+ addTimerEditFormArray.currBouquetName = radioblist[element];
+ addTimerEditFormArray.currBouquetList = {};
+ break;
+ }
+ }
+ }
+ if (found) {
+ // bouquet selected, update menu
+ servicereftoloadepgnow = newchannel;
+ if(typeof(loadedChannellist[servicereftoloadepgnow]) == "undefined") {
+ doRequest(url_getServices+servicereftoloadepgnow, incomingAddTimerFormChangeChannel, true);
+ } else {
+ incomingAddTimerFormChangeChannel();
+ }
+ } else {
+ // real channel selected, update channel and channelName
+ addTimerEditFormArray.channel = newchannel;
+ for (i=0; i<$('channel').options.length; i++) {
+ if ($('channel').options[i].value == newchannel) {
+ addTimerEditFormArray.channelName = $('channel').options[i].text;
+ break;
+ }
+ }
+ }
+}
+
+function incomingAddTimerFormChangeChannel(request) {
+ var services = null;
+ if(typeof(loadedChannellist[servicereftoloadepgnow]) != "undefined"){
+ services = loadedChannellist[servicereftoloadepgnow];
+ } else if(request.readyState == 4) {
+ services = new ServiceList(getXML(request)).getArray();
+ loadedChannellist[servicereftoloadepgnow] = services;
+ }
+ if(services !== null) {
+ debug("[incomingAddTimerFormChangeChannel] Got "+services.length+" Services");
+ for(var i = 0; i < services.length ; i++) {
+ reference = services[i];
+ addTimerEditFormArray.currBouquetList[reference.getServiceReference()] = reference.getServiceName();
+ }
+ }
+
+ lst = addTimerFormPrepareChannelMenu();
+
+ for (i = $('channel').options.length; i !== 0; i--) {
+ $('channel').options[i - 1] = null;
+ }
+ for(element in lst) {
+ $('channel').options[i] = new Option(lst[element]);
+ $('channel').options[i].value = element;
+ if (element == addTimerEditFormArray.channel) {
+ $('channel').options[i].selected = true;
+ }
+ i++;
+ }