<!-- BEGIN DYNAMIC BLOCK: imgSearch -->
<!-- END DYNAMIC BLOCK: imgSearch -->
<!-- BEGIN DYNAMIC BLOCK: searchSection -->
<script language="JavaScript" type="text/JavaScript">
    function ToggleCustomFields(type, option){
        if(type == 'c_profile_field'){
            document.getElementById('customprofile'+option).style.display='';
        }else{
            document.getElementById('customprofile'+option).style.display='none';
        }
        if(type == 'c_package_field'){
            document.getElementById('custompackage'+option).style.display='';
        }else{
            document.getElementById('custompackage'+option).style.display='none';
        }
    }

    function submitCustomUserSearch() {
        filtertext = Ext.get('searchstring').getValue();
        filtertype = Ext.get('searchbyfield').getValue();

        switch(filtertype) {
            case "c_profile_field":
                filterfieldid = Ext.get('searchbycustomprofilefield').getValue();
                break;
            case "c_package_field":
                filterfieldid = Ext.get('searchbycustompackagefield').getValue();
                break;
            case "none":
                Ext.MessageBox.alert(lang('Submit Failed'), lang('Please select a custom field filter type'), function(){});
                return false;
                break;
        }

        if (trim(filtertext) == ""){
            Ext.MessageBox.alert(lang('Submit Failed'), 'Requires&nbsp;search&nbsp;string', function(){});
            return false;
        }else{
            gridstore.setBaseParam('customsearchtype', filtertype);
            gridstore.setBaseParam('customsearchstring', filtertext);
            gridstore.setBaseParam('customsearchfield', filterfieldid);
        }

        gridstore.load({params:{start:0}});
        return false;
    }
</script>

<div style="font-size: 10px;padding-left:0px;">[l]Search filters[/l]:</div>
<div style="float:left;">
    <select id="view">
        <option value="ViewAllUsers"> [l]All Users[/l]</option>
        <option value="ViewActiveUsers"> [l]Active Users[/l]</option>
        <option value="ViewInactiveUsers"> [l]Inactive Users[/l]</option>
        <option value="ViewDeletedUsers"> [l]Canceled Users[/l]</option>
        <option value="ViewFraudUsers"> [l]Fraud Users[/l]</option>
        <option value="ViewPendingUsers"> [l]Pending Users[/l]</option>
    </select>
</div>
<div id="selectwithblock" style="float:left;padding-left:127px;">
    <select id="searchbyfield" name="searchbyfield">
        <option value="none"> -- [l]with[/l] --</option>
        <option value="c_profile_field"> [l]Custom Profile Field[/l]</option>
        <option value="c_package_field"> [l]Custom Package Field[/l]</option>
    </select>
</div>

<div style="display:none;float:left;padding-left:145px;" id="customprofilediv">
    <select id="searchbycustomprofilefield" name="searchbycustomprofilefield">
        <!-- BEGIN DYNAMIC BLOCK: searchbycustomprofilefield -->
        <option value='{PROFILEFIELDID}'> {PROFILEFIELDNAME}</option>
        <!-- END DYNAMIC BLOCK: searchbycustomprofilefield -->
        {CUSTOMPROFILEFIELDS}
    </select>
</div>
<div style="display:none;float:left;padding-left:145px;" id="custompackagediv">
    <select id="searchbycustompackagefield" name="searchbycustompackagefield">
        <!-- BEGIN DYNAMIC BLOCK: searchbycustompackagefield -->
        <option value='{PACKAGEFIELDID}'> {PACKAGEFIELDNAME}</option>
        <!-- END DYNAMIC BLOCK: searchbycustompackagefield -->
        {CUSTOMPACKAGEFIELDS}
    </select>
</div>
<div style="font-size: 10px;padding-left:0px;padding-top:2px;clear:both;">[l]Matching[/l]:</div>
<input size="37" class="x-form-text x-form-field" id="searchstring" name="searchstring" type="text" onkeydown="if(event.keyCode==13){ return submitCustomUserSearch();}">
<!-- END DYNAMIC BLOCK: searchSection -->