var ctk_echo_timer_message = '';
var ctk_echo_timer_write = '';

function ctk_echo_run(content, duration, class_name){
   clearTimeout(ctk_echo_timer_message);
   $("#echos").animate({ top: "-150" }, 200);
   ctk_echo_timer_write = setTimeout(function(){
      document.getElementById('echos').className = class_name;
      document.getElementById('echos_content').innerHTML = content;
   }, 200);
   $("#echos").animate({ top: "0" }, 400);
   if(duration){ ctk_echo_timer_message = setTimeout("ctk_echo_close()", duration); }
}

function ctk_echo_ok(message, duration){
   ctk_echo_run(message, duration, 'echos_ok');
}

function ctk_echo_error(message, duration){
   ctk_echo_run(message, duration, 'echos_bad');
}

function ctk_echo_info(message, duration){
   ctk_echo_run(message, duration, '');
}

function ctk_echo_close(){
   $("#echos").animate({ top: "-150" }, 400);
}
