var responseText;
function xmlhttpGet(strURL, strSubmit, strResultFunc,id) {

        var xmlHttpReq = false;
        // IE
        if (window.ActiveXObject) {
                xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        // Mozilla/Safari
        else if (window.XMLHttpRequest) {
                xmlHttpReq = new XMLHttpRequest();
                xmlHttpReq.overrideMimeType('text/xml');
        }
        xmlHttpReq.open('GET', strURL, true);
        xmlHttpReq.setRequestHeader('Content-Type','text/html');
        xmlHttpReq.onreadystatechange = function() {
                if (xmlHttpReq.readyState == 4) {
                	//performing our things
                	responseText=xmlHttpReq.responseText;
                	eval(strResultFunc+"(responseText,'"+id+"')")
                 }
        }
        xmlHttpReq.send(strSubmit);
}

function callbackWrapper(responseText,obj){
	var xml=getXML(responseText);
	buildList(xml);
}
function buildList(xml){
	//preparing some major elements
	ul=document.createElement('ul');
	div=document.getElementById('playlist');
	items=xml.getElementsByTagName('item');
	
	for(i=0;i<items.length;i++){
		li=document.createElement('li');
		img=document.createElement('img');
		span=document.createElement('span');
		a=document.createElement('a');
		big=document.createElement('big');
		img.src=getNodeValue(items[i],'thumb');
		big.innerHTML=getNodeValue(items[i],'title');
		span.innerHTML=getNodeValue(items[i],'description');
		a.href='javascript:void(null);';
		a.title=getNodeValue(items[i],'playertext');
		a.onclick=function(){showFlash('showplace',this.id,this.title)};
		a.id=getNodeValue(items[i],'link');
		
		a.appendChild(img);
		a.appendChild(big);
		a.appendChild(span);
		li.appendChild(a);
		ul.appendChild(li)
		
		if(i==0){
			first=a;
		} 
	}
	div.appendChild(ul);
	if(items.length>0) showFlash('showplace',first.id,first.title);
	
}
function getNodeValue(obj,tag)
{	
	return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
}
function prepare(url){
	xmlhttpGet(url, '', "callbackWrapper",'');
}

function showFlash(id,src,text){
	var fo = new FlashObject(src, "graph", 400, 312, "7", "#F4EED6");
	fo.write(id);
	//text.replace('||','<br>');
	document.getElementById(id).innerHTML+='<div class="playertext">'+text.replace('||','<br>')+'</div>'
/*	
	var div=document.getElementById(id);
	var xmlIc=document.createElement('object');
	xmlIc.setAttribute('type','application/x-shockwave-flash');
	xmlIc.setAttribute('data', '');
	xmlIc.data=src;
	xmlIc.setAttribute('width', '');
	xmlIc.width="400";
	xmlIc.setAttribute('height','');
	xmlIc.height="500";
	
	var paramIc=document.createElement('param');
	paramIc.setAttribute('name','');
	paramIc.name="movie";
	paramIc.setAttribute('value','');
	paramIc.value=src;
	xmlIc.appendChild(paramIc);
	while (div.firstChild){
		div.removeChild(div.firstChild);
	}
	div.appendChild(xmlIc);
*/
	//tt=document.getElementById('interactive');
	//tt.LoadMovie(0, src);
}

function getXML(text){
if (window.ActiveXObject)
  {
  var doc=new ActiveXObject("Microsoft.XMLDOM");
  doc.async="false";
  doc.loadXML(text);
  }
// code for Mozilla, Firefox, Opera, etc.
else
  {
  var parser=new DOMParser();
  var doc=parser.parseFromString(text,"text/xml");
  }
return doc;
}