function scount(limitarea, limitcount, limitnum) {
    var larea = document.getElementById(limitarea);
    var lcount = document.getElementById(limitcount);

    if (larea.value.length > limitnum)
    {
        larea.value = larea.value.substring(0, limitnum);
    }
    else
    {
        lcount.innerHTML = limitnum - larea.value.length;
    }
}

function policycheck(checkbox, submitbutton) {
    var cb = document.getElementById(checkbox);
    var sb = document.getElementById(submitbutton);

    sb.disabled = !cb.checked;
}

var did = $('#sl_tekstai');
var dh = did.css('height');
var paused = false;
var speed = 1500;
var pause_time = 3;

function doscroll() {
  if (did.find('tr').length > 1) {
    if(!paused)
    {
        if (anime)
        {
            did.animate({scrollTop: dh}, speed, "linear", function(){
                did.find('tr:first').insertAfter(did.find('tr:last'));
                did.attr('scrollTop', 0);
            });
        }
        else
        {
            did.attr('scrollTop', dh);
            did.find('tr:first').insertAfter(did.find('tr:last'));
            did.attr('scrollTop', 0);
        }
    }
    setTimeout("doscroll()", anime?(pause_time*speed):(pause_time*speed+speed));
  }
}

function anime_toogle() {
    anime = !anime;
    $('#anime_str').html(anime?anime_str2:anime_str1);
    document.cookie = "hotline="+anime+"; path=/";
}

$('#anime_str').html(anime?anime_str2:anime_str1);
setTimeout("doscroll()", speed*pause_time);
did.mouseover(function(){paused = true;}).mouseout(function(){paused = false;});