


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');
}

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=''; 
  for (i=0; i<x.length; i++) { 
    Urls[i]=getTag("location"); Imgs[i]=getTag("image");  //getTag("title"); getTag("creator"); getTag("info");

    txt+='\n\t<div  onclick="play('+i+')" class="playlistlo" onmouseover="this.className = \'playlisthi\';" onmouseout="this.className = \'playlistlo\';">\n';
    txt+='\t\t<big>'+getTag("title")+'</big><br />\n';
    txt+='\t\t<img src="'+getTag("image")+'" width="90" height="68" alt="Click to Play">\n';
    txt+= '<p>' + getTag("annotation")+'</p>\n';
    txt+='\t</div>\n';
  }
   document.getElementById(thePlace).innerHTML=txt; 
}

function play(theMovie)
{
	var movieUrl;
	//alert('you want to watch ' + Urls[theMovie] + ' with image ' + Imgs[theMovie]);
	//alert('Your resolution is '+screen.width+'x'+screen.height);
	if (screen.width < 900) {
		movieUrl="movie-small.php";
	}
	else if (screen.width < 1100) {
		movieUrl="movie-med.php";
	}
	else {
		movieUrl="movie-large.php";
	}
	self.location = movieUrl+"?movie="+Urls[theMovie]+'&image='+Imgs[theMovie];
}
