var loadArray = new Array();
function loadPicArray(xmlFile)
{
//xmlFile = the file name of the xml file

// open the xml 

// var doc = new ActiveXObject("MSXML2.DOMDocument");
// doc.async = false;
// doc.load(xmlFile);
var doc = loadXMLDoc(xmlFile);
//check for errors
// if (doc.parseError.errorCode != 0)
// 		alert("error " + doc.parseError.reason);
var imageNodeList = new Array();

//get all the image nodes
 imageNodeList = doc.getElementsByTagName("image");

//loop through and add all the images to the array
 for (i=0;i<imageNodeList.length;i++)
 {
  loadArray[i] = imageNodeList(i).text;
 }
return loadArray;
}



function getTitle(xmlFile)
{

//xmlFile = the file name of the xml file

// open the xml 
var doc = loadXMLDoc(xmlFile);
//check for errors
// if (doc.parseError.errorCode != 0)
// 		alert("error " + doc.parseError.reason);
var imageNodeList = new Array();
//get all the image nodes
 imageNodeList = doc.getElementsByTagName("title");

return imageNodeList(0).text;
}



function loadXML(xmlFile, formName, selectName, area)
{
//read through an xml file and create drop down boxes complete with input buttons

//xmlFile = the file name of the xml file
//formName = the form name for the html
//selectName = the select name for the html
//area = the div id to write the html to

// initialize the variable to store all the options
 var optionPart = "";

var doc = loadXMLDoc(xmlFile);
//get all the text nodes		 
var textNodeList = new Array();
var HREFNodeList = new Array();
 textNodeList = doc.getElementsByTagName("text");

//and all the href nodes 
 HREFNodeList = doc.getElementsByTagName("href");

// store the form and select information
var firstPart =  '<form name="' + formName + '" method="post"><select name="' + selectName + '" size="1" onchange="location=document.' + formName + '.' + selectName + '.options[document.' + formName + '.'+ selectName + '.selectedIndex].value;">';

//loop through and add all the <option> data as retrieved from the xml doc
 for (i=0;i<textNodeList.length;i++)
 {
  optionPart = optionPart + '<option value="' + HREFNodeList[i].text + '">' + textNodeList[i].text + '</option> ';
 }

// add an input button and complete the form 


//var lastPart = '<input type="button" onclick="location=document.' + formName + '.' + selectName + '.options[document.' + formName + '.'+ selectName + '.selectedIndex].value;" value="GO"> </form>';

// write the html to the div id

//document.getElementById(area).innerHTML = firstPart + optionPart + lastPart;
document.getElementById(area).innerHTML = firstPart+ optionPart;
return false;
}



function loadSlideXML(xmlFile, formName, selectName, area)
{

//read through an xml file and create drop down boxes complete with input buttons

//xmlFile = the file name of the xml file
//formName = the form name for the html
//selectName = the select name for the html
//area = the div id to write the html to

// initialize the variable to store all the options
 var optionPart = "";

var doc = loadXMLDoc(xmlFile);
//check for errors
// if (doc.parseError.errorCode != 0)
// 		alert("error " + doc.parseError.reason);

var textNodeList = new Array();
var HREFNodeList = new Array();

//get all the text nodes		 
 textNodeList = doc.getElementsByTagName("text");

//and all the href nodes 
 HREFNodeList = doc.getElementsByTagName("value");

// store the form and select information
var firstPart =  '<form name="' + formName + '" method="post"><select name="' + selectName + '" size="1">';

//loop through and add all the <option> data as retrieved from the xml doc
 for (i=0;i<textNodeList.length;i++)
 {
  optionPart = optionPart + '<option value="' + HREFNodeList(i).text + '">' + textNodeList(i).text + '</option> ';
 }

// add an input button and complete the form 
var lastPart = '<input type="button" onclick="watchShow(document.' + formName + '.' + selectName + '.options[document.' + formName + '.'+ selectName + '.selectedIndex].value)" value="Watch the Show"> </form>';


// write the html to the div id

document.getElementById(area).innerHTML = firstPart + optionPart + lastPart;
return false;
}


function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
xmlDoc.load(dname);
return(xmlDoc);
} 

