function Replace(totalValue,oldValue,newValue)
{
	while(totalValue.indexOf(oldValue) > -1)
		totalValue=totalValue.replace(oldValue,newValue);
			return totalValue;
}

function getNode(TagName, node)
{
	var currentNode = (node == null) ? xmlDoc.getElementsByTagName(TagName) : 
					items[node].getElementsByTagName(TagName);
		if(currentNode.length > 0) {
			if(currentNode[0].firstChild)
				return currentNode[0].firstChild.nodeValue;
			else
				return '';
		} else
			return '';
}

    var tabLinks = new Array();
    var contentDivs = new Array();

    function init() {

      // Grab the tab links and content divs from the page
      var tabListItems = document.getElementById('tabs').childNodes;
      for ( var i = 0; i < tabListItems.length; i++ ) {
        if ( tabListItems[i].nodeName == "LI" ) {
          var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
          var id = getHash( tabLink.getAttribute('href') );
          tabLinks[id] = tabLink;
          contentDivs[id] = document.getElementById( id );
        }
      }

      // Assign onclick events to the tab links, and
      // highlight the first tab
      var i = 0;

      for ( var id in tabLinks ) {
        tabLinks[id].onclick = showTab;
        tabLinks[id].onfocus = function() { this.blur() };
        if ( i == 0 ) tabLinks[id].className = 'selected';
        i++;
      }

      // Hide all content divs except the first
      var i = 0;

      for ( var id in contentDivs ) {
        if ( i != 0 ) contentDivs[id].className = 'tabContent hide';
        i++;
      }
    }

    function showTab() {
      var selectedId = getHash( this.getAttribute('href') );

      // Highlight the selected tab, and dim all others.
      // Also show the selected content div, and hide all others.
      for ( var id in contentDivs ) {
        if ( id == selectedId ) {
          tabLinks[id].className = 'selected';
          contentDivs[id].className = 'tabContent';
        } else {
          tabLinks[id].className = '';
          contentDivs[id].className = 'tabContent hide';
        }
      }

      // Stop the browser following the link
      return false;
    }

    function getFirstChildWithTagName( element, tagName ) {
      for ( var i = 0; i < element.childNodes.length; i++ ) {
        if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
      }
    }

    function getHash( url ) {
      var hashPos = url.lastIndexOf ( '#' );
      return url.substring( hashPos + 1 );
    }

function feedSet(feedTabId, feedURL) { 
	var xmlhttp=null;
	if (window.XMLHttpRequest) {
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp != null) {
		xmlhttp.open("GET", feedURL, true);
		xmlhttp.onreadystatechange = function () {
    			if (xmlhttp.readyState == 4) {
        			if (xmlhttp.status != 404) {
					items = xmlhttp.responseXML.getElementsByTagName('item');
					var buffer = '<table width=620>';
					for(var i = 0; i < items.length; i++) {
						var output = '<tr><td align=left><img src = "' + getNode('MediaItemThumbnailURL', i) + '" height = "90" width = "130" onclick = "RemoveStopScreen(\'flashobject\', false); LoadMediaItemInQueueAndPlay(\'flashobject\', \'' + getNode('MediaItemGuid', i) + '\');" /></td><td valign=top><strong>' + getNode('MediaItemName', i) +'</strong>  <br/>' + getNode('MediaItemDescription', i) + '</td></tr>';
						buffer += output;
					}
					buffer += '</table>';
					document.getElementById(feedTabId).innerHTML = buffer;
				} else {
               				alert("Failed to receive RSS file from the server - file not found");
        	       			return false;
               			}
            		}
		}
  		xmlhttp.send(null);
  	} else {
  		alert("Your browser does not support XMLHTTP");
  	}
}