jQuery.makeslider = function(sliderpath, filename, photoscount, photoheight) 
{
	var img = new Image(), photospan = $(sliderpath +' span'), sliderelement = $(sliderpath + " > div");
	img.onload = function() {
		photospan.css('background-image', 'url('+img.src+')');
		sliderelement.slider({
			slide : function(e, ui) {
				var value = ui.value == 100 ? 0 : parseInt(photoscount*ui.value/100), moveby = value * photoheight, moveby = value * photoheight;
				photospan.css('background-position', '0px -'+moveby+'px');
			}
		});
	};
	img.src = filename;
	return sliderelement;
}

