


<script type="text/javascript" >

    var time = new Date().getTime();
    $(document.body).bind("mousemove keypress", function (e) {
        time = new Date().getTime();
    });

    function refresh() {
        if (new Date().getTime() - time >= 1000) {

            var url = "products/scc/scc_getcallevents.php?userId=" + <?php echo $_SESSION['ownerId']; ?>


            $.get(url, function (data) {

                var obj = jQuery.parseJSON(data);
                if (obj.errorCode == 0) {
                    $('#content-wrapper').load("products/scc/scc_popup_form.php?item=" + obj.TicketNumber);

                }
                else {
                    setTimeout(refresh, 1000);
                }

            });


        } else
            setTimeout(refresh, 1000);
    }

    setTimeout(refresh, 1000);

</script>