function preview(x){

 if ( navigator.appName.indexOf('Explorer') == -1 )
{
    var xml = new XMLHttpRequest();     // Firefox, Safari, ...
	xml.open( 'GET', x, false );
    xml.onreadystatechange
    	{
	    xml.send(null);
	   	t = xml.responseText

		u = t.substr(t.indexOf('<title>'))
		u = u.substring(0, u.indexOf('</title>'))
		u = u.substring(0, u.lastIndexOf(' > '))
		u = u.substring(0, u.lastIndexOf(' > '))
		type = u.substring(u.lastIndexOf(' > ')+3)


		u = t.substr(t.indexOf('<title>'))
		u = u.substring(0, u.indexOf('</title>'))
		u = u.substring(0, u.lastIndexOf(' > '))
		platform = u.substring(u.lastIndexOf(' > ')+3)

		u = t.substr(t.indexOf('<title>'))
		game = u.substring(u.lastIndexOf(' > ')+3, u.indexOf('</title>'))

		document.write('<div class="" onmouseover="style.cursor=\'hand\'" onmouseout="style.cursor=\'pointer\'" OnClick="window.open(\'' + x + '\',\'_self\')"><H1>' + type + ': ' + game + ' on ' + platform + '</H1>')


		if (t.indexOf('<div style="text-align:center"><IMG')>-1)
		{
		u = t.substr(t.indexOf('<div style="text-align:center"><IMG')+31)
		u = u.substr(0, u.indexOf('"/>'))
		document.write(u + '" align="left" width="60px" style="margin:3px 10px 0px 10px;border:solid gray 3px"/>')
		}

		u = t.substr(t.indexOf('<p class="firstchar">')+21)
		u = u.substr(0, u.indexOf('</p>'))
		document.write('<p class=\"firstchar\" style=\"font-weight:normal\">' + u + '</p> ')

		q1 = t.substr(t.indexOf('<p class="callout">'))
		q2 = q1.substr(20)
		if (q1.indexOf('<p class="callout">') > -1)
		{

			q1 = q1.substring(19,q1.indexOf('</p>'))
			document.write('<p class="news" >Highlights:</p><p class="news" style="padding-left:10px">"'+ q1 + '"</p>')
		}


		q2 = q2.substr(q2.indexOf('<p class="callout">'))
		if (q2.indexOf('<p class="callout">') > -1)
		{
			q2 = q2.substring(19,q2.indexOf('</p>'))
			document.write('<p class="news" style="padding-left:10px">"'+ q2 + '"</p>')

		}
			document.write('<p style="padding-bottom:4px;border-bottom:dashed gray 1px;text-align:right">'+ document.lastModified + ' ...<a>read</a></p></div>')


		}
}

else
 if ( navigator.appName.indexOf('Explorer') > -1 )
 {
	var xml = new ActiveXObject("Microsoft.XMLHTTP");
	xml.Open( "GET", x, false );
	xml.Send()
	t = xml.responseText
		u = t.substr(t.indexOf('<title>'))
		u = u.substring(0, u.indexOf('</title>'))
		u = u.substring(0, u.lastIndexOf(' > '))
		u = u.substring(0, u.lastIndexOf(' > '))
		type = u.substring(u.lastIndexOf(' > ')+3)


		u = t.substr(t.indexOf('<title>'))
		u = u.substring(0, u.indexOf('</title>'))
		u = u.substring(0, u.lastIndexOf(' > '))
		platform = u.substring(u.lastIndexOf(' > ')+3)

		u = t.substr(t.indexOf('<title>'))
		game = u.substring(u.lastIndexOf(' > ')+3, u.indexOf('</title>'))

		document.write('<div class="" onmouseover="style.cursor=\'hand\'" onmouseout="style.cursor=\'pointer\'" OnClick="window.open(\'' + x + '\',\'_self\')"><H1>' + type + ': ' + game + ' on ' + platform + '</H1>')


		if (t.indexOf('<div style="text-align:center"><IMG')>-1)
		{
		u = t.substr(t.indexOf('<div style="text-align:center"><IMG')+31)
		u = u.substr(0, u.indexOf('"/>'))
		document.write(u + '" align="left" width="60px" style="margin:3px 10px 0px 10px;border:solid gray 3px"/>')
		}

		u = t.substr(t.indexOf('<p class="firstchar">')+21)
		u = u.substr(0, u.indexOf('</p>'))
		document.write('<p class=\"firstchar\" style=\"font-weight:normal\">' + u + '</p> ')

		q1 = t.substr(t.indexOf('<p class="callout">'))
		q2 = q1.substr(20)
		if (q1.indexOf('<p class="callout">') > -1)
		{

			q1 = q1.substring(19,q1.indexOf('</p>'))
			document.write('<p class="news" >Highlights:</p><p class="news" style="padding-left:10px">"'+ q1 + '"</p>')
		}


		q2 = q2.substr(q2.indexOf('<p class="callout">'))
		if (q2.indexOf('<p class="callout">') > -1)
		{
			q2 = q2.substring(19,q2.indexOf('</p>'))
			document.write('<p class="news" style="padding-left:10px">"'+ q2 + '"</p>')

		}
			document.write('<p style="padding-bottom:4px;border-bottom:dashed gray 1px;text-align:right">'+ document.lastModified + ' ...<a>read</a></p></div>')


		}
}

// main function to process the fade request //
function colorFade(id,element,start,end,steps,speed) {
  var startrgb,endrgb,er,eg,eb,step,rint,gint,bint,step;
  var target = document.getElementById(id);
  steps = steps || 20;
  speed = speed || 20;
  clearInterval(target.timer);
  endrgb = colorConv(end);
  er = endrgb[0];
  eg = endrgb[1];
  eb = endrgb[2];
  if(!target.r) {
    startrgb = colorConv(start);
    r = startrgb[0];
    g = startrgb[1];
    b = startrgb[2];
    target.r = r;
    target.g = g;
    target.b = b;
  }
  rint = Math.round(Math.abs(target.r-er)/steps);
  gint = Math.round(Math.abs(target.g-eg)/steps);
  bint = Math.round(Math.abs(target.b-eb)/steps);
  if(rint == 0) { rint = 1 }
  if(gint == 0) { gint = 1 }
  if(bint == 0) { bint = 1 }
  target.step = 1;
  target.timer = setInterval( function() { animateColor(id,element,steps,er,eg,eb,rint,gint,bint) }, speed);
}

// incrementally close the gap between the two colors //
function animateColor(id,element,steps,er,eg,eb,rint,gint,bint) {
  var target = document.getElementById(id);
  var color;
  if(target.step <= steps) {
    var r = target.r;
    var g = target.g;
    var b = target.b;
    if(r >= er) {
      r = r - rint;
    } else {
      r = parseInt(r) + parseInt(rint);
    }
    if(g >= eg) {
      g = g - gint;
    } else {
      g = parseInt(g) + parseInt(gint);
    }
    if(b >= eb) {
      b = b - bint;
    } else {
      b = parseInt(b) + parseInt(bint);
    }
    color = 'rgb(' + r + ',' + g + ',' + b + ')';
    if(element == 'background') {
      target.style.backgroundColor = color;
    } else if(element == 'border') {
      target.style.borderColor = color;
    } else {
      target.style.color = color;
    }
    target.r = r;
    target.g = g;
    target.b = b;
    target.step = target.step + 1;
  } else {
    clearInterval(target.timer);
    color = 'rgb(' + er + ',' + eg + ',' + eb + ')';
    if(element == 'background') {
      target.style.backgroundColor = color;
    } else if(element == 'border') {
      target.style.borderColor = color;
    } else {
      target.style.color = color;
    }
  }
}

// convert the color to rgb from hex //
function colorConv(color) {
  var rgb = [parseInt(color.substring(0,2),16), 
    parseInt(color.substring(2,4),16), 
    parseInt(color.substring(4,6),16)];
  return rgb;
}



function listing(z, y, w)
{

// global flag
var isIE = false;
var o = ""



if (typeof y === "undefined") {y = "output"}

if (typeof w === "undefined") {w = "20"}

// global request and XML document objects
var req;

function loadXMLDoc(url) {
    // branch for native XMLHttpRequest object

    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}

function processReqChange() {
    // only if req shows "loaded"

    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {


        var x = req.responseXML.getElementsByTagName("item");
		count = 0

		for (var i=0;i< x.length;i++)
			{
			if (count < w)
			{

					s = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue
					t = s.substring(s.indexOf(" >")+3)
					t = t.substring(t.indexOf(" >")+3)


					console = t.substring(t.indexOf(" >")+3)
					console = console.substring(0, console.indexOf(" >"))
					
					writer = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue
					writer = writer.substring(writer.indexOf(" >")+3)
					writer = writer.substring(0, writer.indexOf(" >"))
					
					stream = s.substring(s.indexOf(" >")+3)
					stream = stream.substring(0, stream.indexOf(" >"))
					
	if (stream == "Dad Writing Gamer") streamlink = "paulgovan.htm"
	if (stream == "Dad Race Gamer") streamlink = "jonstrakey.htm"
	if (stream == "Twenties Sports Gamer") streamlink = "davidkenson.htm"
	if (stream == "Dad Fitness Gamer") streamlink = "lukepyper.htm"
	if (stream == "Eclectic Gamer Wife") streamlink = "clareswindlehurst.htm"
	if (stream == "Dad Engrossed Gamer") streamlink = "domroberts.htm"
	if (stream == "Twenties Returning Gamer") streamlink = "hedleycook.htm"
	if (stream == "Teen Gamer") streamlink = "rowanbrown.htm"
	if (stream == "Teen Paper Craft Gamer") streamlink = "lottierose.htm"
	if (stream == "Teen Singing Gamer") streamlink = "rebeccamayes.htm"
	if (stream == "Twenties Tech Gamer") streamlink = "simonbarker.htm"
	if (stream == "Mum Domestic Gamer") streamlink = "josiecampbell.htm"
	if (stream == "Dad Teaching Gamer") streamlink = "melrosefish.htm"
	if (stream == "Scared Gamer") streamlink = "shaunrudley.htm"	
	if (stream == "Tech Gamer") streamlink = "simonbarker.htm"	
	if (stream == "Emotional Dad Gamer") streamlink = "adamstanding.htm"	
	
						
	
					link = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue

					
					
					image = link.substring(link.indexOf("_")+1,link.lastIndexOf(".")) + "_pack.jpg"
					

					try
					{
					date = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue
					date = date.substring(0, date.indexOf("+")-10)
					}
					catch(err)
					{
					date = "Sat, 09 May 2009"
					}


					try
					{
					c = x[i].getElementsByTagName("content")[0].childNodes[0].childNodes[0].nodeValue
					}
					catch(err)
					{
					c = ""
					}

					try
					{
					gl = x[i].getElementsByTagName("genre")[0].childNodes[0].nodeValue
					g = gl.substring(0,1).toUpperCase() + gl.substring(1,gl.length)
					g = '<a href="genres_'+ gl + '.htm">' + g
					}
					catch(err)
					{
					g = ""
					gl= ""
					}
					
					if (s.indexOf("Article >") > -1) {g = '<a href="paulgovan_archive.htm">Editorial'}
					
					o = o + '<div id="wrapper" OnClick="window.open(\'' + link + '\',\'_self\')"><div id="header"><h1 style="margin-top:20px">' + t + '<br/><span style="font-size:10pt;font-weight:normal"> Related to: <a href="console_' + console.toLowerCase() +'.htm">' + console + '</a> <a href="'+ streamlink +'">' + stream + '</a> <a href="genres_'+ gl + '.htm">' + g + '</a></span></h1></div><div id="content"><div id="navigation"><img width="120px" style="margin:3px 10px 0px 10px;border:solid gray 3px" src="'+ image +'"/></div><p>' + c + '</p></div><div id="extra"><div style="margin-bottom:10px"><div style="padding-bottom:4px;border-bottom:dashed gray 1px;text-align:left;padding-left:10px">Posted: ' + date + '</div><div style="font-size:12pt;font-weight:normal;margin-top:-30px">Share:  <a style="border:0px" href="http://del.icio.us/post?url=' + link + '"><img border="0" src="icon_delicious.gif"> </a> <a style="border:0px" href="http://digg.com/submit?url=' + link + '"><img border="0" src="icon_digg.gif"> </a> <a style="border:0px" href="http://www.stumbleupon.com/submit.php?url=' + link + '"><img border="0" src="icon_stumbleupon.gif"></a> <a style="border:0px" href="http://www.facebook.com/sharer.php#/sharer.php?u=' + link + '"><img border="0" src="icon_fs.gif"></a></div></div></div></div>'
					count = count + 1
			}

			}
	
		document.getElementById(y).innerHTML = o
         } else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
         }
    }
}

       loadXMLDoc(z);
}
