var pausebetweenmsg=10 //customize pause in miliseconds between each message showing up (3000=3 seconds)
var glidespeed=2 //customize glide speed in pixels per frame.


function actualstyle(el, cssproperty){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(cssproperty)
}
}


function onebyoneglide(eleid){
glidearray=new Array();
glidearray[0] = document.getElementById(eleid);
//if (curobjindex<glidearray.length)
        glidetimer=setInterval("glideroutine()",50)
}

function glideroutine(){
if (parseInt(actualstyle(glidearray[0], "left"))<0)
glidearray[0].style.left=parseInt(actualstyle(glidearray[0], "left"))+50+"px"
else{
glidearray[0].style.left=0;
//curobjindex++
clearInterval(glidetimer);
//setTimeout("onebyoneglide()", pausebetweenmsg)
}
}

var newslist=new Array();
var cnt=0;			// current news item
var curr = "";
var i=-1;			// current letter being typed


newslist[0]=new Array("<em>&ldquo;We have been waiting  for a long time for a product that allows us to represent our properties in the  best way possible. It offers us a huge selling point to win listings. It is  also a great way to get money up front from Vendors which is obviously always  good news. These definitely help us sell properties and get viewings quicker  through our online portal partners&rdquo;</em> <br /><br /><strong>Capital Estates  &ndash; Rob Tancred &ndash; Owner </strong>");
newslist[1]=new Array("<em>&ldquo;In an industry where unique selling points are hard to find, we have  found&nbsp;Audiotours have given us the edge over our competition. They&nbsp; have secured us instructions which have  already resulted in valuable income and have increased the level of enquires  received from&nbsp;<a href='http://www.rightmove.com/'>www.rightmove.com</a>&rdquo;</em><br /><br /><strong>Alan Gout &ndash; Michael Everett - Owner</strong>");
newslist[2]=new Array("<em>&ldquo;We are committed to providing our customers with the best choice and availability of the most innovative marketing products in the market. With this in mind we are pleased to offer estate agents direct access to the new and very exciting Audio Tours provided by AudioAgent through our software&rdquo;</em><br /><br /><strong>Jakx - Estate Agent Software</strong>");
newslist[3]=new Array("<em>&ldquo;We have found the AudioTours a fantastic visual selling aid; it is the best listing tool we have seen in 20 years in the industry.&rdquo;</em><br /><br /><strong>Marlowe Property Services </strong>");




function newsticker()
{
  //cnt = rand(newslist.length);
  cnt = Math.floor(Math.random()*newslist.length)
  // next text
  document.getElementById("mtxt").style.left = -500 + "px";
  document.getElementById("mtxt").innerHTML = "<span style='color:#13588E; font-weight:bold;'></span>&nbsp;" + newslist[cnt] ;
  
  onebyoneglide("mtxt");

  // new item
  i = -1; curr = "";
  //if (cnt<newslist.length-1)
    //cnt++;
  //else
    //cnt=0;
  setTimeout('newsticker()',10000)
}

//function newsticker()
//{
//  // next character of current item
//  if (i < newslist[cnt][0].length - 1)
//  {
//    i++;
//    temp1 = newslist[cnt][0];
//    temp1 = temp1.split('');
//    curr = curr+temp1[i];
//    temp2 = newslist[cnt][1];
//    //mtxt.innerHTML = "<strong><font color='#ffffff' size='2'>LATEST NEWS ...&nbsp;&nbsp;"+curr+"_</font><strong>";
//    document.getElementById("mtxt").innerHTML = "<span style='color:#13588E; font-weight:bold;'>Latest News ...</span>&nbsp;" + curr+"...";
//	setTimeout('newsticker()',25)
//    return;
//  }
//  // new item
//  i = -1; curr = "";
//  if (cnt<newslist.length-1)
//    cnt++;
//  else
//    cnt=0;
//  setTimeout('newsticker()',5000)
//}
//  End -->



// Generate random number
function rand(n) {
seed = (0x015a4e35*seed) % 0x7fffffff;
return (seed >>4) %n;
}

var now= new Date()
var seed= now.getTime() % 0xffffffff



if (window.addEventListener)
window.addEventListener("load", newsticker, false)
else if (window.attachEvent)
window.attachEvent("onload", newsticker)
else if (document.getElementById)
window.onload=newsticker