
function quicklinks()
{

var xmlDoc=null;
if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle the Quick Links script.');
}

if (xmlDoc!=null)
{ 
xmlDoc.async=false;
xmlDoc.load("messages.xml");

var x=xmlDoc.getElementsByTagName("LINK");

var usednums=new Array(); // creates array

// the output below sets the starting div and top graphics, this allows for it to not display if JS is turned off
document.write("<div>&nbsp;</div>");  
//document.write("<img src=\"images/qlinks.jpg\" alt=\"Quick Links\" />");
//document.write("<hr class=\"ruler\" />");
document.write("<div id=\"quick\">");

var linkscount=x.length; // finds the total number of links in the XML file, later used to calculate the random number
var totlinks=linkscount-1;  // subtract 1, I guess nodes are numbered the same way as an array?
// the line above has caused the script to stop working like once every 20 refreshes, to fix this I subtracted 1

for (i=0;i<3;i++) // Allows for 5 links to show
{

var rannum=i;
/*var rannum=Math.round(Math.random()*totlinks);  // sets random number using the total number of nodes in the xml file

var n = usednums.length;  // counts the previously used numbers
for (var j=0; j<n; j++)
  {
	if (usednums[j]==rannum) // compares used numbers to the current random number
	{
		var rannum=Math.round(Math.random()*totlinks);  // resets random number because it has already been used
		j=0;  // sets counter to 0 to recheck the new random number
	}
  }

usednums[i]=rannum; // enters the random number in the array
*/
//document.write("<a href=\"");
//document.write(x[rannum].getElementsByTagName("HREF")[0].childNodes[0].nodeValue);
//document.write("\">");

document.write(x[rannum].getElementsByTagName("TEXT")[0].childNodes[0].nodeValue);
document.write("<br/><br/>");
//document.write("</a>");
}

document.write("</div>");  // outputs closing div tag


var tryDate = x[4].getElementsByTagName("EXPDATE")[0].childNodes[0].nodeValue;
if (tryDate != undefined)
{
document.write("contains data");
}
else
{
document.write("does not");
}





var d=new Date();
var day=d.getDate();
var month=d.getMonth() + 1;
var year=d.getFullYear();

var expDate = x[1].getElementsByTagName("EXPDATE")[0].childNodes[0].nodeValue;
var currDate = month + "/" + day + "/" + year;

document.write("currDate: " + currDate);
document.write("expDate: " + expDate);

if (Date.parse(expDate) > Date.parse(currDate)) 
{
document.write("expired");
}
else
{
document.write("still good");
}




}

}
