function Hide(ID)
{
    document.getElementById(ID).style.display = 'none';
}

function Show(ID)
{
    document.getElementById(ID).style.display = 'block';
}

function HideAllAddresses()
{
    Hide('homeAddress1');
    Hide('homeAddress2');
    Hide('officeAddress1');
    Hide('officeAddress2');
    Hide('officeAddress3');
    Hide('dormAddress1');
    Hide('dormAddress2');
    Hide('dormAddress3');
    Hide('dormAddress4');
    Hide('otherAddress1');
    Hide('otherAddress2');
}

function ShowAddress(which)
{
    HideAllAddresses()
    if (which == 'home') {
        Show('homeAddress1');
        Show('homeAddress2');
    } else if (which == 'office') {
        Show('officeAddress1');
        Show('officeAddress2');
        Show('officeAddress3');
    } else if (which == 'dorm') {
        Show('dormAddress1');
        Show('dormAddress2');
        Show('dormAddress3');
        Show('dormAddress4');
    } else if (which == 'other') {
        Show('otherAddress1');
        Show('otherAddress2');
    }
}

function HideAllFields()
{
    HideAllAddresses();
    Hide('phoneNumberRow');
    Hide('phoneNumberRow2');
    Hide('spacerRow2');
    Hide('addressTypeRow');
    Hide('cityRow');
    Hide('zipRow');
    Hide('nearRow');
    Hide('instructionsRow');
    Hide('instructionsRow2');
    Hide('spacerRow');
    Hide('whenOrderRow');
}

function ShowAllFields()
{
    Show('phoneNumberRow');
    Show('phoneNumberRow2');
    Show('spacerRow2');
    Show('addressTypeRow');
    Show('cityRow');
    Show('zipRow');
    Show('nearRow');
    Show('instructionsRow');
    Show('instructionsRow2');
    Show('spacerRow');
    Show('whenOrderRow');
    ShowAddress(document.forms.promo.addressType.value);
}

function toggleFields()
{
    if (document.forms.promo.showFieldsCheckbox.checked) {
        ShowAllFields();
    } else {
        HideAllFields();
    }
}

function showPopup(url, name, width, height) {
    var newWindow;
    newWindow=window.open(url,name,'height=' + height +
        ',width=' + width + ',' +
        'scrollbars=no,toolbar=no,menubar=no,resizable=yes');
    if (window.focus) {newWindow.focus()}
}

function showImage(url, width, height) {
    var newWindow;
    newWindow=window.open('about:blank','image','height=' + height +
        ',width=' + width + ',' +
        'scrollbars=no,toolbar=no,menubar=no,resizable=yes');
        newWindow.document.write('<html><head><title>Beauty\'s Pizza</title><style>body { margin: 0px 0px 0px 0px; }</style></head><body><img src="' +
            url + '"></body></html>');
    if (window.focus) {newWindow.focus()}
} 
