var posts_scroll_position = 0;
var content_scroll_position = 0;
function scroll_init(){
    document.getElementById("posts-up").onmousedown = (posts_start_up);
    document.getElementById("posts-up").onmouseup = (posts_stop_up);
    document.getElementById("posts-up").onmouseout = (posts_stop_up);
    document.getElementById("posts-down").onmousedown = (posts_start_down);
    document.getElementById("posts-down").onmouseup = (posts_stop_down);
    document.getElementById("posts-down").onmouseout = (posts_stop_down);
	document.getElementById("posts_scroll-box").style.position = 'relative';
    document.getElementById("content-up").onmousedown = (content_start_up);
    document.getElementById("content-up").onmouseup = (content_stop_up);
    document.getElementById("content-up").onmouseout = (content_stop_up);
    document.getElementById("content-down").onmousedown = (content_start_down);
    document.getElementById("content-down").onmouseup = (content_stop_down);
    document.getElementById("content-down").onmouseout = (content_stop_down);
	document.getElementById("content_scroll-box").style.position = 'relative';
	csb_height = document.getElementById("content_scroll-box").offsetHeight;
	psb_height = document.getElementById("posts_scroll-box").offsetHeight;
	if (csb_height < 450) {
		document.getElementById("content-up").style.display = "none";
		document.getElementById("content-down").style.display = "none";
	};
	if (psb_height < 450) {
		document.getElementById("posts-up").style.display = "none";
		document.getElementById("posts-down").style.display = "none";
	};
}

function posts_start_up(){
    posts_upIntervalId = setInterval("posts_move_up()", 10);
}

function posts_start_down(){
    posts_downIntervalId = setInterval("posts_move_down()", 10);
}

function posts_move_up(){
    posts_scroll_position = (posts_scroll_position + 3);
    if (posts_scroll_position < 0) {
        document.getElementById("posts_scroll-box").style.top = (posts_scroll_position + "px");
    }
    else {
        posts_stop_up();
        posts_scroll_position = 0;
    };
    ;
    }

function posts_move_down(){
    posts_scroll_position = (posts_scroll_position - 3);
    var divh = (((document.getElementById('posts_scroll-box').offsetHeight) * -1) + 350);
    if (posts_scroll_position > divh) {
        document.getElementById("posts_scroll-box").style.top = (posts_scroll_position + "px");
    }
    else {
        posts_stop_down();
        posts_scroll_position = divh;
    };
    ;
    }

function posts_stop_up(){
    clearInterval(posts_upIntervalId);
}

function posts_stop_down(){
    clearInterval(posts_downIntervalId);
}

function content_start_up(){
    content_upIntervalId = setInterval("content_move_up()", 10);
}

function content_start_down(){
    content_downIntervalId = setInterval("content_move_down()", 10);
}

function content_move_up(){
    content_scroll_position = (content_scroll_position + 3);
    if (content_scroll_position < 0) {
        document.getElementById("content_scroll-box").style.top = (content_scroll_position + "px");
    }
    else {
        content_stop_up();
        content_scroll_position = 0;
    };
    ;
    }

function content_move_down(){
    content_scroll_position = (content_scroll_position - 3);
    var divh = (((document.getElementById('content_scroll-box').offsetHeight) * -1) + 350);
    if (content_scroll_position > divh) {
        document.getElementById("content_scroll-box").style.top = (content_scroll_position + "px");
    }
    else {
        content_stop_down();
        content_scroll_position = divh;
    };
    ;
    }

function content_stop_up(){
    clearInterval(content_upIntervalId);
}

function content_stop_down(){
    clearInterval(content_downIntervalId);
}
