function showPopup() {
    $('#sending').fadeIn('slow');
    if($.browser.msie)
    {
        $('#opaco').height($(document).height()).toggleClass('hidden');
        if(parseInt($.browser.version) < 8) {
            setFormPosition();
            $(window).bind('scroll', setFormPosition);
        }
    }
    else {
        $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
    }

    $('#popup')
    .html($('#popup_' + popup_type).html())
    .alignCenter()
    .toggleClass('hidden');

    return false;
}

function closePopup()
{
    if(parseInt($.browser.version) < 8) {
        $(window).unbind('scroll', setFormPosition);
    }
    $('#fname').val('Name');
    $('#company').val('Company');
    $('#mail').val('E-mail');
    $('#err1').text('');
    $('#err2').text('');
    $('#opaco').toggleClass('hidden').removeAttr('style');
    $('#sending').fadeOut(200);
    return false;
}

function setScroll(x, y)
{
    window.scrollTo(x, y);
}

function prepareIE(height, overflow)
{
    var bod = document.getElementsByTagName('body')[0];
    bod.style.height = height;
    bod.style.overflow = overflow;

    var htm = document.getElementsByTagName('html')[0];
    htm.style.height = height;
    htm.style.overflow = overflow;
}

function getScroll()
{
    return {
        left:document.documentElement.scrollLeft,
        top:document.documentElement.scrollTop
        };
}

function setFormPosition()
{
    var scroll = getScroll();
    $('#sending').css('top', scroll.top + $(window).height() / 2);
}