/* SQLBreeze - Functions Javascript
=============================================================================================*/

var globals = {}

var trace = function( string, alert )
{
   console.debug(string);
}

var dotdotdot = function( elm, length )
{
   var text = $(elm).text();
   
   if( text.length >= length )
   {
      text = text.substring(0, length);
      $(elm).text(text+'...');
   }

   return true;
}

var timer = function( options )
{
   var execute = options.execute||null;
   var duration = options.duration||null;
   var kill = options.kill||null;
   
   if( kill != null )
   {
      clearTimeout(globals.timer);
      return true;
   }
   
   globals.timer = setTimeout( execute, duration );
   
   return true;
}

/* Keep Alive
============================================================= */

function keepalive()
{
   $( function()
   {
      var intervalID = window.setInterval( function(){
         $.post( '/services/keepalive' );
      } , 30000 );
   });	
};

