﻿var scrollToBottomTimeout = null;
var notify = false;


$(document).ready(function() {
    scrollToBottom();    
})

window.onerror = function(message,url,line)
{  
    return true;
}

function pageLoad()
{      
   var manager = Sys.WebForms.PageRequestManager.getInstance();
   manager.add_endRequest(endRequest);
}

function endRequest(sender, args)
{
  var Error = args.get_error();
  //document.getElementById("divError").innerHTML = Error.message;
  args.set_errorHandled(true);
}

function playNotification() {
    niftyplayer('jsniftyplayer').play();    
}

function playInLine() {
    niftyplayer('jsInLine').play();    
}

function scrollToBottom() {

    $('.autoScrollToBottom').each(function() {
        
        $(this).mousedown(function() {
            clearTimeout(scrollToBottomTimeout);
            scrollToBottomTimeout = null;
        });

        $(this).mouseup(function() {
            if (scrollToBottomTimeout == null)
                scrollToBottomTimeout = window.setTimeout('scrollToBottom()', 300);
        });        
        this.scrollTop = this.scrollHeight;        
    });
    
    scrollToBottomTimeout = window.setTimeout('scrollToBottom()', 300);        
}
