//*************************************************************************************************
//
// File Name: FormulateCSE.js
// Author: An Dang (FMS)
// Created: 05/23/08
// Main function: Formulate queries for Google CSE.
//
//*************************************************************************************************

<!--

function KickIn()
{
var lVal = document.title;
var lQry;
var lParam = "&as_qdr=y&num=" + document.search.num.value + "&lr=" + document.search.lr.value + "&as_filetype=" + document.search.as_filetype.value;

lParam = lParam + "&as_sitesearch=fms.treas.gov" + document.search.as_sitesearch.value

if ((document.search.CiUserParam1.value != null) || (document.search.CiUserParam1.value != '')) {
lQry = document.search.CiUserParam1.value;}

if ((document.search.CiUserParam2.value != null) && (document.search.CiUserParam2.value != '')){
lQry = lQry  + ' "' + document.search.CiUserParam2.value + '"'; }

if ((document.search.CiUserParam3.value != null) && (document.search.CiUserParam3.value != '')){
lQry = lQry  + document.search.CiUserParam3.value.replace(/ /g,' or '); }

if ((document.search.CiUserParam4.value != null) && (document.search.CiUserParam4.value != '')){
lQry = lQry  + ' -' + document.search.CiUserParam4.value.replace(/ /g,' -'); }

if (lQry != ""){
	window.location = '/results.html?cx=014540195463098743471:a6dxixgppgu&cof=FORID%3A11&q=' + lQry + lParam;
}
else
{
	alert("Please enter a search term, it cannot be blank or empty characters.");
}
return false;

}

function validate1() {
    document.getElementById("CiUserParam1").value=filterNum(document.getElementById("CiUserParam1").value);

    function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          return str.replace(re, "");
	}
}

function validate2() {
    document.getElementById("CiUserParam2").value=filterNum(document.getElementById("CiUserParam2").value);

    function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          return str.replace(re, "");
	}
}

function validate3() {
    document.getElementById("CiUserParam3").value=filterNum(document.getElementById("CiUserParam3").value);

    function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          return str.replace(re, "");
	}
}

function validate4() {
    document.getElementById("CiUserParam4").value=filterNum(document.getElementById("CiUserParam4").value);

    function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          return str.replace(re, "");
	}
}
//-->
