﻿//remove dash line from firefox
window.onload=function(){ for(var i=0; i<document.links.length; i++) document.links[i].onfocus=function(){this.blur()}};

// WMP inc and switch buttons
var texthigh;
var textlow;
var mmsaddress_high;
var mmsaddress_low;
//Get the address throw element id
function getAddress(id)
{
    var obj = document.getElementById(id);
    var straddress = obj.getElementsByTagName("div")[0].getElementsByTagName("div")[0].getElementsByTagName("span")[0].innerText;
    texthigh = straddress.split("|")[0];
    mmsaddress_high = straddress.split("|")[1];
    textlow = straddress.split("|")[2];
    mmsaddress_low = straddress.split("|")[3];
}
getAddress("dh_hp_mmsaddress");

function wmpHigh()
{
    play(mmsaddress_high);
}

function wmpLow()
{
    play(mmsaddress_low);
}

wmpLow();

//Play code
function play(address)
{
var wmpTags = '<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" '
+  'standby="Loading Microsoft Windows Media Player components..." '
+  'width="354" height="246" id="meidawmp"> '
+  '<param name="URL" value="'
+  address
+  '" /> '
+  '<param name="autoStart" value="true" /> '
+  '<param name="uiMode" value="full" /> '
+  '<param name="enabled" value="true" />'
+  '<param name="fullScreen" value="false" /> '
+  '<param name="mute" value="false" />'
+  '<param name="volume" value="100" />'
+  '<param name="playcount" value="1" />'
+  '<param name="enableContextMenu" value="true" />'
+  '<param name="stretchToFit" value="false" />'
+  '<param name="rate" value="1" />'
+  '<param name="windowlessVideo" value="false" />'
+  '<embed src="'
+  address
+  '" '
+  'autostart="1" uimode="full" enabled="1" fullscreen="0" mute="0" volume="100" playcount="1" enablecontextmenu="1" stretchtofit="0" rate="1" windowlessvideo="0" samifilename="" captioningid="" ' 
+  'width="354" height="246"'
+  'align="middle" allowScriptAccess="always" '
+  'type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/alldownloads.aspx" />'
+  '<\/object>';

var buttonsHTML;
if (address == mmsaddress_low)
{
    buttonsHTML =  "<ul><li><a href='#' onclick='wmpHigh()'>"+ texthigh +"</a></li><li class='currentmedia'>"+ textlow +"</li></ul>";
}
else
{
    buttonsHTML =  "<ul><li class='currentmedia'>"+ texthigh +"</li><li><a href='#' onclick='wmpLow()'>"+ textlow +"</a></li></ul>";
}

document.getElementById("dh_hp_wmp").innerHTML = wmpTags + buttonsHTML;
}