// Highslide configuration settings
jQuery.extend(hs, {
	"graphicsDir": "http://www.gbaselive.net/synertech/scripts/highslide/graphics/",
	"outlineType": "flat-white",
	"dimmingOpacity": 0.65,
	"fadeInOut": true,
	"align": "center",
	"captionEval": "this.a.title",
	"minWidth": 400,
	"minHeight": 400,
	"padToMinWidth": true,
	"marginTop": 30,
	"marginBottom": 30,
	"marginLeft": 30,
	"marginRight": 30
});

// Gallery config object
var highslideConfig = {
	"transitions": ["expand", "crossfade"],
	"captionId": "highslideCaption"
};

// Modify caption on the "onAfterGetCaption" event
hs.Expander.prototype.onAfterGetCaption = function (sender) {
	if (!sender.caption) return;
	var num = sender.getAnchorIndex(),
	    len = hs.anchors.images.length;
	$(sender.caption).find(".next, .next span")[num + 1 === len ? "addClass" : "removeClass"]("disabled").filter("a")[0].onclick = function() {};
	$(sender.caption).find(".previous, .previous span")[num === 0 ? "addClass" : "removeClass"]("disabled").filter("a")[0].onclick = function() {};
};

// Set live event handlers for the previous and next buttons in the caption
$("div.customHighslideCaption a.next, div.customHighslideCaption a.previous").live("click", function() {
	var obj = $(this);
	if (obj.is(".disabled")) {
		return false;
	}
	return hs[obj.is(".next") ? "next" : "previous"](this);
});

// Set live event handlers to show links with the class "highSlidePopup" using a Highslide IFRAME
$("a.highSlidePopup").live("click", function() {
	var obj = $(this);
	return hs.htmlExpand(this, {
		"objectType": "iframe",
		"outlineType": "rounded-white",
		"dimmingOpacity": 0,
		"overlayOptions": {
			"className": "test"
		},
		"width": obj.attr("hswidth") || 643,
		"height": obj.attr("hsheight") || 328
	});
});
