
function imageShow(photo_key){
    /// Удаляем старую картинку
    $('#ppImage img').eq(0).remove();

    /// Добавляем новую
    var img = new Image();

    img.onload = function() {
        $('#ppImage').append(this);
        $('#ppImage img').eq(0).hide();
        $('#ppImage img').eq(0).fadeIn(200);
    };

    /// Вывод фото
    img.src = '/img/saved/'+photos[photo_key];

    $('#ppImage img').attr('id','BigImg');
    $('#ppImage img').attr('name','BigImg');
}

function showPopupID(id) {
    $('#black'+id).height(document.body.offsetHeight);
    currentOffset2 = 0;
    currentOffset = document.documentElement.scrollTop || document.documentElement.scrollTop;
    var windowHeight;
    if (!($.browser.opera)) { windowHeight = document.documentElement.clientHeight } else { windowHeight = document.body.clientHeight }
	if (windowHeight < $('#photoPopup'+id).height()) {
		currentOffset = (windowHeight - $('#photoPopup'+id).height() + currentOffset - 10);
	} else {
		currentOffset2 = parseInt((windowHeight - $('#photoPopup'+id).height()) / 2);
	}
	pLeft = (document.body.clientWidth - $('#photoPopup'+id).width()) / 2;
	$('#black'+id).show();
	$('#photoPopup'+id).css({top:currentOffset+currentOffset2,left:pLeft}).show();
}
