// JavaScript Document
function SubmitForm() 
{
  document.WizardForm.submit();
}
 
function exposure_hz(hz)
{
	if (hz==50)
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 0;		
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 1;			
	} 
	else 
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 1;		
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 0;			
	}	
}
 
function exposure_auto_enable(exposure_auto)
{
}
 
function sensor_fps_change(fps)
{
    var form = document.WizardForm
	if (fps==25)
	{
        form.CamInfo_Sensor_Resolution.value = "1920x1080";
	}
	else
	{
        form.CamInfo_Sensor_Resolution.value = "1280x720";
	}
 
    if (document.getElementById('CamInfo_Exposure_Auto_id').value == 8)
    {
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 1;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 1;
        return 0;
    }
 
	if (fps==25)
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 0;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 1;
	}
	else
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 1;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 0;
	}
}
 
function std_change(std)
{
    var form = document.WizardForm
 
    if (std==0)
    {
        document.getElementById('CamInfo_Resolution_id_1').disabled = 0;
        document.getElementById('CamInfo_Resolution_id_2').disabled = 1;
        form.CamInfo_Sensor_Fps.value = 25;
        sensor_fps_change(25);
    }
    else
    {
        document.getElementById('CamInfo_Resolution_id_1').disabled = 1;
        document.getElementById('CamInfo_Resolution_id_2').disabled = 0;
        form.CamInfo_Sensor_Fps.value = 50;
        sensor_fps_change(50);
    }
}
 
function wdr_change(wdr)
{
    if (wdr==0)
    {
        document.getElementById('CamInfo_Gamma_id').disabled = 1;
        document.getElementById('CamInfo_Gamma_id').disabled = 0;
    }
    else
    {
        document.getElementById('CamInfo_Gamma_id').disabled = 0;
        document.getElementById('CamInfo_Gamma_id').disabled = 1;
    }
}
 
function sensor_resolution_change(resolution)
{
    var form = document.WizardForm
 
	if (resolution=="1920x1080")
	{
        form.CamInfo_Sensor_Fps.value = 25;
	}
	else
	{
        form.CamInfo_Sensor_Fps.value = 50;
	}
 
    if (document.getElementById('CamInfo_Exposure_Auto_id').value == 8)
    {
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 1;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 1;
        return 0;
    }
 
	if (resolution=="1920x1080")
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 0;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 1;
	}
	else
	{
		document.getElementById('CamInfo_Exposure_Time_id_1').disabled = 1;
		document.getElementById('CamInfo_Exposure_Time_id_3').disabled = 0;
	}
}
 
function checkosdinfo()
{
	var form = document.WizardForm;
	if(document.getElementById("id_osdinfo").value.length > 12 )
	{
		alert("osdinfo长度应该小于或等于12个字符。");
		return 0;
	}
	if (IntegerCheck(form.IPCamOSDPosX.value,0,1920) == 0) {
		alert('请输入0-1920之间的值作为OSD起始点的X坐标')
		form.IPCamOSDPosX.focus();/*hrt modify, 2007-9-26*/
		form.IPCamOSDPosX.select();
		return 0;
	}
	if (IntegerCheck(form.IPCamOSDPosY.value,0,1080) == 0) {
		alert('请输入0-1080之间的值作为OSD起始点的Y坐标')
		form.IPCamOSDPosY.focus();/*hrt modify, 2007-9-26*/
		form.IPCamOSDPosY.select();
		return 0;
	}
	return 1;
}
/*
function check_disable(value)
{
	if(!document.getElementById("id_NVEnable").checked)  {

		//document.getElementById("id_NVLevel").disabled = 1;
	}else{
		//document.getElementById("id_NVLevel").disabled = 0;
	}
}*/
 
function CheckBoxClicked(theForm, theCheckBox, theVariable, theCheckValueEnable, theCheckValueDisable)
{
  if (theCheckBox.checked)
    theForm.elements[theVariable].value = theCheckValueEnable
  else
    theForm.elements[theVariable].value = theCheckValueDisable
}
 
function checkbounds(inputValue,maxValue,minValue)
{
 if(inputValue > maxValue)
   {
      inputValue = maxValue  
   } 
  if(inputValue < minValue)
   {
      inputValue = minValue  
   } 
   return inputValue
}
 
function IntegerCheck(value, low, high)
{
  if (value.length == 0)
    return 0
 
  if (((value.charAt(0)<'0') || (value.charAt(0)>'9')) && value.charAt(0) != '-')
    return 0
 
  for (var i=1; i<value.length; i++) {
    if ((value.charAt(i)<'0') || (value.charAt(i)>'9'))
      return 0
  }
  var integerValue = parseInt(value, 10)
  if ((integerValue<low) || (integerValue>high))
    return 0
 
  return 1
}
/*
function On_Stream_Duration_Enable_change()
{
   var form = document.WizardForm
   if(!document.getElementById("Stream_Duration_Enable_alian").checked)
  {
  	form.Stream_Duration.disabled = 1;
  	form.Stream_Duration_Unit.disabled = 1;
  }
  else
  {
  	form.Stream_Duration.disabled = 0;
  	form.Stream_Duration_Unit.disabled = 0;
  }
}
 
function On_Stream_FPS_Enable_change()
{
	  var form = document.WizardForm
	   if(!document.getElementById("Stream_FPS_Enable_alian").checked)
	  {
	  	form.Stream_FPS.disabled = 1;
	  }
	  else
	  {
	  	form.Stream_FPS.disabled = 0;
	  }
}
*/
function onLoad()
{
  var form = document.WizardForm
}
function saveData()
{
  var form = document.WizardForm;
  form.submit()
}
 
function defaultData()
{
  var form = document.WizardForm
}