+/* updates playlist to display active entry */
+function update_playlist_view ()
+{
+ if( req.readyState == 4 ) {
+ if( req.status == 200 ) {
+ var status = req.responseXML.documentElement;
+ var title = status.getElementsByTagName( 'title' );
+ if( title.length > 0 ) {
+ title = title[0].firstChild.data;
+
+ //update now-playing..
+ var nowplaying = document.getElementById( 'nowplaying' );
+ clear_children( nowplaying );
+ nowplaying.appendChild( document.createTextNode( title ) );
+
+ //update playlist..
+ var playtree = document.getElementById( 'playtree' );
+ if( playtree.hasChildNodes() )
+ {
+ var root = playtree.firstChild; //root div
+ if( root.hasChildNodes() )
+ {
+ for( var i = 0; i < root.childNodes.length - 1; i++ )
+ {
+ if ( root.childNodes[i].className == "pl_node" && root.childNodes[i].hasChildNodes() )
+ {
+ var node = root.childNodes[i]; //pl_node
+ if( node.className == "pl_node" && node.hasChildNodes() )
+ {
+ for( var j = 0; j < node.childNodes.length - 1; j++ )
+ {
+ if( node.childNodes[j].className == "pl_leaf" )
+ {
+ var leaf = node.childNodes[j]; //pl_leaf
+ var pl_title = leaf.textContent.substring( 0, leaf.textContent.length - leaf.text.length )
+ //if( leaf.style.fontWeight == "bold" && pl_title.substring(0, 2) == "* " ) //handle leaf currently identified as playing..
+ //{
+ // pl_title = pl_title.substring(2);
+ //}
+ if( pl_title == title )
+ {
+ leaf.style.fontWeight = "bold";
+ }
+ else
+ {
+ leaf.style.fontWeight = "";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+