/**
* Heartbeat
*/
$.jheartbeat = {
options: {delay: 10000},
beatfunction: function(){},
timeoutobj: {id: -1},
set: function(options, onbeatfunction) {
if (this.timeoutobj.id > -1) {
clearTimeout(this.timeoutobj);
}
if (options) {
$.extend(this.options, options);
}
if (onbeatfunction) {
this.beatfunction = onbeatfunction;
}
this.timeoutobj.id = setTimeout("$.jheartbeat.beat();", this.options.delay);
},
beat: function() {
this.timeoutobj.id = setTimeout("$.jheartbeat.beat();", this.options.delay);
this.beatfunction();
}
};