function myboxinit()
{
	
	//init all images?
	
	bigImageSrc=$('a.mylightbox').attr("href");
	overlay=$("<div id='lbOverlay' />");
	overlay.css("opacity","0.6");
	overlay.css("z-index","9997");
	overlay.css("float","left");
	overlay.css("position","absolute");
	imageDiv=$("<div id='lbImage'  />");
	imageDiv.css("z-index","9998");
	imageDiv.css("height","auto");
	imageDiv.css("cursor","pointer");
	imageDiv.css("background","#FFFFFF");
	
	imageBorderDiv=$("<div id='imgBorder'/>");
	imageBorderDiv.append('<img id="bigimage" style="z-index:9999;border:0px solid #FFFFFF;" src="'+bigImageSrc+'"/>');
	imageBorderDiv.append($('div.firstcaption:eq(0)').clone());
	imageDiv.append(imageBorderDiv);
	
	
	overlay.click(function(){
		hide();
	});
	imageDiv.click(function(){
		hide();
	});
	
	
	$("body").prepend(imageDiv);
	$("body").prepend(overlay);
	
	hide();	
	$('a.mylightbox').click(function () { 
      show($(this)); 
	  return false;
    });
}

function show(link)
{
	//change picture url
	var bigImageSrc=link.attr("href");
	$("img#bigimage").attr("src",bigImageSrc);
	
	//change description div
	var id = link.attr("id");
	var imageDesc = $('div.firstcaption:eq('+id+')').clone()
	$('div#imgBorder').append(imageDesc);
	
	//calc scroll pos
	var scrollPos = $(window).scrollTop();
	
	$("div#lbOverlay").show();
	$("div#lbImage").show();
	$("img#bigimage").show();
	
	var imgWidth = $("img#bigimage").width();
	var imgHeight = $("img#bigimage").height();

	$("div#lbOverlay").css("width",$(window).width());
	$("div#lbOverlay").css("height",$(window).height());
	$("div#lbOverlay").css("margin-top",scrollPos);
	
	$("html").css("overflow","hidden");
	
	var top = ($(window).height() - imgHeight - 20)/2 + scrollPos;
	var left = ($(window).width() - imgWidth - 20)/2;
	$("div#imgBorder").css("width",imgWidth);
	
	$("div#lbImage").css("margin-left",left+"px");
	$("div#lbImage").css("margin-top",top+"px");
	$("div#lbImage").css("position","absolute");
}

function hide()
{
	$('div.firstcaption:eq(0)').remove();//picture description allways will be at the top of the page. with pos = 0
	$("img#bigimage").hide();
	$("div#lbImage").hide();
	$("div#lbOverlay").hide();
	$("html").css("overflow","");
}