﻿function openAddPhoto(id)
{
    window.scrollTo(0, 0);
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight + document.documentElement.scrollTop;

    var layer = document.createElement('div');
    layer.style.zIndex = 7100;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.clientHeight + 'px';
    layer.style.width = width + 'px';
    layer.style.backgroundColor = 'black';
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.style.position = 'static';
    document.body.appendChild(layer);  
  
    var size = { 'height': 600, 'width': 750 };
    var iframe = document.createElement('iframe');
    iframe.name = 'AddPhoto';
    iframe.id = 'AddPhoto';
    iframe.src = 'PhotoEdit.aspx?id=' + id;
    iframe.style.height = size.height + 'px';
    iframe.style.width = size.width + 'px';
    iframe.style.position = 'fixed';
    iframe.style.zIndex = 7200;
    iframe.style.backgroundColor = 'white';
    iframe.style.border = '4px solid silver';
    iframe.frameborder = '0';	

    iframe.style.top = ((height + document.documentElement.scrollTop) / 2) - (size.height / 2) + 'px';
    iframe.style.left = (width / 2) - (size.width / 2) + 'px';	

    document.body.appendChild(iframe);  
}

function closePopup()
{
    document.body.removeChild(document.getElementById('AddPhoto'));
    document.body.removeChild(document.getElementById('layer'));
    document.body.style.position = '';
}
