// JavaScript Document
xmlsrc="mobile.xml";

var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET", xmlsrc, false);
xmlhttp.send(null);
var xmlDoc = xmlhttp.responseXML.documentElement;
var x=xmlDoc.getElementsByTagName("ITEM");


function parseXML()	{
		try //Internet Explorer
		  {
		  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		  }
		catch(e)
		  {
		  try //Firefox, Mozilla, Opera, etc.
			{
//		xmlsrc="widgets.xml";
//		var xmlhttp = new window.XMLHttpRequest();
//		xmlhttp.open("GET", xmlsrc, false);
//		xmlhttp.send(null);
		var xmlDoc = xmlhttp.responseXML.documentElement;
			}
		  catch(e)
			{
			alert(e.message);
			return;
			}
		  }
}


function show(i)
        {
			agency=(x[i].getElementsByTagName("AGENCY")[0].childNodes[0].nodeValue);
			title=(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
			dateadded=(x[i].getElementsByTagName("DATEADDED")[0].childNodes[0].nodeValue);
			descr=(x[i].getElementsByTagName("DESCRIPTION")[0].childNodes[0].nodeValue);
			rating=(x[i].getElementsByTagName("RATING")[0].childNodes[0].nodeValue);
			dlink=(x[i].getElementsByTagName("LINK")[0].childNodes[0].nodeValue);
			image=(x[i].getElementsByTagName("IMAGE")[0].childNodes[0].nodeValue);
			
			spotlightImg = "<img src='images/icons/"+image+"' class='image'>";
			
			// <img src='images/star_"+rating+".gif'><br />
			
			txt="<div class='dh'>"+title+"</div><div class='dsh'>"+agency+"</div><p>"+descr+"<p />";
			
			document.getElementById("spotlightImage").innerHTML=spotlightImg;
	
			
			// <img src='images/star_"+rating+".gif'><br />
			
			txt="<div class='dh'>"+title+"</div><div class='dsh'>"+agency+"</div><p>"+descr+"<p />";
			
			downloadlinktxt="<div class='dh'><a href="+dlink+" target='blank'><img src='images/forms/button_download.gif' alt='Download' /></a>";
			document.getElementById("details").innerHTML=txt;
			document.getElementById("downloadlink").innerHTML=downloadlinktxt;
		}
		
		
		function filterResults(type,category) {
			var category = 'do'
			for (var i=0;i<x.length;i++)
			{ 
				var catSelect = x[i].getElementsByTagName("CATEGORY")[0].childNodes[0].nodeValue;
//catSelect==category
				if (category!='') {
					document.write("<tr onclick='selectRow(this);show(" + i + ")' class='result_row' onmouseover='hover(this);' onmouseout='dehover(this)'>");
					document.write("<td><h3>");
					document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
					document.write("</h3>");
					document.write(x[i].getElementsByTagName("AGENCY")[0].childNodes[0].nodeValue);
					document.write("</td>");
					
					document.write("<td>");
					document.write(x[i].getElementsByTagName("CATEGORY")[0].childNodes[0].nodeValue);
					document.write("</td>");
					
					document.write("<td>");
					document.write(x[i].getElementsByTagName("TYPE")[0].childNodes[0].nodeValue);
					document.write("</td>");
	
/*
					document.write("<td><img src='images/star_");
					document.write(x[i].getElementsByTagName("RATING")[0].childNodes[0].nodeValue);
					document.write(".gif'></td>");
				
					document.write("<td>");
					document.write(x[i].getElementsByTagName("DATEADDED")[0].childNodes[0].nodeValue);
					document.write("</td>");
*/
					
					document.write("<td align=center>");
					document.write("<img src='images/buttons/button_viewdetails.gif' alt='Get It'>");
					document.write("</td>");
					
					document.write("</tr>");
				}
			}
		}
		
