<!--
var req,wheel;

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}
	
function loadXMLDoc(input) 
{
	var d = new Date();
	var url="scripts/xml.php?"+d.getSeconds();
	
	var getImg = new getObj('galleryImg');
	var changeImg = getImg.obj;
	

	var height=changeImg.height;
	

	place('<div style="width:396px;height:'+height+'px;"><br /><br /><br /><br /><img src="imgs/loading.gif" id="galleryImg" width="100" height="100" /></div>','wheelImg')

	wheel=input;
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}else{
		// forward unsupported browsers to a different version
		alert("Your browser does not support XMLHTTP.")
	}
	
}
function getElementTextNS(local, parentElem) {
	var result = "";
        result = parentElem.getElementsByTagName(local)[0];
	       
	if (result) {
	        // get text, accounting for possible
 	       // whitespace (carriage return) text nodes 
	       if (result.childNodes.length > 1) {
			var collect="";
			for(var i=0;i<result.childNodes.length;i++){
				collect+=result.childNodes[i].nodeValue;
			}
			return collect;
			
		} else {
			return result.firstChild.nodeValue;	
		}
	} else {
		return "n/a";
	}
}
function place(content,table){
	var getDiv = new getObj(table);
	div = getDiv.obj;
	if(div){
		// clear old content
		div.innerHTML = "";
		// new HTML content
		div.innerHTML = content;
	}
}

function processReqChange() 
{
	var items,description,img,size="";
	// only if req shows "complete"  3=recieving
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
		// ...processing statements go here...
			
			items = req.responseXML.getElementsByTagName(wheel);  
               		// check for content
			if(items.length>0){
				name = getElementTextNS("name", items[0]);
				img = getElementTextNS("img", items[0]);
				description=getElementTextNS("description", items[0]);
				size=getElementTextNS("size", items[0]);
				place(img,"wheelImg");
				place(name,"wheelName");
				place(description,"wheelInfo");
				place(size,"wheelBox");
				
				
						
					
			}
		} else {
			alert("There was a problem retrieving the XML data:\n" + req.statusText);
		}
	}

}
// image swap

	var current="";

	function setFade(object){

		object.style.opacity='.25';
		object.style.MozOpacity='.25';
		object.style.KhtmlOpacity='.25';
		object.style.filter='alpha(opacity=25)';	
	}
	function setBack(object){
		object.style.opacity='1';
		object.style.MozOpacity='1';
		object.style.KhtmlOpacity='1';
		object.style.filter='alpha(opacity=100)';	
	}	
	function setCurrent(name){
		var getCurrent=new getObj(name);
		current = getCurrent.obj;
	}
	function img_on(img_name) {
		setFade(img_name);
	}
	// set current gallery / unset old
	function img_hit(img_name) {

		if(current){
			setBack(current);
		}
		setFade(img_name);
		
		current=img_name;
	}
	function img_off(img_name) {
		if(img_name!=current){
			setBack(img_name);			
		}
	}
//-->

