	var autoPlay=false;
	var autoPlayTimer="";
	var mainImageSize;
	mainImageSize="_md";
	function startAutoPlay()
	{
		
		if(autoPlay==true)
		{
			document.getElementById('auto').innerHTML="stop";
			getNext();
			autoPlayTimer=setTimeout("startAutoPlay();",3000);
		}
		else
		{
			
		}
	}
	function setAutoPlay()
	{
		if(autoPlay==false)
		{
			autoPlay=true;
			startAutoPlay();
		}
		else if(autoPlay==true)
		{
			autoPlay=false;
			clearTimeout("autoPlayTimer");
			document.getElementById('auto').innerHTML="play";
		}
	}
	function getNext()
	{
		getNextThumb();
	}
	function getPrev()
	{
		getPrevThumb();
	}
	var currentThumbPage=1;
	function thumbPage(pageNumber)
	{
		if(pageNumber==1)
		{
			document.location.href=htmlRoot+"/";
		}
		else
		{
			document.location.href=htmlRoot+"/"+workPath+subCat+"-"+pageNumber+".php";
		}
		currentThumbPage=pageNumber;
	}
	function getNextThumbPage(totalPages)
	{
		if((currentWorkNumber+1)<=totalPages)
		{
			thumbPage(currentWorkNumber+1);
		}
		else
		{
			thumbPage(1);
		}
	}
	function getPrevThumbPage(totalPages)
	{
		if((currentWorkNumber-1)>=1)
		{
			thumbPage(currentWorkNumber-1);
		}
		else
		{
			thumbPage(totalPages);
		}
	}
	function setThumbNavColor()
	{
		if(document.getElementById("thumb1"))
		{
			document.getElementById("thumb1").style.color="#ffcc33";	
		}
	}
	
	
	
	


var nowShowing=false;
	function loadPicFromThumb(oThumb)
	{
		sURL = new String;
		bits = new Object;
		var x = 0;
		var stop = 0;
		var output = "/";
		sURL = oThumb.src;
		sURL = sURL.slice(8,sURL.length);
		chunkStart = sURL.indexOf("/");
		sURL = sURL.slice(chunkStart+1,sURL.length)
		
		while(!stop)
		{
			chunkStart = sURL.indexOf("/");
		 	if (chunkStart != -1)
			{
		   		bits[x] = sURL.slice(0,chunkStart)
		   		sURL = sURL.slice(chunkStart+1,sURL.length);
		 	}
			else
			{
		   		stop = 1;
			}
		 	x++;
		}
		for(var i in bits)
		{
			if(bits[i]=="thumb")
			{
			}
			else
			{
				output += bits[i] + "/";
			}
		}
		/*get filename*/
		var getLastSlash=oThumb.src.lastIndexOf("/");
		//highlight the thumb
		var topBorder=oThumb.parentNode;
		topBorder.style.borderStyle="solid"
		topBorder.style.borderColor="#666633";
		topBorder.style.borderWidth="1px";

		var getLastDot=oThumb.src.lastIndexOf(".");
		var getLastUnderscore=oThumb.src.lastIndexOf("_");
		filename=oThumb.src.slice(0,getLastUnderscore);
		filename=filename+mainImageSize;
		
		//top.document.getElementById('blowUp').src=output+"/"+filename+".jpg";
		var myImage = top.document.createElement("img");
		myImage.src=filename+".jpg";
		/*destroy existing image*/
		var foo=top.document.getElementById('blowUp');
		var container=top.document.getElementById('bigPic');
		container.removeChild(foo);
		//alert('just removed child');
		myImage.id="blowUp";
		//alert(myImage.id);
		//alert('here');
		var holder=top.document.getElementById('bigPic');
		//alert(holder.id);
		if(!(holder.appendChild))
		{
		}
		else
		{
			holder.appendChild(myImage);
		}
		
		if((nowShowing!==false))
		{
			var prevThumb=pageThumbs[nowShowing];
			prevThumb=prevThumb.parentNode;
			//prevThumb=prevThumb.parentNode;
			//
			//alert(prevThumb.tagName);
			prevThumb.style.borderStyle="solid"
			prevThumb.style.borderColor="#000000";
			prevThumb.style.borderWidth="1px";
		}
		//checkLoad();
		for(i=0;i<pageThumbs.length; i++)
		{
			if(oThumb.src==pageThumbs[i].src)
			{
				nowShowing=i;	
			}
		}
		loadInfoToTop(oThumb.parentNode);
	}
	function checkLoad()
	{
		//if(top.document.getElementById('blowUpShell').complete==true)
		//{
			//alert(top.document.getElementById('blowUp').width);
			//var setWidth=top.document.getElementById('blowUp').width;
			//var setHeight=top.document.getElementById('blowUp').height;
			//top.document.getElementById('blowUp').width=setWidth;
			//top.document.getElementById('blowUp').height=setHeight;
		//}
		//else
		//{
			setTimeout("checkLoad()",100);
		//}
	}
	var pageThumbs;
	pageThumbs=false;
	function setFirstThumb()
	{
		if(document.getElementById('thumbContainer'))
		{
			pageThumbs=document.getElementById('thumbContainer').getElementsByTagName('img');		
			loadPicFromThumb(pageThumbs[0]);
		}
	}
	function getNextThumb()
	{
		if(pageThumbs[nowShowing+1]!=undefined)
		{
			loadPicFromThumb(pageThumbs[nowShowing+1]);	
		}
		else
		{
			
			loadPicFromThumb(pageThumbs[0]);	
		}
	}
	function getPrevThumb()
	{
		
		if((nowShowing-1)<0)
		{
			loadPicFromThumb(pageThumbs[pageThumbs.length-1]);	
		}
		else
		{
			loadPicFromThumb(pageThumbs[nowShowing-1]);	
		}
	}
	function loadInfoToTop(descr)
	{//set any information about this item to the top
		var container=document.getElementById('descHolder');
		while ( container.childNodes.length >= 1 )
		{
			container.removeChild( container.firstChild );       
		} 
		var descriptionArray=new Array()
		descriptionArray["title"]="";
		descriptionArray["description"]="";
		descriptionArray["dimensions"]="";
		descriptionArray["material"]="";
		descriptionArray["firing"]="";
		descriptionArray["process2"]="";
		descriptionArray["category"]="";
		descriptionArray["year"]="";
		descriptionArray["price"]="";
		descriptionArray["current location"]="";
		if(descr.childNodes)
		{//access all child nodes
			for(i=0;i<descr.childNodes.length;i++)
			{//loop through them
				if(descr.childNodes[i].nodeName=="DIV")
				{//if it is a div, get the inner html
				
					for(j=0;j<descr.childNodes[i].childNodes.length;j++)
					{
						if(descr.childNodes[i].childNodes[j].nodeName=="DIV")
						{//if it is a div, get the inner html
							for(var oNode in descriptionArray)
							{
								//if(l==k)
								//{//and populate the proper text descriptor
									var nodeIndex=oNode.toLowerCase();
									if(descr.childNodes[i].childNodes[j].id.toLowerCase().lastIndexOf(nodeIndex)!=-1)
									//if(nodeIndex.lastIndexOf(descr.childNodes[i].id.toLowerCase())!=-1)
									{
										//alert(descr.childNodes[i].id.toLowerCase());
										descriptionArray[oNode]=descr.childNodes[i].childNodes[j].innerHTML;
									}
								//}
							}
						}
					}
				}
			}
		}
		//create the text to show
		l=0;
		for(var oNode in descriptionArray)
		{
			var newNodeLable=false;
			var newNode=false;
			var newNodeLable = top.document.createElement("div");
			newNodeLable.innerHTML=oNode;
			//newNodeLable.innerHTML="";
			newNodeLable.className="descLable";
			
			if(descriptionArray[oNode]=="")
			{
				
			}
			else
			{
				
				var newNode = document.createElement("div");
				newNode.innerHTML=descriptionArray[oNode];	
				newNode.className="descValue";
			}
			
			
			if(!(container.appendChild))
			{
			}
			else
			{
				if(newNode!=false)
				{
					//alert(container.appendChild);
					container.appendChild(newNodeLable);
					container.appendChild(newNode);
				}
			}

			l++;
		}
	}
	
	
	
	
	
	
	
	