function debounce (func, wait, immediate) {

    "use strict";

    var timeout, result;