// citations array is created by php - needs include citations.inc.php

last_cit_no = 0;
timeout = 10000;

function changeCitation() {
	// get array

	rand_no = Math.round(Math.random() * citations.length);
	if (rand_no > 0) {
		rand_no -= 1;
	}
	if (rand_no == last_cit_no) {
		if (last_cit_no == 0) {
			rand_no = citations.length - 1;
		}  else {
			--rand_no;
		}
	}
	
	last_cit_no = rand_no;	

//	alert("Wechsel " + rand_no);

	$("#cittext").html('"' + citations[rand_no]['text'] + '"');
	$("#citsource").html(citations[rand_no]['source']);
	
//	Element.update('cittext','"' + citations[rand_no]['text'] + '"');
//	Element.update('citsource',citations[rand_no]['source']);

	window.setTimeout("changeCitation()", timeout);
	
}

