<div class="content_div_small content_div_width">
  <div class="table_tab_div">
    <div class="table_tab_left"></div>
    <div class="table_tab table_tab_width">AC-3描述符</div>
    <div class="table_tab_right"></div>
  </div>
  <table id="detail_edit_table">
    <tr>
      <th colspan="2">
        <input type="checkbox" id="descEnhanced" onclick="changeEnhance($(this));" />
      </th>
      <th colspan="4">加强型AC-3描述符</th>
    </tr>
    <tr>
      <th colspan="2">
        <input type="checkbox" id="descVersionFlag" onclick="changeVersion($(this));" />
      <th colspan="2">AC-3版本</th>
      <td colspan="2">
        <input type="text" id="descVersion" value="0" disabled="disabled" />
      </td>
    </tr>
    <tr>
      <th colspan="2">
        <input type="checkbox" id="mainIdFlag" onclick="changeMainId($(this));" />
      </th>
      <th colspan="2">主标识</th>
      <td colspan="4">
        <select id="mainId" disabled="disabled">
          <option value="0" selected="selected">0</option>
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="6">6</option>
          <option value="7">7</option>
        </select>
      </td>
    </tr>
    <tr>
      <th rowspan="2">
        <input type="checkbox" id="asvc" onclick="changeAsvc($(this));" />
        关联标识</th>
      <td colspan="2">子流7
        <input type="checkbox" id="bit7" disabled="disabled" />
      </td>
      <td>子流6
        <input type="checkbox" id="bit6" disabled="disabled" />
      </td>
      <td>子流5
        <input type="checkbox" id="bit5" disabled="disabled" />
      </td>
      <td>子流4
        <input type="checkbox" id="bit4" disabled="disabled" />
      </td>
    </tr>
    <tr>
      <td colspan="2">子流3
        <input type="checkbox" id="bit3" disabled="disabled" />
      </td>
      <td>子流2
        <input type="checkbox" id="bit2" disabled="disabled" />
      </td>
      <td>子流1
        <input type="checkbox" id="bit1" disabled="disabled" />
      </td>
      <td>子流0
        <input type="checkbox" id="bit0" disabled="disabled" />
      </td>
    </tr>
    <tr>
      <th rowspan="2">
        <input type="checkbox" id="descType" checked="checked" onclick="changeType($(this));" />
        AC-3类型</th>
      <th colspan="2">全业务</th>
      <th>业务类型</th>
      <th colspan="2">声道数标识</th>
    </tr>
    <tr>
      <td colspan="2">
        <input type="checkbox" id="fullService0" onclick="changeFullService($(this), 0);" />
      </td>
      <td>
        <select id="serviceType0" class="service">
          <option value="1" selected="selected">音效(ME)</option>
          <option value="2">视觉障碍的(VI)</option>
          <option value="3">听觉障碍的(HI)</option>
          <option value="4">对话(D)</option>
          <option value="5">评论(C)</option>
          <option value="7">画外音(VO)</option>
        </select>
      </td>
      <td colspan="2">
        <select id="soundTrack0" class="channel">
          <option value="0" selected="selected">单声道</option>
          <option value="1">1+1模式</option>
          <option value="2">双声道(立体声)</option>
          <option value="3">双声道杜比环绕声编码</option>
          <option value="4">多声道音频(多于多声道)</option>
        </select>
      </td>
    </tr>
    <tr>
      <th colspan="2">
        <input type="checkbox" id="mixInfo" disabled="disabled" />
      </th>
      <th colspan="4">混合信息标志</th>
    </tr>
    <tr>
      <th>子流</th>
      <th>混音</th>
      <th>全业务</th>
      <th>业务类型</th>
      <th colspan="2">声道数标识</th>      
    </tr>
    <tr>
      <th>
        <input type="checkbox" id="stream1" onclick="changeStream($(this), 0);" disabled="disabled" />
        1 </th>
      <td>
        <input type="checkbox" id="soundMix1" disabled="disabled" />
      </td>
      <td>
        <input type="checkbox" id="fullService1" onclick="changeFullService($(this), 1);" disabled="disabled" />
      </td>
      <td>
        <select id="serviceType1" disabled="disabled">
          <option value="1" selected="selected">音效(ME)</option>
          <option value="2">视觉障碍的(VI)</option>
          <option value="3">听觉障碍的(HI)</option>
          <option value="4">对话(D)</option>
          <option value="5">评论(C)</option>
          <option value="7">画外音(VO)</option>
        </select>
      </td>
      <td colspan="2">
        <select id="soundTrack1" disabled="disabled">
          <option value="0" selected="selected">单声道</option>
          <option value="1">1+1模式</option>
          <option value="2">双声道(立体声)</option>
          <option value="3">双声道杜比环绕声编码</option>
          <option value="4">多声道音频(多于多声道)</option>
        </select>
      </td>
    </tr>
    <tr>
      <th>
        <input type="checkbox" id="stream2" onclick="changeStream($(this), 1);" disabled="disabled" />
        2 </th>
      <td>
        <input type="checkbox" id="soundMix2" disabled="disabled" />
      </td>
      <td>
        <input type="checkbox" id="fullService2" onclick="changeFullService($(this), 2);" disabled="disabled" />
      </td>
      <td>
        <select id="serviceType2" disabled="disabled">
          <option value="1" selected="selected">音效(ME)</option>
          <option value="2">视觉障碍的(VI)</option>
          <option value="3">听觉障碍的(HI)</option>
          <option value="4">对话(D)</option>
          <option value="5">评论(C)</option>
          <option value="7">画外音(VO)</option>
        </select>
      </td>
      <td colspan="2">
        <select id="soundTrack2" disabled="disabled">
          <option value="0" selected="selected">单声道</option>
          <option value="1">1+1模式</option>
          <option value="2">双声道(立体声)</option>
          <option value="3">双声道杜比环绕声编码</option>
          <option value="4">多声道音频(多于多声道)</option>
        </select>
      </td>
    </tr>
    <tr>
      <th>
        <input type="checkbox" id="stream3" onclick="changeStream($(this), 2);" disabled="disabled" />
        3 </th>
      <td>
        <input type="checkbox" id="soundMix3" disabled="disabled" />
      </td>
      <td>
        <input type="checkbox" id="fullService3" onclick="changeFullService($(this), 3);" disabled="disabled" />
      </td>
      <td>
        <select id="serviceType3" disabled="disabled">
          <option value="1" selected="selected">音效(ME)</option>
          <option value="2">视觉障碍的(VI)</option>
          <option value="3">听觉障碍的(HI)</option>
          <option value="4">对话(D)</option>
          <option value="5">评论(C)</option>
          <option value="7">画外音(VO)</option>
        </select>
      </td>
      <td colspan="2">
        <select id="soundTrack3" disabled="disabled">
          <option value="0" selected="selected">单声道</option>
          <option value="1">1+1模式</option>
          <option value="2">双声道(立体声)</option>
          <option value="3">双声道杜比环绕声编码</option>
          <option value="4">多声道音频(多于多声道)</option>
        </select>
      </td>
    </tr>
    <tr>
      <th>附加信息</th>
      <td colspan="5">
        <textarea id="addInfo" class="addInfo"></textarea>
      </td>
    </tr>
  </table>
  <div class="bottom_button_div">
    <input type="button" id="descApplyBtn" value="确 定" class="input_normal" onclick="descPageApply();" />
    <input type="button" id="descCancelBtn" value="取 消" class="input_normal" onclick="cancelEdit();" />
  </div>
</div>
<style type="text/css">
#simplemodal-container 
{
	width: 650px;
}
.content_div_width
{
	width: 630px;
}
.content_div_width .table_tab_width
{
	width: 610px;
}
.channel
{
	width: 215px;
}
.service
{
	width: 150px;
}
.addInfo
{
	width: 99%;
	height: 25px;	
}
</style>
<script>
var STREAM_NUM = 3;
function changeEnhance(obj)
{
	var length;
	
	if(obj.prop("checked") == true)
	{
		for(var i = 0; i < STREAM_NUM; i++)
		{
			$("#" + enhanceObjIdArray[0][i + 5]).attr("disabled", false);
			changeStream($("#" + enhanceObjIdArray[0][i + 5]), i);
		}
		$("#" + enhanceObjIdArray[0][4]).attr("disabled", false);
		descTag = 122;
	}
	else
	{
		for(var i = 0; i < STREAM_NUM; i++)
		{
			$("#" + enhanceObjIdArray[0][i + 5]).attr("disabled", true);
			length = $("#" + enhanceObjIdArray[i + 3]).length;
			for(var j = 0; j < length; j++)
			{
				$("#" + enhanceObjIdArray[i + 3][j]).attr("disabled", true);
			}
		}
		$("#" + enhanceObjIdArray[0][4]).attr("disabled", true);
		descTag = 106;
	}
}

function changeVersion(obj)
{
	if(obj.prop("checked") == true)
	{
		$("#descVersion").attr("disabled", false);
	}
	else
	{
		$("#descVersion").attr("disabled", true);
	}
}

function changeMainId(obj)
{
	if(obj.prop("checked") == true)
	{
		$("#mainId").attr("disabled", false);
	}
	else
	{
		$("#mainId").attr("disabled", true);
	}
}

function changeAsvc(obj)
{
	var length = asvcIdArray.length;
	if(obj.prop("checked") == true)
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + asvcIdArray[i]).attr("disabled", false);
		}
	}
	else
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + asvcIdArray[i]).attr("disabled", true);
		}
	}
}

function changeType(obj)
{
	var length = typeIdArray.length;
	if(obj.prop("checked") == true)
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + typeIdArray[i]).attr("disabled", false);
		}
	}
	else
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + typeIdArray[i]).attr("disabled", true);
		}
	}
}

function changeStream(obj, index)
{
	var length = enhanceObjIdArray[index + 3].length;
	
	if(obj.prop("checked") == true)
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + enhanceObjIdArray[index + 3][i]).attr("disabled", false);
		}
	}
	else
	{
		for(var i = 0; i < length; i++)
		{
			$("#" + enhanceObjIdArray[index + 3][i]).attr("disabled", true);
		}
	}
}

function changeFullService(obj, index)
{
	var service = $("#serviceType" + index);
	service.empty();
	if(obj.prop("checked") == true)
	{
		if(language == ENGLISH)
		{
			service.append("<option value='0'>Complete Main (CM)</option>");
			service.append("<option value='2'>Visually Impaired (VI)</option>");
			service.append("<option value='3'>Hearing Impaired (HI)</option>");
			service.append("<option value='5'>Commentary (C)</option>");
			service.append("<option value='6'>Emergency (E)</option>");
			service.append("<option value='7'>Karaoke</option>");
		}
		else
		{
			service.append("<option value='0'>完全重要的(CM)</option>");
			service.append("<option value='2'>视觉障碍的(VI)</option>");
			service.append("<option value='3'>听觉障碍的(HI)</option>");
			service.append("<option value='5'>评论(C)</option>");
			service.append("<option value='6'>紧急(E)</option>");
			service.append("<option value='7'>卡拉OK(单声道和“1+1”禁止)</option>");
		}
	}
	else
	{
		if(language == ENGLISH)
		{
			service.append("<option value='1'>Music and Effects (ME)</option>");
			service.append("<option value='2'>Visually Impaired (VI)</option>");
			service.append("<option value='3'>Hearing Impaired (HI)</option>");
			service.append("<option value='4'>Dialogue (D)</option>");
			service.append("<option value='5'>Commentary (C)</option>");
			service.append("<option value='7'>Voiceover (VO)</option>");
		}
		else
		{
			service.append("<option value='1'>音效(ME)</option>");
			service.append("<option value='2'>视觉障碍的(VI)</option>");
			service.append("<option value='3'>听觉障碍的(HI)</option>");
			service.append("<option value='4'>对话(D)</option>");
			service.append("<option value='5'>评论(C)</option>");
			service.append("<option value='7'>画外音(VO)</option>");
		}
	}
}

var SEC_NUM_NORMAL = 4;
var SEC_NUM_ENHANCE = 7;
var normalInfoIdArray = ["descType", "descVersionFlag", "mainIdFlag", "asvc", "descVersion", "mainId"];
var enhanceInfoIdArray = ["descType", "descVersionFlag", "mainIdFlag", "asvc", "mixInfo", "stream1", "stream2", "stream3", "descVersion", "mainId"];
var asvcIdArray = ["bit7", "bit6", "bit5", "bit4", "bit3", "bit2", "bit1", "bit0"];
var typeIdArray = ["fullService0", "serviceType0", "soundTrack0"]
var stream1IdArray = ["soundMix1", "fullService1", "serviceType1", "soundTrack1"];
var stream2IdArray = ["soundMix2", "fullService2", "serviceType2", "soundTrack2"];
var stream3IdArray = ["soundMix3", "fullService3", "serviceType3", "soundTrack3"];
var addIdArray = ["addInfo"];
var normalObjIdArray = [normalInfoIdArray, asvcIdArray, typeIdArray, addIdArray];
var enhanceObjIdArray = [enhanceInfoIdArray, asvcIdArray, typeIdArray, stream1IdArray, stream2IdArray, stream3IdArray, addIdArray];
</script>