function whichMR(obj) {
	if (obj.modulation_target.value == "QAM64 NTSC-A") {
		obj.constant_bit_rate.value =(CLOCK_RATE_QAM64_NTSC_188_A).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM64A_NTSC_188);
		obj.modulation_type.value = 'QAM 64';
	} else if (obj.modulation_target.value == "QAM256 NTSC-A") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM256_NTSC_188_A).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM256A_NTSC_188);
		obj.modulation_type.value = 'QAM 256';
	} else if (obj.modulation_target.value == "QAM64 PAL-A") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM64_PAL_188_A).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM64A_PAL_188);
		obj.modulation_type.value = 'QAM 64';
	} else if (obj.modulation_target.value == "QAM256 PAL-A") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM256_PAL_188_A).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM256A_PAL_188);
		obj.modulation_type.value = 'QAM 256';
	} else if (obj.modulation_target.value == "QAM64 NTSC-B") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM64_NTSC_188_B).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM64B_NTSC_188);
		obj.modulation_type.value = 'QAM 64';
	} else if (obj.modulation_target.value == "QAM256 NTSC-B") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM256_NTSC_188_B).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM256B_NTSC_188);
		obj.modulation_type.value = 'QAM 256';
	} else if (obj.modulation_target.value == "QAM64 PAL-B") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM64_PAL_188_B).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM64B_PAL_188);
		obj.modulation_type.value = 'QAM 64';
	} else if (obj.modulation_target.value == "QAM256 PAL-B") {
		obj.constant_bit_rate.value = (CLOCK_RATE_QAM256_PAL_188_B).toFixed();
		obj.symbol_rate.value = (SYMBOL_RATE_QAM256B_PAL_188);
		obj.modulation_type.value = 'QAM 256';
	}
	obj.delivery_descriptor.value = "Cable";
	if (obj.modulation_target.value == "QPSK") {
		obj.delivery_descriptor.value = "Satellite";
	}
}

function showassign () {
	if (iptv_assign !== undefined) {
		// empty the assigment list
		document.getElementById('assigned_programs').options.length=0;
		// loop through the assigned array.
		for (var i=0; i < iptv_assign.length; i++) {
			var name = iptv_assign[i].source_port+","+iptv_assign[i].source_pn;
			//console.log(name);
			for (var j=0; j < document.getElementById('available_programs').options.length; j++ ) {
				if (name ==document.getElementById('available_programs').options[j].value) {
					document.getElementById('available_programs').options[j].selected=true;
				}
			}
		}
		// move the items.
		moveSelectedOptions(document.getElementById('available_programs'), document.getElementById('assigned_programs'));
	}
}

function TIptvAssignment(port, pn) {
	this.source_port = port;
	this.source_pn = pn;
	return this;
}

function hide_all() {
	document.getElementById('DVB').style.display = "none";
}

function show_activeTable() {
	hide_all();
	try {
		document.getElementById(document.getElementById("active_table").value).style.display = "";
	} catch (error) {}
}

function load() {
	showassign();
	show_activeTable();
}