(function() {
	if ($("imagechangerthumbs")) {
		var cont = $("imagechangerthumbs");
		var el = $("thumbs-left");
		el.style.cursor = "pointer";
		el.observe("click", function() {
			new Effect.Scroll(cont, { x: cont.scrollLeft - cont.getWidth() });
		});
		var el = $("thumbs-right");
		el.style.cursor = "pointer";
		el.observe("click", function() {
			new Effect.Scroll(cont, { x: cont.scrollLeft + cont.getWidth() });
		});

		var slideshow_timer;
		var timeout = 5000;

		var next = function() {
			nextImage();
			slideshow_timer = window.setTimeout(next, timeout);
		};
		slideshow_timer = window.setTimeout(next, timeout);

		$$(".imagechangerthumb").invoke("observe", "click", function() {
			window.clearTimeout(slideshow_timer);
		});
	}
}).onLoad();

var it_cb = function(it, minp, maxp, el) {
	$("classification").value = (el.id == "new-build" ? "2" : "");
};

var on_restore_search = function(request) {
	var inputs = $$("input[name=instruction_type]");
	var index = (typeof request.classification == "string" && request.classification == "2") ? 2 : 0;
	inputs[index].checked = "checked";
	$("classification").value = (typeof request.classification == "string" && request.classification == "2") ? "2" : "";
}

