//====================================================================
//     File Name:		ChangeFormStatus.js
//     Author:			Hao Jun
//     Created:			2002.5
//     Version:			0.1
//     Purpose:			根据用户的选择动态显示文字查询条件项目的方法
//     Functionality:	
//	   remark:			
//	   LastChange:		2002.10.18 15:00
//====================================================================

var landsatCount = 0;
var spotCount	 = 0;
var anotherCount = 0;

// LANDSAT卫星被选取
function clickLandsat(aObj)
{
	if (true == aObj.checked)
	{
		landsatCount++;
	}
	else
	{
		landsatCount--;
	}
//	alert("clickLandsat\n" + "LANDSAT: " + landsatCount + "\nSPOT: " + spotCount + "\nANOTHER: " + anotherCount);
	
	changeSatelliteCheckboxs();	
	return true;
}

// SPOT卫星被选取
function clickSpot(aObj)
{
	if (true == aObj.checked)
	{
		spotCount++;
	}
	else
	{
		spotCount--;
	}

	changeSatelliteCheckboxs();	
	return true;
}

// 其它卫星被选取
function clickAnother(aObj)
{
	if (true == aObj.checked)
	{
		anotherCount++;
	}
	else
	{
		anotherCount--;
	}
	
	changeSatelliteCheckboxs();	
	return true;
}

// 按卫星被选取状态改变向用户提供的表单状态
function changeSatelliteCheckboxs()
{
	// 附加查询条件部分
	document.getElementById("Spot12").style.display = "none";
	document.getElementById("Spot4").style.display = "none";
	document.getElementById("RadaSate").style.display = "none";
        
	document.getElementById("Spot5").style.display = "none";
  document.getElementById("P6").style.display = "none";
  document.getElementById("ENV1").style.display = "none";     
   document.getElementById("THEOS1").style.display = "none";     
       // 显示Spot-1/2卫星附加查询条件
	if (((true == document.QueryCondition.Satellite[1].checked) ||
		 (true == document.QueryCondition.Satellite[7].checked)) && 
		 (0 < spotCount))
	{
		document.getElementById("Spot12").style.display = "block";
	}
	else
	{
		document.getElementById("Spot12").style.display = "none";
	}
	
	// 显示Spot-4卫星附加查询条件
	if ((true == document.QueryCondition.Satellite[11].checked) && (0 < spotCount))
	{
		document.getElementById("Spot4").style.display = "block";
	} 	else
	{
		document.getElementById("Spot4").style.display = "none";
	} 	// 显示Spot-5卫星附加查询条件
	if ((true == document.QueryCondition.Satellite[12].checked) && (0 < spotCount))
	{	document.getElementById("Spot5").style.display = "block";
	}
	
	else
	{
		document.getElementById("Spot5").style.display = "none";
	}
	
	
	if ((true == document.QueryCondition.Satellite[14].checked) && (0 < anotherCount))
	{
		document.getElementById("P6").style.display = "block";
	}
	else
	{
		document.getElementById("P6").style.display = "none";
	}
	
	if((true == document.QueryCondition.Satellite[13].checked) &&(0<anotherCount))
	{
		document.getElementById("ENV1").style.display = "block";
	}
  else
  {
  	document.getElementById("ENV1").style.display = "none";
  }
	// 显示雷达卫星附加查询条件
	if (((true == document.QueryCondition.Satellite[3].checked) ||
		 (true == document.QueryCondition.Satellite[9].checked) ||
		 (true == document.QueryCondition.Satellite[2].checked) ||
		 (true == document.QueryCondition.Satellite[8].checked)) && 
		 (0 < anotherCount))
	{
		document.getElementById("RadaSate").style.display = "block";
	}
	else
	{
		document.getElementById("RadaSate").style.display = "none";
	}
	
		if ((true == document.QueryCondition.Satellite[15].checked) && (0 < anotherCount))
	{
		document.getElementById("THEOS1").style.display = "block";
	}
	else
	{
		document.getElementById("THEOS1").style.display = "none";
	}
}// changeSatelliteCheckboxs()

function resumeSatelliteCheckboxs()
{
	landsatCount = 0;
	spotCount	 = 0;
	anotherCount = 0;

	if (true == document.QueryCondition.Satellite[0].checked)
		landsatCount++;
	if (true == document.QueryCondition.Satellite[6].checked)
		landsatCount++;

	if (true == document.QueryCondition.Satellite[1].checked)
		spotCount++;
	if (true == document.QueryCondition.Satellite[7].checked)
		spotCount++;
	if (true == document.QueryCondition.Satellite[11].checked)
		spotCount++;

	if (true == document.QueryCondition.Satellite[2].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[3].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[4].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[5].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[8].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[9].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[10].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[12].checked)
		spotCount++;
	if (true == document.QueryCondition.Satellite[14].checked)
		anotherCount++;
	if (true == document.QueryCondition.Satellite[13].checked)
		anotherCount++;
	
	// 切换空间限定方式
	if (true == document.QueryCondition.AreaLimitMode[0].checked)
	{
		document.getElementById("LonLatAreaTable").style.display = "block";
		document.getElementById("GeoGridSysAreaTable").style.display = "none";
		document.getElementById("AdminAreaTable").style.display = "none";
	}
	else if (true == document.QueryCondition.AreaLimitMode[1].checked)
	{
		document.getElementById("LonLatAreaTable").style.display = "none";
		document.getElementById("GeoGridSysAreaTable").style.display = "block";
		document.getElementById("AdminAreaTable").style.display = "none";
	}
	else if (true == document.QueryCondition.AreaLimitMode[2].checked)
	{
		document.getElementById("LonLatAreaTable").style.display = "none";
		document.getElementById("GeoGridSysAreaTable").style.display = "none";
		document.getElementById("AdminAreaTable").style.display = "block";
	}
	
	// 切换图像云量的限定方式
	if (true == document.QueryCondition.CloudLimitMode[0].checked)
	// 四角云量
	{
		document.getElementById("FourCornerCloudTable").style.display = "block";
		document.getElementById("AverageCloudTable").style.display = "none";
	}
	else if (true == document.QueryCondition.CloudLimitMode[1].checked)
	// 平均云量
	{
		document.getElementById("FourCornerCloudTable").style.display = "none";
		document.getElementById("AverageCloudTable").style.display = "block";
	}
	
	// 切换空间范围三种方式
	changeSatelliteCheckboxs();
	
}// resumeSatelliteCheckboxs()

// 切换三种空间限定方式的方法
function switchAreaLimitMode(aObj)
{
	if ("LonLatArea" == aObj.id)
	{
		document.getElementById("LonLatAreaTable").style.display = "block";
		document.getElementById("GeoGridSysAreaTable").style.display = "none";
		document.getElementById("AdminAreaTable").style.display = "none";
	}
	else if ("GeoGridSysArea" == aObj.id)
	{
		document.getElementById("LonLatAreaTable").style.display = "none";
		document.getElementById("GeoGridSysAreaTable").style.display = "block";
		document.getElementById("AdminAreaTable").style.display = "none";
	}
	else if ("AdminArea" == aObj.id)
	{
		document.getElementById("LonLatAreaTable").style.display = "none";
		document.getElementById("GeoGridSysAreaTable").style.display = "none";
		document.getElementById("AdminAreaTable").style.display = "block";
	}
}

// 切换图像云量限定方式的方法
function switchCloudLimitMode(aObj)
{
	if ("FourCornerCloud" == aObj.id)
	// 四角云量
	{
		document.getElementById("FourCornerCloudTable").style.display = "block";
		document.getElementById("AverageCloudTable").style.display = "none";
	}
	else if ("AverageCloud" == aObj.id)
	// 平均云量
	{
		document.getElementById("FourCornerCloudTable").style.display = "none";
		document.getElementById("AverageCloudTable").style.display = "block";
	}
}

