var url = window.location.href;
var intPos = url.indexOf("="); 
var slotno= url.substr(intPos + 1);
var OFF = 0;
var ON = 1;
var CC = 1;
var TT = 2;
var I = 0;
function funcUpdateDisplay() 
{	
	if(VID_HDENC_SYS_STANDARD == 1)
	{
		$("#EncMode").css("display","none");
		$("#VideoLevelMode").css("display","none");
		$("#VideSwitchMode").css("display","none");
		$("#ChormMode").css("display","none");
		$("#HdencEncMode").attr("disabled",true);
		$("#HdencVideoLevel").attr("disabled",true);
		$("#HdencVideoOnOff").attr("disabled",true);
		$("#HdencChromaSampling").attr("disabled",true);
		
		$("#mepg2_audio").css("display","none");
		$("#HdencMp2AudioOnOff").attr("disabled",true);
		$("#HdencMp2AudioRate").attr("disabled",true);
		$("#HdencMp2AudioSel").attr("disabled",true);
		$("#HdencMp2SampRate").attr("disabled",true);
		$("#HdencMp2Group").attr("disabled",true);
		$("#HdencMp2Pair").attr("disabled",true);
		
		$("#providermode").css("display","none");
		$("#HdencServiceProvider").attr("disabled",true);
		$("#AudioPidMode").css("display","none");
		$("#HdencMp2AudioPID").attr("disabled",true);
		
		$("#CCMode").css("display","none");	
		$("#HdencCCMode").attr("disabled",true);		
		$("#TTSwitchMode").css("display","none");
		$("#HdencTTOnOff").attr("disabled",true);	
		$("#TTPid").css("display","none");
		$("#HdencTTPID").attr("disabled",true);
		
		$("#AFDSwitchMode").css("display","");	
		$("#AFDLineMode").css("display","");	
		$("#HdencAFDOnOff").val(VID_HDENC_AFD_ONOFF);
		$("#HdencAFDLine").val(VID_HDENC_AFD_LINE);
		$("#mepg2_video").css("height", "100px");
		$("#div_mpeg2_ts").css("height", "125px");		
	}
	else
	{
		$("#mepg2_audio").css("display","");
		$("#HdencMp2AudioOnOff").val(VID_HDENC_MPEG2_AUDIO_SWITCH);
		$("#HdencMp2AudioRate").val(VID_HDENC_AUDIO_RATE);
		$("#HdencMp2AudioSel").val(VID_HDENC_AUDIO_SELECT);
		$("#HdencMp2SampRate").val(VID_HDENC_AUDIO_SAMP_RATE);
		$("#HdencMp2Group").val(VID_HDENC_MPEG_GROUP);
		$("#HdencMp2Pair").val(VID_HDENC_MPEG_PAIR);
		
		$("#providermode").css("display","");
		$("#HdencServiceProvider").val(VID_HDENC_SERVPROVIDER);
		$("#AudioPidMode").css("display","");
		$("#HdencMp2AudioPID").val(VID_HDENC_AUDIOPID);
		
		$("#CCMode").css("display","");	
		$("#HdencCCMode").val(VID_HDENC_CC_MODE);
		$("#TTSwitchMode").css("display","");	
		$("#TTPid").css("display","");
		$("#HdencTTOnOff").val(VID_HDENC_TT_ONOFF);
		$("#HdencTTPID").val(VID_HDENC_TT_PID);
		
		$("#AFDSwitchMode").css("display","none");	
		$("#AFDLineMode").css("display","none");
		$("#HdencAFDOnOff").attr("disabled",true);
		$("#HdencAFDLine").attr("disabled",true);		
	}
	$("#HdencEncMode").val(VID_HDENC_ENC_MODE);
	if(parseInt($("#HdencEncMode").val(),10)==1)
	{
		$("#HdencGopSize").attr("disabled",false);
	}
	else
	{
		$("#HdencGopSize").attr("disabled",true);	
	}
	$("#HdencChromaSampling").val(VID_HDENC_CHROMA_SAMPLING);
	$("#HdencVideoOnOff").val(VID_HDENC_VIDEO_ONOFF);
	$("#HdencVideoLevel").val(VID_HDENC_VIDEO_LEVEL);		
	$("#HdencVideoRate").val(VID_HDENC_VIDEORATE);
	$("#HdencAspectRatio").val(VID_HDENC_ASPECT_RATIO);
	$("#HdencGopStruct").val(VID_HDENC_GOPSTRUCT);
	$("#HdencGopSize").val(VID_HDENC_GOPSIZE);
	$("#HdencVideoSel").val(VID_HDENC_VIDEO_SEL);
	$("#HdencVideoInputInfo").val(VID_HDENC_VIDEO_INPUT_INFO);
	
	$("#HdencPmtPID").val(VID_HDENC_PMTPID);
	$("#HdencPcrPID").val(VID_HDENC_PCRPID);
	$("#HdencVideoPID").val(VID_HDENC_VIDEOPID);
	
	$("#HdencAc3AudioPID").val(VID_HDENC_AC3_PID);
	$("#HdencAc3AudioPID2").val(VID_HDENC_AC3_2_PID);
	$("#HdencDolby51PID").val(VID_HDENC_DB51_PID);
	$("#HdencServiceName").val(VID_HDENC_SERVNAME);
	
	$("#HdencCCOnOff").val(VID_HDENC_CC_ONOFF);	
	$("#HdencCCDelay").val(VID_HDENC_CC_DELAY);	
	$("#curslot").val(slotno);
}
function jump(id)
{
	if(id==1)
	{
		window.location.href="hdenccard.asp?slotno="+slotno;
	}
	else
	{
		window.location.href="c101H_port1.asp?slotno="+slotno;
	}
}
function jumpgroup(id)
{
	if(id==1)
	{
		window.location.href="c101H_port1.asp?slotno="+slotno;
	}
	else if(id==2)
	{
		window.location.href="c101H_port2.asp?slotno="+slotno;
	}
	else
	{
		window.location.href="c101H_port3.asp?slotno="+slotno;
	}
}

function changeSwitchValue(param, obj)
{
	if(obj.val() == ON)
	{
		if(param == CC)
		{
			$("#HdencTTOnOff").val(OFF);
		}
		else if(param == TT)
		{
			$("#HdencCCOnOff").val(OFF);
		}
	}
}

function changelist()
{
	if(parseInt($("#HdencEncMode").val(),10)==1)
	{
		$("#HdencGopSize").val(12);
		$("#HdencGopSize").attr("disabled",false);
	}
	else
	{
		$("#HdencGopSize").attr("disabled",true);	
	}
}

function displayPrompt(obj)
{
	if(parseInt(obj.val(), 10) == I)
	{
		if(language == 1)
		{
			alert("切换为选项”I“时，请注意修改对应的<视频码率 (bps)>！");		
		}
		else
		{
			alert('Make sure to modify the corresponding <video bitrate (bps)> when GOP structure is set to "I"!');	
		}
		
	}
}