var scrollerstep = 1;
var lefttime = 0;
var scroll_interval=5000;
var scroll_speed=50;
var part = 1;
var step = 50;
var delta = 0;
var delta_d = 1;
var correct = 0;
var step_l = 0;
var scrol__data = new Array();
var scroll_text_id = 'scroll_text';
var scroll_text_class = 'scroll_data';
function scroll_add(str){scrol__data[scrol__data.length] = str;}
function set_Interval(interval){scroll_interval = interval;}
function set_Speed(speed){scroll_speed = speed;}
function runScroll(){if (part > scrol__data.length - 1){$('#'+scroll_text_id).css('top','0'); $('#'+scroll_text_id).attr('innerHTML', ''); $('#'+scroll_text_id).append('<p class="'+scroll_text_class+'">' + scrol__data[scrol__data.length - 1]); part=0;}
if (part != 0){$('#'+scroll_text_id).css('top','0');$('#'+scroll_text_id).attr('innerHTML', ''); $('#'+scroll_text_id).append('<p class="'+scroll_text_class+'">' + scrol__data[part - 1]);}
if (correct==4){correct=0;}else{correct=correct + 1;}
var c_data='<p class="'+scroll_text_class+'">'+scrol__data[part];part=part+1;step_l=0;$('#'+scroll_text_id).append(c_data);lefttime=setInterval("scrollText()", scroll_speed);}
function scrollText(){currstop = parseInt(-1 * (step) - delta);
if(parseInt(step_l)>=currstop){nextval=parseInt($('#'+scroll_text_id).css('top'))-scrollerstep+'pt';step_l=step_l - scrollerstep; $('#'+scroll_text_id).css('top', nextval);}else{window.clearInterval(lefttime);}}
function scroll_run(){$('#'+scroll_text_id).append('<p class="'+scroll_text_class+'">'+scrol__data[0]);setInterval("runScroll()",scroll_interval);}