function write_message( mindex, urlarray, textarray, index ) {
	if ( urlarray[index] == "" ) {
	    messages[ mindex ] = source_font + "" + textarray[index] + "<br>";
	} else {
	    messages[ mindex ] = source_font + "<a href='" + urlarray[index] + "'>" + textarray[index] + "</a><br>";
	}
//    if ( textarray[ index + 1 ] )
//		if ( urlarray[index] == "" ) {
//			messages[ mindex ] += "<br>Ēš " + textarray[index + 1];
//		    messages[ mindex ] +="</font>"
//		} else {
//			messages[ mindex ] += "<br>Ēš <a href='" + urlarray[index + 1] + "'>" + textarray[index + 1] + "</a>";
//			messages[ mindex ] +="</font>"
//		}
}

//	mess_len = ( express_heads.length +  (express_heads.length % 2)) / 2 ;
	mess_len = express_heads.length ;
   for (d=0, m=0, e=0; m<=(mess_len-1); m++) {  
       if ( disc_heads[d] )  {
          write_message( m, disc_news_url, disc_source_text, disc_urls, disc_heads, d );
	  d += 1;
       } else if ( express_heads[e] ) {
	  write_message(m, express_urls, express_heads, e );
	  e += 1;
       } 
   }

if (messages.length>1) {
  i=2
  if ( i >= messages.length )
    i = 0;
}
else
  i=0

function move1(whichlayer){
  tlayer=eval(whichlayer)
  if (tlayer.top>0&&tlayer.top<=dtop){
    tlayer.top=0
    setTimeout("move1(tlayer)",toppause)
    setTimeout("move2(document.main.document.second)",toppause)
    return
  }
  if (tlayer.top>=tlayer.document.height*-1){
    tlayer.top-=decrement
    setTimeout("move1(tlayer)",minipause)
  } else {
    tlayer.top=scrollerheight
    tlayer.document.write(messages[i])
    tlayer.document.close()
    if (i==messages.length-1)
      i=0
    else
      i++
  }
}


function move2(whichlayer){
	tlayer2=eval(whichlayer)
	if (tlayer2.top>0&&tlayer2.top<=dtop){
		tlayer2.top=0
		setTimeout("move2(tlayer2)",toppause)
		setTimeout("move1(document.main.document.first)",toppause)
		return
	}
	if (tlayer2.top>=tlayer2.document.height*-1){
		tlayer2.top-=decrement
		setTimeout("move2(tlayer2)",minipause)
	} else{
		tlayer2.top=scrollerheight
		tlayer2.document.write(messages[i])
		tlayer2.document.close()
		if (i==messages.length-1)
			i=0
		else
		i++
	}
}

function move3(whichdiv){
	tdiv=eval(whichdiv)
	if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=dtop){
		tdiv.style.pixelTop=0
		setTimeout("move3(tdiv)",toppause)
		setTimeout("move4(second2)",toppause)
		return
	}
	if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
		tdiv.style.pixelTop-=decrement
		setTimeout("move3(tdiv)",minipause)
	} else{
		tdiv.style.pixelTop=scrollerheight
		tdiv.innerHTML=messages[i]
		if (i==messages.length-1)
			i=0
		else
			i++
	}
}

function move4(whichdiv){
	tdiv2=eval(whichdiv)
	if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=dtop){
		tdiv2.style.pixelTop=0
		setTimeout("move4(tdiv2)",toppause)
		setTimeout("move3(first2)",toppause)
		return
	}
	if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
		tdiv2.style.pixelTop-=decrement
		setTimeout("move4(second2)",minipause)
	}
	else{
		tdiv2.style.pixelTop=scrollerheight
		tdiv2.innerHTML=messages[i]
		if (i==messages.length-1)
		i=0
		else
		i++
	}
}

function startscroll(){
	if (document.all){
		move3(first2)
		second2.style.top=scrollerheight
		second2.style.visibility='visible'
	}
	else if (document.layers){
		document.main.visibility='show'
		move1(document.main.document.first)
		document.main.document.second.top=scrollerheight+decrement
		document.main.document.second.visibility='show'
	}
}