// JavaScript Document - works for IE & Mozilla; not updated for Safari
var moz = (typeof(document.implementation) != 'undefined') && (typeof(document.implementation.createDocument) != 'undefined'); 
var ie = (typeof(window.ActiveXObject) != 'undefined'); 
var xmlDoc;
var par = 'quote';
var wow="&quot;Women may be the one group that grows more radical with age.&quot; &mdash; Gloria Steinam";

function importXML(file) { 
 if (moz) { 
		 xmlDoc = document.implementation.createDocument("", "", null) 
		 xmlDoc.load(file); 
		 xmlDoc.onload = readXML; 
	 } else if (ie) { 
		 xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
		 xmlDoc.load(file); 
		 xmlDoc.onreadystatechange = function () { if (xmlDoc.readyState == 4) readXML };
	 } 
		else
	 {
			return false;
	 }
	 return;
}

function readXML() {
	var x=((xmlDoc.documentElement.childNodes.length)-1)/2;
	if (x>0) {
	//Random quote
		var y=Math.round(Math.random()*(x-1));
		var qt=(xmlDoc.documentElement.getElementsByTagName(par)[y]).childNodes[1].textContent;
		qt=qt.replace("'", "\'");
		var au=(xmlDoc.documentElement.getElementsByTagName(par)[y]).childNodes[3].textContent;
		au=au.replace("'", "\'");
		
		wow = '&quot;'+qt+'&quot; <BR /><BR />&mdash '+au;
	}
	document.getElementById("sbrquotes").innerHTML=wow;

}

/*
	This section utilizes Spry to pole data from xml file and display random record
	
	totrecs - Total number of quotes in xml file; must update this number if adding or subtracting quotes from file.
	
	all variables are global to page document.
*/
var totrecs=14;
var rnd=Math.floor(Math.random()*(totrecs));
var wow = new Spry.Data.XMLDataSet("js/wow.xml", "quotelist/quote[@id="+rnd+"]");
