hs.graphicsDir = '/img/u/highslide/';
hs.showCredits = false;
hs.creditsHref = '';
hs.transitions = ['expand', 'crossfade'];
hs.objectLoadTime = 'before'; // Load iframes 'before' or 'after' expansion.
hs.outlineType = null;
hs.fadeInOut = true;
//hs.headingEval = 'this.thumb.alt';
hs.align = 'center';
//hs.dimmingOpacity = 0.01;
hs.outlineType = 'drop-shadow';


hs.lang.creditsText = '';
hs.lang.creditsTitle = '';


hs.Expander.prototype.onAfterExpand = function(sender) {
	var h = $(".controlbar").parent("div").parent("div").css("height");
	var w = $(".controlbar").parent("div").parent("div").css("width");
	if (typeof(($(".controlbar").parent("div").attr("id"))) != "undefined") {
		if ((($(".controlbar").parent("div").attr("id")).indexOf("hsId")) == 0) {
			$(".controlbar").parent("div").css( { "height" : h , "width" : w} );
		}
	}
	$(".highslide-previous, .highslide-next").fadeIn("200");
}
hs.registerOverlay({
		thumbnailId: null,
		overlayId: 'controlbar',
		position: 'top left',
		hideOnMouseOut: true,
		opacity: 1
});

hs.registerOverlay({
		thumbnailId: null,
		overlayId: 'closebar',
		position: 'bottom right',
		hideOnMouseOut: false,
		html: '<a href="#" onclick="hs.close(this); return false;" class="highslide-close"><span>'+locale['close']+'</span></a>',
		opacity: 1
});



$(document).ready(function(){
	init();
});

hs.Expander.prototype.onBeforeExpand = function (sender) {
	hideControls();
}


hs.Expander.prototype.onCreateOverlay = function (sender, e) {
	var prev = locale['previousTitle'];
	var next = locale['nextTitle'];
    var str = '	<a href="#" onclick="return hs.previous(this)" title="'+prev+'" class="highslide-previous"><span>Předchozí</span></a>';
	str += '	<a href="#" onclick="return hs.next(this)" title="'+next+'" class="highslide-next"><span>Další</span></a>';
	if (e.overlay.className.indexOf("controlbar") > -1) {
		e.overlay.innerHTML = str;
	}
};

function hideControl() {
	$(".highslide-previous, .highslide-next").hide();
}

function hideControls() {
	$(".highslide-next, .highslide-previous").hide();	
}

function getParameter(name) {
	if(typeof document.parameters == "undefined") {
		setupParameters();
	}
	return document.parameters[name];
}
function setupParameters() {
	var parameters = new Object();
	if(window.location.search) {
		var paramArray = window.location.search.substr(1).split('&');
		var length = paramArray.length;
		for (var index = 0;index <length; index++ ) {
			var param = paramArray[index].split('=');
			var name = param[0];
			var value =
			typeof param[1] == "string"
				? decodeURIComponent(param[1].replace(/\+/g, ' '))
				: null;
			parameters[name] = value;
		}
	}
	document.parameters = parameters;
}
function init() {
	/* gallery on demand */
	var paramGallery = getParameter("hsi");
	if (typeof paramGallery != "undefined") {
		openHighslideGallery(paramGallery);
	}
}
function openHighslideGallery(id) {
	if ($("#"+id)) {
		var anch = document.getElementById(id);
		hs.expand(anch, { fadeInOut: false, wrapperClassName: 'wide-border imageHighslide'});
	}
}
$(document).ready(function(){
	init();
});
