﻿function ShowPopup(obj, text) {
    var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
    if(IE6){
        var selects = document.forms[0].getElementsByTagName('select');
        var i = 0;
        while (i < selects.length){
            selects[i].style.visibility = 'hidden';
            i++;
        }
    }
    ShowStaticHint(obj, text);
}

function HidePopup() {
    var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
    if(IE6){
        var selects = document.forms[0].getElementsByTagName('select');
        var i = 0;
        while (i < selects.length){
            selects[i].style.visibility = 'visible';
            i++;
        }
    }
    HideHint();
}

function ShowBidPopup()
{
    ShowSplash();
    AlignDiv(document.getElementById('bidDiv'));
    document.getElementById('bidDiv').style.visibility = 'visible';
}

function HideBidPopup()
{
    document.getElementById('bidDiv').style.visibility = 'hidden';
}

function ShowSaveSearchPopup()
{
    ShowSplash();
    AlignDiv(document.getElementById('saveSearchDiv'));
    document.getElementById('saveSearchDiv').style.visibility = 'visible';
}

function HideSaveSearchPopup()
{
    document.getElementById('saveSearchDiv').style.visibility = 'hidden';
}

function ShowAlertPopup()
{
    ShowSplash();
    AlignDiv(document.getElementById('alertDiv'));
    document.getElementById('alertDiv').style.visibility = 'visible';
}

function HideAlertPopup()
{
    document.getElementById('alertDiv').style.visibility = 'hidden';
}

function ShowNewTownPopup()
{
    ShowSplash();
    AlignDiv(document.getElementById('newTownDiv'));
    document.getElementById('newTownDiv').style.visibility = 'visible';
}

function HideNewTownPopup()
{
    document.getElementById('newTownDiv').style.visibility = 'hidden';
}

function ShowDeleteBidPopup()
{
    ShowSplash();
    AlignDiv(document.getElementById('deleteBidDiv'));
    document.getElementById('deleteBidDiv').style.visibility = 'visible';
}

function HideDeleteBidPopup()
{
    document.getElementById('deleteBidDiv').style.visibility = 'hidden';
}

function ShowSplash()
{
    var obj = document.getElementById('SplashDiv');
    if (obj == null) alert('SplashDiv not found.');
    var pageHeight = GetPageHeight();
    var browserHeight = GetBrowserHeight();
    if (pageHeight > browserHeight)
        obj.style.height = pageHeight + 'px';
    else obj.style.height = browserHeight + 'px';
    obj.style.display = 'block';
    // hide all dropdowns
    var dropdowns = document.getElementsByTagName('select')
    for (i=0; i<dropdowns.length; i++)
        dropdowns[i].style.visibility = 'hidden';
}

function HideSplash()
{
    document.getElementById('SplashDiv').style.display = 'none';
    // show all dropdowns
    var dropdowns = document.getElementsByTagName('select')
    for (i=0; i<dropdowns.length; i++)
        dropdowns[i].style.visibility = 'visible';
}

function AlignDiv(obj)
{
    var objSize = GetElementSize(obj);
    var browserSize = GetBrowserSize();
    var scroll = GetScrollXY();
    obj.style.left = Math.round(browserSize[0] / 2 - objSize[0] / 2) + scroll[0] + 'px';
    obj.style.top = Math.round(browserSize[1] / 2 - objSize[1] / 2) + scroll[1] + 'px';
}