var recipients_element_height = 255;
var recipients_scroll_step = 10;
var recipients_scroll_timeout = 40;
var recipients_max_position = 0;
var recipients_position = 0;
var new_recipients_position = 0;

function UpdateRecipientsScrollButtons() {
	var recipients = document.getElementById('recipientsContainer');
	if (recipients) recipients_max_position = recipients.offsetHeight;
	var top_link = document.getElementById('recipients_lister_top');
	var bottom_link = document.getElementById('recipients_lister_bottom');
	if ((top_link) && (bottom_link)) {
		top_link.className = (recipients_position > 0) ? 'active' : '';
		bottom_link.className = (recipients_position < (recipients_max_position - recipients_element_height)) ? 'active' : '';
	} // end if
} // end if

function RecipientsScrollTimer() {
	var recipients = document.getElementById('recipientsContainer');
	if (recipients) {
		if (new_recipients_position > recipients_position) {
			recipients_position += recipients_scroll_step;
			if (recipients_position > new_recipients_position) recipients_position = new_recipients_position;
		} else if (new_recipients_position < recipients_position) {
			recipients_position -= recipients_scroll_step;
			if (recipients_position < new_recipients_position) recipients_position = new_recipients_position;
		} // end if
		recipients.style.top = -recipients_position;
		UpdateRecipientsScrollButtons();
		if (new_recipients_position != recipients_position) setTimeout(RecipientsScrollTimer, recipients_scroll_timeout);
	} // end if
} // end function

function RecipientsScroll(increment) {
	var recipients = document.getElementById('recipientsContainer');
	if (recipients) {
		UpdateRecipientsScrollButtons();
		new_recipients_position += increment * recipients_element_height;
		if (new_recipients_position > (recipients_max_position - recipients_element_height)) {
			new_recipients_position = (recipients_max_position - recipients_element_height);
		} // end if
		if (new_recipients_position < 0) new_recipients_position = 0;
		if (new_recipients_position != recipients_position) setTimeout(RecipientsScrollTimer, recipients_scroll_timeout);
		recipients.style.top = -recipients_position;
	} // end if
	return false;
} // end function
