var xmlDoc;
var xmlObj;

try { //Internet Explorer
	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e) {
	try{ //Firefox, Mozilla, Opera, etc.
    	xmlDoc=document.implementation.createDocument("","",null);
    }
  	catch(e) {
		alert("Gallery will not display. Not supported by this browser. Error: " + e.message);
    }
}

function loadXML(xmlFile){ 
	xmlDoc.async="false"; 
	xmlDoc.onreadystatechange=verify; 
	xmlDoc.load(xmlFile); 
	xmlObj=xmlDoc.documentElement; 
}

function verify(){ 
	// 0 Object is not initialized
	// 1 Loading object is loading data
	// 2 Loaded object has loaded data
	// 3 Data from object can be worked with
	// 4 Object completely initialized
	if (xmlDoc.readyState != 4)	{
		return false;
	}
}
				
function buildGallery(arg){
	for(i = 0; i < xmlObj.childNodes.length; i++){
		if(xmlObj.childNodes[i].tagName == arg){
			cn = xmlObj.childNodes[i];
			for(j = 0; j < cn.childNodes.length; j++){
				document.write('<img id="image-' + cn.childNodes[j].getAttribute("id") + '" src="' + cn.childNodes[j].text + '" />');
			}
		}
	}
}