String.prototype.ReplaceAll = function(AFindText,ARepText)
{
	var raRegExp = new RegExp(AFindText,"g")
	try{
	var res = this.replace(raRegExp,ARepText);
	return res;
	}catch(e){return "";}
}
function search()
{
	var s_keyword = document.searchform.s_keyword.value;
	document.searchform.keyword.value = encodeURIComponent(s_keyword);
	document.searchform.submit();
}
function chn_search()
{
	var s_keyword = document.searchform.s_keyword.value;
	var s_where = document.searchform.s_where.value;
	
	if(s_where == "NODESEARCHNAME=国防视频" || s_where == "NODESEARCHNAME=國防視頻" || s_where == "NODESEARCHNAME=Video")
	{
		s_where = "";
		document.searchform.action = document.searchform.action.ReplaceAll("sitesearch","videosearch");
		document.searchform.action = document.searchform.action.ReplaceAll("picsearch","videosearch");
	}

	if(s_where == "NODESEARCHNAME=军事图片" ||s_where == "NODESEARCHNAME=軍事圖片" || s_where == "NODESEARCHNAME=Photos")
	{
		s_where = "";
		document.searchform.action = document.searchform.action.ReplaceAll("sitesearch","picsearch");
		document.searchform.action = document.searchform.action.ReplaceAll("videosearch","picsearch");
	}
	document.searchform.keyword.value = encodeURIComponent(s_keyword);
	document.searchform.where.value = encodeURIComponent(s_where);
	//分析是否为繁体字检索，如果是则进行替换
	var docurl = window.location.href;
	if(docurl.indexOf("big5")!=-1)
	{
		document.searchform.action = document.searchform.action.ReplaceAll("search.jsp","search_big5.jsp");
	}
	//提交当前的表单
	document.searchform.submit();
}
function eng_search()
{
	var s_keyword = document.searchform.s_keyword.value;
	var s_where_ele = document.searchform.s_where;
	var s_where = s_where_ele.options[s_where_ele.selectedIndex].value+"";
	
	if(s_where == "NODESEARCHNAME=国防视频" || s_where == "NODESEARCHNAME=國防視頻" || s_where == "NODESEARCHNAME=Video")
	{
		s_where = "";
		document.searchform.action = document.searchform.action.ReplaceAll("sitesearch","videosearch");
		document.searchform.action = document.searchform.action.ReplaceAll("picsearch","videosearch");
	}

	if(s_where == "NODESEARCHNAME=军事图片" ||s_where == "NODESEARCHNAME=軍事圖片" || s_where == "NODESEARCHNAME=Photos")
	{
		s_where = "";
		document.searchform.action = document.searchform.action.ReplaceAll("sitesearch","picsearch");
		document.searchform.action = document.searchform.action.ReplaceAll("videosearch","picsearch");
	}
	
	document.searchform.keyword.value = encodeURIComponent(s_keyword);
	document.searchform.where.value = encodeURIComponent(s_where);
	//分析是否为繁体字检索，如果是则进行替换
	var docurl = window.location.href;
	if(docurl.indexOf("big5")!=-1)
	{
		document.searchform.action = document.searchform.action.ReplaceAll("search.jsp","search_big5.jsp");
	}
	//提交当前的表单
	document.searchform.submit();
}
