// Filtering scripts for Payee Summary Report
// Author: Jeff Parker
// Date: 12/9/2014


// '#instafilta-field'in the functions below is the search input field

//Requires: instafilta.js
$(function() {

    $('#instafilta-field').instaFilta({
    targets: '.tagName',
    sections: '.tag',
    markMatches: true
    });

});


// The same template ("Payee Summary Report.xslt") is used for both the Payee summary
// AND the payee pop-up report from the Payee list
// In the latter case the search makes no sense (one payee) ansd so we hide it
$(function() {
		var numOfVisibleRows = $('.tag:visible').length;
		if (numOfVisibleRows == 1 ){
		$('#instafilta-field').hide();
		}
});



//Changing input type to "search" creates a safari search feild with clear button
//however clcikin clear empties the field but does not reset the report to the deafult state
//you must send a keyup event to the script to re-display the hidden items
function OnSearch(input) {
    if(input.value == "") {
        $( '#instafilta-field' ).keyup();
    }
   
}


//Requires list.js
// another script that has some sort options but much more complicated
//		var options = {
//				valueNames: [ 'tagName' ],
//				listClass: [ 'treeCollection']
//		};
//
//		var userList = new List('innerWrapper', options);
