hs.registerOverlay({
	thumbnailId: null,
	overlayId: 'controlbar',
	position: 'top right',
	hideOnMouseOut: true
});
hs.showCredits=false;
hs.captionSlideSpeed=0;
hs.graphicsDir = 'http://api.apricotion.com/highslide/graphics/';
hs.outlineType = 'rounded-white';
// Tell Highslide to use the thumbnail's title for captions
hs.captionEval = 'this.thumb.alt';
$(document).ready(function(){

	$(document.body).append(''
	+'<div id="controlbar" class="highslide-overlay controlbar">'
	+'<a href="#" class="previous" onclick="return hs.previous(this)" title="Previous (left arrow key)"></a>'
	+'<a href="#" class="next" onclick="return hs.next(this)" title="Next (right arrow key)"></a>'
    +'<a href="#" class="highslide-move" onclick="return false" title="Click and drag to move"></a>'
    +'<a href="#" class="close" onclick="return hs.close(this)" title="Close"></a>'
	+'</div>'
	);

	var checkImageExt=function(a){
		a=$(a);
		var imgs=["jpg","gif","png","bmp","jpeg"];
		var href=$.trim((a.attr("href")||"").toLowerCase());
		for(var i=0;i<imgs.length;i++)
		{
			if((href.indexOf("."+imgs[i])+(1+imgs[i].length))==href.length)
				return true;
		}
		return false;
	};

	$("a").each(function(){
		var a=$(this);
		if(checkImageExt(a))
		{
			a
			.addClass("highslide")
			.click(function(){
				return hs.expand(this);
			});
		}
	});

	hs.getAdjacentAnchor=function(key,op){
		var activeI=-1;
		var aAr=$("a.highslide");
		aAr.each(function(i){
			if (hs.expanders[key] && this == hs.expanders[key].a)
			{
				activeI=i;
			}
		});
		return aAr[activeI + op]||null;
	};

	hs.previousOrNext = function (el, op) {
		var exp = hs.last = hs.getExpander(el);
		try {
			var adj = hs.upcoming =  hs.getAdjacentAnchor(exp.key, op);
			$(adj).click(); 		
		} catch (e){}
		try { exp.close(); } catch (e) {}	
		return false;
	};

	hs.preloadImages();

});