﻿// JScript File

/* Show send a friend popup */
function ShowSendAFriendPopup()
{
    DarkenPage();

    width = 586;
    height = 32;
    var sendafriend_panel = getElementById_s('send_a_friend_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 send a friend panel
    xc = Math.round((document.documentElement.clientWidth/2)-(w/2))
    yc = Math.round((document.documentElement.clientHeight/2)-(h/2))

    if (sendafriend_panel != null)
    {
        // Show send a friend panel
        sendafriend_panel.style.left = xc + "px";
        sendafriend_panel.style.top  = yc + "px";
        sendafriend_panel.style.display = 'block';
        sendafriend_panel.style.width = parseInt(width) + 17 + "px";
        sendafriend_panel.style.paddingLeft = 6 + "px";
        sendafriend_panel.style.paddingRight = 6 + "px";
        sendafriend_panel.style.paddingTop = 8 + "px";
    }
    
    // Locate send a friend form and fill it with html
    var sendafriend_form = getElementById_s('send_a_friend_form');
    if (sendafriend_form != null)
    {
        sendafriend_form.style.width = 580 + "px"; //parseInt(width) - 2 + "px";;
        sendafriend_form.style.paddingLeft = 4 + "px";
    }
    
    if (sendafriend_panel != null)
    {
        // Set height based on inner html from sendafriendform
        sendafriend_panel.style.height = parseInt(height) + 10 + 24 + sendafriend_form.clientHeight + "px";   
    }
}

function HideSendAFriendPopup()
{
    var sendafriend_panel = getElementById_s('send_a_friend_panel');

    if (sendafriend_panel != null)
    {
        sendafriend_panel.style.display = 'none';
    }
    
    LightenPage();
}

function OpenConditions(width, height)
{    
    var conditions_panel = getElementById_s('conditions_panel');
    
    if (conditions_panel != null)
    {
        DarkenPage();

        // w is a width of the newsletter panel
        w = 432;
        // h is a height of the newsletter panel
        h = 272;
        
        //  Get the x and y coordinates to center the send a friend panel
        xc = Math.round(((document.documentElement.clientWidth) / 2)-(w/2));
        yc = Math.round(((document.documentElement.clientHeight) / 2)-(h/2)) + 26;

        if ($('Conditions'))
        {
            $('Conditions').src = 'http://www.webregio.nl/content/Acties/webregio_nl/tips/voorwaardenkleppie.html';
        }

        // Show send a friend panel
        conditions_panel.style.left = xc + "px";
        conditions_panel.style.top  = yc + "px";
        conditions_panel.style.display = 'block';
        conditions_panel.style.width = parseInt(width) + 17 + "px";
        conditions_panel.style.paddingLeft = 6 + "px";
        conditions_panel.style.paddingRight = 6 + "px";
        conditions_panel.style.paddingTop = 8 + "px";
    }
}

function CloseConditions()
{
    var conditions_panel = getElementById_s('conditions_panel');
    
    if (conditions_panel != null)
    {
        conditions_panel.style.display = 'none';
    }
    
    LightenPage();
}
