﻿// JScript File
var sHoofdFoto = '';
function ShowPreview(sImgD, sImgG, ClientFieldArticleID, ProductID, MeID) {
    var sPrijsblok = document.getElementById('prijsfoto').innerHTML;
    var sImgtxt = '<img class="fotogroot" src="' + sImgD + '" id="' + sHoofdFoto + 'img" >';
    var oDiv = $get(sHoofdFoto);
    if (oDiv) {
        oDiv.innerHTML = sImgtxt + '<span id="prijsfoto" class="prijsblokfoto">' + sPrijsblok + '</span>';
        //Klik naar product maken bij Tip van de week 
        if (ClientFieldArticleID) {
            sOnClick = "$get('" + ClientFieldArticleID + "').value='" + ProductID + "~" + MeID + "';MenuClick(this,17,'',event);";
            var sImgtxt = '<img class="fotogroot" src="' + sImgD + '" id="' + sHoofdFoto + 'img" onclick="' + sOnClick + '">';
            oDiv.innerHTML = sImgtxt + '<span id="prijsfoto" class="prijsblokfoto">' + sPrijsblok + '</span>';
            return false;
        } else {
            oDiv._sImgD = sImgD;
            oDiv._sImgG = sImgG;
            oDiv.onclick = PreOnClick;
        }
    }
}

function PreOnClick() {
    var oDiv = $get(sHoofdFoto);
    box_click(oDiv._sImgG, $get(sHoofdFoto + 'img'), oDiv._sImgD, '');
}


function Prijsvan_Change(dropdownmin, dropdownmax) {
    //dropdown uitlezen en volgende instellen als nodig.
    if (dropdownmin && dropdownmax) {
        var iMinWaarde = toNumber(GetValue(dropdownmin));
        if (iMinWaarde > 0) {
            var iMaxWaarde = toNumber(GetValue(dropdownmax));
            if (iMinWaarde >= iMaxWaarde && iMaxWaarde > 0) {
                switch (iMinWaarde) {
                    case 1000000: 
                        var iNieuw = 1250000;
                        SetValue(dropdownmax, iNieuw);
                        break;
                    case 1250000: 
                        var iNieuw = 1500000;
                        SetValue(dropdownmax, iNieuw);
                        break;
                    case 1500000: 
                        var iNieuw = -1;
                        SetValue(dropdownmax, iNieuw);
                        break;
                    default: 
                        var iNieuw = iMinWaarde + 50000;
                        SetValue(dropdownmax, iNieuw);
                        break;
                }
            }
        }
    }
}

function Prijstot_Change(dropdownmin, dropdownmax) {
    //dropdown uitlezen en volgende instellen als nodig.
    if (dropdownmin && dropdownmax) {
        var iMaxWaarde = toNumber(GetValue(dropdownmax));
        if (iMaxWaarde > 0) {
            var iMinWaarde = toNumber(GetValue(dropdownmin));
            if (iMaxWaarde <= iMinWaarde && iMinWaarde > 0) {
                switch (iMaxWaarde) {
                    case 50000: 
                        var iNieuw = -1;
                        SetValue(dropdownmin, iNieuw);
                        break;
                    case 1250000: 
                        var iNieuw = 1000000;
                        SetValue(dropdownmin, iNieuw);
                        break;
                    case 1500000: 
                        var iNieuw = 1250000;
                        SetValue(dropdownmin, iNieuw);
                        break;
                    default: 
                        var iNieuw = iMaxWaarde - 50000;
                        SetValue(dropdownmin, iNieuw);
                        break;
                }
            }
        }
    }
}

// doe click bij enter
function submitOnEnter(e, oButtonClick) {
    var ENTER_KEY = 13;
    var code = '';
    if (window.event) // IE
        code = e.keyCode;
    else if (e.which) // Netscape/Firefox/Opera
        code = e.which;
    if (code == ENTER_KEY) {
        oButtonClick.click();
        return true;
    }
}

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded()
