if(m_strWOG==1)
{

document.write ('<tr><td nowrap align="left" class = "cluster_panel"><font class = "cluster_list">Search within: </font></td>');
document.write ('<td align="left" nowrap class = "cluster_list"><input id="m_strSearch_Choice" onclick="hideCluster();showTopic();" type="radio" name="m_strSearch_Choice" value="' + m_strAgencyIDArray.split("^")[0] + '" checked="checked">'+m_strAgencyIDArray.split("^")[1]);

if(undefined===window.m_strClusterItemCount || m_strClusterItemCount == 0) {
	document.write ('&nbsp;&nbsp;&nbsp;&nbsp;');
	}
else
{
document.write ('<input id="m_strSearch_Choice" onclick="showCluster();hideTopic();" type="radio" name="m_strSearch_Choice" value="CLUSTER" >Cluster');
}
	
document.write ('<input id="m_strSearch_Choice" type="radio" onclick="hideCluster();hideTopic();" name="m_strSearch_Choice" value="WOG" >Whole of Government  <sup><font size=1 color=red>(beta)</font></sup>');

document.write ('</td></tr><tr><Td colspan=3 class = "cluster_list">');

document.write ('<div id="ClusterDropDown" style="display:none">Cluster: <SELECT NAME="m_strClusterSysID" class = "cluster_list">');
 	
if(undefined===window.m_strClusterItemCount || m_strClusterItemCount == 0) {

	}
else { 	
 	for ( var i=0, len=m_strClusterSysIDArray.length; i<len; ++i ){
   		document.write('<option  value="' + m_strClusterSysIDArray[i][0] + '">' + m_strClusterSysIDArray[i][1] + '</option>')
   	}
}
document.write ('</SELECT></div>');

document.write('<td align="right">&nbsp;<asp:label id="lblcluster_error" runat="server"></asp:label>');
document.write ('</td></tr>');
}

function showCluster()
{
document.getElementById('ClusterDropDown').style.display = "block";
}

function hideCluster()
{
document.getElementById('ClusterDropDown').style.display = "none";
}

function showTopic()
{
//document.getElementById('TopicDropDown1').style.display = "block";
//document.getElementById('TopicDropDown2').style.display = "block";
//document.getElementById('TopicDropDown3').style.display = "block";
//document.getElementById('TopicDropDown4').style.display = "block";
}

function hideTopic()
{
//document.getElementById('TopicDropDown1').style.display = "none";
//document.getElementById('TopicDropDown2').style.display = "none";
//document.getElementById('TopicDropDown3').style.display = "none";
//document.getElementById('TopicDropDown4').style.display = "none";
}

function searchClick()
{

	if (document.frmlist.Keywords.value.length==0 || document.frmlist.Keywords.value == ' Enter your question here ') 
	{
		alert('Please enter a search phrase.');
		return false;
	}


	if(m_strWOG!=1)
	{
	document.frmlist.target='_self';
	document.frmlist.action='?action=SEARCHNOW';
	document.frmlist.submit();
	}
	else {
	if (document.frmlist.m_strSearch_Choice[0].checked){
	document.frmlist.target='_self';
	document.frmlist.action='?action=SEARCHNOW';
	document.frmlist.submit();			
	}
	else if (document.frmlist.m_strSearch_Choice[1].checked){

if(undefined===window.m_strClusterItemCount || m_strClusterItemCount == 0) {
		var strURL = striFAQ_Path + "?siteID=" + m_strAgencyIDArray.split("^")[0] + "&q=" + urlencode ( document.frmlist.Keywords.value) + "&SearchChoice=WOG"
	
}
else {

		var strURL = striFAQ_Path + "?siteID=" + m_strAgencyIDArray.split("^")[0] + "&q=" + urlencode ( document.frmlist.Keywords.value) + "&SearchChoice=" + document.frmlist.m_strSearch_Choice[1].value + "&clusterid=" + document.frmlist.m_strClusterSysID[document.frmlist.m_strClusterSysID.selectedIndex].value
		//alert(strURL);
	}
		window.open(strURL);
	}
else if (document.frmlist.m_strSearch_Choice[2].checked){
		var strURL = striFAQ_Path + "?siteID=" + m_strAgencyIDArray.split("^")[0] + "&q=" + urlencode ( document.frmlist.Keywords.value) + "&SearchChoice=" + document.frmlist.m_strSearch_Choice[2].value 
		window.open(strURL);	
	}	
	}

}

function urlencode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // %          note: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'
    // *     example 2: urlencode('http://kevin.vanzonneveld.net/');
    // *     returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
    // *     example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
    // *     returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
                                     
    var histogram = {}, histogram_r = {}, code = 0, tmp_arr = [];
    var ret = str.toString();
    
    // The histogram is identical to the one in urldecode.
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    
    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);
    
    for (search in histogram) {
        replace = histogram[search];
        tmp_arr = ret.split(search); // Custom replace
        ret = tmp_arr.join(replace); 
    }
    
    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
    
    return ret;
}