    var xmlDoc;
    function loadxml(file)
    {
        path = "scroll/xml/" + file + ".xml";
        xmlDoc=loadXMLDoc(path);
        x=xmlDoc.documentElement.childNodes;
        random = xmlDoc.getElementsByTagName("random")[0].childNodes[0].nodeValue;
        items = xmlDoc.getElementsByTagName("productid");
        values = new Array;
        for (i = 0; i < items.length; i++){
            tmp = new Array;
            tmp['productid'] = xmlDoc.getElementsByTagName("productid")[i].childNodes[0].nodeValue;
            tmp['productname'] = xmlDoc.getElementsByTagName("productname")[i].childNodes[0].nodeValue;
            tmp['artistname'] = xmlDoc.getElementsByTagName("artistname")[i].childNodes[0].nodeValue;
            tmp['zoomedimage'] = xmlDoc.getElementsByTagName("zoomedimage")[i].childNodes[0].nodeValue;
            tmp['thumbimage'] = xmlDoc.getElementsByTagName("thumbimage")[i].childNodes[0].nodeValue;
            tmp['artiststore'] = xmlDoc.getElementsByTagName("artiststore")[i].childNodes[0].nodeValue;
            values[i] = tmp;
	}
        
       

html = "";



if(random == 'yes'){
    values.sort(function() {return 0.5 - Math.random()}); //Array elements now scrambled
}

        for(i = 0; i < values.length; i++){
            tmp = values[i];
            html += '<div>\n' +
                '<table border="0"><tr><td>' +
                '<a href="' + tmp['zoomedimage'] + '">' +
                '<img src="' + tmp['thumbimage'] + '" width="226" height="226"></a>' +
                '</td>' +
                '</tr>' +
                '<tr><td><a href="http://www.iscrapbook.com/store/product' + tmp['productid'] + '.html" class="mainpagelink"><strong>' + tmp['productname'] + '</strong></a></td></tr>' +
                '<tr><td><a class="mainpagelink" href="' + tmp['artiststore'] + '">' + tmp['artistname'] + '</a></td></tr>' +
                '</table>\n' +
                '</div>\n';
            //alert(tmp['productid'] + ": " + tmp['productname']);
            
        }


      


return html;
    }
 

function loadXMLDoc(dname){
    var xmlDoc;
    if (window.XMLHttpRequest)
      {
      xmlDoc=new window.XMLHttpRequest();
      xmlDoc.open("GET",dname,false);
      xmlDoc.send("");
      return xmlDoc.responseXML;
      }

    alert("Error loading document");
    return null;
}


