//=======================================================
function forHtmlSpecialChars(str){ //将HTML中的特殊字符替换成代码
   str=strReplace(str,"&","&amp;");
   str=strReplace(str,'"',"&quot;");
   str=strReplace(str,"<","&lt;");
   str=strReplace(str,">","&gt;");
   str=strReplace(str,"%20"," ");
   return str;
}
//=================================================================
function strReplace(str,str1,str2){ //将str中的所有str1替换城str2
   while(str.search(str1)>-1)
      str=str.replace(str1,str2);
   return str;
} 
//=========================================
function pageHeader(targetUrl)
{
	selector=document.getElementById('pager');
	targetUrl+=selector.value;
	location.href=targetUrl;
}
function showSubInfo()
{
	X=document.getElementById("subTitle");
	if(document.getElementById('SubInfo').style.display=="none")
	{
		document.getElementById('SubInfo').style.display="block";
		document.getElementById('listControl').innerHTML="Hide ";
		document.getElementById('subContentDisplay').style.display="block";
	}
	else
	{
		document.getElementById('SubInfo').style.display="none";
		X.innerHTML="Tools";
		document.getElementById('listControl').innerHTML="Show Tools";
		document.getElementById('subContentDisplay').style.display="none";
	}
}

function createHttpRequest()
{
	if(window.ActiveXObject)
	{
		try {
				return new ActiveXObject("Msxml2.XMLHTTP") ;
			} catch (e) {
				try {
					return new ActiveXObject("Microsoft.XMLHTTP") ;
				} catch (e2) {
					return null ;
	 			}
	 		}
	}
	else if(window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	}
	else
	{
		return null;
	}

}
//=============================
var oldSubContentName="";
//=============================
function checkNewsDate(form)
{
	var month=form.month.value;
	var day=form.day.value;
	if(form.year.value>2050|form.year.value<1980)
	{
		alert("Incorrect Year");
		return;
	}
	if(form.month.value>12|form.month.value<1)
	{
		alert("Incorrect Month");
		return;
	}
	if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&(day>31||day<1))
	{
		alert("Incorrect Day");
		return;
	}
	if((month==4||month==6||month==9||month==11)&&(day>30||day<1))
	{
		alert("Incorrect Day");
		return;
	}
	if(month==2&&(day>29||day<1))
	{
		alert("Incorrect Day");
		return;
	}
	if(form.hour.value>24||form.hour.value<0)
	{
		alert('Incorrect Hour');
		return;
	}
	if(form.minute.value>60||form.minute.value<0)
	{
		alert('Incorrect minute');
		return;
	}
	if(form.second.value>60||form.second.value<0)
	{
		alert('Incorrect second');
		return;
	}
	form.submit();
}