﻿// JScript File

/* Show react popup */
function ShowReactPopup()
{
    DarkenPage();

    width = 586;
    height = 32;
    var react_panel = $('react_panel');

    // w is a width of the newsletter panel
    w = width;
    // h is a height of the newsletter panel
    h = height;
    
    //  Get the x and y coordinates to center the react panel
    xc = Math.round((document.documentElement.clientWidth/2)-(w/2))
    yc = Math.round((document.documentElement.clientHeight/2)-(h/2))

    if (react_panel != null)
    {
        // Show send a friend panel
        react_panel.style.left = xc + "px";
        react_panel.style.top  = yc + "px";
        react_panel.style.display = 'block';
        react_panel.style.width = parseInt(width) + 17 + "px";
        react_panel.style.paddingLeft = 6 + "px";
        react_panel.style.paddingRight = 6 + "px";
        react_panel.style.paddingTop = 8 + "px";
    }
    
    // Locate react form and fill it with html
    var react_form = $('react_form');
    if (react_form != null)
    {
        react_form.style.width = 580 + "px"; //parseInt(width) - 2 + "px";;
        react_form.style.paddingLeft = 4 + "px";
    }
    
    if (react_panel != null)
    {
        // Set height based on inner html from sendafriendform
        react_panel.style.height = parseInt(height) + 10 + 24 + react_form.clientHeight + "px";   
    }
    scroll(0,0);
}

function HideReactPopup()
{
    var react_panel = getElementById_s('react_panel');

    if (react_panel != null)
    {
        react_panel.style.display = 'none';
    }
    
    LightenPage();
}