﻿jQuery.noConflict();
jQuery(document).ready(function(){
	// seeMore
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}

	jQuery("#seeMoreBox").css({height: yScroll});

	var widthWindow;
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			widthWindow = document.body.offsetWidth;
		} else {
			widthWindow = window.innerWidth;
		}
	}

	var nameImg;
	var marLeftImg;
	var marLeftClose;
	var widthImg;

	jQuery(".imgRight").click(function(){
		jQuery("#seeMoreBox").css({"display":"block"});
		nameImg = jQuery(this).attr("src");
	});

	jQuery("#seeMoreBox").click(function(){
		jQuery("#seeMoreBox").css({display:'none'});
		jQuery("#seeMoreBox img, #seeMoreBox .desc").remove();
		nameImg = '';
		marLeftImg = 0;
		marLeftClose = 0;
		widthImg = 0;
	});

	jQuery(".imgRight").click(function(){
		nameImg = nameImg.replace(/\//, "/bigPhotos/");
		jQuery("#mainSeeMoreBox").append('<img src="'+nameImg+'" />');

		widthImg = jQuery("#mainSeeMoreBox img").width() + 40;

		jQuery("#seeMoreBox #contButtonClose").css({"width": widthImg});

		if (nameImg == '_img/bigPhotos/zdjecie5.jpg' || nameImg == '_img/bigPhotos/zdjecie2.jpg') {
			jQuery("#mainSeeMoreBox").append('<div class="desc">Zdjęcie pochodzi ze zbiorów Narodowego Archiwum Cyfrowego</div>');
		}
	});
});