--sorry for the double post... and the novel writting

it must be

haha!
------
Hi guys.
I fixed the 'clipping' problem of the right side... (had a read of P01's great demonstration of scrollers in JS and HTML)...
I also read up on AJAX, and found a way to rip information from server files and place them into HTML div's... great great! This has allowed us to get one step closer to finally creating a gadget that we can call 'finished'.
The track information works! AJAX rips the info great!!! So, we have a live track update... sort of... unfortunately, for some reason, the track information doesn't change after you have obtained it upon connecting.
I first decided to use the XML document on our server, but the information was coming down as the whole file (including tags)... so I decided that it would be best to make a text document to be parsed through out HitPlayer, and only have the Song Title and Song Artist displayed... I could say it would look like the attached text file, being updated every event change (done by our HitPlayer). This means the AJAX will rip the whole song title
AND song artist as one line, and change that to the current song for the message in the HTML (if when the interval triggers another 'get' and the string is different).
I'm not sure why it isn't changing the song! When I restarted my computer, it changed! But it won't change 'live' when the gadget is on, or even with the SideBar restarted!
I have attached both the demonstrative text document and my AJAX JavaScript file is below. Can someone please have a sift through (you only really need to worry about the AJAX bit, the other is just sorting out the play/stop and images)...
Also! Why is it scrolling faster after every play/stop hit!?
Thanks!
var audioURL;
var trackURL;
var updateInterval = 5000;
var output = " KIK LIVE Stream kikconnect.net";
var song = " KIK LIVE Stream kikconnect.net";
var pos = 0;
var timer;
var status = false;
window.onload = function()
{
audioURL = "mms://win4.fast-serv.com/kikfm";
trackURL = "http://www.kikconnect.net/TrackServ/live_update.txt";
mediaPlayer.url = audioURL;
System.Gadget.settingsUI = "Settings.html";
}
function AjaxGet()
{
if (status) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = infoReceived;
req.open("GET", trackURL, true);
req.send();
}
setTimeout("AjaxGet()", updateInterval);
}
}
function startScroll()
{
var s = " " + song;
if (s.length > 28) {
pos += 0.25;
if (pos >= s.length + 15) {
pos = 0;
}
message.innerHTML = s.substring(pos, s.length);
} else {
message.innerHTML = song;
}
timer = setTimeout("startScroll()", 80);
}
function infoReceived()
{
if (req.readyState == 4) {
if (req.status == 200) {
output = req.responseText;
if (output != song) {
song = output;
message.innerHTML = song;
pos = 0;
clearTimeout(timer);
startScroll();
}
}
}
}
function controlImageClick()
{
if (controlImage.src == "images/buttons/stop.png") {
mediaPlayer.controls.stop();
} else {{
mediaPlayer.controls.play();
pos = 0;
clearTimeout(timer);
startScroll();
}
mediaPlayer.controls.play();
startScroll();
}
}
function playStateChange(newstate)
{
switch (newstate) {
case 1: // Display Player Status as Stopped
status = false;
if (timer != null) {
clearTimeout(timer);
}
song = "";
pos = 0;
message.innerHTML = " KIK LIVE Stream kikconnect.net";
playbackStatus.innerHTML = "Stopped";
controlImage.src = "images/buttons/play.png";
break;
case 3: // Display Player Status as Playing
AjaxGet();
status = true;
playbackStatus.innerHTML = "Playing";
controlImage.src = "images/buttons/stop.png";
break;
case 6: // Display Player Status as Buffering
playbackStatus.innerHTML = "Buffering";
controlImage.src = "images/buttons/stop.png";
break;
case 7: // Display Player Status as Waiting
playbackStatus.innerHTML = "Waiting";
break;
case 8: // Stopped Media
playbackStatus.innerHTML = "Media Ended";
controlImage.src = "images/buttons/play.png";
break;
case 9: // Connecting to Media Stream
playbackStatus.innerHTML = "Connecting...";
controlImage.src = "images/buttons/stop.png";
break;
case 10: // Display Player as Ready
playbackStatus.innerHTML = "Ready";
controlImage.src = "images/buttons/play.png";
break;
}
}