
	// For clarifications on the below script, please contact shine_cs@ncs.com.sg
	// - - - Start - Configuration - Settings the Agency can modify - - - //
	// All values passed to GSA must be URL-encoded. eg. spaces must be replaced by char '+'
	var Search_Text_Box_Size = 37;
	var Server_URL = "http://sgms.internet.gov.sg/search";
	var Collections = "";
	var SiteSearchItems = "";
	var MetaDataFilters = "";
	//Specify the Website's Feedback URL here e.g http://www.mywebsite.gov.sg/feedback.htm
	//must begin with http://
	var paramFeedbackPageURL="http://sgms-web.internet.gov.sg/UIs/Feedback.aspx";
	//Specify the Website's Contact Info URL here e.g http://www.mywebsite.gov.sg/contact.htm
	// must begin with http://
	var paramContactInfoPageURL="http://sgms-web.internet.gov.sg/UIs/ContactInfo.aspx";
	// Specify additional Collection options using the following //
	Collections =
	[

	
	]
	// Specify within this site (ie. sitesearch) options using the following //
	// Only specify the website hosting this script
	SiteSearchItems =
	[
      ["EDB", "edb"],
      ["Whole of Government", ""]
	]
	// - - - End - Configuration - - - //
	function SetServerURL() 
	{
		var surl = document.getElementById('sitesearch');
		
		if (surl.checked)
		{
		document.SearchPlugInfrm.searchTerm.value = document.SearchPlugInfrm.q.value;
			document.SearchPlugInfrm.action = strSearchURL;
			document.SearchPlugInfrm.target = "";
		} else {
			document.SearchPlugInfrm.action = "http://sgms.internet.gov.sg/search";
			document.SearchPlugInfrm.target = "_blank";
		}
	}
	function SearchValidate() 
	{
		var searchText  = document.getElementById('q');
		if(searchText.value == '由此键入搜索内容') 
		{
		return false;
		}else{
		return true;
		}
	}

	function clearsearch() { 
		var searchtxt = document.getElementById("q");
		if (searchtxt.value == "由此键入搜索内容") { 
		searchtxt.setAttribute("class", "clearsearch");
		searchtxt.value = "";
		$('#q').css('color', '#000000');
		}
	}
	function inputsearch() { 
	
		var searchtxt = document.getElementById("q");
		if (searchtxt.value == "") { 
		searchtxt.setAttribute("class", "emptysearch");
		$('#q').css('color', '#999999');
		searchtxt.value = "由此键入搜索内容";
		}
	}
	
	function ShowResults()
	{

	document.writeln("<form method='GET'  name='SearchPlugInfrm' action='"+ strSearchURL + "' onSubmit='return SearchValidate(this);' style=\"margin:0px\">");
	



if(SiteSearchItems != "")
	{
	var param_ssearch_value = ""; //Do not remove
	document.writeln("<div class=\"searchby\" id=\"searchby\">");
	for (i = 0; i < SiteSearchItems.length; i++)
	{
	if(i == 0){
	 
	document.writeln("<table><tr><td><input type='radio' id='sitesearch' name='sitesearch' VALUE=" + SiteSearchItems[i][1] +" checked></td><td valign=\"middle\"><div style='font-size:11px; margin-top:4px; *margin-top:2px;'>" + SiteSearchItems[i][0] + "</div></td>");
	}
 else{
	document.writeln("<td><input type='radio' id='sitesearch' name='sitesearch' VALUE=" + SiteSearchItems[i][1] +"></td><td><div style='font-size:11px; margin-top:5px;'>所有政府网站</div></td></tr></table>");
	}
	
	//Do not remove
	param_ssearch_value += SiteSearchItems[i][0] + "#" + SiteSearchItems[i][1]
	+ "|";
	}
	//Do not remove
	document.writeln("<input type='hidden' name='filter_ss' value='" +
	param_ssearch_value + "' />");
	document.writeln("</div>");
	}

	
	 
	document.writeln("<div class=\"searchfield\"><input name=\"q\" type=\"text\" id=\"q\" size=\"33\" maxlength=\"100\" value=\"由此键入搜索内容\" onfocus=\"clearsearch();\" onblur=\"inputsearch();\" class=\"emptysearch\" /></div>")
	

	
	
	if (Collections != "")
	{
	var param_site_value = ""; //Do not remove

	document.writeln("<SELECT id='server' name='site'>");
	for (i = 0; i < Collections.length; i++)
	{
	document.writeln("<OPTION VALUE=" + Collections[i][1] +">" +
	Collections[i][0]);
	//Do not remove
	param_site_value += Collections[i][0] + "#" + Collections[i][1] + '|';
	}
	document.writeln("</SELECT>");
	//Do not remove
	document.writeln("<input type='hidden' name='filter_s' value='" +
	param_site_value + "' />");
	}
	else
	{
	//Do not remove
	document.writeln("<input type='hidden' name='site' value='default' />");
	}

	document.writeln("<div class=\"searchbutton\"><input type=\"image\" style=\"margin:0px;padding:0px;\" border=\"0\" src=\"/apps/edb/docroot/icons/"+ strLgnIcon +"common_btn_search.gif\" alt='' name=\"topsearch_but\" id=\"topsearch_but\" onclick='SetServerURL();' /></div>");
	
	
	document.writeln("<input type='hidden' value='" + paramFeedbackPageURL + "' name='feedback_url' />");
	document.writeln("<input type='hidden' value='" + paramContactInfoPageURL + "' name='contact_url' />");
	document.writeln("<input type='hidden' name='client' value='default' />");
	document.writeln("<input type='hidden' name='proxystylesheet' value='default' />");
	document.writeln("<input type='hidden' name='output' value='xml_no_dtd' />");
	document.writeln("<input type='hidden' name='searchTerm' value='' />");
	document.writeln("</form>");
	}
	function clearSelectedRadio(radioId)
	{
	var x=document.getElementsByName(radioId);
	for(i=0;i<x.length;i++){x[i].checked=false;}
	document.getElementById('btnG').focus();	
	}
