var picsGallery = new Gallery('picsGallery', 0, 120, 0, 0, 5, 10, 0, 0, -1, 5, 20, 7.5, false);

var maxMenuPxWidth = 200; //px
var galleriesPctWidth = 0.8; //percent
var galleriesCurrentPctWidth = galleriesPctWidth
var galleriesMargin = 50;

var selectedPic = -1;
var unfoggedPic = -1;

var minOpacity = 0.4;
var lowOpacity = 0.7;
var midOpacity = 0.6;
var higOpacity = 0.6;
var maxOpacity = 1.0;

pic_dimension = new Array();

function select_pic(id)
{
	if (document.getElementById("legend_" + selectedPic))
		document.getElementById("legend_" + selectedPic).style.display = "none";
	document.getElementById("legend_" + id).style.display = "inline";
	if (selectedPic >= 0 && selectedPic != id)
		unselect_pic(selectedPic);
	selectedPic = id;
//	unfog_pic(id);
}
function unselect_pic(id)
{
	setOpacity("img_pic_" + id, minOpacity);
}
function unfog_pic(id)
{
	if (selectedPic >= 0)
		setOpacity("img_pic_" + selectedPic, maxOpacity);
	if (id != selectedPic)
		setOpacity("img_pic_" + id, lowOpacity);
}
function fog_pic(id)
{
	unselect_pic(id);
	if (selectedPic >= 0)
		unfog_pic(selectedPic);
}
function select_pic_click(id)
{
	picsGallery.scrollGalleryIfNecessary(id==0 ? 0 : -pic_dimension[id - 1], -pic_dimension[id], 'fade("img_pic_' + id+'", ' + maxOpacity + ');select_pic(' + id + ');');
}
function resizeGalleries() 
{
	documentHeight = document.documentElement.clientHeight;
	galleryPxWidth = 735;

	document.getElementById("picsGalleryDivContainer").style.width = galleryPxWidth + "px";//galleriesCurrentPctWidth * 100 + "%";
	picsGallery.setWidth(galleryPxWidth);
	
	picsGallery.setFinalHMargin(-pic_dimension[pic_dimension.length - 1] + picsGallery.width);
		picsGalleryHeight = parseInt(document.getElementById("picsGalleryDivContainer").style.height);

}
function initGalleries()
{
	window.onresize = resizeGalleries;

	resizeGalleries();

	document.getElementById("picsGalleryImgBackground").style.width = pic_dimension[pic_dimension.length - 1] + "px";

	fog_all_pics();
	
	picsGallery.showHideScrollButtons(0);

	select_pic_click(0);

	picsGallery.showHideGallery();
	
}