<div id="song_info" onMouseOver="updateIE()"></div>
<iframe name="aux" id="aux" src="get_track_info.php"></iframe>
<script language="JavaScript" type="text/javascript">
function detectIE() {
var agent = navigator.userAgent.toLowerCase()
return agent.indexOf('msie')
}
function detectOpera() {
var agent = navigator.userAgent.toLowerCase()
var i = agent.indexOf('opera')
if (i!=-1) return parseFloat(agent.slice(i+6))
return false
}
i = 0;
if (detectOpera()) {
document.getElementById('analyser').style.top += 250;
}
function scroll(str, disp, obj) {
clearTimeout(timer);
var length = str.length - 1;
if (disp >= length) {
obj.innerHTML = str;
return;
}
var temp = '';
var out = '';
if ((i + disp > length) && (i <= length)) {
temp = str.slice(i);
fromStart = i + disp - (length + 1);
out = temp + str.slice(0, fromStart);
} else if (i < length) {
out = str.slice(i, i + disp);
} else {
i = 0;
var timer;
out = str.slice(0, disp);
}
i++;
obj.innerHTML = out.replace(' ', ' ');
timer = setTimeout(function() {scroll(text, 35, obj);}, 500);
}
function updateIE() {
aux.location.href = 'get_track_info.php';
text = aux.getSong();
if (text != oldtext) {
text = text.slice(0, text.indexOf('<'));
if (text.length > 35) text += ' ***** ';
scroll(text, 35, obj);
}
}
var text = ' ';
var newtext = ' ';
var oldtext = ' ';
obj = document.getElementById('song_info');
if (detectIE() == -1) {
setTimeout(function() {
aux.location.href = 'get_track_info.php';
newtext = aux.getSong();
i = 0;
oldtext = newtext;
text = newtext.slice(0, newtext.indexOf('<'));
if (text.length > 35) text += ' ***** ';
scroll(text, 35, obj);}, 400);
setInterval(function() {
aux.location.href = 'get_track_info.php';
newtext = aux.getSong();
if (newtext != oldtext) {
i = 0;
oldtext = newtext;
text = newtext.slice(0, newtext.indexOf('<'));
if (text.length > 35) text += ' ***** ';
scroll(text, 35, obj);
}}, 8000);
} else {
setTimeout(function() {
text = aux.getSong();
oldtext = text;
text = text.slice(0, text.indexOf('<'));
if (text.length > 35) text += ' ***** ';
scroll(text, 35, obj);}, 400);
}
</script>