
function rungal()
{
bigRoot = document.getElementById("gal");
num = bigRoot.childNodes.length;
		z = 0;
		for (i=0; i<num; i++) 
		{
			node = bigRoot.childNodes[i];
			if (node.nodeName=="SPAN")
			{
				z = z + 1;
			}
		}

		
		for (i=1; i<=z; i++) 
		{
			smallRoot = document.getElementById("d"+i);
			num2 = smallRoot.childNodes.length;
				
				for (x=0; x<num2; x++)
				{
			
					node = smallRoot.childNodes[x];
					if (node.nodeName=="A")
					{
				
						node.onclick=function()
						{
							change (this.name);
							return false;
						}
					}	
				}
				
		}
		
		function change(dat)
		{
		
			for (i=1; i<=z; i++) 
			{
				document.getElementById("sd"+i).className = "none";
				document.getElementById("d"+i).className = "none";
	                }
	                
	                document.getElementById("sd"+dat).className = "sel";
			document.getElementById("d"+dat).className = "sel";			
			
			
		}
		



}

window.onload = rungal;
