/**
 * ValidateCalls
 *
 * for ValidateCallsController
 */
var ValidateCalls = {};

/**
 * functions to execute when document is ready
 *
 * only for ValidateCallsController
 *
 * @return void
 */
ValidateCalls.documentReady = function() {
	ValidateCalls.filter();
}

/**
 * Submits form for filtering ValidateCalls
 *
 * @return void
 */
ValidateCalls.filter = function() {
	$('#FilterAdminIndexForm').submit(function() {
		var filter = '';
		var q='';

		// type
		if ($('#FilterSrcPhoneNumber').val() != '') {
			filter += 'src_phone_number:' + $('#FilterSrcPhoneNumber').val() + ';';
		}
		
		var loadUrl = Bemmelhor.basePath + 'admin/v_validate_calls/index/';
		if (filter != '') {
			loadUrl += 'filter:' + filter;
		}
		

		window.location = loadUrl;
		return false;
	});
}

/**
 *
 */
$(document).ready(function() {
	if (Bemmelhor.params.controller == 'v_validate_calls') {
		ValidateCalls.documentReady();
	}
});
