// Do NOT use Quotes (" or ') in the text, it will confuse the script.
// You can use right-angle quotes («) and left-angle quotes (») instead, and they will be replaced by regular quotes (").
//
// Use brackets (ie, [ ]) for links. Links are explained and defined after this text.
//


//
// change the links here.
//
counter=0;
totalLinks=1; // write the total amount of links you wish to have here.
var link=new Array(totalLinks)
link[0]='http://www.un.org/News/fr-press/docs/2004/AG1483.doc.htm';
link[1]='http://www.un.org/webcast/58thaids.htm';
link[2]='http://www.un.org/';
link[3]='http://www.un.org/ga/';
//
// You can add as many links as you want, just write link[(link number minus one)]='(http://your_link_here/)';
// Replace everything in parentheses, and remove the parentheses.
// example: if you wanted to add a fifth link, you would add: link[4]='(http://fifth_link/)';
// and then change: totalLinks=5;
//

function wandleSpaces(c) {
    if(c.indexOf(' ')!=-1) {
        cneu=c.substring(0,c.indexOf(' '))+'&nbsp;'+c.substring(c.indexOf(' ')+1,c.length);
        if(cneu.indexOf(' ')!=-1) wandleSpaces(cneu);
        return cneu;
    }
    else return c;
}
function wandleQuotes1(c) {
    if(c.indexOf('«')!=-1) {
        cneu=c.substring(0,c.indexOf('«'))+'&quot;'+c.substring(c.indexOf('«')+1,c.length);
        if(cneu.indexOf('«')!=-1) wandleQuotes1(cneu);
        return cneu;
    }
    else return c;
}
function wandleQuotes2(c) {
    if(c.indexOf('»')!=-1) {
        cneu=c.substring(0,c.indexOf('»'))+'&quot;'+c.substring(c.indexOf('»')+1,c.length);
        if(cneu.indexOf('»')!=-1) wandleQuotes2(cneu);
        return cneu;
    }
    else return c;
}

function wandleLinks1(c) {
	if(c.indexOf('[')!=-1) {
        cneu=c.substring(0,c.indexOf('['))+'<a href='+link[counter]+' target=_blank>'+c.substring(c.indexOf('[')+1,c.length);
        if(cneu.indexOf('[')!=-1) wandleLinks1(cneu);
        return cneu;
    }
    else return c;
}
function wandleLinks2(c) {
    if(c.indexOf(']')!=-1) {
        cneu=c.substring(0,c.indexOf(']'))+'</a>'+c.substring(c.indexOf(']')+1,c.length);
        if(cneu.indexOf(']')!=-1) wandleLinks2(cneu);
        return cneu;
    }
    else return c;
}
function tick(text,pos) {
    var c1=text.substring(pos, pos+1);
    var c2=text.substring(pos+1, pos+txtBreite-1);
    var c3=text.substring(pos+txtBreite-1, pos+txtBreite);

    if(c1==' ') c1='&nbsp;';
    else if(c1=='«') c1='&quot;';
    else if(c1=='»') c1='&quot;';
    else if(c1=='[') c1='<a href='+link[counter]+' target=_blank>';
    else if(c1==']') {
		c1='</a>';
		if(counter == (totalLinks-1)) counter = 0;
	}
    if(c3==' ') c3='&nbsp;';
    else if(c3=='«') c3='&quot;';
    else if(c3=='»') c3='&quot;';
    else if(c3=='[') {
		counter+=1;
		if(counter >= totalLinks) counter = 0;
		c3='<a href='+link[counter]+' target=_blank>';
    }
    else if(c3==']') c3='</a>';
    c2=wandleSpaces(c2);
    c2=wandleQuotes1(c2);
    c2=wandleQuotes2(c2);
    c2=wandleLinks1(c2);
    c2=wandleLinks2(c2);

    var schrift='<div><font face="lucida console, verdana, helvetica" color="#ffffff" size="2"><b><font color="#777777">'+c1+'</font>'+c2+'<font color="#777777">'+c3+'</font></b></font></div>';

    if(document.layers) {
	  document.layers.ticker.document.open();
	  document.layers.ticker.document.write( schrift );
      document.layers.ticker.document.close();
	}
    else if (document.all) ticker.innerHTML=schrift;
    else if (document.getElementById) {
      node = document.getElementById('ticker').innerHTML=schrift;
  }

    pos+=1;

    if(pos<text.length)
		setTimeout('tick("'+text+'",'+pos+')', tempo);
    else
		tick(txt0+txt1+txt2+txt3+txt4,0);
}
function tickers() {
    if(document.layers) { txtBreite=33; tempo=180; }
    else if(document.all) { txtBreite=33; tempo=220; }
    else if(document.getElementById) { txtBreite=33; tempo=180; }
    if (document.all || document.layers || document.getElementById) tick(txt0+txt1+txt2+txt3+txt4,0);
}

