// depends checkbox.js

/***
 * Aanmelden pagina. Bij het aanmelden wordt naar aanhef 'De heer' of 'Mevrouw' gevraagd.
 * Deze methode zorgt ervoor dat de juiste image komt als er op het input veld word geclicked.
 **/
function aanmelden_AanhefCheckbox(poObj1, poObj2)
{
    if (poObj1.checked)
        poObj1.myImage.src = imgTrue;
    else
        poObj1.myImage.src = imgFalse;


    poObj2.checked = !poObj1.checked;
    if (poObj2.checked)
        poObj2.myImage.src = imgTrue;
    else
        poObj2.myImage.src = imgFalse;
}


/**
 * Deze functie veranderd de foto met id 'fotoX' met de foto met URL pstrImageURL.
 * pstrAlt is de alt tekst bij de foto. De volgende functie is kaarten, deze is gebasseerd op deze functie.
 **/
function updateFoto(pstrAlt, pstrImageURL)
{
    var loFoto = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabCycloMedia:imageCycloMedia');
    loFoto.src = pstrImageURL;
    loFoto.alt = pstrAlt;

    var loF1 = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabCycloMedia:labFront');
    var loF2 = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabCycloMedia:labLeft');
    var loF3 = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabCycloMedia:labRight');
    var loF4 = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabCycloMedia:labOpposite');

    if (pstrAlt == 'Frontaanzicht')
    {
        loF1.className = 'LblLev2Txt';
        loF2.className = 'LblLev3Txt';
        loF3.className = 'LblLev3Txt';
        loF4.className = 'LblLev3Txt';
    }
    else if (pstrAlt == 'Straataanzicht links')
    {
        loF1.className = 'LblLev3Txt';
        loF2.className = 'LblLev2Txt';
        loF3.className = 'LblLev3Txt';
        loF4.className = 'LblLev3Txt';
    }
    else if (pstrAlt == 'Straataanzicht rechts')
    {
        loF1.className = 'LblLev3Txt';
        loF2.className = 'LblLev3Txt';
        loF3.className = 'LblLev2Txt';
        loF4.className = 'LblLev3Txt';
    }
    else if (pstrAlt == 'Overkant huis')
    {
        loF1.className = 'LblLev3Txt';
        loF2.className = 'LblLev3Txt';
        loF3.className = 'LblLev3Txt';
        loF4.className = 'LblLev2Txt';
    }

}

/**
 * Als je op de knop drukt voor kaart selecteren krijg je een menu te zien met kaarten.
 * De style van de div moet wel "position: absolute; z-index: 10; width:100px; height: 200px;"
 * Waarbij de z-index, width en height zelf bepaald mag worden.
 */
function showKaartOverzicht()
{
    var loObject = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:layoutPanelSelectie');

    // tijdenlijk, als je als je nog een keer op de knop drukt verdwijnt het kaarten overzicht schermpje
    if (loObject.className == 'group-background')
        loObject.className = 'group-background hidden';
    else
        loObject.className = 'group-background';
}

/***
 * Method veranderd bij Bridgis de legenda en de kaart op het scherm.
 **/
function updateKaart(pstrAlt, pstrImageURL)
{
    var loKaart = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageBridgis');
    loKaart.src = pstrImageURL;
    loKaart.alt = pstrAlt;

    var loText = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:labBridgis');
    if (loText != null)
    {
        loText.innerHTML = pstrAlt;
    }


    var loObject = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:layoutPanelSelectie');


    var loLegenda;
    if (pstrAlt == 'Voorzieningen publiek')
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = null;
        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background hidden';

    }
    else if (pstrAlt == 'Voorzieningen commercieel')
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = null;
        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background hidden';

    }
    else if (pstrAlt == 'Waarde')
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = null;

        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background hidden';
    }

    else if (pstrAlt == 'Welstand')
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = null;

        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background hidden';
    }
    else if (pstrAlt == 'Referentieobjecten')
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = 'hidden';

        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background';
    }
    else
    {
        loLegenda = document.getElementById('formLoginMenu:imageLegendaPubliek');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaCommercieel');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaWaarde');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:imageLegendaInkomen');
        if (loLegenda != null)
            loLegenda.className = 'hidden';
        loLegenda = document.getElementById('formLoginMenu:layoutPanelRef');
        if (loLegenda != null)
            loLegenda.className = 'group-background  hidden';
    }


    loObject.className = 'group-background hidden';

}


/**
 *
 */
function prepareBridgis()
{
    var loObj1 = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:pbKaartSelecteren');

    if (loObj1 != null)
    {
        var loObj2 = document.createElement('input');

        loObj2.type = 'button';
        loObj2.style.left = '9px';
        loObj2.style.top = '30px';
        loObj2.style.position = 'absolute';
        loObj2.style.width = '140px';
        loObj2.className = loObj1.className;
        loObj2.value = loObj1.value;
        loObj2.id = loObj1.id;
        loObj2.onclick = function() {
            showKaartOverzicht()
        };

        loObj1.parentNode.replaceChild(loObj2, loObj1);
    }

    var loImage;
    var loHyperlink;

    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkOmgeving');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkOmgeving_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Omgeving', '/Image?source=Bridgis&name=omgeving')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Omgeving', '/Image?source=Bridgis&name=omgeving')
        };
    }

    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkVoorzieningenPubliek');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkVoorzieningenPubliek_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Voorzieningen publiek', '/Image?source=Bridgis&name=voorzieningen-publiek')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Voorzieningen publiek', '/Image?source=Bridgis&name=voorzieningen-publiek')
        };
    }
    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkVoorzieningenCommercieel');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkVoorzieningenCommercieel_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Voorzieningen commercieel', '/Image?source=Bridgis&name=voorzieningen-commercieel')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Voorzieningen commercieel', '/Image?source=Bridgis&name=voorzieningen-commercieel')
        };
    }


    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkWaarde');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkWaarde_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Waarde', '/Image?source=Bridgis&name=waarde')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Waarde', '/Image?source=Bridgis&name=waarde')
        };
    }

    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkWelstand');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkWelstand_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Welstand', '/Image?source=Bridgis&name=welstand')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Welstand', '/Image?source=Bridgis&name=welstand')
        };
    }

    loHyperlink = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkReferentieobjecten');
    loImage = document.getElementById('formInvoer:tabSetResultaat:tabVisuals:tabSetVisuals:tabBridgis:imageHyperlinkReferentieobjecten_image');
    if (loHyperlink != null)
    {
        loHyperlink.href = "javascript: updateKaart('Referentieobjecten', '/Image?source=Bridgis&name=referentieobjecten')";
        loHyperlink.onclick = null;
        loImage.onclick = function() {
            updateKaart('Referentieobjecten', '/Image?source=Bridgis&name=referentieobjecten')
        };
    }
}


