﻿hs.registerOverlay({
	html: '<div class="hs-controls"><div class="closebutton" onclick="return hs.close(this)" title="Close"></div><div class="nextbutton" onclick="return hs.next(this)" title="Next"></div><div class="previousbutton" onclick="return hs.previous(this)" title="Previous"></div></div>',
	position: 'top right',
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});
hs.graphicsDir = 'graphics/highslide/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.fadeInOut = true;
hs.dimmingOpacity = .96;
hs.outlineType= null
hs.showCredits = false;
hs.lang = { 
loadingText: '',
restoreTitle: 'Use your keyboard arrows for next/previous image or click to close image.'
};
hs.loadingOpacity = 1;
hs.blockRightClick = true;
hs.marginLeft = 30;
hs.marginRight = 30;
hs.marginTop = 60;
hs.marginBottom = 14;
hs.minWidth = 50;
hs.minHeight = 50;
//hs.padToMinWidth = true;

if (!hs.ie || hs.uaVersion > 6) hs.extend ( hs.Expander.prototype, {
	fix: function(on) {
		var sign = on ? -1 : 1,
			stl = this.wrapper.style;

		if (!on) hs.getPageSize(); // recalculate scroll positions

		hs.setStyles (this.wrapper, {
			position: on ? 'fixed' : 'absolute',
			zoom: 1, // IE7 hasLayout bug,
			left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +'px',
			top: (parseInt(stl.top) + sign * hs.page.scrollTop) +'px'
		});

		if (this.outline) {
			stl = this.outline.table.style;
			hs.setStyles (this.outline.table, {
				position: on ? 'fixed' : 'absolute',
				zoom: 1, // IE7 hasLayout bug,
				left: (parseInt(stl.left) + sign * hs.page.scrollLeft) +'px',
				top: (parseInt(stl.top) + sign * hs.page.scrollTop) +'px'
			});

		}
		this.fixed = on; // flag for use on dragging
	},
	onAfterExpand: function() {
    	this.fix(true); // fix the popup to viewport coordinates
	},

	onBeforeClose: function() {
		this.fix(false); // unfix to get the animation right
	},

    onDrop: function() {
    	this.fix(true); // fix it again after dragging
	},

	onDrag: function(sender, args) {
		if (this.fixed) { // only unfix it on the first drag event
			this.fix(false);
		}
	}

});