
var GN_IE = (document.all) ? true : false;
var GN_MOZ = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');

var xmlData;
var xslIndexStylesheet;
var xslListStylesheet;
var xmlReorder;


function test()
{

}

function document_load ()
{

}

function load_stories ()
{
	if (GN_MOZ)
	{
		xmlData = document.implementation.createDocument("", "doc", null);
		xmlData.addEventListener('load', load_stories_2, false); 
		
		xslIndexStylesheet = document.implementation.createDocument("", "doc", null);
		xslIndexStylesheet.addEventListener('load', load_stories_3, false); 
		
		xslListStylesheet = document.implementation.createDocument("", "doc", null);
		xslListStylesheet.addEventListener('load', load_stories_4, false); 
		
		xmlReorder = new XSLTProcessor();
		
		xmlData.load('stories/stories.xml'); 
	}
	if (GN_IE)
	{
		xmlData = new ActiveXObject("Microsoft.XMLDOM");
		xmlData.async = false;
		xmlData.load('stories/stories.xml');
	
		xslIndexStylesheet = new ActiveXObject("Microsoft.XMLDOM");
		xslIndexStylesheet.async = false;
		xslIndexStylesheet.load('stories/storyindex.xsl');
	
		xslListStylesheet = new ActiveXObject("Microsoft.XMLDOM");
		xslListStylesheet.async = false;
		xslListStylesheet.load('stories/storylist.xsl');

		xmlReorder = new ActiveXObject("Microsoft.XMLDOM");
		xmlData.transformNodeToObject(xslIndexStylesheet, xmlReorder);
		idINDEXES.innerHTML = xmlReorder.xml;

		xmlData.transformNodeToObject(xslListStylesheet, xmlReorder);
		idLISTINGS.innerHTML = xmlReorder.xml;
	}
}

function load_stories_2()
{
	//alert (xmlData);
	//alert (xmlData.xml);
	xslIndexStylesheet.load('stories/storyindex.xsl');
}

function load_stories_3()
{
	//alert (xslIndexStylesheet);
	//alert (xslIndexStylesheet.xml);
	xslListStylesheet.load('stories/storylist.xsl');
}
function load_stories_4()
{
	idINDEXES.innerHTML = "Sorry buy Mozilla isn't currently supported!";

	alert (xslListStylesheet);
	//alert (xslListStylesheet.xml);
		
	//alert (xmlReorder);
	//transformToFragment
	xmlReorder.importStylesheet(xslIndexStylesheet);
	//alert (xmlReorder);
	
	var newDocument = xmlReorder.transformToDocument(xmlData);
	
	//alert (newDocument);

	//xmlData.transformNodeToObject(xslIndexStylesheet, xmlReorder);
	//alert (xmlData.transformNode(xslIndexStylesheet)); 
		
	//alert (xmlReorder);
	//alert (xmlReorder.xml);
		
	idINDEXES.innerHTML = xmlReorder.xml;


}

function check_contact(poForm)
{
	if (poForm.idname.value=="")
	{
		poForm.idname.focus();
		alert ("You must enter a Name so we know who you are!");
		return(false);
	}
	if (poForm.idemail.value=="")
	{
		poForm.idemail.focus();
		alert ("You must enter an Email Address so we can contact you!");
		return(false);
	}
	if (poForm.idmessage.value=="")
	{
		poForm.idmessage.focus();
		alert ("You must enter a Message, so we know what you want!");
		return(false);
	}
}