// <!CDATA[

function OpenImagePopup(img)
{
    DarkenPage();
    ShowImagePanel(img);
}

function OpenindexImagePopup(img)
{
    DarkenPage();
    ShowIndexImagePanel(img);
}

function OpenVideoPopup(img)
{
    DarkenPage();
    ShowVideoPanel(img);
}

function OpenHandoutPopup(img)
{
    DarkenPage();
    ShowHandout(img);
}

function ShowImagePanel(img)
{
    var image_panel = parent.document.getElementById('image_panel');

    // w is a width of the newsletter panel
    w = 640;
    // h is a height of the newsletter panel
    h = 640;

    // get the x and y coordinates to center the newsletter panel
    if (document.getElementById && !document.all) { //Firefox or NS6+
      xc = Math.round((parent.window.innerWidth/2)-(w/2))
      yc = Math.round((parent.window.innerHeight/2)-(h/2))
    }
    else {
      xc = Math.round((parent.document.body.clientWidth/2)-(w/2))
      yc = Math.round((parent.document.body.clientHeight/2)-(h/2))
    }

    // show the newsletter panel
    image_panel.style.left = xc + "px";
    image_panel.style.top  = yc + "px";
    image_panel.style.backgroundImage = "url(" + img + ")";
    image_panel.style.display = 'block';
}

function ShowIndexImagePanel(img)
{
    var image_panel = parent.document.getElementById('index_image_panel');

    // w is a width of the newsletter panel
    w = 925;
    // h is a height of the newsletter panel
    h = 395;

    // get the x and y coordinates to center the newsletter panel
    if (document.getElementById && !document.all) { //Firefox or NS6+
      xc = Math.round((parent.window.innerWidth/2)-(w/2))
      yc = Math.round((parent.window.innerHeight/2)-(h/2))
    }
    else {
      xc = Math.round((parent.document.body.clientWidth/2)-(w/2))
      yc = Math.round((parent.document.body.clientHeight/2)-(h/2))
    }

    // show the newsletter panel
    image_panel.style.left = xc + "px";
    image_panel.style.top  = yc + "px";
    image_panel.style.backgroundImage = "url(" + img + ")";
    image_panel.style.display = 'block';
}

function ShowHandout(img)
{
    var image_panel = parent.document.getElementById('handout_panel');

    // w is a width of the newsletter panel
    w = 595;
    // h is a height of the newsletter panel
    h =719;

    // get the x and y coordinates to center the newsletter panel
    if (document.getElementById && !document.all) { //Firefox or NS6+
      xc = Math.round((parent.window.innerWidth/2)-(w/2))
      yc = Math.round((parent.window.innerHeight/2)-(h/2))
    }
    else {
      xc = Math.round((parent.document.body.clientWidth/2)-(w/2))
      yc = Math.round((parent.document.body.clientHeight/2)-(h/2))
    }

    // show the newsletter panel
    image_panel.style.left = xc + "px";
    image_panel.style.top  = yc + "px";
    image_panel.style.backgroundImage = "url(" + img + ")";
    image_panel.style.display = 'block';
}

function ShowVideoPanel(file)
{
    var image_panel = parent.document.getElementById('image_panel');

    // w is a width of the video panel
    w = 470;
    // h is a height of the video panel
    h = 620;

    // get the x and y coordinates to center the video panel
    if (document.getElementById && !document.all) { //Firefox or NS6+
      xc = Math.round((parent.window.innerWidth/2)-(w/2))
      yc = Math.round((parent.window.innerHeight/2)-(h/2))
    }
    else {
      xc = Math.round((parent.document.body.clientWidth/2)-(w/2))
      yc = Math.round((parent.document.body.clientHeight/2)-(h/2))
    }

    // show the newsletter panel
    image_panel.style.left = xc + "px";
    image_panel.style.top  = yc + "px";
    image_panel.style.backgroundColor = "#FFFFFF";
    image_panel.style.width = 470;
    image_panel.style.height = 620;
    image_panel.style.display = 'block';
    image_panel.src = file;
}

// this function puts the dark screen over the entire page
function DarkenPage()
{
    var page_screen = parent.document.getElementById('page_screen');
    page_screen.style.height = parent.document.body.parentNode.scrollHeight + 'px';
    page_screen.style.width = parent.document.body.parentNode.scrollWidth + 'px';
    page_screen.style.display = 'block';
}

// ]]>

