// V3 25/09/06

function clearHelp() {
	var helphd = document.getElementById("helphead");
	var helper = document.getElementById("helper");
	helphd.value = "";	
	helper.value = "";	
}
function setHelp(t,s) {
	var helphd = document.getElementById("helphead");
	var helper = document.getElementById("helper");
	helphd.value = t;
	helper.value = s;
}
function contact(i) {
	var e;
	e = document.getElementById("message")
	e.value = "Please contact us regarding the item labelled "+i.toUpperCase()+" on the PJS Reclamation page";
	e = document.getElementById("contactform")
	e.style.display="block";
	location.href="#contactform";
}
function requestReclamationCatalog() {
	var xhr = null;
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	} else {
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xhr.open("GET","/reclamation.xml?z="+new Date().getTime(),true);
	xhr.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	xhr.onreadystatechange = function() { populateReclamationCatalog(xhr); };
	xhr.send(null);
}
function populateReclamationCatalog(xhr) {
	if ((xhr.readyState == 4) && (xhr.status == 200)) {
		var	hook= document.getElementById("catalog");
		var	root= document.getElementById("catcore");
		var doc	= xhr.responseXML;
		
		var items = doc.getElementsByTagName("item");
		
		var table = document.createElement("table");
		table.setAttribute("border","0",0);
		table.id="catcore";
		
		var i = -1;
		while (++i < items.length) {
			var item = items[i];
			
			var row = document.createElement("tr");
			row.setAttribute("valign","top",0);
			
			var cell = document.createElement("td");
			cell.setAttribute("rowspan","3",0);
			
			var img = document.createElement("img");
			img.src = "/images/rec/"+item.getElementsByTagName("jpg")[0].firstChild.nodeValue;
			
			cell.appendChild(img);
			row.appendChild(cell);
			
			cell = document.createElement("th");
			cell.setAttribute("height","20",0);
			cell.appendChild( document.createTextNode( item.getElementsByTagName("title")[0].firstChild.nodeValue ) );
			
			row.appendChild(cell);
			
			table.appendChild(row);
			
			row = document.createElement("tr");
			row.setAttribute("valign","top",0);
			
			cell = document.createElement("td");
			
			cell.appendChild( document.createTextNode( item.getElementsByTagName("notes")[0].firstChild.nodeValue ) );
			
			row.appendChild(cell);
			table.appendChild(row);

			var row = document.createElement("tr");
			row.setAttribute("valign","bottom",0);
			
			var cell = document.createElement("td");
			cell.setAttribute("height","20",0);
			
			var link = document.createElement("a");
			link.href = "javascript:contact('"+item.getElementsByTagName("uid")[0].firstChild.nodeValue+"')";
			link.appendChild( document.createTextNode( "Request more information about this item!" ) );
			
			cell.appendChild(link);
			row.appendChild(cell);
			table.appendChild(row);
			
		}
		
		hook.replaceChild(table,root);
	}	
}
