function importXML(theFile) {
	if ((document.implementation)&&(document.implementation.createDocument)) {
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = loaded;
	} else if (window.ActiveXObject) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function() { if (xmlDoc.readyState == 4) loaded() }; 
	} else { alert('Sorry, your browser can\'t handle this script'); return; }

	xmlDoc.load(theFile);
}


function loaded() {	
  showTags('track','writeroot');
  createPlayer(Urls[0], Imgs[0], false, true);
}


var Urls = new Array();
var Imgs = new Array();

function showTags(theTag,thePlace) {

  function getTag(tag) { 
    var tmp='';
    xx=x[i].getElementsByTagName(tag);     
    try { tmp=xx[0].firstChild.data; } 
    catch(er) { tmp=''; }    
    return(tmp); 
  }

  var xx; var x; var txt;
  x = xmlDoc.getElementsByTagName(theTag);
  txt='<table border="0" cellPadding="2" width="150">'; 

  for (i=0; i<x.length; i++) { 
    Urls[i]=getTag("location"); Imgs[i]=getTag("image"); //getTag("title"); getTag("creator"); getTag("info");

    txt+='<tr><td><table onclick="play('+i+')" class="playlistlo" style="border-bottom:1px #ccc dashed; margin-bottom:10px;"	 onmouseover="this.className = \'playlisthi\';" onmouseout="this.className = \'playlistlo\';"><tr>';
    txt+='<td><center><img src="'+getTag("image")+'" width="95" height="68" style="padding:2px; background=#fff;" border="1" alt="Click to Play"></center></td></tr><tr><td width="150" valign=top>';
    txt+='<p><b>'+getTag("title")+'</b><br>';
   txt+='&nbsp;&copy; '+getTag("creator")+'<br>';
 //   txt+='&nbsp;'+getTag("date");
    txt+='</td></tr></table></td></tr>';
  }
  txt+="</table>";

  document.getElementById(thePlace).innerHTML=txt; 
}



function createPlayer(theFile, theImg, start, icons) {
	var s1 = new SWFObject('mediaplayer1.swf','mpl','400','320','8');
	s1.addParam("allowfullscreen", "true");
	s1.addParam('menu','false');
	s1.addVariable("file", theFile);
	s1.addVariable("width", "400");
	s1.addVariable("height", "320");
	s1.addVariable('backcolor','0x000000');
	s1.addVariable('frontcolor','0xFFFFFF');
	s1.addVariable('lightcolor','0x009999');
	s1.addVariable('screencolor','0x000000');
	s1.addVariable('bufferlength','1');
	s1.addVariable('searchbar','false');	
/*	s1.addVariable("autostart", "true");*/
	if (start) s1.addVariable("autostart", "true"); 
	if (! icons) s1.addVariable("showicons", "false");
	if (theImg != "") s1.addVariable("image", theImg);

	s1.write("placeholder");
}

function play(number) { 
  createPlayer(Urls[number], Imgs[number], true, true);
}


