var ctr = 0;
var ntCtr = -1;
var ntCtrx = 0;
var links = new Array();
var items = new Array();

document.observe('dom:loaded', function(e) {
	if($('information')) {
		newsTicker();
	}
});

function newsTicker() {
	b = $('informationText');
	if(ntCtr < 0) {
		if(links[ctr] == '') {
			b.replace(new Element('div',{'id': 'informationText'}).update('&nbsp;'));
		} else {
			b.replace(new Element('a',{'id': 'informationText'}).update('&nbsp;'));
			b = $('informationText');
			b.href = links[ctr];
		}
		ntCtr++;
	}
    // next character of current item
    if (ntCtr < items[ctr].length) {
		if(ntCtrx == 0) {
			ntCtr++;
			ntCtrx++;
			curr = items[ctr].substring(0,ntCtr) + '-';
		} else {
			ntCtrx = 0;
			curr = items[ctr].substring(0,ntCtr) + '_';
		}
		b.update(curr);
		setTimeout('newsTicker()',30);
		return;
    }
	b.update(items[ctr]);
	// new item
    ntCtr = -1;
    if (ctr < items.length-1) {
        ctr++;
    } else {
        ctr = 0;
    }
    setTimeout('newsTicker()',5000);
}
