	var iId = "3";
	var oXmlHttp = null;	
	var functionOver = "return displayImageAlt(this);";
  var s = null;
  
	function Gallery()
	{	 
	  this._sax = new Sax("/gallery.xml");
	  this._sax.target = Gallery_HandleResponse;
	}
	
	Gallery.prototype.GetImages = function(ddlist_)
	{	  
		// remove all the images that were added previously
		var myList = document.getElementById("trImages");
		if (null != myList)
		{
		  while (myList.firstChild)
		  {
			  myList.removeChild(myList.firstChild);
		  }
		}
		
		iId = ddlist_.value;
	
		if (this._sax.HasResponse())
		{
			// not necessary to make a new request for each change.
			Gallery_HandleResponse(this._sax);
		}
		else
		{
		  this._sax.SendRequest();
		}
	}
	
	function Gallery_HandleResponse(sax_)
	{
		if (sax_.HasResponse())
		{
			UpdateOrderSamples(iId);
	
			var strXPath = "/GALLERY/PRODUCT[@ID=" + iId + "]/IMAGE";
			var xnodeList = sax_.xmlHttp.responseXML.selectNodes(strXPath);			
			if (xnodeList.length > 0)
			{
				var strAltText = getAttributeValue(xnodeList[0], "ALT");
				var imgPhoto = document.getElementById("photo");
				imgPhoto.alt = strAltText;
				imgPhoto.title = strAltText;
				imgPhoto.src = "/_images/gallery/" + getNodeText(xnodeList[0]) + ".jpg";				
				if (document.all)
				{
					imgPhoto["onmouseover"]  = new Function(functionOver);
					imgPhoto["onmouseout"]  = new Function(functionOut);
				}
				else
				{
					imgPhoto.setAttribute("onmouseover", "functionOver");
					imgPhoto.setAttribute("onmouseout", functionOut);
				}
				
				for( var i = 0; i < xnodeList.length;	i++)
				{
					Gallery_AddItemToList(xnodeList[i]);
				}
			}
		}
	}

  function Gallery_AddItemToList(node_)
	{
	//alert("I'm in here.");
		var strImageUrl = getNodeText(node_);
		var myList = document.getElementById("trImages");		
		
		var anchorItem = document.createElement("a");
		var strAltText = getAttributeValue(node_, "ALT");
		
		anchorItem.href = "javascript:;";
		if (document.getElementById)
		{			
			var functionChangeImage = "return changeImage(\"photo\", \"/_images/gallery/" + strImageUrl + ".jpg\", \"" + strAltText + "\");";
			
			//workaround for IE 5.x<BR>
			if (document.all)
			{
				anchorItem["onclick"] = new Function(functionChangeImage);
			}
			else
			{
				anchorItem.setAttribute("onclick", functionChangeImage);
			}
		}
				
		var imgItem = document.createElement("img");
		imgItem.src = "_images/gallery/" + strImageUrl + "_thumb.jpg";
		imgItem.alt = strAltText;
		imgItem.title = strAltText;
		imgItem.width = "60";
		imgItem.height = "60";
		imgItem.border = "0";
		
		if (document.all)
		{
			imgItem["onmouseover"] = new Function(functionOver);
			imgItem["onmouseout"]  = new Function(functionOut);
		}
		else
		{		
			imgItem.setAttribute("onmouseover", "functionOver");
			imgItem.setAttribute("onmouseout", functionOut);
		}
		
		anchorItem.appendChild(imgItem);

		var tdItem = document.createElement("td");
		tdItem.appendChild(anchorItem);
		
		myList.appendChild(tdItem);
	}	