function initgallery() {
	$('a').each(function() {
		if (this.getAttribute('href') && (this.getAttribute('rel') == 'slide')){
			this.onclick = function () {
				$("#slide").toggle();
				$("#slideimg").html('<img src="'+this.href+'" width="530" alt="'+this.getAttribute("title")+'" title="'+this.getAttribute("title")+'" />');
				$("#slidecaption").html("<em>"+this.getAttribute("title")+"</em>");
				setTimeout("$('#slide').fadeIn('slow')", 2000);
				return false;
			}
		}
	});
	
	var allThumbs = $("#thumbs a").get();
	thumbLength = allThumbs.length;
	tOffset = 0;
}

function leftScroll() {
	if(tOffset < 10) {
		tOffset = tOffset + 10;
		document.getElementById("thumbs").style.marginLeft = tOffset + "px";
		doscroll = setTimeout("leftScroll()", 30);
	}
}

function rightScroll() {
	if(tOffset > ((thumbLength * 80) - ((thumbLength * 80) * 2) - 10) + 510) {
		tOffset = tOffset - 10;
		document.getElementById("thumbs").style.marginLeft = tOffset + "px";
		doscroll = setTimeout("rightScroll()", 30);
	}
}

function stopScroll() {
	if(doscroll) clearTimeout(doscroll);
}



	
	 
	