﻿function checkImage(el) {
    document[el].onerror = function() {
        this.src = 'img/leeg.png'; // show an empty img     
    }
}


//////////////////////////////////
function ChangePrice() {

    alert('test');
    //$get("priceIndications").innerHTML = com;
}

function JSAddPrice(val) {
    //alert('bert' + $get("priceIndications").innerHTML);


    if ($get("priceIndications") && !getQueryVariable('SOW')) {
        var som = +$get("priceIndications").innerHTML + val;
        $get("priceIndications").innerHTML = som;
    }
}

//////////////////////////////////
function JSPrice() {
    //var som = + $get("pricehid").value + val;
    //$get("priceIndications").innerHTML = som + ' ' + $get("pricecur").value;


    var pricehid = +($get("pricehid").value);
    var pricepla = +($get("pricepla").value);
    var pricesti = +($get("pricesti").value);
    var pricemon = +($get("pricemon").value);



    if (parseInt(pricehid) == "nan") {
        pricehid = +pricehid;
        alert('hid' + pricehid);
    }

    if (parseInt(pricepla) == "nan") {
        pricepla = +pricepla;
        alert('pla' + pricepla);
    }

    if (parseInt(pricesti) == "nan") {
        pricesti = +pricesti;
        alert('sti' + pricesti);
    }

    if (parseInt(pricemon) == "nan") {
        pricemon = +pricemon;
        alert('mon' + pricemon);
    }


    var tot = pricepla + pricesti + pricemon + pricehid;

    //alert('tot' + tot);

    if ($get("priceIndications") && !getQueryVariable('SOW'))
        $get("priceIndications").innerHTML = tot;

}

// passes the event callback function.
function GetPriceInfo() {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetPriceInfo(SuccesCallbackPrice, ErrorHandler, TimeOutHandler);
}

// passes the event callback function.
function SetPriceInfo(key, value) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.SetPriceInfo(key, value, SuccesCallbackPrice, ErrorHandler, TimeOutHandler);
}

// SET DESIGN COLLAR INFO DETAILS INTO REVIEW
function SuccesCallbackPrice(result, eventArgs) {

    var res = result;
    if ($get("pricehid"))
        $get("pricehid").value = res;

    if ($get("priceIndications") && !getQueryVariable('SOW'))
        $get("priceIndications").innerHTML = res.replace(" ", "");


}

//2 PARAMETERS
//ENKEL CONTRASTEN? CONTRASTEN 
//z= inputid (vb: whitecollar)
//i= check or not
function GetPriceInfoExtra(z, i) {

    z += '';

    if (z == "" || !z) {

    } else {
        if (z == "68" || z == "69" || z == "17" || z == "54" || z == "58" || z == "62" || z == "87" || z == "61" || z == "70" || z == "91" || z == "150" || z == "162" || z == "163" || z == "164" || z == "165" || z == "166" || z == "167" || z == "169") {

            if (z == "68" || z == "69" || z == "17" || z == "54" || z == "58" || z == "62" || z == "87" || z == "61" || z == "70" || z == "91" || z == "150" || z == "162" || z == "163" || z == "164" || z == "165" || z == "166" || z == "167" || z == "169") {
                if ($get('hidconactive')) {
                    $get('hidconactive').value = z;
                }
            }


            var disab = $get(z + '');
            var galok = document.getElementById('galok').value;
            //alert('disab: ' + disab + ' en galok: ' + galok);
            if (disab) {
                var disabclass = disab.getAttribute('class') + '';
                var selok = document.getElementById('selok').value;
                var galok = document.getElementById('galok').value;
                //alert('selok: ' + selok + ' en galok: ' + galok);
                if (disabclass && disabclass != 'imgContrast_disabled') {
                    if ((!getQueryVariable('SELID') || selok == '1') && i < 2) {
                        //get current contrastcolor
                        var d = document.getElementById('contrastPicker');
                        if (getElementsByClassName('stofsel', d)) {
                            var col = getElementsByClassName('stofsel', d);
                            var optcontrastMTMfabid = col.getAttribute('rel') + '_' + col.alt; //11104_Marco 4
                        }

                        var d2 = document.getElementById(z);
                        var optcontrastMTMfabid2 = d2.getAttribute('alt');
                    }
                    //coming from alter design
                    //i = 0 or 1
                    else {
                        //i = 1;
                        //var optcontrastMTMfabid = '11104_Marco 4'; //$get('hidcon' + z + 'fab').value + '_Marco 4';
                        //var optcontrastMTMfabid2 = 'Marco 4';  //$get('hidcon' + z + 'fab').value;
                        var optcontrastMTMfabid = document.getElementById('hidcon' + z + 'fab').value;
                        var optcontrastMTMfabid2 = document.getElementById('hidcon' + z + 'fab').value;
                    }

                    //if (!getQueryVariable('SELID')) 
                    {
                        var hidcon17 = document.getElementById('hidcon17').value;
                        if (hidcon17 == 1) {
                            if ($get("17")) {
                                $get("17").className = "imgContrast_active";
                            }
                        }
                        var hidcon54 = document.getElementById('hidcon54').value;
                        if (hidcon54 == 1) {
                            if ($get("54")) {
                                $get("54").className = "imgContrast_active";
                            }
                        }
                        var hidcon58 = document.getElementById('hidcon58').value;
                        if (hidcon58 == 1) {
                            if ($get("58")) {
                                $get("58").className = "imgContrast_active";
                            }
                        }
                        var hidcon62 = document.getElementById('hidcon62').value;
                        if (hidcon62 == 1) {
                            if ($get("62")) {
                                $get("62").className = "imgContrast_active";
                            }
                        }
                        var hidcon87 = document.getElementById('hidcon87').value;
                        if (hidcon87 == 1) {
                            if ($get("87")) {
                                $get("87").className = "imgContrast_active";
                            }
                        }
                        var hidcon61 = document.getElementById('hidcon61').value;
                        if (hidcon61 == 1) {
                            if ($get("61")) {
                                $get("61").className = "imgContrast_active";
                            }
                        }
                        var hidcon70 = document.getElementById('hidcon70').value;
                        if (hidcon70 == 1) {
                            if ($get("70")) {
                                $get("70").className = "imgContrast_active";
                            }
                        }
                        var hidcon91 = document.getElementById('hidcon91').value;
                        if (hidcon91 == 1) {
                            if ($get("91")) {
                                $get("91").className = "imgContrast_active";
                            }
                        }
                        var hidcon150 = document.getElementById('hidcon150').value;
                        if (hidcon150 == 1) {
                            if ($get("150")) {
                                $get("150").className = "imgContrast_active";
                            }
                        }
                        var hidcon163 = document.getElementById('hidcon163').value;
                        if (hidcon163 == 1) {
                            if ($get("163")) {
                                $get("163").className = "imgContrast_active";
                            }
                        }
                        var hidcon164 = document.getElementById('hidcon164').value;
                        if (hidcon164 == 1) {
                            if ($get("164")) {
                                $get("164").className = "imgContrast_active";
                            }
                        }
                        var hidcon165 = document.getElementById('hidcon165').value;
                        if (hidcon165 == 1) {
                            if ($get("165")) {
                                $get("165").className = "imgContrast_active";
                            }
                        }
                        var hidcon166 = document.getElementById('hidcon166').value;
                        if (hidcon166 == 1) {
                            if ($get("166")) {
                                $get("166").className = "imgContrast_active";
                            }
                        }
                        
                        

                        var hidcon68 = document.getElementById('hidcon68').value;
                        if (hidcon68 == 1) {
                            if ($get("68")) {
                                $get("68").className = "imgContrast_active";
                            }
                        }

                        var hidcon69 = document.getElementById('hidcon69').value;
                        if (hidcon69 == 1) {
                            if ($get("69")) {
                                $get("69").className = "imgContrast_active";
                            }
                        }
                    }


                    //////////////////////////////////////////////
                    //////////////////////////////////////////////
                    var hideo172 = document.getElementById('hideo172').value;
                    var hideo171 = document.getElementById('hideo171').value;
                    //geen eo aangevinkt
                    if ((z == "162" || z == "167" || z == "169") && (hideo171 != 1 && hideo172 != 1)) {
                        var hidcon162 = document.getElementById('hidcon162').value;
                        if (hidcon162 == 1) {
                            if ($get("162")) {
                                $get("162").className = "imgContrast_active";
                            }
                        }

                        var hidcon167 = document.getElementById('hidcon167').value;
                        if (hidcon167 == 1) {
                            if ($get("167")) {
                                $get("167").className = "imgContrast_active";
                            }
                        }
                        var hidcon169 = document.getElementById('hidcon169').value;
                        if (hidcon169 == 1) {
                            if ($get("169")) {
                                $get("169").className = "imgContrast_active";
                            }
                        }
                    }
                    else if ($get(z)) {
                        document.getElementById('hidcon' + z).value = 1;
                        $get(z).className = "imgContrast_active";
                    }

 
                    var hideo172 = document.getElementById('hideo172').value;
                    var hideo171 = document.getElementById('hideo171').value;
                    //geen eo aangevinkt
                    if (hideo171 != 1 && hideo172 != 1) {

                        if (z == "162") {
                            deactivate('167', 0);
                            deactivate('169', 0);
                        }

                        if (z == "167") {
                            deactivate('162', 0);
                            deactivate('169', 0);
                        }

                        if (z == "169") {
                            deactivate('162', 0);
                            deactivate('167', 0);
                     
                        }
                        var hidPAT = document.getElementById('hidPATFAB').value;
                        var plahid = document.getElementById('plahid').value;

                        if (plahid != 50002) { //hide 167/169
                            deactivate('167', 1);
                            deactivate('169', 1);
                            deactivate('162', 1);
                        }
                        else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
                            //LINES = 3 => show 167/169
                            //do nothing
                            activate('167');
                            activate('169');
                            activate('162');
                        } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
                            //CHECKS = 2 => show 167, hide 169
                            deactivate('169', 1);
                            activate('167');
                            activate('162');
                        } else {
                            //UNI = 1/8/11 => hide 167/169
                            deactivate('167', 1);
                            deactivate('169', 1);
                            activate('162');
                        }
                    }
                    else {
                        //do nothing
                        ShowEO171();
                        ShowEO172();
                    }
                    //////////////////////////////////////////////
                    //////////////////////////////////////////////

                    /////if ((!getQueryVariable('SELID')) &&  (i == 1 && optcontrastMTMfabid != '00000_0')) {
                    if ((i == 1 && optcontrastMTMfabid != '00000_0')) {


                        //RULES OUTER PLACKET, FABRIC DESIGN PATTERN
                        var z = $get('hidconactive').value;
                        if (z == "62") {
                            deactivate('17', 0);
                        }

                        if (z == "17") {
                            deactivate('62', 0);
                        }

                        if ($get('hidcon' + z)) {
                            //////alert('kkkk voor z: ' + z);
                            $get('hidcon' + z).value = 1;
                            $get('hidcon' + z + 'fab').value = optcontrastMTMfabid;
                        }
                        if ($get("rev" + z)) {
                            if (optcontrastMTMfabid && optcontrastMTMfabid.length > 5) {
                                var CID = getQueryVariable('CID');
                                if (CID == 50 || CID == 53 || CID == 54) {
                                    $get("rev" + z).innerHTML = optcontrastMTMfabid.substring(6) + ' - ' + optcontrastMTMfabid2 + ' (£2)';
                                }
                                else if (CID == 36 || CID == 37) {
                                    $get("rev" + z).innerHTML = optcontrastMTMfabid.substring(6) + ' - ' + optcontrastMTMfabid2;
                                }
                                else {
                                    $get("rev" + z).innerHTML = optcontrastMTMfabid.substring(6) + ' - ' + optcontrastMTMfabid2 + ' (€/£ 3)';
                                }
                            }
                        }
                        if ($get("lirev" + z)) {
                            $get("lirev" + z).className = '';
                        }
                        if ($get("fabrev" + z)) {
                            $get("fabrev" + z).className = "stof";
                        }
                        if ($get(z)) {
                            $get(z).className = "imgContrast_active_last";
                        }
                        if ($get("fabrev" + z)) {

                            $get("fabrev" + z).src = "Images/" + document.getElementById('hidcon' + z + 'fab').value.substring(0, 5) + ".jpg";

                        }
                        //men drukt op contracticoon en stof is uit = de-activeren
                    } else if (((i == 1 && optcontrastMTMfabid == '00000_0') || (i == 0 || optcontrastMTMfabid == '00000_0'))) {
                        i = 0;

                        //Highlighted border disable
                        if ($get(z)) {
                            $get(z).className = "imgContrast_none";
                        }

                        if ($get('hidcon' + z)) {
                            //alert('terug 0');
                            $get('hidcon' + z).value = 0;
                            $get('hidcon' + z + 'fab').value = '';
                        }
                        if ($get("rev" + z)) {
                            $get("rev" + z).innerHTML = '';
                        }
                        if ($get("fabrev" + z)) {
                            $get("fabrev" + z).src = "img/spacer.gif";
                        }
                        if ($get("lirev" + z)) {
                            $get("lirev" + z).className = 'contrast_hidden';
                        }
                        if ($get("fabrev" + z)) {
                            $get("fabrev" + z).className = '';
                        }
                    }
                }
            }
        }
    }

    if ((typeof (i) != "undefined") && (typeof (z) != "undefined") && (typeof (optcontrastMTMfabid) != "undefined")) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        //09012010 optcontrast => optcontrastMTM
        //alert('getprice: ' + z + ' en ' + i);
        Samples.AspNet.WebService.GetPriceInfoExtra(z, i, optcontrastMTMfabid.substring(0, 5), optcontrastMTMfabid.substring(6), SuccesCallbackPrice, ErrorHandler, TimeOutHandler);
    }
}

function deactivate(z, i) {

    //alert('deactivate: ' + z + ' en ' + i);
    //if ($get(z) && $get("img" + z))

    if (!getQueryVariable('SELID')) {
        if ($get(z))
            $get(z).className = "imgContrast_none";


        if ($get('hidcon' + z)) {
            $get('hidcon' + z).value = 0;
            $get('hidcon' + z + 'fab').value = '';
        }
        if ($get("rev" + z)) {
            $get("rev" + z).innerHTML = '';
        }
        if ($get("fabrev" + z)) {
            $get("fabrev" + z).src = "img/spacer.gif";
        }
        if ($get("lirev" + z)) {
            $get("lirev" + z).className = 'contrast_hidden';
        }
        if ($get("fabrev" + z)) {
            $get("fabrev" + z).className = '';
        }

        if (i == 1) {
            if ($get("img" + z)) {
                $get("img" + z).src = "images/" + z + "_0.png";
            }
            if ($get(z)) {
                $get(z).className = "imgContrast_disabled";
            }
        }
    }

    if (typeof (z) != "undefined") {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        //09012010 optcontrast => optcontrastMTM
        Samples.AspNet.WebService.GetPriceInfoExtra(z, 0, 00000, '', SuccesCallbackPrice, ErrorHandler, TimeOutHandler);
    }
}

function activate(z) {

    //important if
    if (getQueryVariable('SELID')) {
        z += '';
        if (document.getElementById('hidcon' + z) && !getQueryVariable('SELID')) {
            document.getElementById('hidcon' + z).value = 1;
        }
        if ($get(z) && !getQueryVariable('SELID')) {

            $get(z).className = "imgContrast_active";
        }
    }

    //UITGEZET VOOR REGELS OUTER PLACKET
    //var z2 = $get('hidconactive').value;
    //if (z2)
    {
        var CID = getQueryVariable('CID');
        var disab = document.getElementById(z);
        if (disab) {
            var disabclass = disab.getAttribute('class');
            //alert('disabclass: ' + disabclass);
            if (disabclass != 'imgContrast_active_last') {
                if (disabclass != 'imgContrast_active') {
                    if ($get(z))
                        $get(z).className = "imgContrast_none";
                    if ($get("img" + z)) {
                        if (CID == 50 || CID == 53 || CID == 54) {
                            $get("img" + z).src = "images/" + z + "_ms.png";
                        }
                        else if (CID == 65 || CID == 66 ) {
                            $get("img" + z).src = "images/" + z + "_baur.jpg";
                        }
                        else {
                            $get("img" + z).src = "images/" + z + ".png";
                        }
                    }
                    if ($get("lirev" + z))
                        $get("lirev" + z).className = 'contrast_hidden';
                }
            }
        }
    }
}

function activateGAL(z) {
    z += '';
    if (document.getElementById('hidcon' + z)) {
        document.getElementById('hidcon' + z).value = 1;
    }
    if (typeof (z) != "undefined") {
        if (z == "68" || z == "69" || z == "17" || z == "54" || z == "58" || z == "62" || z == "87" || z == "61" || z == "70" || z == "91" || z == "150" || z == "162" || z == "163" || z == "164" || z == "165" || z == "166" || z == "167" || z == "169") {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            var optcontrastMTMfabid = document.getElementById('hidcon' + z + 'fab').value;
            var optcontrastMTMfabid2 = document.getElementById('hidcon' + z + 'fab').value;
            Samples.AspNet.WebService.GetPriceInfoExtra(z, 1, optcontrastMTMfabid, '');
        }
    }
}



//VOORBEELD: WHITE COLLAR  
function GetExtraOptionsInfo(z, i) {
    //CID
    var CID = getQueryVariable('CID');

    //TODO uitlezen tapid from div
    if (z == 39 && i == 1) {

        var opttapid = $get("tapid").value;
        if (opttapid == 0) {
            $get("tapid").value = 1;
            $get("taphid").value = 'red';
            var opttapid = 1;
        }
    }
    else {
        var opttapid = 1;
    }

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetExtraOptionsInfo(CID, z, i, opttapid, SuccesCallbackExtraOptionsInfo, ErrorHandler, TimeOutHandler);
}

//REVIEW FOR EXTRA OPTIONS
//SET DESIGN PLACKET INFO DETAILS INTO REVIEW
function SuccesCallbackExtraOptionsInfo(result, eventArgs) {
    //SET REVIEW COLLAR (set empty if 0)
    //SETTING TRUE FALSE EO OPTIONS
    //is uitgevinkt
    if (result.length > 0) {
        if (result[0].FabID == 0) {
            $get('hideo' + result[0].OptionTypeID).value = 0;
        }
        //is aangevinkt
        else {
            $get('hideo' + result[0].OptionTypeID).value = 1;
        }

        //get white collar
        var wit = document.getElementById('withid').value;
        var fab = document.getElementById('fabhid').value;
        var col = document.getElementById('colhid').value;
        if (col == 20052) {
            col = 20015;
        } else if (col == 20035) {
            col = 20053;
        } else if (col == 20050) {
            col = 20061;
        } else if (col == 20001) {
            col = 20041;
        } else if (col == 20017) {
            col = 20015;
        } else if (col == 20020) {
            col = 20015;
        } else if (col == 20005) {
            col = 20056;
        } else if (col == 20060) {
            col = 20056;
        }


        var hideo15 = document.getElementById('hideo15').value;
        var hideo401 = document.getElementById('hideo401').value;
        if (result[0].OptionTypeID == 15 && hideo15 == 1 && hideo401 != 1) {
            ////////Collar load
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + wit + '.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + wit + '_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + wit + '.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + wit + '_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + wit + '_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');
            //hide contrast collar image
            document['img14'].src = 'img/leeg.png';
            document['img20014'].src = 'img/leeg.png';
            //rule: if you have chosen for white collar the choice of contrast collar must be disabled
            deactivate('58', 1);
            deactivate('87', 1);
            //hide contrast collar image
            document['img14'].src = 'img/leeg.png';
            document['img20014'].src = 'img/leeg.png';
            //white collar never has biesjes
            document['img21'].src = 'img/leeg.png';
            document['img121'].src = 'img/leeg.png';
            document['img20021'].src = 'img/leeg.png';
            document['img22'].src = 'img/leeg.png';
            document['img122'].src = 'img/leeg.png';
            document['img20022'].src = 'img/leeg.png';
        }
        else if (result[0].OptionTypeID == 15 && hideo15 == 0) {

            activate('58');
            activate('87');

            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + fab + '.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + fab + '_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + fab + '.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + fab + '_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + fab + '_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');
        }

        //////get vertical stripes//////////////////////////////
        var hideo401 = document.getElementById('hideo401').value;
        if (hideo401 == 1 && col == 20019) {
            //Collar load if not white
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + fab + '_64.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + fab + '_64_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + fab + '_64.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + fab + '_64_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + fab + '_64_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');

            //rule: white collars kan niet samen met vertical stripes, dus uitvinken
            if (hideo15 == 1) {
                if ($get("15"))
                    $get("15").checked = false;
                GetPriceInfoExtra('15', 0);
            }
        }
        else if (hideo401 == 1 && col == 20035) {
            //Collar load if not white
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + fab + '_65.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + fab + '_65_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + fab + '_65.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + fab + '_65_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + fab + '_65_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');

            //rule: white collars kan niet samen met vertical stripes, dus uitvinken
            if (hideo15 == 1) {
                if ($get("15"))
                    $get("15").checked = false;
                //????????????
                GetPriceInfoExtra('15', 0);
            }
        }
        else if (hideo401 == 1 && col == 20053) {
            //Collar load if not white
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + fab + '_66.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + fab + '_66_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + fab + '_66.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + fab + '_66_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + fab + '_66_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');

            //rule: white collars kan niet samen met vertical stripes, dus uitvinken
            if (hideo15 == 1) {
                $get("15").checked = false;
                //??????????
                GetPriceInfoExtra('15', 0);
            }
        }
        else if (hideo401 == 1 && col == 20058) {
            //Collar load if not white
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src6 = 'ren2/men_front_p14_' + col + '_' + fab + '_67.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p14_' + col + '_' + fab + '_67_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }
            else if (part == 2) {
                var src6 = 'ren2/men_front_p2_' + col + '_' + fab + '_67.png';
                document['img6'].src = src6;
                checkImage('img6');

                var src106 = 'ren2/men_front_p2_' + col + '_' + fab + '_67_zoom.png';
                document['img106'].src = src106;
                checkImage('img106');
            }

            var src20006 = 'ren2/men_front_p2_' + col + '_' + fab + '_67_zoom.png';
            document['img20006'].src = src20006;
            checkImage('img20006');

            //rule: white collars kan niet samen met vertical stripes, dus uitvinken
            if (hideo15 == 1) {
                $get("15").checked = false;
                //??????????????????
                GetPriceInfoExtra('15', 0);
            }
        } //////////////////////////////////////////////


        ////////////////////shoulder flap/////////////////////input_60001_15303.png
        var hideo6 = document.getElementById('hideo6').value;
        if (result[0].OptionTypeID == 6 && hideo6 == 1) {
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                var src53 = 'ren2/input_60001_' + fab + '.png';
                document['img53'].src = src53;
                checkImage('img53');

                var but = document.getElementById('buthid').value;
                showpla_button(but);

            }
            else {
                document['img53'].src = 'img/leeg.png';
                document['img57'].src = 'img/leeg.png';
            }
        }
        else if (hideo6 == 0) {
            var part = document.getElementById('parthid').value;
            if (part == 14) {
                document['img53'].src = 'img/leeg.png';
                document['img57'].src = 'img/leeg.png';
            }
            else {
                document['img53'].src = 'img/leeg.png';
                document['img57'].src = 'img/leeg.png';
            }
        } //////////////////////////////////////////////



        ////////////////////EO PLACKET///////////////////////
        var hideo171 = document.getElementById('hideo171').value;
        if (result[0].OptionTypeID == 171 && hideo171 == 1) {
            ShowEO171();
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
            //deactivate('167', 1);
            deactivate('169', 1);
            deactivate('162', 1);
        }
        else if (result[0].OptionTypeID == 171 && hideo171 == 0) {
            ShowEO171();
            placketextrarule();
            placketextraCONrule();
        }

        var hideo172 = document.getElementById('hideo172').value;
        if (result[0].OptionTypeID == 172 && hideo172 == 1) {
            ShowEO172();
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
            deactivate('167', 1);
            //deactivate('169', 1);
            deactivate('162', 1);
        }
        else if (result[0].OptionTypeID == 172 && hideo172 == 0) {
            ShowEO172();
            placketextrarule();
            placketextraCONrule();
        }

        //get inner band tape
        showtap(col);

        //get white cuff
        var cuf = document.getElementById('cufhid').value;
        var hideo4 = document.getElementById('hideo4').value;
        if (result[0].OptionTypeID == 4 && hideo4 == 1) {
            //short sleeve choice invisible
            if ($get("divsleeveshort"))
                $get("divsleeveshort").style.visibility = "hidden";

            //rule: if you have chosen for white cuffs the choice of contrast cuffs must be disabled
            //15/7/2011
            deactivate('61', 1);
            deactivate('91', 1);

            //hide contrast cuff image
            document['img13'].src = 'img/leeg.png';
            document['img30013'].src = 'img/leeg.png';
            showcuf(cuf);
            //reset price
            ///////////////////////////////GetPriceInfoExtra('61', 0);

        }
        else if (hideo4 == 0) {
            //15/7/2011
            //alert('yyyyyyyy');
            activate('61');
            activate('91');
            showcuf(cuf);

            if ($get("divsleeveshort"))
                $get("divsleeveshort").style.visibility = "visible";
        }

        GetPriceInfo();
    }

}

function placketextrarule() {
    var hidPAT = document.getElementById('hidPATFAB').value;
    var plahid = document.getElementById('plahid').value;
    if (plahid != 50002) { //hide 167/169
        if ($get("171")) {
            $get("171").checked = false;
            $get("171").disabled = true;
        }
        if ($get("172")) {
            $get("172").checked = false;
            $get("172").disabled = true;
        }
    }
    else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
        //LINES = 3 => show 167/169
        //do nothing
        if ($get("171")) {
            $get("171").checked = false;
            $get("171").disabled = false;
        }
        if ($get("172")) {
            $get("172").checked = false;
            $get("172").disabled = false;
        }
    } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
        //CHECKS = 2 => show 167, hide 169
        if ($get("171")) {
            $get("171").checked = false;
            $get("171").disabled = false;
        }
        if ($get("172")) {
            $get("172").checked = false;
            $get("172").disabled = true;
        }
    } else {//UNI = 1/8/11 => hide 167/169
        if ($get("171")) {
            $get("171").checked = false;
            $get("171").disabled = true;
        }
        if ($get("172")) {
            $get("172").checked = false;
            $get("172").disabled = true;
        }
    }   //////////////////////////////////////
}

function placketextraCONrule() {
    var hideo172 = document.getElementById('hideo172').value;
    var hideo171 = document.getElementById('hideo171').value;
    //geen eo aangevinkt
    if (hideo171 != 1 && hideo172 != 1) {
        var hidPAT = document.getElementById('hidPAT').value;
        var plahid = document.getElementById('plahid').value;
        if (plahid != 50002) { //hide 167/169
            deactivate('167', 1);
            showcon(167);
            deactivate('169', 1);
            showcon(169);
            deactivate('162', 1);
            showcon(162);
        } else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
            //LINES = 3 => show 167/169
            activate('167');
            activate('169');
            activate('162');
        } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
            //CHECKS = 2 => show 167, hide 169
            deactivate('169', 1);
            activate('167');
            activate('162');
        } else {//UNI = 1/8/11 => hide 167/169
            deactivate('167', 1);
            deactivate('169', 1);
            activate('162');
        }
    }
    //BERT: after clicking contrast fabric, de bias option is gone so empty
    else {
       ShowEO171();
       ShowEO172();
   }



}


function placketextraCONruleINLINE() {
        var hidPAT = document.getElementById('hidPAT').value;
        var plahid = document.getElementById('plahid').value;
        if (plahid != 50002) { //hide 167/169
            GetExtraOptionsInfo(171, 0);
            GetExtraOptionsInfo(172, 0);
            ShowEO171();
            ShowEO172();
            deactivate('167', 1);
            showcon(167);
            deactivate('169', 1);
            showcon(169);
            deactivate('162', 1);
            showcon(162);
        } else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
            //LINES = 3 => show 167/169
            activate('167');
            activate('169');
            activate('162');
        } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
            //CHECKS = 2 => show 167, hide 169
            deactivate('169', 1);
            activate('167');
            activate('162');
        } else {//UNI = 1/8/11 => hide 167/169
            deactivate('167', 1);
            deactivate('169', 1);
            activate('162');
        }
}





function gabytest() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //Samples.AspNet.WebService.GetXmlDocument();
}

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
}


function Rotation() {
    //var img = document.getElementById("raf");
    //var r = Raphael(document.getElementById("holder"), 90, 90); 
    //r.image(img.src, 0, 0, 90, 90);

    //var img2 = document.getElementById("raf2");
    //var r2 = Raphael(document.getElementById("holder2"), 90, 90); 
    //r2.image(img2.src, 0, 0, 90, 90);
}

//GetTypeforConfMonoTypeID
function GetMONloc() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetLocforConfMonoTypeID("101", SuccesCallbackMONloc, ErrorHandler, TimeOutHandler);
}

//GetTypeforConfMonoTypeID
function GetMONloc2(id) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetLocforConfMonoTypeID(id, SuccesCallbackMONloc, ErrorHandler, TimeOutHandler);
}

function SuccesCallbackMONloc(result, eventArgs) {
    if (document.getElementById('postionMonogram')) {
        var d = document.getElementById('postionMonogram');
        d.innerHTML = "";

        //THIS IS NOT DISPLAYED YOERI
        var z = document.getElementById('langhid').value;
        if (z == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
            d.innerHTML += "<strong style='display:block'>Position</strong>"
        }
        else if (z == 2) {
            d.innerHTML += "<strong style='display:block'>Plaats</strong>"
        }
        else if (z == 3) {
            d.innerHTML += "<strong style='display:block'>Position</strong>"
        }
        else if (z == 4) {
            d.innerHTML += "<strong style='display:block'>Position</strong>"
        }
        else if (z == 5 || document.URL.toLowerCase().indexOf('10009') != -1) {
            d.innerHTML += "<strong style='display:block'>Posición</strong>"
        }
        else {
            d.innerHTML += "<strong style='display:block'>Position</strong>"
        }

        var CID = getQueryVariable('CID');
        if ((z == 1) && (CID == 50 || CID == 53 || CID == 54)) {

            for (i = 0; i < 20; i++) {
                if (result.length > i) {
                    d.innerHTML += "<div class='postionMonograms'><img onclick=SetLocsel('" + result[i].SQnumber + "'); id='loc_" + result[i].SQnumber + "'  src='images/" + result[i].SQnumber + "_ms.png' alt='" + result[i].SQcolvalue + "' class='initialsPostion' /><br />" + result[i].SQcolvalue + "</div>";
                }
            }
        }

        else if ((z == 1) && (CID == 65 || CID == 66 )) {

            for (i = 0; i < 20; i++) {
                if (result.length > i) {
                    d.innerHTML += "<div class='postionMonograms'><img onclick=SetLocsel('" + result[i].SQnumber + "'); id='loc_" + result[i].SQnumber + "'  src='images/" + result[i].SQnumber + "_baur.jpg' alt='" + result[i].SQcolvalue + "' class='initialsPostion' /><br />" + result[i].SQcolvalue + "</div>";
                }
            }
        }

        else {
            for (i = 0; i < 20; i++) {
                if (result.length > i) {
                    d.innerHTML += "<div class='postionMonograms'><img onclick=SetLocsel('" + result[i].SQnumber + "'); id='loc_" + result[i].SQnumber + "'  src='images/" + result[i].SQnumber + ".png' alt='" + result[i].SQcolvalue + "' class='initialsPostion' /><br />" + result[i].SQcolvalue + "</div>";
                }
            }
        }
        if ($get('loc_' + result[0].SQnumber))
            $get('loc_' + result[0].SQnumber).className = 'highlight';

    }
}

function exist(a) {
    try { var b = a; }
    catch (e) { return false; }
    return true;
} // exist 


// This function calls the Web service method and 
// passes the event callback function.
function SetLocsel(i) {

    //SetLocsel('130001');
    //alert('setlocsel i: ' + i);
    var d = document.getElementById('postionMonogram');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }
    if ($get("loc_" + i))
        $get("loc_" + i).className = 'highlight';




    //Rule: if monogram on longsleeve, show longsleeve
    if (i == "130002" || i == "130006" || i == "130038") {
        //$get("cufhid").value = 30003;
        //showcuf(30003);
    }

    if (!getQueryVariable('SELID'))
    {
        GenerateMonogram2();
    }


}



//STARTUP FUNCTION
function GetMONchoice() {

    //CID
    var CID = getQueryVariable('CID');
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetMONchoice(CID, SuccesCallbackMONchoice, ErrorHandler, TimeOutHandler);
}

//RETURN GetMONchoice()
function SuccesCallbackMONchoice(result, eventArgs) {
    if (document.getElementById('MonoChoice')) {
        var d = document.getElementById('MonoChoice');
        d.innerHTML = "";

        if (result.length > 0) {

            if (result.length > 1) {
                var z = document.getElementById('langhid').value;
                if (z == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    d.innerHTML += "<input id='menumono1' onclick=menumonoclick('1','" + result[0].SQcolvalue + "'); type='radio' checked='checked'/><strong>Initials</strong>";
                }
                else if (z == 2) {
                    d.innerHTML += "<input id='menumono1' onclick=menumonoclick('1','" + result[0].SQcolvalue + "'); type='radio' checked='checked'/><strong>Initialen</strong>";
                }
                else if (z == 3) {
                    d.innerHTML += "<input id='menumono1' onclick=menumonoclick('1','" + result[0].SQcolvalue + "'); type='radio' checked='checked'/><strong>Initiales</strong>";
                }
                else if (z == 4) {
                    d.innerHTML += "<input id='menumono1' onclick=menumonoclick('1','" + result[0].SQcolvalue + "'); type='radio' checked='checked'/><strong>Initialen</strong>";
                }


                d.innerHTML += "<input id='menumono2' onclick=menumonoclick('2','" + result[1].SQcolvalue + "'); type='radio' /><strong>Medaillon</strong>";
                GetMONcol2(result[0].SQcolvalue);
                GetMONtyp2(result[0].SQcolvalue);
                GetMONloc2(result[0].SQcolvalue);
            } else if (result.length > 0) {
                var z = document.getElementById('langhid').value;
                if (z == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    d.innerHTML += "<strong>Initials</strong>";
                }
                else if (z == 2) {
                    d.innerHTML += "<strong>Initialen</strong>";
                }
                else if (z == 3) {
                    d.innerHTML += "<strong>Initiales</strong>";
                }
                else if (z == 4) {
                    d.innerHTML += "<strong>Initialen</strong>";
                }



                //d.innerHTML += "<strong>Initials</strong>";
                GetMONcol2(result[0].SQnumber);
                GetMONtyp2(result[0].SQnumber);
                GetMONloc2(result[0].SQnumber);
            } else if (result.length < 1) {
                d.innerHTML += "<strong>NO MONOGRAM</strong>";
            }

        }
    }
}

//GetTypeforConfMonoTypeID
function GetMONtyp() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetTypeforConfMonoTypeID("101", SuccesCallbackMONtyp, ErrorHandler, TimeOutHandler);
}

//GetTypeforConfMonoTypeID
function GetMONtyp2(id) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetTypeforConfMonoTypeID(id, SuccesCallbackMONtyp, ErrorHandler, TimeOutHandler);
}

//RETURN GetMONtyp2
function SuccesCallbackMONtyp(result, eventArgs) {
    if (document.getElementById('monogramFont2')) {
        var d = document.getElementById('monogramFont2');
        d.innerHTML = "";

        if (result.length > 0) {
            for (i = 0; i < 20; i++) {
                if (result.length > i) {
                    //<input type="radio" name="monogramFont" id="swissblock" value="diamant"/><label for="swissblock"><img src="img/swissblock.jpg" alt="swiss block" /></label><br />
                    d.innerHTML += "<input onclick=SetTypsel('" + result[i].SQnumber + "');GetMONloc2('" + result[i].SQconfnumber + "');GetMONcol2('" + result[i].SQconfnumber + "'); type='radio' name='monogramFont' id='typ_" + result[i].SQnumber + "' value='" + result[i].SQimg + "'/><label for='swissblock'><img src='images/" + result[i].SQnumber + ".jpg' alt='swiss block' /></label><br />";
                }
            }

            if ($get('typ_' + result[0].SQnumber)) {
                $get('typ_' + result[0].SQnumber).checked = true;
                $get('typ_' + result[0].SQnumber).className = 'highlight';
            }
        }
    }
}

// This function calls the Web service method and 
// passes the event callback function.
function SetTypsel(i) {
    var d = document.getElementById('monogramFont2');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }
    if ($get("typ_" + i))
        $get("typ_" + i).className = 'highlight';
}


// This function calls the Web service method and 
// passes the event callback function.
function SetTapsel(i) {
    if (i == 1) {
        if ($get("tap1"))
            $get("tap1").className = 'highlight';
        if ($get("tap2"))
            $get("tap2").className = 'colourTape';
        if ($get("tap3"))
            $get("tap3").className = 'colourTape';
        if ($get("tap4"))
            $get("tap4").className = 'colourTape';
        if ($get("taphid"))
            $get("taphid").value = 'red';
        if ($get("tapid"))
            $get("tapid").value = '1';

        if ($get("39").checked == true && $get("39").disabled == false) {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.SetTapsel(i);
            GetPriceInfo();
        }

    } else if (i == 2) {
        if ($get("tap1"))
            $get("tap1").className = 'colourTape';
        if ($get("tap2"))
            $get("tap2").className = 'highlight';
        if ($get("tap3"))
            $get("tap3").className = 'colourTape';
        if ($get("tap4"))
            $get("tap4").className = 'colourTape';
        if ($get("taphid"))
            $get("taphid").value = 'orange';
        if ($get("tapid"))
            $get("tapid").value = '2';

        if ($get("39").checked == true && $get("39").disabled == false) {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.SetTapsel(i);
            GetPriceInfo();
        }

    } else if (i == 3) {
        if ($get("tap1"))
            $get("tap1").className = 'colourTape';
        if ($get("tap2"))
            $get("tap2").className = 'colourTape';
        if ($get("tap3"))
            $get("tap3").className = 'highlight';
        if ($get("tap4"))
            $get("tap4").className = 'colourTape';

        if ($get("taphid"))
            $get("taphid").value = 'black';
        if ($get("tapid"))
            $get("tapid").value = '3';

        if ($get("39").checked == true && $get("39").disabled == false) {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.SetTapsel(i);
            GetPriceInfo();
        }
    } else if (i == 4) {
        if ($get("tap1"))
            $get("tap1").className = 'colourTape';
        if ($get("tap2"))
            $get("tap2").className = 'colourTape';
        if ($get("tap3"))
            $get("tap3").className = 'colourTape';
        if ($get("tap4"))
            $get("tap4").className = 'highlight';

        if ($get("taphid"))
            $get("taphid").value = 'blue';
        if ($get("tapid"))
            $get("tapid").value = '4';

        if ($get("39").checked == true && $get("39").disabled == false) {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.SetTapsel(i);
            GetPriceInfo();
        }
    }

    //show new coltap
    var col = document.getElementById('colhid').value;
    showtap(col);
}

function SetSQsel(i) {
    $get('sq13hid').value = i;
    ShowSQimg();

    var d = document.getElementById('postionMonogram2');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }

    if ($get("SQpos_" + i))
        $get("SQpos_" + i).className = 'highlight';
}

// SET SQUIRREL
function GetSQimg(i) {
    if ($get('sq14hid'))
        $get('sq14hid').value = i;
    ShowSQimg();

    var strSQnumber = i.toString();
    if ($get("SquirrelIMG"))
        $get("SquirrelIMG").src = "img/" + strSQnumber + ".gif";

    if ($get("confExtraSq")) {
        $get("confExtraSq").src = "img/" + strSQnumber + ".gif";
    }
}

// This function calls the Web service method and 
// passes the event callback function.
function GetMONcol() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //Samples.AspNet.WebService.GetSquirrel(SuccesCallback1, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetColforConfMonoTypeID("201", SuccesCallback1, ErrorHandler, TimeOutHandler);
}

// This function calls the Web service method and 
// passes the event callback function.
function GetMONcol2(id) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //Samples.AspNet.WebService.GetSquirrel(SuccesCallback1, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetColforConfMonoTypeID(id, SuccesCallback1, ErrorHandler, TimeOutHandler);
}

// RETURN GetMONcol2
function SuccesCallback1(result, eventArgs) {
    if (document.getElementById('allCollors1')) {
        var d = document.getElementById('allCollors1');
        d.innerHTML = "";

        for (i = 0; i < 20; i++) {
            if (result.length > i) {
                d.innerHTML += "<div alt='" + result[i].SQcolvalue + "' rel='" + result[i].SQcolvalue + "' title='" + result[i].SQcollabel + "' onclick=SetColsel1('" + result[i].SQnumber + "'); class='collors' id='col1_" + result[i].SQnumber + "' style='background-color:#" + result[i].SQcolvalue + ";'>.</div>";
            }
        }

        var i = document.getElementById('hidmoncol').value;
        if ($get('col1_' + i)) {
            $get('col1_' + i).className = 'collorssel';
        }
        else if ($get('col1_' + result[0].SQnumber)) {
            $get('col1_' + result[0].SQnumber).className = 'collorssel';
            $get("hidmoncol").value = result[0].SQnumber;
        }
    }


    //if (!getQueryVariable('SELID')) 
    {
        GenerateMonogram2();
    }

}

// STARTUP FUNCTION
function GetMONcolsq() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //Samples.AspNet.WebService.GetSquirrel(SuccesCallback1, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetColforSQ(SuccesCallback1SQ, ErrorHandler, TimeOutHandler);

}

// This function calls the Web service method and 
// passes the event callback function.
function GetMONcolsqdefaultfab(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetMONcolsqdefaultfab(i, SuccesCallback1SQdefault, ErrorHandler, TimeOutHandler);
}

// RETURN GetMONcolsqdefaultfab
function SuccesCallback1SQdefault(result, eventArgs) {
    //CHECK IF POSSIBLE, THUS ENABLE
    if (result.length > 0) {
        //Set squirrel+color
        if (result[0].SQnumber) {
            if ($get('SquirrelIMG'))
                $get('SquirrelIMG').src = 'img/' + result[0].SQnumber + '.gif';

            if ($get("confExtraSq"))
                $get("confExtraSq").src = "img/" + result[0].SQnumber + ".gif";

            var d = document.getElementById('allCollors2');
            var el = getElementsByClassName('collorssel', d);
            if (el) {
                el.className = 'collors';
            }
            if ($get('col2_' + result[0].SQnumber))
                $get('col2_' + result[0].SQnumber).className = 'collorssel';
        }
    } else {
        //alert('no default squirrel');
    }

    if ($get('sq14hid') && result.length > 0) {
        $get('sq14hid').value = result[0].SQnumber;
        var sq13hid = document.getElementById('sq13hid').value;
        $get('sq13hid').value = sq13hid;
        ShowSQimg();
    }
}


// This is the callback function invoked if the Web service succeeded.
// It accepts the result object as a parameter.
function SuccesCallback1SQ(result, eventArgs) {

    if (document.getElementById('allCollors2')) {
        var d2 = document.getElementById('allCollors2');
        d2.innerHTML = "";

        for (i = 0; i < 30; i++) {
            if (result.length > i) {
                //filter doubles
                if (i > 0 && result[i].SQimg != result[i - 1].SQimg) {
                    d2.innerHTML += "<div onclick=GetSQimg(" + result[i].SQnumber + ");SetColsel2('" + result[i].SQnumber + "'); class='collors' id=col2_" + result[i].SQnumber + " alt='0|" + result[i].SQimg + '|' + result[i].SQconfnumber + "' rel='" + result[i].SQconfnumber + "' title='" + result[i].SQcollabel + "' style='background-color:#" + result[i].SQcolvalue + ";'>.</div>";
                }
                else if (i == 0) {
                    d2.innerHTML += "<div onclick=GetSQimg(" + result[i].SQnumber + ");SetColsel2('" + result[i].SQnumber + "'); class='collors' id=col2_" + result[i].SQnumber + " alt='0|" + result[i].SQimg + '|' + result[i].SQconfnumber + "' rel='" + result[i].SQconfnumber + "' title='" + result[i].SQcollabel + "' style='background-color:#" + result[i].SQcolvalue + ";'>.</div>";
                }
            }
        }
    }
}

// This function calls the Web service method and 
// passes the event callback function.
function SetColsel1(i) {

    if (i.length < 6) {
        i = i.replace('14', '140');
    }
    
    var d = document.getElementById('allCollors1');
    var el = getElementsByClassName('collorssel', d);
    if (el) {
        el.className = 'collors';
    }
    if ($get("col1_" + i))
        $get("col1_" + i).className = 'collorssel';

    $get("hidmoncol").value = i;


    //if (!getQueryVariable('SELID')) 
    {
        GenerateMonogram2();
    }
}

// This function calls the Web service method and 
// passes the event callback function.
function SetColsel2(i) {
    //i length needs to be 6
    if (i.length < 6) {
        i = i.replace('14', '140');
    }
    var d = document.getElementById('allCollors2');
    var el = getElementsByClassName('collorssel', d);
    if (el) {
        el.className = 'collors';
    }
    if ($get("col2_" + i))
        $get("col2_" + i).className = 'collorssel';
}


function GenerateMonogram2() {
    //if JA
    if ($get("yesmon").checked) {

        var i = document.getElementById('inputtxt2').value;

        //Get highlighted PLACE
        var d3 = document.getElementById('postionMonogram');
        var el3 = getElementsByClassName('highlight', d3);
        if (el3) {
            var monogramplace = el3.id.substring(4);
        }
        else {
            var monogramplace = 130001;
        }

        var typdiv = document.getElementById('monogramFont2');
        var typ = getElementsByClassName('highlight', typdiv);
        if (typ) {
            var fontVal = typ.id.substring(4);
        }
        else {
            var fontVal = 120001;
        }
        //alert(typVal);
        //120002
        //var fontVal = 120002;

        var coldiv = document.getElementById('allCollors1');
        var col = getElementsByClassName('collorssel', coldiv);
        //var colVal = col.rel;
        if (col) {
            var colVal = col.getAttribute('rel');
        }
        else {
            var colVal = 'fef32d';
        }

        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        //current collar, cuff, pocket
        var cuf = document.getElementById('cufhid').value;
        var poc = document.getElementById('pochid').value;
        var col = document.getElementById('colhid').value;
        var bas = document.getElementById('bashid').value;
        if (document.getElementById('MONGUID')) {
            var MONGUID = document.getElementById('MONGUID').value;
        }
        if (poc == "no" || poc == "") {
            poc = "70001";
        }

        if (poc == "70099") {
            poc = "70004";
        }

        if (fontVal != undefined) {
            Samples.AspNet.WebService.GenerateMonogramMethod2(i, fontVal, colVal, monogramplace, col, cuf, poc, bas, MONGUID);
            Start2();
        }
    }
}



function Start2() {
    var t = 1; // interval in seconds
    setTimeout("Start2enStop()", t * 1000);
}

function Start2enStop() {
    tmp = new Date();
    tmp = "?" + tmp.getTime();
    if (document.getElementById('MONGUID')) {
        var MONGUID = document.getElementById('MONGUID').value;
        document.images["refresh2"].src = "images/test2" + MONGUID + ".png" + tmp;

        var part = document.getElementById('parthid').value;
        if (part == 14) {
            document.images["refresh22"].src = "images/test22" + MONGUID + ".png" + tmp;
        } else {
            showmonogramp();
        }
    }
}

function showmonogramp() {

    tmp = new Date();
    tmp = "?" + tmp.getTime();

    var d3 = document.getElementById('postionMonogram');
    var el3 = getElementsByClassName('highlight', d3);
    if (el3) {
        var placeVal = el3.id.substring(4);
    }
    else {
        var placeVal = 130001;
    }

    var part = document.getElementById('parthid').value;
    //MONGUID
    if (document.getElementById('MONGUID')) {
        var MONGUID = document.getElementById('MONGUID').value;
    }
    if ((part == 2) && (placeVal == "130035")) {
        document.images["refresh22"].src = "images/test222" + MONGUID + ".png" + tmp;
    } else if ((part == 3) && (placeVal == "130002" || placeVal == "130006")) {
        document.images["refresh22"].src = "images/test222" + MONGUID + ".png" + tmp;
    } else if ((part == 6) && (placeVal == "130001" || placeVal == "130010" || placeVal == "130013")) {
        document.images["refresh22"].src = "images/test222" + MONGUID + ".png" + tmp;
    }
    else {
        document.images["refresh22"].src = 'img/leeg.png';
    }
}

function rot() { }



function isAlphaNumeric(keyCode) {
    return (((keyCode >= 48 && keyCode <= 57) && isShift == false) || (keyCode >= 65 && keyCode <= 90) || keyCode == 8 || (keyCode >= 96 && keyCode <= 105))
}

var isShift = false;
function keyUP(keyCode) {
    if (keyCode == 16)
        isShift = false;
}
////////////////////////////////////////////////////////////////////
//////////////////////end monogram//////////////////////////////////
////////////////////////////////////////////////////////////////////

function menuclickplus() {
    $get("previous_button_Design_collar_page").className = "previousBtn previous_button_ms";
    var hidmenu = parseInt(document.getElementById('hidmenu').value) + 1;
    if (hidmenu == 7 || hidmenu == 8) {
        hidmenu = 5;
        menuclick(hidmenu);
    }
    else if (hidmenu == 5) {
        hidmenu = 7;
        menuclick(hidmenu);
    }
    else {
        menuclick(hidmenu);
    } 
}

function menuclickmin() {
    $get("next_button").className = "";
    $get("next_button").src = "MS/images/B1_MS__06.png";
    var hidmenu = parseInt(document.getElementById('hidmenu').value) - 1;
    if (hidmenu == 1) {
        $get("previous_button_Design_collar_page").className = "hidden";
    }
    else {
        $get("previous_button_Design_collar_page").className = "previousBtn previous_button_ms";
    }

    if (hidmenu == 6 ) {
        hidmenu = 4;
        menuclick(hidmenu);
    }
    else if (hidmenu == 4) {
        hidmenu = 7;
        menuclick(hidmenu);
    } else {
        menuclick(hidmenu);
    }
}

function menuclick(id) {
    if (id == 1) {
        if ($get("previous_button_Design_collar_page"))
            $get("previous_button_Design_collar_page").className = "hidden";
        if ($get("previous_button_Design_collar_page_baur"))
            $get("previous_button_Design_collar_page_baur").className = "hidden";
    }
    else {
        if ($get("previous_button_Design_collar_page"))
            $get("previous_button_Design_collar_page").className = "previousBtn previous_button_ms";
        if ($get("previous_button_Design_collar_page_baur"))
            $get("previous_button_Design_collar_page_baur").className = "previousBtn previous_button_baur";
    }
    
    if (document.getElementById('hidmenu')) {
        var hidmenu = parseInt(document.getElementById('hidmenu').value);
        if (id == 5) {
            if ($get("next_button")) {
                $get("next_button").className = "hidden";
            }
            if ($get("next_button_baur")) {
                $get("next_button_baur").className = "hidden";
            }
        }
        else {
            if ($get("next_button")) {
                $get("next_button").className = "";
                $get("next_button").src = "MS/images/B1_MS__06.png";
            }
            if ($get("next_button_baur")) {
                $get("next_button_baur").className = "";
                $get("next_button_baur").src = "Baurm/images/B1_baur__06.png";
            }
        }
        $get('hidmenu').value = id;
    }
    var affvar = gup('affid');
    var cidvar = gup('CID');
    //set menu state
    if (id == 1) {

        if ($get("hcmli1"))
            $get("hcmli1").className = 'current';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1current.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'todo';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2todo.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'todo';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3todo.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'todo';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4todo.jpg';
        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5todo.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'todo';
            }

            $get("hcmli6").className = 'last_todo';
        } else {
        if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_todo';
            }
        }

    } else if (id == 2) {


        //check cuffrule
        var f = document.getElementById('cufhid').value;
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetRuleCUF(f, SuccesCallbackcufklik, ErrorHandler, TimeOutHandler);


        //get collar
        var e = document.getElementById('colhid').value;
        //get cuff
        var f = document.getElementById('cufhid').value;
        //get pla
        var g = document.getElementById('plahid').value;

        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetRuleCON(e, f, g, SuccesCallbackmenuklik, ErrorHandler, TimeOutHandler);

        if ($get("hcmli1"))
            $get("hcmli1").className = 'done';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1done.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'current';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2current.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'todo';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3todo.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'todo';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4todo.jpg';


        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5todo.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'todo';
            }

            $get("hcmli6").className = 'last_todo';
        } else {
        if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_todo';
            }
        }

    }

    else if (id == 3) {
        if ($get("hcmli1"))
            $get("hcmli1").className = 'done';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1done.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'done';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2done.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'current';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3current.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'todo';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4todo.jpg';


        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5todo.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'todo';
            }

            $get("hcmli6").className = 'last_todo';
        } else {
        if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_todo';
            }
        }

    } else if (id == 4) {

        if ($get("hcmli1"))
            $get("hcmli1").className = 'done';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1done.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'done';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2done.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'done';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3done.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'current';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4current.jpg';


        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5todo.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'todo';
            }

            $get("hcmli6").className = 'last_todo';
        } else {
        if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_todo';
            }
        }
    } else if (id == 5) {
        if ($get("hcmli1"))
            $get("hcmli1").className = 'done';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1done.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'done';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2done.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'done';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3done.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'done';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4done.jpg';


        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5current.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'done';
            }

            $get("hcmli6").className = 'last_current';
        } else {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_current';
                $get("hcmli5").className = 'last_current';
                $get("hcmli5").className = 'last_current';
            }
        }
        //meas leeg
        var hidcheck = document.getElementById('ctl00_cph1_MeasurementsEditControl_HiddenField1').value;
           
        if ($get("ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue") && (!getQueryVariable('SELID'))) {
            if ($get("ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue").value == "") {
                var modalPopupBehavior = $find('programmaticModalPopupBehavior1');
                modalPopupBehavior.show();

            }else {if (hidcheck == 1) {
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight1')) {

                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight1');
                    if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight1')) {
                        var e1 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight1');
                        if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize1')) {
                            var e2 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize1');
                            if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlAge')) {
                                var e3 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlAge');
                                if (e || e1 || e2 || e3) {
                                    var val = e.options[e.selectedIndex].value;
                                    var val1 = e1.options[e1.selectedIndex].value;
                                    var val2 = e2.options[e2.selectedIndex].value;
                                    var val3 = e3.options[e3.selectedIndex].value;
                                    if ((val == "145") || (val1 == "45") || (val2 == "36") || (val3 == "16")) {
                                        var modalPopupBehavior1 = $find('programmaticModalPopupBehavior11');
                                        modalPopupBehavior1.show();
                                    }
                                }
                            } 
                        }

                    }

                }
            }

            //inch measures
            if (hidcheck == 2) {
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight21')) {

                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight21');
                    if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight22')) {

                        var e0 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight22');
                        if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight2')) {
                            var e1 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight2');
                            if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize2')) {
                                var e2 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize2');
                                if (e || e0 || e1 || e2) {
                                    var val = e.options[e.selectedIndex].value;
                                    var val0 = e0.options[e0.selectedIndex].value;
                                    var val1 = e1.options[e1.selectedIndex].value;
                                    var val2 = e2.options[e2.selectedIndex].value;
                                    if ((val == "4") || (val0 == "0") || (val1 == "99") || (val2 == "14.00")) {
                                        var modalPopupBehavior1 = $find('programmaticModalPopupBehavior11');
                                        modalPopupBehavior1.show();
                                    }
                                }
                            }

                        }


                    }
                }
            }

        }
    }
    } else if (id == 6) {
                if ($get("hcmli6"))
                $get("hcmli6").className = 'last_current';
    } else if (id == 7) {
        if ($get("confExtraChiefBg"))
            $get("confExtraChiefBg").src = "http://www.bivolino.com/ren7/extraVest.png";

        if ($get("hcmli1"))
            $get("hcmli1").className = 'done';
        if ($get("hcmimg1"))
            $get("hcmimg1").src = 'img/1done.jpg';
        if ($get("hcmli2"))
            $get("hcmli2").className = 'done';
        if ($get("hcmimg2"))
            $get("hcmimg2").src = 'img/2done.jpg';
        if ($get("hcmli3"))
            $get("hcmli3").className = 'done';
        if ($get("hcmimg3"))
            $get("hcmimg3").src = 'img/3done.jpg';
        if ($get("hcmli4"))
            $get("hcmli4").className = 'done';
        if ($get("hcmimg4"))
            $get("hcmimg4").src = 'img/4done.jpg';

        if ($get("hcmimg5"))
            $get("hcmimg5").src = 'img/5current.jpg';

        if ($get("hcmli6")) {
            if ($get("hcmli5")) {
                $get("hcmli5").className = 'current';
            }

            $get("hcmli6").className = 'last_todo';
        } else {
        if ($get("hcmli5")) {
                $get("hcmli5").className = 'last_current';
            }
        }
    }

    //monogram yes + leeg
    if ($get("yesmon")) {
        if ($get("yesmon").checked && $get("inputtxt2").value == "") {
            var modalPopupBehavior = $find('programmaticModalPopupBehavior4');
            modalPopupBehavior.show();
        }
    }



    for (var i = 1; i <= 7; i++) {
        if (id == i) {
            if ($get("ctl00_cph1_mod" + i))
                $get("ctl00_cph1_mod" + i).className = 'DivShown';



            menunorevclick(id);
        }
        else {
            if ($get("ctl00_cph1_mod" + i))
                $get("ctl00_cph1_mod" + i).className = 'DivHidden';

        }
    }

    //moonogram
    if (id == 3) {
        var fab = document.getElementById('fabhid').value;
        if ($get("raf2"))
            $get("raf2").src = "images/" + fab + ".jpg";
        if ($get("raf3"))
            $get("raf3").src = "images/" + fab + ".jpg";
        if ($get("rafSQ"))
            $get("rafSQ").src = "images/" + fab + ".jpg";

    }

    if (id != 5) {
        if ($get("BtnAddSC"))
            $get("BtnAddSC").className = 'DivHidden';

    }

    if (id == 5) {

        if ($get("BtnAddSC"))
            $get("BtnAddSC").className = 'DivShown';


        if ($get("yesmon")) {
            if ($get("yesmon").checked) {
                //SET highlighted MONTEXT
                var d4 = document.getElementById('inputtxt2');
                ChangeText('monrevtxt', d4.value + '');

                //SET highlighted MONCOLOUR
                var d2 = document.getElementById('allCollors1');
                var el2 = getElementsByClassName('collorssel', d2);
                if (el2) {
                    //                ChangeText('monrevcol', el2.id.substring(5) + '');
                    ChangeText('monrevcol', el2.title + '');
                }

                //SET highlighted MONFONT
                var d = document.getElementById('monogramFont2');
                var el = getElementsByClassName('highlight', d);
                if (el) {
                    //defaultValue = "diamant"
                    ChangeText('monrevfont', el.defaultValue + '');
                    //el3.id.substring(4)
                    //set price for monogram
                    if (el.id.substring(4) == "120006") {
                        if (affvar == '10008') {
                            //toggle if (fontVal == "120006")
                            ChangeText('monrevprice', '(0 €/£)');
                            //SetParam('extraprice_monogram', '10');
                            SetPriceInfo('alg_monogram_price', '0');
                        }
                        else if (affvar == '10052') {
                            //toggle if (fontVal == "120006")
                            ChangeText('monrevprice', '(0 €/£)');
                            //SetParam('extraprice_monogram', '10');
                            SetPriceInfo('alg_monogram_price', '0');
                        }
                        else if (affvar == '10009') {
                            //toggle if (fontVal == "120006")
                            ChangeText('monrevprice', '(4 €)');
                            //SetParam('extraprice_monogram', '10');
                            SetPriceInfo('alg_monogram_price', '4');
                        }
                        else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                            //toggle if (fontVal == "120006")
                            ChangeText('monrevprice', '(£3)');
                            //SetParam('extraprice_monogram', '10');
                            SetPriceInfo('alg_monogram_price', '3');
                        }
                        else {
                            //toggle if (fontVal == "120006")
                            ChangeText('monrevprice', '(10 €/£)');
                            //SetParam('extraprice_monogram', '10');
                            SetPriceInfo('alg_monogram_price', '10');
                        }
                    }
                    else {
                        if (affvar == '10008' ) {
                            ChangeText('monrevprice', '(0 €/£)');
                            //SetParam('extraprice_monogram', '5');
                            SetPriceInfo('alg_monogram_price', '0');
                        }
                        else if (affvar == '10052') {
                            ChangeText('monrevprice', '(0 €/£)');
                            //SetParam('extraprice_monogram', '5');
                            SetPriceInfo('alg_monogram_price', '0');
                        }
                        
                        else if (affvar == '10009') {
                            ChangeText('monrevprice', '(4 €)');
                            //SetParam('extraprice_monogram', '5');
                            SetPriceInfo('alg_monogram_price', '4');
                        }
                        else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                            ChangeText('monrevprice', '(£3)');
                            //SetParam('extraprice_monogram', '5');
                            SetPriceInfo('alg_monogram_price', '3');
                        }
                        else {
                            ChangeText('monrevprice', '(5 €/£)');
                            //SetParam('extraprice_monogram', '5');
                            SetPriceInfo('alg_monogram_price', '5');
                        }
                    }
                }

                //SET highlighted MONPOSITION
                var d3 = document.getElementById('postionMonogram');
                var el3 = getElementsByClassName('highlight', d3);
                if (el3) {
                    //ChangeText('monrevpos', el3.id.substring(4) + '');
                    ChangeText('monrevpos', el3.alt + '');
                }
            }
            else {
                ChangeText('monrevtxt', '');
                ChangeText('monrevcol', '');
                ChangeText('monrevfont', '');
                ChangeText('monrevpos', '');
                ChangeText('monrevprice', '');
            }
        }


        var ggg = document.getElementById('langhid').value;



        //set White Collar
        var hideo15 = document.getElementById('hideo15').value;


        if (hideo15 == 1) {
            if ($get("rev15")) 
            {
                if (affvar == '10008') 
                {
                    SetPriceInfo('eop_15_price', '0');
                    ChangeText('rev15', 'Weißer Kragen');
                }
                else if (affvar == '10052') 
                {
                
                SetPriceInfo('eop_15_price', '0');
                ChangeText('rev15', 'White collar');
                    
                }
              
                else if (affvar == '10010') {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'Witte boord (3 €)');
                }
                else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'White Collar (£3)');
                }
                else if (ggg == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'White Collar (3 €/£)');
                }
                else if (ggg == 2) {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'Witte boord (3 €/£)');
                }
                else if (ggg == 3) {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'Col blanc (3 €/£)');
                }
                else if (ggg == 4) {
                    SetPriceInfo('eop_15_price', '3');
                    ChangeText('rev15', 'Weißer Kragen (3 €/£)');
                }

                $get("rev15").className = '';
            }

        } else if (hideo15 == 0) {
            if ($get("rev15")) {
                ChangeText('rev15', '');
                $get("rev15").className = 'hidden';
            }
        }

        //set RB
        var hideo24 = document.getElementById('hideo24').value;
        if (hideo24 == 1) {
            if ($get("rev24")) {
                if (affvar == '10008') {
                    ChangeText('rev24', 'Entferntbare Fischbein');
                    SetPriceInfo('eop_24_price', '0');
                }
                if (affvar == '10052') {
                    ChangeText('rev24', 'Ballenas extraíbles');
                    SetPriceInfo('eop_24_price', '0');
                }
               
                else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    ChangeText('rev24', 'Removable Bones (£2)');
                    SetPriceInfo('eop_24_price', '2');
                }
                else if (ggg == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    ChangeText('rev24', 'Removable bones (2 €/£)');
                    SetPriceInfo('eop_24_price', '2');
                }
                else if (ggg == 2) {
                    ChangeText('rev24', 'Verwijderbare baleinen (2 €/£)');
                    SetPriceInfo('eop_24_price', '2');
                }
                else if (ggg == 3) {
                    ChangeText('rev24', 'Baleines amovibles (2 €/£)');
                    SetPriceInfo('eop_24_price', '2');
                }
                else if (ggg == 4 && affvar != '10008') {
                    ChangeText('rev24', 'Entferntbare Fischbein (2 €/£)');
                    SetPriceInfo('eop_24_price', '2');
                }
                $get("rev24").className = '';
            }
        } else if (hideo24 == 0) {
            if ($get("rev24")) {
                ChangeText('rev24', '');
                $get("rev24").className = 'hidden';
            }
        }
        //set VS
        var hideo401 = document.getElementById('hideo401').value;
        if (hideo401 == 1) {
            if ($get("rev401")) {
                if (affvar == '10008') {
                    SetPriceInfo('eop_401_price', '0');
                    ChangeText('rev401', 'Stripes vertical');
                }
                if (affvar == '10052') {
                    SetPriceInfo('eop_401_price', '0');
                    ChangeText('rev401', 'Stripes vertical');
                }
                
                else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    SetPriceInfo('eop_401_price', '0');
                    ChangeText('rev401', 'Vertical Stripes (£2)');
                }
                else if (ggg == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    SetPriceInfo('eop_401_price', '2');
                    ChangeText('rev401', 'Vertical stripes (2 €/£)');
                }
                else if (ggg == 2) {
                    SetPriceInfo('eop_401_price', '2');
                    ChangeText('rev401', 'Strepen vertikaal (2 €/£)');
                }
                else if (ggg == 3) {
                    SetPriceInfo('eop_401_price', '2');
                    ChangeText('rev401', 'Lignes verticales (2 €/£)');
                }
                else if (ggg == 4) {
                    SetPriceInfo('eop_401_price', '2');
                    ChangeText('rev401', 'Stripes vertical (2 €/£)');
                }
                $get("rev401").className = '';
            }

        } else if (hideo401 == 0) {
            if ($get("rev401")) {
                ChangeText('rev401', '');
                $get("rev401").className = 'hidden';
            }
        }
        //set tape color
        var hideo39 = document.getElementById('hideo39').value;
        if (hideo39 == 1) {
            if ($get("rev39")) {
                if (affvar == '10008')
                 {
                    SetPriceInfo('eop_39_price', '0');
                    var taptxt = 'Tape ' + document.getElementById('taphid').value;
                    ChangeText('rev39', taptxt);
                    $get("rev39").className = '';
                }
                if (affvar == '10052') {
                    SetPriceInfo('eop_39_price', '0');
                    var taptxt = 'Tape ' + document.getElementById('taphid').value;
                    ChangeText('rev39', taptxt);
                    $get("rev39").className = '';
                }
              
                else if (cidvar == '50') {
                    SetPriceInfo('eop_39_price', '0');
                    var taptxt = 'Tape (£ 1)' + document.getElementById('taphid').value;
                    ChangeText('rev39', taptxt);
                    $get("rev39").className = '';
                }
                else {
                    SetPriceInfo('eop_39_price', '1');
                    var taptxt = 'Tape (1 €/£) ' + document.getElementById('taphid').value;
                    ChangeText('rev39', taptxt);
                    $get("rev39").className = '';
                }
            }
        } else if (hideo39 == 0) {
            if ($get("rev39")) {
                var taptxt = '';
                ChangeText('rev39', taptxt);
                $get("rev39").className = 'hidden';
            }
        }

        //set shoulderflap 
        var hideo6 = document.getElementById('hideo6').value;
        if (hideo6 == 1) {
            if ($get("rev6")) {
                    SetPriceInfo('eop_6_price', '0');
                    var taptxt = 'Shoulder Flap';
                    ChangeText('rev6', taptxt);
                    $get("rev6").className = '';
            }
        } else if (hideo6 == 0) {
            if ($get("rev6")) {
                var taptxt = '';
                ChangeText('rev6', taptxt);
                $get("rev6").className = 'hidden';
            }
        }

        //set eo placket 171
        var hideo171 = document.getElementById('hideo171').value;
        if (hideo171 == 1) {
            if ($get("rev171")) {
                if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    var taptxt = 'Placket Bias (£1)';
                }
                else {
                    var taptxt = 'Placket Biais (€/£ 1)';
                }
                ChangeText('rev171', taptxt);
                $get("rev171").className = '';
            }
        } else if (hideo171 == 0) {
            if ($get("rev171")) {
                var taptxt = '';
                ChangeText('rev171', taptxt);
                $get("rev171").className = 'hidden';
            }
        }

        //set eo placket 172
        var hideo172 = document.getElementById('hideo172').value;
        if (hideo172 == 1) {
            if ($get("rev172")) {
                if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    var taptxt = 'Placket Horizontal (£1)';
                }
                else {
                    var taptxt = 'Placket Horizontal (€/£ 1)';
                }
                ChangeText('rev172', taptxt);
                $get("rev172").className = '';
            }
        } else if (hideo172 == 0) {
            if ($get("rev172")) {
                var taptxt = '';
                ChangeText('rev172', taptxt);
                $get("rev172").className = 'hidden';
            }
        }

        //set White Cuff
        var hideo4 = document.getElementById('hideo4').value;
        if (hideo4 == 1) {
            if ($get("rev4")) {
                //eop_4_price
                if (affvar == '10008') {
                    SetPriceInfo('eop_4_price', '0');
                    var taptxt = 'weiße Manschetten';
                    ChangeText('rev4', taptxt);

                }
               else  if (affvar == '10052') {
                    SetPriceInfo('eop_4_price', '0');
                    var taptxt = 'White Cuff';
                    ChangeText('rev4', taptxt);

                }
                
                else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                    SetPriceInfo('eop_4_price', '3');
                    var taptxt = 'White Cuff (£3)';
                    ChangeText('rev4', taptxt);

                }
                else if (ggg == 1 || document.URL.toLowerCase().indexOf('deben') != -1) {
                    SetPriceInfo('eop_4_price', '3');
                    var taptxt = 'White Cuff (3 €/£)';
                    ChangeText('rev4', taptxt);
                }
                else if (ggg == 2) {
                    SetPriceInfo('eop_4_price', '3');
                    var taptxt = 'Witte manchetten (3 €/£)';
                    ChangeText('rev4', taptxt);
                }
                else if (ggg == 3) {
                    SetPriceInfo('eop_4_price', '3');
                    var taptxt = 'Poignets blancs (3 €/£)';
                    ChangeText('rev4', taptxt);
                }
                else if (ggg == 4) {
                    SetPriceInfo('eop_4_price', '3');
                    var taptxt = 'weiße Manschetten (3 €/£)';
                    ChangeText('rev4', taptxt);
                }

                $get("rev4").className = '';
            }
        } else if (hideo4 == 0) {
            if ($get("rev4")) {
                var taptxt = '';
                ChangeText('rev4', taptxt);
                $get("rev4").className = 'hidden';
            }
        }
        //if ($get("monrevsqpos")) 
        {
            //SET highlighted MONPOSITION
            var d33 = document.getElementById('postionMonogram2');
            var el33 = getElementsByClassName('highlight', d33);
            if (el33) {
                //ChangeText('monrevpos', el3.id.substring(4) + '');
                ChangeText('monrevsqpos', el33.alt + '');
            }

            //SET highlighted MONCOLOUR
            var d2 = document.getElementById('allCollors2');
            var el2 = getElementsByClassName('collorssel', d2);
            if (el2) {
                //ChangeText('monrevsqcol', el2.id.substring(5) + '');
                //alert('el2.title[' + el2.title + ']');
                ChangeText('monrevsqcol', el2.title + '');
            }



            //SET knopen in review
            var d2 = document.getElementById('knopen');
            var el2 = getElementsByClassName('highlight', d2);
            if (el2) {
                if (el2.id.substring(6) == 640020 || el2.id.substring(6) == 640099) {
                    if (affvar == '10008') {
                        //id knoop_640001
                        ChangeText('rev51', ' ' + el2.alt + '');
                        //SetParam('alg_button_colour_price', '2');
                        SetPriceInfo('alg_button_colour_price', '0');
                    }
                    else if (affvar == '10052') {
                        //id knoop_640001
                        ChangeText('rev51', ' ' + el2.alt + '');
                        //SetParam('alg_button_colour_price', '2');
                        SetPriceInfo('alg_button_colour_price', '0');
                    }
                    
                    else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                        //id knoop_640001
                        ChangeText('rev51', ' ' + el2.alt + '(£2)');
                        //SetParam('alg_button_colour_price', '2');
                        SetPriceInfo('alg_button_colour_price', '0');
                    }
                    else {
                        //id knoop_640001
                        ChangeText('rev51', ' ' + el2.alt + '(2 €/£)');
                        //SetParam('alg_button_colour_price', '2');
                        SetPriceInfo('alg_button_colour_price', '2');
                    }

                } else {
                    ChangeText('rev51', ' ' + el2.alt + '');
                    RemoveParam('alg_button_colour_price');
                }
            }


            //SET stitch in review
            //knoopsgaten
            var d222 = document.getElementById('knoopsgaten');
            var el222 = getElementsByClassName('highlight', d222);
            if (el222) {
                if (el222.id.substring(10) == 770010) {
                    ChangeText('rev52', ' ' + el222.alt);
                    SetPriceInfo('alg_button_yarncolour', '0');
                }
                else {
                    if (affvar == '10008') {
                        ChangeText('rev52', ' ' + el222.alt + '');
                        SetPriceInfo('alg_button_yarncolour', '0');
                    }
                    else if (affvar == '10052') {
                        ChangeText('rev52', ' ' + el222.alt + '');
                        SetPriceInfo('alg_button_yarncolour', '0');
                    }

                    else if (cidvar == '50' || cidvar == '53' || cidvar == '54') {
                        ChangeText('rev52', ' ' + el222.alt + '(£1)');
                        SetPriceInfo('alg_button_yarncolour', '1');
                    }
                    else {
                        ChangeText('rev52', ' ' + el222.alt + '(1 €/£)');
                        SetPriceInfo('alg_button_yarncolour', '1');
                    }
                }
            }
            
            //MEASUREMENTS profile name
            if ($get("ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue")) {
                var txt = $get("ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue").value;
                ChangeText('measProfileName', txt + '');
            }
            if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlProfile')) {
                var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlProfile');
                var val = e.options[e.selectedIndex].text;
                ChangeText('measProfileName', val + '');
            }


            var selok = document.getElementById('selok').value;
            //if (selok == "1") 
            {

                var hidcheck = document.getElementById('ctl00_cph1_MeasurementsEditControl_HiddenField1').value;
                if (hidcheck == 1) {
                    //set weight1
                    if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight1')) {
                        var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight1');
                        if (e) {
                            var val = e.options[e.selectedIndex].value;
                            ChangeText('measWeight', val + ' kg');
                        }
                    }
                }
                else {
                    //set weight2
                    if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight2')) {
                        var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlWeight2');

                        if (e) {
                            var val = e.options[e.selectedIndex].value;
                            ChangeText('measWeight', val + ' lbs/stone');
                        }
                    }
                }
            }



            if (hidcheck == 1) {
                //set height1
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight1')) {
                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight1');
                    if (e) {
                        var val = e.options[e.selectedIndex].value;
                        ChangeText('measHeight', val + ' cm');
                    }
                }
            }
            else {
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight21')) {
                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight21');
                    if (e) {
                        var val = e.options[e.selectedIndex].value;
                        var e2 = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlHeight22');
                        var val2 = e2.options[e2.selectedIndex].value;
                        ChangeText('measHeight', val + ' feet ' + val2 + ' inch');
                    }
                }
            }


            if (hidcheck == 1) {
                //set collar1
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize1')) {
                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize1');
                    if (e) {
                        var val = e.options[e.selectedIndex].value;
                        ChangeText('measCollar', val + ' cm');
                    }
                }
            }
            else {
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize2')) {
                    var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlCollarsize2');
                    if (e) {
                        var val = e.options[e.selectedIndex].value;
                        ChangeText('measCollar', val + ' inch');
                    }
                }
            }

            //set age
            if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlAge')) {
                var e = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlAge');
                if (e) {
                    var val = e.options[e.selectedIndex].value;
                    ChangeText('measAge', val + '');
                }
            }


            //set fit
            var fit2 = document.getElementById('allFits');
            var elfit2 = getElementsByClassName('highlight', fit2);
            if (elfit2) {
                var fitname = elfit2.alt;
                var fit = document.getElementById('fithid').value;
                if (fit) {
                    if (fit == 8018020) {
                        ChangeText('measFit', fitname);
                    }
                    else if (fit == 8018015) {
                        ChangeText('measFit', fitname);
                    } else if (fit == 8018010) {
                        ChangeText('measFit', fitname);
                    }
                }
            }

            //SET MEASUREMENTS TXT IN REVIEW
            if (!getQueryVariable('SELID')) {
                if (document.getElementById('ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue')) {
                    var MeasTxt = document.getElementById('ctl00_cph1_MeasurementsEditControl_txtProfileName_txtValue').value;
                    ChangeText('measProfileName', MeasTxt + '');
                }
                else {
                    //ctl00_cph1_MeasurementsEditControl_DdlProfile
                    if (document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlProfile')) {
                        var ddl = document.getElementById('ctl00_cph1_MeasurementsEditControl_DdlProfile');
                        if (ddl && ddl.selectedIndex && ddl.options && ddl.options[ddl.selectedIndex] && ddl.options[ddl.selectedIndex].text) {
                            var MeasTxt = ddl.options[ddl.selectedIndex].text;
                            ChangeText('measProfileName', MeasTxt + '');
                        }
                        else {
                            var MeasTxt = ddl.options[0].text;
                            ChangeText('measProfileName', MeasTxt + '');
                        }
                    }
                }
            }
        }

        $get("selok").value = '1';
    }
}



function menuGALclick(id) {
    for (var i = 1; i <= 4; i++) {
        if (id == i) {
            $get("ctl00_cph1_mod" + i).className = 'DivShown';
        }
        else {
            $get("ctl00_cph1_mod" + i).className = 'DivHidden';
        }
    }
}

function menurevclick(id) {
    $get("ctl00_cph1_mod" + id).className = 'DivShown';
    if (id < 5) {
        if ($get('NextButton' + id))
            $get("NextButton" + id).className = 'DivHidden';
        if ($get('ReviewButton' + id))
            $get("ReviewButton" + id).className = 'config_buttons DivShown';

        if (id == 2) {
            if ($get('NextButton' + id + '1'))
                $get("NextButton" + id + '1').className = 'DivHidden';
            if ($get('ReviewButton' + id + '1'))
                $get("ReviewButton" + id + '1').className = 'config_buttons DivShown';

            if ($get('NextButton' + id + '2'))
                $get("NextButton" + id + '2').className = 'DivHidden';
            if ($get('ReviewButton' + id + '2'))
                $get("ReviewButton" + id + '2').className = 'config_buttons DivShown';

            if ($get('NextButton' + id + '3'))
                $get("NextButton" + id + '3').className = 'DivHidden';
            if ($get('ReviewButton' + id + '3'))
                $get("ReviewButton" + id + '3').className = 'config_buttons DivShown';

            if ($get('NextButton' + id + '4'))
                $get("NextButton" + id + '4').className = 'DivHidden';
            if ($get('ReviewButton' + id + '4'))
                $get("ReviewButton" + id + '4').className = 'config_buttons DivShown';

            if ($get('NextButton' + id + '5'))
                $get("NextButton" + id + '5').className = 'DivHidden';
            if ($get('ReviewButton' + id + '5'))
                $get("ReviewButton" + id + '5').className = 'config_buttons DivShown';

            if ($get('NextButton' + id + '6'))
                $get("NextButton" + id + '6').className = 'DivHidden';
            if ($get('ReviewButton' + id + '6'))
                $get("ReviewButton" + id + '6').className = 'config_buttons DivShown';
        }
    }
}

function menunorevclick(id) {
    if ($get("ctl00_cph1_mod" + id)) {
        $get("ctl00_cph1_mod" + id).className = 'DivShown';
    }
    if (id < 5) {
        if ($get('NextButton' + id))
            $get("NextButton" + id).className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id))
            $get("ReviewButton" + id).className = 'DivHidden';
    }

    if (id == 2) {
        if ($get('NextButton' + id + '1'))
            $get("NextButton" + id + '1').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '1'))
            $get("ReviewButton" + id + '1').className = 'DivHidden';

        if ($get('NextButton' + id + '2'))
            $get("NextButton" + id + '2').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '2'))
            $get("ReviewButton" + id + '2').className = 'DivHidden';

        if ($get('NextButton' + id + '3'))
            $get("NextButton" + id + '3').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '3'))
            $get("ReviewButton" + id + '3').className = 'DivHidden';

        if ($get('NextButton' + id + '4'))
            $get("NextButton" + id + '4').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '4'))
            $get("ReviewButton" + id + '4').className = 'DivHidden';

        if ($get('NextButton' + id + '5'))
            $get("NextButton" + id + '5').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '5'))
            $get("ReviewButton" + id + '5').className = 'DivHidden';

        if ($get('NextButton' + id + '6'))
            $get("NextButton" + id + '6').className = 'config_buttons DivShown';
        if ($get('ReviewButton' + id + '6'))
            $get("ReviewButton" + id + '6').className = 'DivHidden';
    }
}

function monoclick(id) {
    if (id == 1) {
        if ($get("menDesingInitials"))
            $get("menDesingInitials").className = 'DivShown';

        if ($get("menDesingSquirrel"))
            $get("menDesingSquirrel").className = 'DivHidden';

        if ($get("monoclass1"))
            $get("monoclass1").className = 'currentTabMneu';

        if ($get("monoclass2"))
            $get("monoclass2").className = '';

    }
    else if (id == 2) {
        if ($get("menDesingSquirrel"))
            $get("menDesingSquirrel").className = 'DivShown';

        if ($get("menDesingInitials"))
            $get("menDesingInitials").className = 'DivHidden';

        if ($get("monoclass1"))
            $get("monoclass1").className = '';

        if ($get("monoclass2"))
            $get("monoclass2").className = 'currentTabMneu';

    }
}

function monotopclick(id) {
    var affvar = gup('affid');
    var affvar2 = gup('affid');
    if ($get("yesmon")) {
        if (id == 'yesmon') {
            $get("yesmon").checked = true;
            $get("nomon").checked = false;
            $get("initials_disabled").className = '';
            $get("refresh22").className = '';
            if (affvar == '10008') {
                SetPriceInfo('alg_monogram_price', '0');
                $get("pricemon").value = 0;
            }
            else if (affvar == '10052') {
                SetPriceInfo('alg_monogram_price', '0');
                $get("pricemon").value = 0;
            }
            else if (affvar == '10009') {
                SetPriceInfo('alg_monogram_price', '4');
                $get("pricemon").value = 4;
            }
            else if (affvar2 == '10012') {
                SetPriceInfo('alg_monogram_price', '3');
                $get("pricemon").value = 3;
            }
            else {
                SetPriceInfo('alg_monogram_price', '5');
                $get("pricemon").value = 5;
            }
        }
        else if (id == 'nomon') {
            $get("yesmon").checked = false;
            $get("nomon").checked = true;
            $get("initials_disabled").className = 'boxOverlay';
            $get("refresh22").className = 'hidden';
            SetPriceInfo('alg_monogram_price', '0');
            $get("pricemon").value = 0;

        }
    }
}

function menumonoclick(id, id2) {
    var affvar = gup('affid');
    var affvar2 = gup('affid');
    if (id == 1) {
        $get("menumono2").checked = false;
        $get("menumono1").checked = true;
        if (affvar == '10008') {
            SetPriceInfo('alg_monogram_price', '0');
            $get("pricemon").value = +0;
        }
        else if (affvar == '10052') {
            SetPriceInfo('alg_monogram_price', '0');
            $get("pricemon").value = +0;
        }
        else if (affvar == '10009') {
            SetPriceInfo('alg_monogram_price', '4');
            $get("pricemon").value = +4;
        }
        else if (affvar2 == '10012') {
            SetPriceInfo('alg_monogram_price', '3');
            $get("pricemon").value = 3;
        }
        else {
            SetPriceInfo('alg_monogram_price', '5');
            $get("pricemon").value = +5;
        }


        //fill input div
        var d = document.getElementById('moninput');
        d.innerHTML = "<input id='inputtxt2' type='text' maxlength='4' onkeypress='GenerateMonogram2()'/><br /><span>&nbsp;*Max 4 Characters</span>";


        //load types, etc.
        GetMONtyp2(id2);
        GetMONloc2(id2);
        GetMONcol2(id2);

    }
    else if (id == 2) {
        if ($get("menumono1")) {
            $get("menumono1").checked = false;
            $get("menumono2").checked = true;
        }

        if (affvar == '10008') {
            SetPriceInfo('alg_monogram_price', '0');
            $get("pricemon").value = +0;
        }
       else  if (affvar == '10052') {
            SetPriceInfo('alg_monogram_price', '0');
            $get("pricemon").value = +0;
        }
        else if (affvar == '10009') {
            SetPriceInfo('alg_monogram_price', '4');
            $get("pricemon").value = +4;
        }
        else if (affvar2 == '10012') {
            SetPriceInfo('alg_monogram_price', '3');
            $get("pricemon").value = 3;
        }
        else {
            SetPriceInfo('alg_monogram_price', '10');
            $get("pricemon").value = +10;
        }

        //fill input div
        var d = document.getElementById('moninput');
        d.innerHTML = "<input id='inputtxt2' type='text' maxlength='3' onkeypress='GenerateMonogram2()'/><br /><span>&nbsp;*Min/Max 3 Characters</span>";

        //load types, etc.
        GetMONtyp2('302');
        GetMONloc2('306');
        GetMONcol2('306');
    }
}



function menudesignclick(id) {

    //collar
    if (id == 1) {
        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivHidden';

        if ($get("designclass1")) {
            $get("designclass1").className = 'currentTabMneu';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = '';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = '';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = '';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = '';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = '';
        }
    }
    //sleeve
    else if (id == 2) {
        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivHidden';

        if ($get("designclass1")) {
            $get("designclass1").className = '';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = 'currentTabMneu';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = '';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = '';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = '';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = '';
        }

        //check cuffrule
        var f = document.getElementById('cufhid').value;
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetRuleCUF(f, SuccesCallbackcufklik, ErrorHandler, TimeOutHandler);
    }
    //pocket
    else if (id == 3) {
        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivHidden';


        if ($get("designclass1")) {
            $get("designclass1").className = '';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = '';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = 'currentTabMneu';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = '';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = '';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = '';
        }
    }
    //placket
    else if (id == 4) {
        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivHidden';


        if ($get("designclass1")) {
            $get("designclass1").className = '';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = '';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = '';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = 'currentTabMneu';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = '';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = '';
        }

    }
    //base hem   
    else if (id == 5) {
        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivHidden';


        if ($get("designclass1")) {
            $get("designclass1").className = '';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = '';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = '';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = '';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = 'currentTabMneu';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = '';
        }
    }
    //contrasting
    else if (id == 6) {
        //set menu state



        $get("ctl00_cph1_ctrlCONF_design_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design3").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design4").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design5").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_design6").className = 'DivShown';

        if ($get("designclass1")) {
            $get("designclass1").className = '';
        }
        if ($get("designclass2")) {
            $get("designclass2").className = '';
        }
        if ($get("designclass3")) {
            $get("designclass3").className = '';
        }
        if ($get("designclass4")) {
            $get("designclass4").className = '';
        }
        if ($get("designclass5")) {
            $get("designclass5").className = '';
        }
        if ($get("designclass6")) {
            $get("designclass6").className = 'currentTabMneu';
        }


        //RULE CONTRAST//////////////////////////////////////////////////////////////////////////
        //get collar
        var e = document.getElementById('colhid').value;
        //get cuff
        var f = document.getElementById('cufhid').value;
        //get pla
        var g = document.getElementById('plahid').value;

        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetRuleCON(e, f, g, SuccesCallbackmenuklik, ErrorHandler, TimeOutHandler);
        /////////////////////////////////////////////////////////////////////////////////////

        //RULE WHITE CUFF => NO CUFF CONTRASTING
        var hideo4 = document.getElementById('hideo4').value;
        //alert('hideo4: ' + hideo4);
        if (hideo4 == 1) {
            deactivate('61', 1);
            deactivate('91', 1);
        }

        //RULES OUTER PLACKET, FABRIC DESIGN PATTERN
        placketextraCONrule();
        ////////////////////////////////


        //RULE WHITE COLLAR => NO COLLAR CONTRASTING
        var hideo15 = document.getElementById('hideo15').value;
        //alert('hideo15: ' + hideo15);
        if (hideo15 == 1) {
            deactivate('58', 1);
            deactivate('87', 0);
        }

        //monogram yes + leeg
        if ($get("yesmon")) {
            if ($get("yesmon").checked && $get("inputtxt2").value == "") {
                var modalPopupBehavior = $find('programmaticModalPopupBehavior4');
                modalPopupBehavior.show();
            }
        }
    }
}

function menudesignclickPL(id) {

    //RESET Higlighted last
    $get('hidconactive').value = "";

    //collar
    if (id == 1) {
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design1").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design3").className = 'DivHidden';

        if ($get("designclass1PL"))
            $get("designclass1PL").className = 'currentTabMneu';
        if ($get("designclass2PL"))
            $get("designclass2PL").className = '';
        if ($get("designclass3PL"))
            $get("designclass3PL").className = '';



    }
    //cuff
    else if (id == 2) {
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design2").className = 'DivShown';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design3").className = 'DivHidden';

        if ($get("designclass1PL"))
            $get("designclass1PL").className = '';
        if ($get("designclass2PL"))
            $get("designclass2PL").className = 'currentTabMneu';
        if ($get("designclass3PL"))
            $get("designclass3PL").className = '';

    }
    //patchwork
    else if (id == 3) {
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design1").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design2").className = 'DivHidden';
        $get("ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design3").className = 'DivShown';


        if ($get("designclass1PL"))
            $get("designclass1PL").className = '';
        if ($get("designclass1PL"))
            $get("designclass2PL").className = '';
        if ($get("designclass3PL"))
            $get("designclass3PL").className = 'currentTabMneu';


    }

    //    //RULE CONTRAST//////////////////////////////////////////////////////////////////////////
    //    //get collar
    //    var e = document.getElementById('colhid').value;
    //    //get cuff
    //    var f = document.getElementById('cufhid').value;
    //    //get pla
    //    var g = document.getElementById('plahid').value;

    //    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //    Samples.AspNet.WebService.GetRuleCON(e, f, g, SuccesCallbackmenuklik, ErrorHandler, TimeOutHandler);

}

//coming from GetRuleCUF
function SuccesCallbackcufklik(result, eventArgs) {
    if (document.getElementById('sleevePickerExtra')) {
        //DISABLE ALL ELEMENTS WITHIN sleevePickerExtra
        var rosItems1 = document.getElementById('sleevePickerExtra').getElementsByTagName('input')
        for (var i = 0; i < rosItems1.length; i++) {
            rosItems1[i].disabled = true;
        }

        //CHECK IF POSSIBLE, THUS ENABLE
        if (result.length > 0) {
            for (i = 0; i < result.length; i++) {
                if ($get(result[i].FabName)) {
                    $get(result[i].FabName).disabled = false;
                }
            }
        }
    }
}


function SuccesCallbackcolklik(result, eventArgs) {
    if (result.length > 0) {
        //check all 4 elements, Loop only reaches 1, 2, 3, or 4
        if (result.length < 2) {
            if (result[0].FabName == 15) {
                if ($get(result[0].FabName))
                    $get(result[0].FabName).disabled = false;
            }
            else {
                if ($get(result[0].FabName))
                    $get(result[0].FabName).disabled = true;
                $get(result[0].FabName).checked = false;
            }
            /////////////////////////////////////
            if ($get("24")) {
                $get("24").disabled = true;
                $get("24").checked = false;
            }
            if ($get("39")) {
                $get("39").disabled = true;
                $get("39").checked = false;
            }
            if ($get("401")) {
                $get("401").disabled = true;
                $get("401").checked = false;
            }
            if ($get("6")) {
                $get("6").disabled = false;
            }
        }

        else if (result.length < 3) {

            if (result[0].FabName == 15) {
                if ($get("15")) {
                    $get("15").disabled = false;
                }
            }
            else {
                if ($get("15")) {
                    $get("15").disabled = true;
                    $get("15").checked = false;
                }
            }

            if (result[1].FabName == 24) {
                if ($get("24")) {
                    $get("24").disabled = false;
                }
            }
            else {
                if ($get("24")) {
                    $get("24").disabled = true;
                    $get("24").checked = false;
                }

            }
            ////////////////////////////////////////////
            if ($get("39")) {
                $get("39").disabled = true;
                $get("39").checked = false;
            }
            if ($get("401")) {
                $get("401").disabled = true;
                $get("401").checked = false;
            }
            if ($get("6")) {
                $get("6").disabled = false;
            }
        }

        else if (result.length < 4) {

            if (result[0].FabName == 15) {
                if ($get("15"))
                    $get("15").disabled = false;
            }
            else {
                if ($get("15")) {
                    $get("15").disabled = true;
                    $get("15").checked = false;
                }
            }


            if (result[1].FabName == 24) {
                if ($get("24"))
                    $get("24").disabled = false;
            }
            else {
                if ($get("24")) {
                    $get("24").disabled = true;
                    $get("24").checked = false;
                }
            }
            if (result[2].FabName == 39) {
                if ($get("39"))
                    $get("39").disabled = false;
            }
            else {
                if ($get("39")) {
                    $get("39").disabled = true;
                    $get("39").checked = false;
                }
            }
            ////////////////////////////////////////////
            if ($get("401")) {
                $get("401").disabled = true;
                $get("401").checked = false;
            }
            if ($get("6")) {
                $get("6").disabled = false;
            }
        }

        else if (result.length < 5) {

            if (result[0].FabName == 15) {
                if ($get(result[0].FabName))
                    $get(result[0].FabName).disabled = false;

            }
            else {
                if ($get(result[0].FabName)) {
                    $get(result[0].FabName).disabled = true;
                    $get(result[0].FabName).checked = false;
                }
            }

            if (result[1].FabName == 24) {
                if ($get(result[1].FabName))
                    $get(result[1].FabName).disabled = false;

            }
            else {
                if ($get(result[1].FabName)) {
                    $get(result[1].FabName).disabled = true;
                    $get(result[1].FabName).checked = false;
                }
            }

            if (result[2].FabName == 39) {
                if ($get(result[2].FabName))
                    $get(result[2].FabName).disabled = false;

            }
            else {
                if ($get(result[2].FabName)) {
                    $get(result[2].FabName).disabled = true;
                    $get(result[2].FabName).checked = false;
                }
            }

            if (result[3].FabName == 401) {
                if ($get(result[3].FabName))
                    $get(result[3].FabName).disabled = false;

            }
            else {
                if ($get(result[3].FabName)) {
                    $get(result[3].FabName).disabled = true;
                    $get(result[3].FabName).checked = false;
                }
            }
            ////////////////////////////////////////////
            if ($get("6")) {
                $get("6").disabled = false;
            }
        }

    }

    //CHECK IF POSSIBLE, THUS ENABLE
    if (result.length > 0) {
        for (i = 0; i < result.length; i++) {
            if (result[i].FabName) {

                var hideo15 = document.getElementById('hideo15').value;
                var hideo39 = document.getElementById('hideo39').value;
                var hideo401 = document.getElementById('hideo401').value;
                var hideo24 = document.getElementById('hideo24').value;



                //TAPE
                if ($get("39")) {
                    if ((hideo39 == 1 && $get("39").disabled == false) && result[i].FabName == "39") {

                        if ($get("39")) {

                            $get("39").checked = true;
                            GetPriceInfoExtra('39', 1);
                            GetExtraOptionsInfo('39', 1);
                        }
                    }
                    else if (hideo39 == 0 || $get("39").disabled == true) {
                        if ($get('hideo39'))
                            $get('hideo39').value = 0;
                        GetExtraOptionsInfo('39', 0);
                        GetPriceInfoExtra('39', 0);
                    }
                } else {
                    if ((hideo39 == 1) && result[i].FabName == "39") {
                        GetPriceInfoExtra('39', 1);
                        GetExtraOptionsInfo('39', 1);
                    }
                    else if (hideo39 == 0) {
                    GetPriceInfoExtra('39', 0);
                    GetExtraOptionsInfo('39', 0);
                    }
                }


                //VERTICAL STRIPES
                if ($get("401")) {
                    if ((hideo401 == 1 && $get("401").disabled == false) && result[i].FabName == "401") {

                        if ($get("401"))
                            $get("401").checked = true;
                        GetPriceInfoExtra('401', 1);
                        GetExtraOptionsInfo('401', 1);
                    }
                    else if (hideo401 == 0 || $get("401").disabled == true) {
                        if ($get('hideo401'))
                            $get('hideo401').value = 0;

                        GetPriceInfoExtra('401', 0);
                        GetExtraOptionsInfo('401', 0);
                    }
                }
                //NOT YET ELSE

                //REMOVABLE BONES
                if ((hideo24 == 1 && $get("24").disabled == false) && result[i].FabName == "24") {
                    //alert('1');
                    if ($get("24"))
                        $get("24").checked = true;
                    GetPriceInfoExtra('24', 1);
                    GetExtraOptionsInfo('24', 1);
                 
                }
                else if (hideo24 == 0 || $get("24").disabled == true) {
                    //alert('2');
                    if ($get('hideo24'))
                        $get('hideo24').value = 0;
                    GetExtraOptionsInfo('24', 0);
                    GetPriceInfoExtra('24', 0);
                }

                //rule: white collars kan niet samen met vertical stripes, dus uitvinken
                if (hideo15 == 1 && result[i].FabName == "15" && hideo401 == 0) {
                    if ($get("15"))
                        $get("15").checked = true;
                    GetPriceInfoExtra('15', 1);
                    GetExtraOptionsInfo('15', 1);
                }
                else {
                    //hier niet, heeft met rules te maken, brengt alles in de war
                }
            }
            else {
                //not possible, disable
                if ($get(result[i].FabName))
                    $get(result[i].FabName).checked = false;
            }
        }
    }
}


//coming from GetRuleCON
function SuccesCallbackmenuklik(result, eventArgs) {

    //alert('getrulecon');

    if (result.length > 0) {
  
        var CID = getQueryVariable('CID');
        //alert('CID:' + CID);
        var pla = document.getElementById('plahid').value;
        //alert('pla:' + pla);
        if (CID == 38 && pla == 50011) {
            //alert('ok');
            $get("img54").src = 'images/54art.png';
            //$get("54").disabled = false;
        }
        else if (CID == 38 && pla != 50011) {
            $get("img54").src = 'images/54.png';
            //$get("54").disabled = false;
        }

        var hidcon58 = document.getElementById('hidcon58').value;
        var hidcon61 = document.getElementById('hidcon61').value;
        var hidcon54 = document.getElementById('hidcon54').value;
        var hidcon62 = document.getElementById('hidcon62').value;
        var hidcon87 = document.getElementById('hidcon87').value;
        var hidcon91 = document.getElementById('hidcon91').value;
        var hidcon17 = document.getElementById('hidcon17').value;

        //enable
        if (result.length > 0) {
            for (i = 0; i < result.length; i++) {
                if (result[i].FabID) {
                    if (result[i].FabID == 58) {
                        if ($get("img58")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img58").src = 'images/58_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img58").src = 'images/58_baur.jpg';
                            }
                            else {
                                $get("img58").src = 'images/58.png';
                            }
                            if ($get("58") && hidcon58 != '1') {
                                $get("58").className = "imgContrast_none";
                            }
                        }
                    }

                    if (result[i].FabID == 61) {
                        if ($get("img61")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img61").src = 'images/61_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img61").src = 'images/61_baur.jpg';
                            }
                            else {
                                $get("img61").src = 'images/61.png';
                            }
                            if ($get("61") && hidcon61 != 1)
                                $get("61").className = "imgContrast_none";

                        }
                    }
                    if (result[i].FabID == 60) {
                        if ($get("img61")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img61").src = 'images/61_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img61").src = 'images/61_baur.jpg';
                            }
                            else {
                                $get("img61").src = 'images/61.png';
                            }
                            if ($get("61") && hidcon61 != 1)
                                $get("61").className = "imgContrast_none";

                        }
                    }
                    var CID = getQueryVariable('CID');
                    if (result[i].FabID == 54 && CID != 38) {
                        if ($get("img54")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img54").src = 'images/54_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img54").src = 'images/54_baur.jpg';
                            }
                            else {
                                $get("img54").src = 'images/54.png';
                            }

                            if ($get("54") && hidcon54 != 1)
                                $get("54").className = "imgContrast_none";

                        }
                    }
                    //backyokeontrasting
                    if (result[i].FabID == 62) {
                        if ($get("img62")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img62").src = 'images/62_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img62").src = 'images/62_baur.jpg';
                            }
                            else {
                                $get("img62").src = 'images/62.png';
                            }

                            if ($get("62") && hidcon62 != 1)
                                $get("62").className = "imgContrast_none";

                        }
                    }

                    //full collar_contrasting
                    if (result[i].FabID == 87) {
                        if ($get("img87")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img87").src = 'images/87_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img87").src = 'images/87_baur.jpg';
                            }
                            else {
                                $get("img87").src = 'images/87.png';
                            }
                            if ($get("87") && hidcon87 != 1)
                                $get("87").className = "imgContrast_none";

                        }
                    }

                    //full cuff_contrasting
                    if (result[i].FabID == 91) {
                        if ($get("img91")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img91").src = 'images/91_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img91").src = 'images/91_baur.jpg';
                            }
                            else {
                                $get("img91").src = 'images/91.png';
                            }
                            if ($get("91") && hidcon91 != 1)
                                $get("91").className = "imgContrast_none";
                        }
                    }

                    if (result[i].FabID == 17) {
                        if ($get("img17")) {
                            if (CID == 50 || CID == 53 || CID == 54) {
                                $get("img17").src = 'images/17_ms.png';
                            }
                            else if (CID == 65 || CID == 66) {
                                $get("img17").src = 'images/17_baur.jpg';
                            }
                            else {
                                $get("img17").src = 'images/17.png';
                            }

                            if ($get("17") && hidcon17 != 1)
                                $get("17").className = "imgContrast_none";
                        }
                    }
                }
            }
        }

        //rule: if you have chosen for white cuffs the choice of contrast cuffs must be disabled
        var hideo4 = document.getElementById('hideo4').value;
        if (hideo4 == 1) {
            //hide contrast cuff image
            document['img13'].src = 'img/leeg.png';
            //reset price
            ///////////////////////////////GetPriceInfoExtra('61', 0);
            deactivate('61', 1);
            deactivate('91', 1);
        }



        //rule: if you have chosen for white collar the choice of contrast collar must be disabled
        var hideo15 = document.getElementById('hideo15').value;
        if (hideo15 == 1) {
            //hide contrast collar image
            document['img14'].src = 'img/leeg.png';
            //reset price
            deactivate('58', 1);
            deactivate('87', 1);
        }



        //RULE FULL CUFF => NO INNER CUFF CONTRASTING
        var hidcon91 = document.getElementById('hidcon91').value;
        if (hidcon91 == '1') {
            //$get("hidcon61").value = 0;
            deactivate('61', 1);
        }

        //RULE FULL COLLAR => NO INNER COLLAR CONTRASTING
        var hidcon87 = document.getElementById('hidcon87').value;
        if (hidcon87 == '1') {
            //$get("hidcon58").value = 0;
            deactivate('58', 1);
        }
    }
}



// This function calls the Web service method and 
// passes the event callback function.  
function backtoall(i) {
    $get("cross" + i).src = "App_Themes/publicStore/img/undo_select_gray.jpg";
    $get("sel" + i).selectedIndex = 0;

    //show fabs
    GetFabrics();
}

function getfab(i) {
    $get("cross" + i).src = "App_Themes/publicStore/img/undo_select.jpg";

    //show fabs
    GetFabrics();
}


//STARTUP FUNCTION
function FillDDL() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");

    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.GetCollections(CID, FillCollectionDDL, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetColours(FillColourDDL, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetDesigns(FillDesignDDL, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetStructures(FillStructureDDL, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetFinishing(FillFinishingDDL, ErrorHandler, TimeOutHandler);
    Samples.AspNet.WebService.GetMaterials(FillMaterialDDL, ErrorHandler, TimeOutHandler);
}
////////////////////////////////////////////////////////////////////



// STARTUP FUNCTION
function GetContrastFabrics() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetContrastFabrics(CID, SuccesCallbackContrastFabrics, ErrorHandler, TimeOutHandler);

}

// STARTUP FUNCTION
function GetContrastFabrics2(i) {
    //CID
    var CID = getQueryVariable('CID');

    if (document.getElementById("dessin")) {
        var seldesign = document.getElementById("dessin");
        var i = seldesign.options[seldesign.selectedIndex].value;
        if (i > 0) {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.GetContrastFabrics2(i, CID, SuccesCallbackContrastFabrics, ErrorHandler, TimeOutHandler);
        }
        else {
            Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
            Samples.AspNet.WebService.GetContrastFabrics(CID, SuccesCallbackContrastFabrics, ErrorHandler, TimeOutHandler);
        }
    }
    else {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetContrastFabrics(CID, SuccesCallbackContrastFabrics, ErrorHandler, TimeOutHandler);
    }

}


//STARTUP FUNCTION
function GetDesignPlacket() {

    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPlacket(CID, SuccesCallbackDesignPlacket, ErrorHandler, TimeOutHandler);

}

// This function calls the Web service method and 
// passes the event callback function.  
function GetDesignPlacketNOSPECIAL() {

    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPlacketNOSPECIAL(CID, SuccesCallbackDesignPlacket, ErrorHandler, TimeOutHandler);
}

// STARTUP FUNCTION
function GetDesignPocket() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPocket(CID, SuccesCallbackDesignPocket, ErrorHandler, TimeOutHandler);
}

// STARTUP FUNCTION 
function GetDesignSleeve() {

    activate('60');
    activate('61');
    activate('91');
    activate('70');
    activate('165');
    activate('166');
    activate('150');


    $get("sleeveshort").className = '';
    $get("sleevelong").className = 'highlight';

    //Rule: set sleeve monogram squirrel default sleeve
    var d = document.getElementById('postionMonogram2');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }

    //switch
    if ($get("sq41div"))
        $get("sq41div").className = 'hidden';
    if ($get("sq38div"))
        $get("sq38div").className = 'postionMonograms';


    if ($get("SQpos_130038")) {
        $get("SQpos_130038").className = 'highlight';
        $get('sq13hid').value = '130038';
        ShowSQimg();
    }

    //CID
    var CID = getQueryVariable('CID');
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignSleeve(CID, SuccesCallbackDesignSleeve, ErrorHandler, TimeOutHandler);

}



// This function calls the Web service method and 
// passes the event callback function.
function GetDesignSleeveSHORT() {
    deactivate('60', 1);
    deactivate('61', 1);
    deactivate('91', 1);
    deactivate('70', 1);
    deactivate('165', 1);
    deactivate('166', 1);
    deactivate('150', 1);

    $get("sleeveshort").className = 'highlight';
    $get("sleevelong").className = '';

    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignSleeveSHORT(CID, SuccesCallbackDesignSleeve, ErrorHandler, TimeOutHandler);

    $get("hidsleeveshort").value = '1';
    $get("cufhid").value = '30006';

    var part = document.getElementById('parthid').value;
    if (part == 14) {

        var hidsleeveshort = document.getElementById('hidsleeveshort').value;
        //hide long sleeves
        if (hidsleeveshort == 1) {

            //Rule: set sleeve monogram squirrel default sleeve
            var d = document.getElementById('postionMonogram2');
            var el = getElementsByClassName('highlight', d);
            if (el) {
                el.className = '';
            }

            //switch
            if ($get("sq38div"))
                $get("sq38div").className = 'hidden';
            if ($get("sq41div"))
                $get("sq41div").className = 'postionMonograms';


            if ($get("SQpos_130041")) {
                $get("SQpos_130041").className = 'highlight';
                $get('sq13hid').value = '130041';
                ShowSQimg();
            }



            //hide longsleeves
            //hide longsleeves
            //hide arms
            document['img3'].src = "img/leeg.png";
            document['img4'].src = "img/leeg.png";
            document['img16'].src = "img/leeg.png";
            document['img17'].src = "img/leeg.png";
            document['img32'].src = "img/leeg.png";
            document['img43'].src = "img/leeg.png";
            document['img42'].src = "img/leeg.png";
            document['img103'].src = "img/leeg.png";
            document['img104'].src = "img/leeg.png";
            document['img116'].src = "img/leeg.png";
            document['img117'].src = "img/leeg.png";
            document['img132'].src = "img/leeg.png";

            document['img30043'].src = "img/leeg.png";
            document['img30044'].src = "img/leeg.png";



            var g = document.getElementById('fabhid').value;
            var cuf = document.getElementById('cufhid').value;
            var wit = document.getElementById('withid').value;
            var hidsleeveshort = document.getElementById('hidsleeveshort').value;
            var hideo4 = document.getElementById('hideo4').value;

            if (hideo4 == 0) {
                //Cuff load
                var src7 = 'ren2/men_front_p14_' + cuf + '_' + g + '.png';
                document['img7'].src = src7;
                checkImage('img7');

                var src107 = 'ren2/men_front_p14_' + cuf + '_' + g + '_zoom.png';
                document['img107'].src = src107;
                checkImage('img107');

                var src30007 = 'ren2/men_front_p3_' + cuf + '_' + g + '_zoom.png';
                document['img30007'].src = src30007;
                checkImage('img30007');

            } else if (hideo4 == 1) {
                //GEEN WHITE CUFF BIJ SHORT
                var src7 = 'ren2/men_front_p14_' + cuf + '_' + g + '.png';
                document['img7'].src = src7;
                checkImage('img7');

                var src107 = 'ren2/men_front_p14_' + cuf + '_' + g + '_zoom.png';
                document['img107'].src = src107;
                checkImage('img107');

                var src30007 = 'ren2/men_front_p3_' + cuf + '_' + g + '_zoom.png';
                document['img30007'].src = src30007;
                checkImage('img30007');
            }

            //rule open collar (placket contrast) :if you go back to collar  you always return to a closed collar and contrast needs to be resetted ( also price)
            var hidcon61 = document.getElementById('hidcon61').value;
            if (hidcon61 == '1' && hidsleeveshort == 1) {
                //set hid value op 0
                if ($get("hidcon61"))
                    $get("hidcon61").value = 0;
                //                if ($get("61")) {
                //                    $get("61").disabled = true;
                //                    $get("61").checked = false;
                //                }

                //reset price
                deactivate('61', 1);
                //hide placket contrast

                //cuff contrast weg
                var src13 = 'img/leeg.png';
                document['img13'].src = src13;

                var src30013 = 'img/leeg.png';
                document['img30013'].src = src30013;
                ////////////////////////////////////////////////////////////////////////////////
            }


        } else {
            var fab = document.getElementById('fabhid').value; 
            var src3 = 'ren2/men_front_p14_longsleeve_L_' + fab + '.png';
            document['img3'].src = src3;
            checkImage('img3');

            var src103 = 'ren2/men_front_p14_longsleeve_L_' + fab + '_zoom.png';
            document['img103'].src = src103;
            checkImage('img103');

            var src4 = 'ren2/men_front_p14_longsleeve_R_' + fab + '.png';
            document['img4'].src = src4;
            checkImage('img4');

            var src104 = 'ren2/men_front_p14_longsleeve_R_' + fab + '_zoom.png';
            document['img104'].src = src104;
            checkImage('img104');

            var src30004 = 'ren2/men_front_p3_longsleeve_R_' + fab + '_zoom.png';
            document['img30004'].src = src30004;
            checkImage('img30004');


            //LOAD CUFF
            var g = document.getElementById('fabhid').value;
            var cuf = document.getElementById('cufhid').value;
            var wit = document.getElementById('withid').value;
            var hidsleeveshort = document.getElementById('hidsleeveshort').value;
            var hideo4 = document.getElementById('hideo4').value;

            if (hideo4 == 0) {
                //Cuff load
                var src7 = 'ren2/men_front_p14_' + cuf + '_' + g + '.png';
                document['img7'].src = src7;
                checkImage('img7');

                var src107 = 'ren2/men_front_p14_' + cuf + '_' + g + '_zoom.png';
                document['img107'].src = src107;
                checkImage('img107');

                var src30007 = 'ren2/men_front_p3_' + cuf + '_' + g + '_zoom.png';
                document['img30007'].src = src30007;
                checkImage('img30007');

            } else if (hideo4 == 1) {
                //Cuff load
                var src7 = 'ren2/men_front_p14_' + cuf + '_' + wit + '.png';
                document['img7'].src = src7;
                checkImage('img7');

                var src107 = 'ren2/men_front_p14_' + cuf + '_' + wit + '_zoom.png';
                document['img107'].src = src107;
                checkImage('img107');

                var src30007 = 'ren2/men_front_p3_' + cuf + '_' + wit + '_zoom.png';
                document['img30007'].src = src30007;
                checkImage('img30007');
            }
        }
    }
    else if (part == "5") {
        showbac();
    }
}



// This function calls the Web service method and 
// passes the event callback function.  
function GetDesignCollar() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignCollar(CID, SuccesCallbackDesignCollar, ErrorHandler, TimeOutHandler);
}


// DESIGN COLLAR
function SuccesCallbackDesignCollar(result, eventArgs) {
    var d = document.getElementById('collarCollectionWrapper');
    d.innerHTML = "";

    var oTbl = document.createElement("div");
    oTbl.setAttribute('id', 'collarCollection');
    d.appendChild(oTbl);

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            if (i < 1) {
                var oTbl2 = document.createElement("div");
                var CID = getQueryVariable('CID');
                //TCHIBO EXCEPTION
                if (CID != 36 && CID != 37 && CID != 50) {
                    //oTbl2.innerHTML = "<div class='collars'><div class='select_collar'> <img onclick='GetDesignCollarInfo(" + result[i].FabID + ");showcol(" + result[i].MTMID + ");'  class='highlight' src='ren2/SOI_" + result[i].MTMID + ".jpg' id='fabcol" + result[i].FabID + "'  />            <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'> " + result[i].FabInfoIcon + " </span><span class='bottom'></span></span></a>           </div><div class='collarText'>" + result[i].FabName + "</div></div>";
                    oTbl2.innerHTML = "<div class='collars'><div class='select_collar'> <img onclick='GetDesignCollarInfo(" + result[i].FabID + ");showcol(" + result[i].MTMID + ");'  class='highlight' src='ren2/SOI_" + result[i].MTMID + ".jpg' id='fabcol" + result[i].FabID + "'  />                      </div><div class='collarText'>" + result[i].FabName + "</div></div>";

                }
                else {
                    oTbl2.innerHTML = "<div class='collars'><div class='select_collar'> <img onclick='GetDesignCollarInfo(" + result[i].FabID + ");showcol(" + result[i].MTMID + ");'  class='highlight' src='ren2/SOI_" + result[i].MTMID + ".jpg' id='fabcol" + result[i].FabID + "'  />                      </div><div class='collarText'>" + result[i].FabName + "</div></div>";
                }
                oTbl.appendChild(oTbl2);
            }
            else {
                var oTbl2 = document.createElement("div");

                var testje = "";
                testje = "<div class='collars'><div class='select_collar'> <img onclick='GetDesignCollarInfo(" + result[i].FabID + ");showcol(" + result[i].MTMID + ");'  class='Nohighlight' src='ren2/SOI_" + result[i].MTMID + ".jpg' id='fabcol" + result[i].FabID + "'  />         ";


                var CID = getQueryVariable('CID');
                if (CID != 36 && CID != 37 && CID != 50) {
                    if (i == 0 || i == 4 || i == 9 || i == 14 || i == 19) {
                        //rechts
                        //testje += " <a class='tt2' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[i].FabInfoIcon + "</span><span class='bottom'></span></span></a>";
                    }
                    else {
                        //links 4x
                        //testje += " <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[i].FabInfoIcon + "</span><span class='bottom'></span></span></a>";
                    }
                }
                testje += "</div><div class='collarText'>" + result[i].FabName + "</div></div>";
                oTbl2.innerHTML = testje
                oTbl.appendChild(oTbl2);
            }
        }
    }


    //Eerste collar
    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetDesignCollarInfo(result[0].FabID, SuccesCallbackDesignCollarInfo, ErrorHandler, TimeOutHandler);

        //check Rule for first loaded item
        //check colfrule
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetRuleCOL(result[0].MTMID, SuccesCallbackcolklik, ErrorHandler, TimeOutHandler);

        //Rule: for first collar
        //if collar 1/6/8/17/19/35/53/59/60/65 => do have special placket
        var colmtm = result[0].MTMID;
        if (colmtm == 20001 || colmtm == 20006 || colmtm == 20008 || colmtm == 20017 || colmtm == 20019 || colmtm == 20035 || colmtm == 20053 || colmtm == 20059 || colmtm == 20060 || colmtm == 20065) {
            //GetDesignPlacket();
            //show 2 plackets
            if ($get("platd50011"))
                $get("platd50011").className = 'placket_style';
            if ($get("platd50012"))
                $get("platd50012").className = 'placket_style';
        }
        else {
            //GetDesignPlacketNOSPECIAL();
            //hide 2 plackets, highlight existing one
            if ($get("platd50011"))
                $get("platd50011").className = 'hidden';
            if ($get("platd50012"))
                $get("platd50012").className = 'hidden';

            //GetDesignPlacketInfo2('2');
        }

    }
}

// passes the evSuccesCallbackDesignCollarent callback function.  
function GetDesignCollarInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignCollarInfo(i, SuccesCallbackDesignCollarInfo, ErrorHandler, TimeOutHandler);
}




// RETURN GetDesignSleeve
function SuccesCallbackDesignSleeve(result, eventArgs) {
    var d = document.getElementById('sleevePicker');
    d.innerHTML = "";

    var index = 0;
    var oTbl = document.createElement("Table");
    for (i = 0; i < 40; i++) {
        if (result.length > i) {

            var oTR = oTbl.insertRow(i);
            for (j = 0; j < 6; j++) {
                var oTD = oTR.insertCell(j);
                oTD.width = "80";
                oTD.valign = "top";
                if (result.length > 0) {
                    if (result.length > index) {
                        if (index < 1) {
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                //oTD.innerHTML = "<div class='cuffs'> <img onclick='GetDesignSleeveInfo(" + result[index].FabID + ");showcuf(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' id='fabcuf" + result[index].FabID + "'  />      <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[index].FabInfoIcon + "</span><span class='bottom'></span></span></a>  </div>" + result[index].FabName + "</td>";
                                oTD.innerHTML = "<div class='cuffs'> <img onclick='GetDesignSleeveInfo(" + result[index].FabID + ");showcuf(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' id='fabcuf" + result[index].FabID + "'  />       </div>" + result[index].FabName + "</td>";

                            }
                            else {
                                oTD.innerHTML = "<div class='cuffs'> <img onclick='GetDesignSleeveInfo(" + result[index].FabID + ");showcuf(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' id='fabcuf" + result[index].FabID + "'  />       </div>" + result[index].FabName + "</td>";
                            }
                        }
                        else {
                            var testje = "";
                            testje = "<div class='cuffs'> <img onclick='GetDesignSleeveInfo(" + result[index].FabID + ");showcuf(" + result[index].MTMID + ");' class='Nohighlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' id='fabcuf" + result[index].FabID + "'  />    ";
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                if (index == 0 || index == 5 || index == 10 || index == 15 || index == 20) {
                                    //rechts
                                    //testje += "<a class='tt2' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[index].FabInfoIcon + "</span><span class='bottom'></span></span></a>";
                                }
                                else {
                                    //testje += "<a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[index].FabInfoIcon + "</span><span class='bottom'></span></span></a>";

                                }
                            }
                            testje += "</div>" + result[index].FabName + "</td>";
                            oTD.innerHTML = testje
                        }
                    }
                }
                index++;
            }
        }
    }

    d.appendChild(oTbl);

    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetDesignSleeveInfo(result[0].FabID, SuccesCallbackDesignSleeveInfo, ErrorHandler, TimeOutHandler);


        //sleevelong
        //sleeveshort
        var d = document.getElementById('divsleeveshort');
        var el = getElementsByClassName('highlight', d);
        //IS SHORT
        if (el) {
            $get("hidsleeveshort").value = '1';
            $get("cufhid").value = result[0].MTMID;
        }
        else {
            $get("hidsleeveshort").value = '0';
            $get("cufhid").value = result[0].MTMID;
        }

        showcuf(result[0].MTMID);

    }


}

// STARTUP FUNCTION 
function GetDesignSleeveExtra() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignSleeveExtra(CID, SuccesCallbackDesignSleeveExtra, ErrorHandler, TimeOutHandler);
}

// RETURN GetDesignSleeveExtra()
function SuccesCallbackDesignSleeveExtra(result, eventArgs) {
    var d = document.getElementById('sleevePickerExtra');
    d.innerHTML = "";

    var oTbl = document.createElement("ul");
    oTbl.setAttribute('id', 'extraOptions');
    d.appendChild(oTbl);

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            var oTbl2 = document.createElement("div");
            var CID = getQueryVariable('CID');
            //TCHIBO EXCEPTION
            if (CID == 50 || CID == 53 || CID == 54) {
                //oTbl2.innerHTML = "<li><div class='option'><input DISABLED class='DISABLED'  id=" + result[i].MTMID + "  type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + "  </div><div class='info_img_inlist'>      <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[i].FabInfoIcon + "</span><span class='bottom'></span></span></a>         </div></li>";
                oTbl2.innerHTML = "<li><div class='option'><input DISABLED class='DISABLED'  id=" + result[i].MTMID + "  type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + " " + result[i].FabExtraInfo + "  </div><div class='info_img_inlist'>              </div></li>";

            }
            else {
                oTbl2.innerHTML = "<li><div class='option'><input DISABLED class='DISABLED'  id=" + result[i].MTMID + "  type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + "  </div><div class='info_img_inlist'>              </div></li>";
            }
            oTbl.appendChild(oTbl2);

        }
    }
}

// STARTUP FUNCTION
function GetDesignCollarExtra() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignCollarExtra(CID, SuccesCallbackDesignCollarExtra, ErrorHandler, TimeOutHandler);
}

// RETURN GetDesignCollarExtra()
function SuccesCallbackDesignCollarExtra(result, eventArgs) {
    var d = document.getElementById('collarPickerExtra');
    d.innerHTML = "";

    var oTbl = document.createElement("ul");
    oTbl.setAttribute('id', 'extraOptions');
    d.appendChild(oTbl);

  
    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            var oTbl2 = document.createElement("li");
            var CID = getQueryVariable('CID');
            if (CID == 50 || CID == 53 || CID == 54) {
                oTbl2.innerHTML = "<div class='option'><input DISABLED id=" + result[i].MTMID + " class='DISABLED' type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + " " + result[i].FabExtraInfo + "</div>";
            }
            else {
                oTbl2.innerHTML = "<div class='option'><input DISABLED id=" + result[i].MTMID + " class='DISABLED' type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + "  </div>";
            }
            
            oTbl.appendChild(oTbl2);


            if (result[i].MTMID == 39) {

                oTbl2.id = 'SetTapsel';


                if (result[0].WWCM1 == 1) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(1);' id='tap1' src='img/tap1.jpg' class='highlight' />";
                    $get("taphid").value = 'red';
                }

                if (result[0].WWCM2 == 1 && result[0].WWCM1 == 0) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(2);' id='tap2' src='img/tap2.jpg' class='highlight' />";
                    $get("taphid").value = 'orange';
                }
                else if (result[0].WWCM2 == 1) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(2);' id='tap2' src='img/tap2.jpg' class='colourTape' />";
                }

                if (result[0].WWCM3 == 1 && result[0].WWCM1 == 0 && result[0].WWCM2 == 0) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(3);' id='tap3' src='img/tap3.jpg' class='highlight' />";
                    $get("taphid").value = 'black';
                }
                else if (result[0].WWCM3 == 1) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(3);' id='tap3' src='img/tap3.jpg' class='colourTape' />";
                }

                if (result[0].WWCM4 == 1 && result[0].WWCM1 == 0 && result[0].WWCM2 == 0 && result[0].WWCM3 == 0) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(4);' id='tap4' src='img/tap4.jpg' class='highlight' />";
                    $get("taphid").value = 'blue';
                } else if (result[0].WWCM4 == 1) {
                    oTbl2.innerHTML += "<img onclick='SetTapsel(4);' id='tap4' src='img/tap4.jpg' class='colourTape' />";
                }
                //oTbl3.innerHTML += "</li>";

            }


            oTbl2.innerHTML += "<div class='info_img_inlist'>   <a class='hidden' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[i].FabInfoIcon + "</span><span class='bottom'></span></span></a>    </div>";
            oTbl.appendChild(oTbl2);
        }
    }
}


// STARTUP FUNCTION  
function GetDesignContrastExtra() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignContrastExtra(CID, SuccesCallbackDesignContrastExtra, ErrorHandler, TimeOutHandler);

}

function classExists(c) {
    return typeof (c) == "function" && typeof (c.prototype) == "object" ? true : false;
}

// RETURN GetDesignContrastExtra
function SuccesCallbackDesignContrastExtra(result, eventArgs) {
    var d = document.getElementById('contrasting_types1');
    d.innerHTML = "";

    var type1 = "";
    var type2 = "";
    var type3 = "";

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            if (result[i].ASS == 1) {
                var oTbl2 = document.createElement("div");
                var CID = getQueryVariable('CID');
                oTbl2.innerHTML = "<div alt='" + result[i].FabName + "' id='" + result[i].FABID2 + "' class='imgContrast_none' onclick='GetPriceInfoExtra(this.id, 1);showcon(" + result[i].FABID2 + ");'><img src='images/" + result[i].FabIMG + "' alt='" + result[i].FabName + "' width='50' height='35'  class='no' id='img" + result[i].FABID2 + "' /></div>";

                d.appendChild(oTbl2);
                type1 = "yes";
            }
        }
    }

    var d = document.getElementById('contrasting_types2');
    d.innerHTML = "";

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            if (result[i].ASS == 2) {
                var oTbl2 = document.createElement("div");
                var CID = getQueryVariable('CID');
                //oTbl2.innerHTML = "<div class='contrastType' id='condiv" + result[i].FABID2 + "'><img src='images/" + result[i].FabIMG + "' alt='collar contrasting' class='contrastingImg' id='" + result[i].FABID2 + "' onclick='if(this.checked) GetPriceInfoExtra(this.id, 1); else GetPriceInfoExtra(this.id,0);showcon(" + result[i].FABID2 + ");' />            </div>";
                oTbl2.innerHTML = "<div alt='" + result[i].FabName + "' id='" + result[i].FABID2 + "' class='imgContrast_none' onclick='GetPriceInfoExtra(this.id, 1);showcon(" + result[i].FABID2 + ");'><img src='images/" + result[i].FabIMG + "' alt='" + result[i].FabName + "' width='50' height='35'  class='no' id='img" + result[i].FABID2 + "' /></div>";

                d.appendChild(oTbl2);
                type2 = "yes";
            }
        }
    }

    var d = document.getElementById('contrasting_types3');
    d.innerHTML = "";

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            if (result[i].ASS == 3) {
                var oTbl2 = document.createElement("div");
                var CID = getQueryVariable('CID');

                oTbl2.innerHTML = "<div alt='" + result[i].FabName + "' id='" + result[i].FABID2 + "' class='imgContrast_none' onclick='GetPriceInfoExtra(this.id, 1);showcon(" + result[i].FABID2 + ");'><img src='images/" + result[i].FabIMG + "' alt='" + result[i].FabName + "' width='50' height='35'  class='no' id='img" + result[i].FABID2 + "' /></div>";

                d.appendChild(oTbl2);
                type3 = "yes";

            }
        }
    }


    if (type1 == "") {
        if ($get("designclass1PL")) {
            $get("designclass1PL").setAttribute("style", "display:none;");
        }
    }

    if (type2 == "") {
        if ($get("designclass2PL")) {
            $get("designclass2PL").setAttribute("style", "display:none;");
        }
    }

    if (type3 == "") {
        if ($get("designclass3PL")) {
            $get("designclass3PL").setAttribute("style", "display:none;");
        }
    }
}

// STARTUP FUNCTION
function GetDesignPocketExtra() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPocketExtra(CID, SuccesCallbackDesignPocketExtra, ErrorHandler, TimeOutHandler);
}

// NOT NEEDED IN FIRST VERSION
// RETURN GetDesignPocketExtra
function SuccesCallbackDesignPocketExtra(result, eventArgs) {
    var d = document.getElementById('pocketPickerExtra');
    d.innerHTML = "";

    var oTbl = document.createElement("ul");
    oTbl.setAttribute('id', 'extraOptions');
    d.appendChild(oTbl);

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            var oTbl2 = document.createElement("div");

            oTbl2.innerHTML = "<li><div class='option'><input id=" + result[i].MTMID + " class='Nohighlight' type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + "   </div><div class='info_img_inlist'><img src='img/information.jpg' /></div></li>";
            oTbl.appendChild(oTbl2);
        }
    }
}

// STARTUP FUNCTION
function GetDesignPlacketExtra() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPlacketExtra(CID, SuccesCallbackDesignPlacketExtra, ErrorHandler, TimeOutHandler);
}

// RETURN GetDesignPocketExtra
function SuccesCallbackDesignPlacketExtra(result, eventArgs) {
    var d = document.getElementById('placketPickerExtra');
    d.innerHTML = "";

    var oTbl = document.createElement("ul");
    oTbl.setAttribute('id', 'extraOptions');
    d.appendChild(oTbl);

    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            var oTbl2 = document.createElement("div");
            var CID = getQueryVariable('CID');
            if (CID == 50 || CID == 53 || CID == 54) {
                oTbl2.innerHTML = "<li><div class='option'><input id=" + result[i].MTMID + " class='Nohighlight' type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + " " + result[i].FabExtraInfo + "   </div></li>";
            }
            else {
                oTbl2.innerHTML = "<li><div class='option'><input id=" + result[i].MTMID + " class='Nohighlight' type='checkbox' onclick='if(this.checked) GetExtraOptionsInfo(this.id, 1); else GetExtraOptionsInfo(this.id,0);' /> " + result[i].FabName + "   </div></li>";
            }
            
            oTbl.appendChild(oTbl2);
        }
    }
}

// passes the evSuccesCallbackDesignCollarent callback function.  
function GetDesignSleeveInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignSleeveInfo(i, SuccesCallbackDesignSleeveInfo, ErrorHandler, TimeOutHandler);
}



 

//SECOND SCREEN
function LoadSelectedGALShirt(selid) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.LoadSelectedGALShirt(selid, SuccesCallbackLoadSelectedGALShirt, ErrorHandler, TimeOutHandler);
}

//LoadSelectedShirt GALLERY
function SuccesCallbackLoadSelectedGALShirt(result, eventArgs) {

    $get("galok").value = '1';
    
    if (!getQueryVariable('FIT')) {
        $get("fithid").value = '8018015';
    }
    else {
        $get("fithid").value = '80180' + getQueryVariable('FIT');
        var fullfit = 'fit' + '80180' + getQueryVariable('FIT');
        SetSizeFitInfo(fullfit)
    }


    $get("withid").value = '13801';
    $get("parthid").value = '14';
    $get("langhid").value = '1';

    if (result[0].CUFIDMTM != "") {
        if (result[0].CUFIDMTM != "30006" && result[0].CUFIDMTM != "30008" && result[0].CUFIDMTM != "30010" && result[0].CUFIDMTM != "30011" && result[0].CUFIDMTM != "30012") {
            $get("hidsleeveshort").value = 0;
        }
        else {
            $get("hidsleeveshort").value = 1;
        }
    }
    else {
        $get("hidsleeveshort").value = 0;
    }


    if (result[0].EOP15ID != "") {
        if ($get("hideo15"))
            $get("hideo15").value = 1;
        if ($get("15")) {
            $get("15").disabled = false;
            $get("15").checked = true;
        }
        //force white collar for alter design 14062010
        GetExtraOptionsInfo(15, 1)
    }
    else {
        $get("hideo15").value = 0;
    }

    if (result[0].EOP24ID != "") {
        $get("hideo24").value = 1;
        if ($get("24")) {
            $get("24").disabled = false;
            $get("24").checked = true;
        }
        //force white collar for alter design 14062010
        GetExtraOptionsInfo(24, 1)
    }
    else {
        $get("hideo24").value = 0;
    }

    if (result[0].EOP401ID != "") {
        $get("hideo401").value = 1;
        if ($get("401")) {
            $get("401").disabled = false;
            $get("401").checked = true;
        }
        //force white collar for alter design 14062010
        GetExtraOptionsInfo(401, 1)
    }
    else {
        $get("hideo401").value = 0;
    }

    if (result[0].EOP39ID != "") {
        $get("hideo39").value = 1;
        if ($get("39")) {
            $get("39").disabled = false;
            $get("39").checked = true;
        }
        //force white collar for alter design 14062010
        GetExtraOptionsInfo(39, 1)

        //taphid en tapid
        if (result[0].TAPHID != null && result[0].TAPHID != "") {
            $get("taphid").value = result[0].TAPHID;
        }
        else {
            $get("taphid").value = '';
        }
    }
    else {
        $get("hideo39").value = 0;
    }

    if (result[0].EOP4ID != "") {
        $get("hideo4").value = 1;
        if ($get("4")) {
            $get("4").disabled = false;
            $get("4").checked = true;
        }
        //force white collar for alter design 14062010
        GetExtraOptionsInfo(4, 1)
    }
    else {
        $get("hideo4").value = 0;
    }

    if (result[0].FABSTRMTM != null && result[0].FABSTRMTM != "") {
        $get("fabhid").value = result[0].FABSTRMTM;
    }

    if (result[0].COLIDMTM != null && result[0].COLIDMTM != "") {
        $get("colhid").value = result[0].COLIDMTM;
    }
    if (result[0].CUFIDMTM != null && result[0].CUFIDMTM != "") {
        $get("cufhid").value = result[0].CUFIDMTM;
    }
    if (result[0].PLAIDMTM != null && result[0].PLAIDMTM != "50011" && result[0].PLAIDMTM != "50012") {
        $get("plahid").value = "placket";
    }
    else if (result[0].PLAIDMTM != null && result[0].PLAIDMTM != "") {
        $get("plahid").value = result[0].PLAIDMTM;
    }
//    if (result[0].POCID != null && result[0].POCID != "") {
//        $get("pochid").value = result[0].POCIDMTM;
//    }
    if (result[0].BASIDMTM != null && result[0].BASIDMTM != "") {
        $get("bashid").value = result[0].BASIDMTM;
    }

    ////////CONTRASTS////////
    if (result[0].CON62ID != null && result[0].CON62ID != "") {
        $get('hidcon62fab').value = result[0].CON62ID;
        $get('hidcon62').value = 1;
        //activate('62');
        //GetPriceInfoExtra(62, 1);
        //showcon('62');
        activateGAL(62);
    }
    else {
        $get("hidcon62").value = 0;
    }

    if (result[0].CON58ID != null && result[0].CON58ID != "") {
        $get('hidcon58fab').value = result[0].CON58ID;
        $get('hidcon58').value = 1;
        //activate('58');
        //GetPriceInfoExtra(58, 1);
        //showcon('58');
        activateGAL(58);
    }
    else {
        $get("hidcon58").value = 0;
    }

    if (result[0].CON61ID != null && result[0].CON61ID != "") {
        $get('hidcon61fab').value = result[0].CON61ID;
        $get('hidcon61').value = 1;
        if ($get('hidcon60fab')) {
            $get('hidcon60fab').value = result[0].CON61ID;
        }
        if ($get('hidcon60')) {
            $get('hidcon60').value = 1;
        }
        //activate('60');
        //activate('61');
        //GetPriceInfoExtra(61, 1);
        //showcon('61');
        //showcon('60');
        activateGAL(60);
        activateGAL(61);
    } //
    else {
        $get("hidcon61").value = 0;
    }


    if (result[0].CON54ID != null && result[0].CON54ID != "") {
        $get('hidcon54fab').value = result[0].CON54ID;
        $get('hidcon54').value = 1;
        //activate('54');
        //GetPriceInfoExtra(54, 1);
        //showcon('54');
        activateGAL(54);
    }
    else {
        $get("hidcon54").value = 0;
    }

    if (result[0].CON87ID != null && result[0].CON87ID != "") {
        $get('hidcon87fab').value = result[0].CON87ID;
        $get('hidcon87').value = 1;
        //GetPriceInfoExtra(87, 1);
        //activateGAL(87);
        activateGAL(87);
    }
    else {
        $get("hidcon87").value = 0;
    }

    if (result[0].CON91ID != null && result[0].CON91ID != "") {
        //////alert('zzzzzzzzzzz');
        $get('hidcon91fab').value = result[0].CON91ID;
        $get('hidcon91').value = 1;
        //activate('91');
        //GetPriceInfoExtra(91, 1);
        //showcon('91');
        activateGAL(91);
    }
    else {
        $get("hidcon91").value = 0;
    }

    if (result[0].CON150ID != null && result[0].CON150ID != "") {
        $get('hidcon150fab').value = result[0].CON150ID;
        $get('hidcon150').value = 1;
        //activate('150');
        //showcon('150');
        //GetPriceInfoExtra(150, 1);
        activateGAL(150);
    }
    else {
        $get("hidcon150").value = 0;
    }

    if (result[0].CON166ID != null && result[0].CON166ID != "") {
        $get('hidcon166fab').value = result[0].CON166ID;
        $get('hidcon166').value = 1;
        //activate('166');
        //GetPriceInfoExtra(166, 1);
        //showcon('166');
        activateGAL(166);
    }
    else {
        $get("hidcon166").value = 0;
    }

    if (result[0].CON165ID != null && result[0].CON165ID != "") {
        $get('hidcon165fab').value = result[0].CON165ID;
        $get('hidcon165').value = 1;
        //activate('165');
        //GetPriceInfoExtra(165, 1);
        //showcon('165');
        activateGAL(165);
    }
    else {
        $get("hidcon165").value = 0;
    }

    if (result[0].CON164ID != null && result[0].CON164ID != "") {
        $get('hidcon164fab').value = result[0].CON164ID;
        $get('hidcon164').value = 1;
        //activate('164');
        //GetPriceInfoExtra(164, 1);
        //showcon('164');
        activateGAL(164);
    }
    else {
        $get("hidcon164").value = 0;
    }

    if (result[0].CON163ID != null && result[0].CON163ID != "") {
        $get('hidcon163fab').value = result[0].CON163ID;
        $get('hidcon163').value = 1;
        //activate('163');
        //GetPriceInfoExtra(163, 1);
        //showcon('163');
        activateGAL(163);
    }
    else {
        $get("hidcon163").value = 0;
    }

    if (result[0].CON70ID != null && result[0].CON70ID != "") {
        $get('hidcon70fab').value = result[0].CON70ID;
        $get('hidcon70').value = 1;
        //activate('70');
        //GetPriceInfoExtra(70, 1);
        //showcon('70');
        activateGAL(70);
    }
    else {
        $get("hidcon70").value = 0;
    }

    if (result[0].CON69ID != null && result[0].CON69ID != "") {
        $get('hidcon69fab').value = result[0].CON69ID;
        $get('hidcon69').value = 1;
        //activate('69');
        //GetPriceInfoExtra(69, 1);
        //showcon('69');
        activateGAL(69);
    }
    else {
        $get("hidcon69").value = 0;
    }

    if (result[0].CON68ID != null && result[0].CON68ID != "") {
        $get('hidcon68fab').value = result[0].CON68ID;
        $get('hidcon68').value = 1;
        //activate('68');
        //GetPriceInfoExtra(68, 1);
        //showcon('68');
        activateGAL(68);
    }
    else {
        $get("hidcon68").value = 0;
    }

    if (result[0].CON162ID != null && result[0].CON162ID != "") {
        $get('hidcon162fab').value = result[0].CON162ID;
        $get('hidcon162').value = 1;
        ///activate('162');
        //GetPriceInfoExtra(162, 1);
        //showcon('162');
        activateGAL(162);
    }
    else {
        $get("hidcon162").value = 0;
    }

    if (result[0].CON169ID != null && result[0].CON169ID != "") {
        $get('hidcon169fab').value = result[0].CON169ID;
        $get('hidcon169').value = 1;
        //activate('169');
        //GetPriceInfoExtra(169, 1);
        //showcon('169');
        activateGAL(169);
    }
    else {
        $get("hidcon169").value = 0;
    }

    if (result[0].CON167ID != null && result[0].CON167ID != "") {
        $get('hidcon167fab').value = result[0].CON167ID;
        $get('hidcon167').value = 1;
        //activate('167');
        //GetPriceInfoExtra(167, 1);
        //showcon('167');
        activateGAL(167);
    }
    else {
        $get("hidcon167").value = 0;
    }

    //HIDDENFIELD BUTTON AND STITCH
    //buthid
    //stihid
    if (result[0].BUTID != null && result[0].BUTID != "") {
        $get("buthid").value = result[0].BUTID;
        showpla_button(result[0].BUTID);
    }
    else {
        $get("buthid").value = 0;
    }

    if (result[0].STIID != null && result[0].STIID != "") {
        $get("stihid").value = result[0].STIID;
    }
    else {
        $get("stihid").value = 0;
    }

    //cfab(result[0].FABSTRMTM);

    //alert('result[0].FABSTRMTM' + result[0].FABSTRMTM +  ' en fabstr: ' + result[0].FABSTR);
    //CONFIGURED ID'S
    if (result[0].FABSTR) {
        GetFabricInfo(result[0].FABSTR);
    }
    if (result[0].COLID) {
        GetDesignCollarInfo(result[0].COLID);
    }
    if (result[0].CUFID)
        GetDesignSleeveInfo(result[0].CUFID);
//    if (result[0].POCID)
//        GetDesignPocketInfo(result[0].POCID)
    if (result[0].PLAID) {
        GetDesignPlacketInfo(result[0].PLAID);
    }
    if (result[0].BASID)
        GetDesignBasehemInfo(result[0].BASID);




    if (result[0].MONPRICE) {
        if (result[0].MONPRICE != "0" && result[0].MONPRICE != "") {

            //FONT BEPAALT LAATSTE LETTER
            //SetTypsel('120006'); GetMONloc2('306'); GetMONcol2('306');
            //GetMONchoice();
            //SetColsel2(i)

            $get("yesmon").checked = true;
            $get("nomon").checked = false;
            $get("initials_disabled").className = '';
            $get("refresh22").className = '';
            $get('inputtxt2').value = result[0].MONTXT + '';


            //SetTypsel(result[0].MONFONTNR);
            if (result[0].MONPRICE == "10") {
                menumonoclick('2', '999');
            }
            else {
                //menumonoclick('1', '999');
                GetMONchoice();
            }
            //GetMONtyp2('302');
            //GetMONloc2('306');
            //GetMONcol2('302');
            setTimeout("SetTypsel('" + result[0].MONFONTNR + "');", 1000); //120006
            setTimeout("SetColsel1('" + result[0].MONCOL + "');", 1000); //140006
            setTimeout("SetLocsel('" + result[0].MONPOS + "');", 1000); //130006
            setTimeout("SetPriceInfo('alg_monogram_price', " + result[0].MONPRICE + ");", 1000);

            if (result[0].MONSQCOL != null && result[0].MONSQCOL != "") {
                setTimeout("SetColsel2('" + result[0].MONSQCOL + "');", 1000); //140006
            }

            if (result[0].MONSQPOS != null && result[0].MONSQPOS != "") {
                setTimeout("SetSQsel('" + result[0].MONSQPOS + "');", 1000); //140006
            }

            setTimeout("GenerateMonogram2();", 1000);
        }
        else {

            if (result[0].MONSQCOL != null && result[0].MONSQCOL != "") {
                setTimeout("SetColsel2('" + result[0].MONSQCOL + "');", 1000); //140006
            }

            if (result[0].MONSQPOS != null && result[0].MONSQPOS != "") {
                setTimeout("SetSQsel('" + result[0].MONSQPOS + "');", 1000); //140006
            }

            GetMONchoice();
            SetColsel1('140002');
            SetLocsel('130001');
            
            $get("yesmon").checked = false;
            $get("nomon").checked = true;
            $get("initials_disabled").className = 'boxOverlay';
            $get("refresh22").className = 'hidden';

        }
    }
    else {
        if (result[0].MONSQCOL != null && result[0].MONSQCOL != "") {
            setTimeout("SetColsel2('" + result[0].MONSQCOL + "');", 1000); //140006
        }

        if (result[0].MONSQPOS != null && result[0].MONSQPOS != "") {
            setTimeout("SetSQsel('" + result[0].MONSQPOS + "');", 1000); //140006
        }
        GetMONchoice();
        SetColsel1('140002');
        SetLocsel('130001');
    }

    //shirtname
    if (result[0].GALSHIRT != "") {
        if ($get("shirtname"))
            $get("shirtname").innerHTML = result[0].GALSHIRT;
    }
    else {
        if ($get("shirtname"))
            $get("shirtname").innerHTML = "";
    }
    //shirtcreator
    if (result[0].GALCREATOR != "") {
        if ($get("shirtcreator"))
            $get("shirtcreator").innerHTML = result[0].GALCREATOR;
    }
    else {
        if ($get("shirtcreator"))
            $get("shirtcreator").innerHTML = "";
    }

    ////REAL PRICE FOR SOW
    ////priceIndications
    if (result[0].GALPRICE != "") {
        if ($get("priceIndications"))
            $get("priceIndications").innerHTML = result[0].GALPRICE;
    }
    else {
        if ($get("priceIndications"))
            $get("priceIndications").innerHTML = "";
    }


    //ctl00_cph1_LblConfigName
    if (result[0].GALCONF != "") {
        if ($get("ctl00_cph1_LblConfigName"))
            $get("ctl00_cph1_LblConfigName").innerHTML = result[0].GALCONF;
    }
    else {
        if ($get("ctl00_cph1_LblConfigName"))
            $get("ctl00_cph1_LblConfigName").innerHTML = "";
    }


    $get("selok").value = '1';

    setTimeout("show14();", 1000);
//    setTimeout("menuclick(5);", 1000);



    
}

//PLATICO FICHE SELID
function LoadSelectedShirt(selid) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.LoadSelectedShirt(selid, SuccesCallbackLoadSelectedShirt, ErrorHandler, TimeOutHandler);
}


//PLATICO FICHE SELID
function SuccesCallbackLoadSelectedShirt(result, eventArgs) {
    //1//GetFabricContrastInfo(i)
    //set hiddenfields
    //FIX

    if (!getQueryVariable('FIT')) {
        $get("fithid").value = '8018015';
    }
    else {
        $get("fithid").value = '80180' + getQueryVariable('FIT');
        var fullfit = 'fit' + '80180' + getQueryVariable('FIT');
        SetSizeFitInfo(fullfit);

    }
    $get("withid").value = '13801';
    $get("parthid").value = '14';
    $get("langhid").value = '1';

    if (result[0].CUFIDMTM != "30006" && result[0].CUFIDMTM != "30008" && result[0].CUFIDMTM != "30010" && result[0].CUFIDMTM != "30011" && result[0].CUFIDMTM != "30012") {
        $get("hidsleeveshort").value = 0;
    }
    else {
        $get("hidsleeveshort").value = 1;
    }

    ///////////////////////////////////////////////////////
    /////////15, 24, 401, 39, 4, 6, 171, 172///////////////
    ///////////////////////////////////////////////////////
    if (result[0].EOP15ID != "") {
        if ($get("hideo15"))
            $get("hideo15").value = 1;
        if ($get("15")) {
            $get("15").disabled = false;
            $get("15").checked = true;
        }
        GetExtraOptionsInfo(15, 1);
    }
    else {
        $get("hideo15").value = 0;
    }

    if (result[0].EOP24ID != "") {
        $get("hideo24").value = 1;
        if ($get("24")) {
            $get("24").disabled = false;
            $get("24").checked = true;
        }
        GetExtraOptionsInfo(24, 1);
    }
    else {
        $get("hideo24").value = 0;
    }

    if (result[0].EOP401ID != "") {
        $get("hideo401").value = 1;
        if ($get("401")) {
            $get("401").disabled = false;
            $get("401").checked = true;
        }
        GetExtraOptionsInfo(401, 1);
    }
    else {
        $get("hideo401").value = 0;
    }

    if (result[0].EOP39ID != "") {
        $get("hideo39").value = 1;
        if ($get("39")) {
            $get("39").disabled = false;
            $get("39").checked = true;
        }
        GetExtraOptionsInfo(39, 1);

        //taphid en tapid
        if (result[0].TAPHID != null && result[0].TAPHID != "") {
            $get("taphid").value = result[0].TAPHID;
        }
        else {
            $get("taphid").value = '';
        }


    }
    else {
        $get("hideo39").value = 0;
    }

    if (result[0].EOP4ID != "") {
        $get("hideo4").value = 1;
        if ($get("4")) {
            $get("4").disabled = false;
            $get("4").checked = true;
        }
        GetExtraOptionsInfo(4, 1);
    }
    else {
        $get("hideo4").value = 0;
    }

    if (result[0].EOP6ID != "") {
        $get("hideo6").value = 1;
        if ($get("6")) {
            $get("6").disabled = false;
            $get("6").checked = true;
        }
        GetExtraOptionsInfo(6, 1);
    }
    else {
        $get("hideo6").value = 0;
    }

    if (result[0].EOP171ID != "") {
        $get("hideo171").value = 1;
        if ($get("171")) {
            $get("171").disabled = false;
            $get("171").checked = true;
        }
        GetExtraOptionsInfo(171, 1);
        ShowEO171();
    }
    else {
        $get("hideo171").value = 0;
    }

    if (result[0].EOP172ID != "") {
        $get("hideo172").value = 1;
        if ($get("172")) {
            $get("172").disabled = false;
            $get("172").checked = true;
        }
        GetExtraOptionsInfo(172, 1);
        ShowEO172();
    }
    else {
        $get("hideo172").value = 0;
    }

    if (result[0].EOPboxer != "") {
        selectExtra('boxer', 'true');
    }
    else {
        selectExtra('boxer', 'false');
    }

    if (result[0].EOPhandkerchief != "") {
        selectExtra('chief', 'true');
    }
    else {
        selectExtra('chief', 'false');
    }
   
    if (result[0].EOPtie != "") {
        selectExtra('tie', 'true');
    }
    else {
        selectExtra('tie', 'false');
    }
    ///////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////

    if (result[0].FABSTRMTM != null && result[0].FABSTRMTM != "") {
        $get("fabhid").value = result[0].FABSTRMTM;
    }
    if (result[0].COLIDMTM != null && result[0].COLIDMTM != "") {
        $get("colhid").value = result[0].COLIDMTM;
    }
    if (result[0].CUFIDMTM != null && result[0].CUFIDMTM != "") {
        $get("cufhid").value = result[0].CUFIDMTM;
    }
    if (result[0].PLAIDMTM != null && result[0].PLAIDMTM != "50011" && result[0].PLAIDMTM != "50012") {
        $get("plahid").value = "placket";
    }
    else if (result[0].PLAIDMTM != null && result[0].PLAIDMTM != "") {
        $get("plahid").value = result[0].PLAIDMTM;
    }
    if (result[0].POCID != null && result[0].POCID != "") {
        $get("pochid").value = result[0].POCIDMTM;
    }
    if (result[0].BASIDMTM != null && result[0].BASIDMTM != "") {
        $get("bashid").value = result[0].BASIDMTM;
    }




    //<input id="hidcon62" type="hidden" /><!--inner splitted backyoke -->
    //<input id="hidcon62fab" type="hidden" /><!--inner splitted backyoke -->
    //<input id="hidcon58" type="hidden" /><!--collar inside -->
    //<input id="hidcon58fab" type="hidden" /><!--collar inside -->
    //<input id="hidcon61" type="hidden" /><!--cuff inside -->
    //<input id="hidcon61fab" type="hidden" /><!--cuff inside -->
    //<input id="hidcon54" type="hidden" /><!--placket -->
    //<input id="hidcon54fab" type="hidden" /><!--placket -->
    //<input id="hidcon17" type="hidden" /><!--inner splitted backyoke -->
    //<input id="hidcon17fab" type="hidden" /><!--inner splitted backyoke -->
    
    if (result[0].CON62ID != null && result[0].CON62ID != "") {
        $get('hidcon62fab').value = result[0].CON62ID;
        $get('hidcon62').value = 1;
        //activate('62');
        GetPriceInfoExtra(62, 1);
        //showcon('62');
    }
    else {
        $get("hidcon62").value = 0;
    }


    if (result[0].CON58ID != null && result[0].CON58ID != "") {
        $get('hidcon58fab').value = result[0].CON58ID;
        $get('hidcon58').value = 1;
        //activate('58');
        GetPriceInfoExtra(58, 1);
        //showcon('58');
    }
    else {
        $get("hidcon58").value = 0;
    }


    if (result[0].CON61ID != null && result[0].CON61ID != "") {
        $get('hidcon61fab').value = result[0].CON61ID;
        $get('hidcon61').value = 1;
        if ($get('hidcon60fab')) {
            $get('hidcon60fab').value = result[0].CON61ID;
        }
        if ($get('hidcon60')) {
            $get('hidcon60').value = 1;
        }
        //activate('60');
        //activate('61');
        GetPriceInfoExtra(61, 1);
        //showcon('61');
        //showcon('60');
    } //
    else {
        $get("hidcon61").value = 0;
    }


    if (result[0].CON54ID != null && result[0].CON54ID != "") {
        $get('hidcon54fab').value = result[0].CON54ID;
        $get('hidcon54').value = 1;
        //activate('54');
        GetPriceInfoExtra(54, 1);
        //showcon('54');
    }
    else {
        $get("hidcon54").value = 0;
    }

    if (result[0].CON87ID != null && result[0].CON87ID != "") {
        $get('hidcon87fab').value = result[0].CON87ID;
        $get('hidcon87').value = 1;
        //var optcontrastMTMfabid = '11104_Marco 4'; //$get('hidcon' + z + 'fab').value + '_Marco 4';
        //var optcontrastMTMfabid2 = 'Marco 4';  //$get('hidcon' + z + 'fab').value

        GetPriceInfoExtra(87, 1);
        //activate('87');
        //showcon('87');
    }
    else {
        $get("hidcon87").value = 0;
    }

    if (result[0].CON91ID != null && result[0].CON91ID != "") {
        //////alert('zzzzzzzzzzz');
        $get('hidcon91fab').value = result[0].CON91ID;
        $get('hidcon91').value = 1;
        //activate('91');
        GetPriceInfoExtra(91, 1);
        //showcon('91');
    }
    else {
        $get("hidcon91").value = 0;
    }

    if (result[0].CON150ID != null && result[0].CON150ID != "") {
        $get('hidcon150fab').value = result[0].CON150ID;
        $get('hidcon150').value = 1;
        //activate('150');
        //showcon('150');
        GetPriceInfoExtra(150, 1);
    }
    else {
        $get("hidcon150").value = 0;
    }

    if (result[0].CON166ID != null && result[0].CON166ID != "") {
        $get('hidcon166fab').value = result[0].CON166ID;
        $get('hidcon166').value = 1;
        //activate('166');
        GetPriceInfoExtra(166, 1);
        //showcon('166');
    }
    else {
        $get("hidcon166").value = 0;
    }

    if (result[0].CON165ID != null && result[0].CON165ID != "") {
        $get('hidcon165fab').value = result[0].CON165ID;
        $get('hidcon165').value = 1;
        //activate('165');
        GetPriceInfoExtra(165, 1);
        //showcon('165');
    }
    else {
        $get("hidcon165").value = 0;
    }

    if (result[0].CON164ID != null && result[0].CON164ID != "") {
        $get('hidcon164fab').value = result[0].CON164ID;
        $get('hidcon164').value = 1;
        //activate('164');
        GetPriceInfoExtra(164, 1);
        //showcon('164');
    }
    else {
        $get("hidcon164").value = 0;
    }

    if (result[0].CON163ID != null && result[0].CON163ID != "") {
        $get('hidcon163fab').value = result[0].CON163ID;
        $get('hidcon163').value = 1;
        //activate('163');
        GetPriceInfoExtra(163, 1);
        //showcon('163');
    }
    else {
        $get("hidcon163").value = 0;
    }

    if (result[0].CON70ID != null && result[0].CON70ID != "") {
        $get('hidcon70fab').value = result[0].CON70ID;
        $get('hidcon70').value = 1;
        //activate('70');
        GetPriceInfoExtra(70, 1);
        //showcon('70');
    }
    else {
        $get("hidcon70").value = 0;
    }

    if (result[0].CON69ID != null && result[0].CON69ID != "") {
        $get('hidcon69fab').value = result[0].CON69ID;
        $get('hidcon69').value = 1;
        //activate('69');
        GetPriceInfoExtra(69, 1);
        //showcon('69');
    }
    else {
        $get("hidcon69").value = 0;
    }

    if (result[0].CON68ID != null && result[0].CON68ID != "") {
        $get('hidcon68fab').value = result[0].CON68ID;
        $get('hidcon68').value = 1;
        //activate('68');
        GetPriceInfoExtra(68, 1);
        //showcon('68');
    }
    else {
        $get("hidcon68").value = 0;
    }

    if (result[0].CON162ID != null && result[0].CON162ID != "") {
        $get('hidcon162fab').value = result[0].CON162ID;
        $get('hidcon162').value = 1;
        ///activate('162');
        GetPriceInfoExtra(162, 1);
        //showcon('162');
    }
    else {
        $get("hidcon162").value = 0;
    }

    if (result[0].CON169ID != null && result[0].CON169ID != "") {
        $get('hidcon169fab').value = result[0].CON169ID;
        $get('hidcon169').value = 1;
        //activate('169');
        GetPriceInfoExtra(169, 1);
        //showcon('169');
    }
    else {
        $get("hidcon169").value = 0;
    }

    if (result[0].CON167ID != null && result[0].CON167ID != "") {
        $get('hidcon167fab').value = result[0].CON167ID;
        $get('hidcon167').value = 1;
        //activate('167');
        GetPriceInfoExtra(167, 1);
        //showcon('167');
    }
    else {
        $get("hidcon167").value = 0;
    }



    //HIDDENFIELD BUTTON AND STITCH
    //buthid
    //stihid
    if (result[0].BUTID != null && result[0].BUTID != "") {
        $get("buthid").value = result[0].BUTID;
        showpla_button(result[0].BUTID);
    }
    else {
        $get("buthid").value = 0;
    }

    if (result[0].STIID != null && result[0].STIID != "") {
        $get("stihid").value = result[0].STIID;
    }
    else {
        $get("stihid").value = 0;
    }


    /////cfab(result[0].FABSTRMTM);

    //CONFIGURED ID'S
    if (result[0].FABSTR)
        GetFabricInfo(result[0].FABSTR);
    if (result[0].COLID) {
        GetDesignCollarInfo(result[0].COLID);  //confid
        //showcol(result[0].COLIDMTM);
    }
    if (result[0].CUFID)
        GetDesignSleeveInfo(result[0].CUFID);

    if (result[0].POCID)
        GetDesignPocketInfo(result[0].POCID)

    if (result[0].PLAID) {
        GetDesignPlacketInfo(result[0].PLAID);
    }

    if (result[0].BASID)
        GetDesignBasehemInfo(result[0].BASID);





    if (result[0].MONPRICE) {
        if (result[0].MONPRICE != "0" && result[0].MONPRICE != "") {

            //FONT BEPAALT LAATSTE LETTER
            //SetTypsel('120006'); GetMONloc2('306'); GetMONcol2('306');
            //GetMONchoice();
            //SetColsel2(i);

            $get("yesmon").checked = true;
            $get("nomon").checked = false;
            $get("initials_disabled").className = '';
            $get("refresh22").className = '';
            $get('inputtxt2').value = result[0].MONTXT + '';


            //SetTypsel(result[0].MONFONTNR);
            if (result[0].MONPRICE == "10") {
                menumonoclick('2', '999');
            }
            else {
                //menumonoclick('1', '999');
                GetMONchoice();
            }
            //GetMONtyp2('302');
            //GetMONloc2('306');
            //GetMONcol2('302');
            setTimeout("SetTypsel('" + result[0].MONFONTNR + "');", 1000); //120006
            setTimeout("SetColsel1('" + result[0].MONCOL + "');", 1000); //140006
            setTimeout("SetLocsel('" + result[0].MONPOS + "');", 1000); //130006
            setTimeout("SetPriceInfo('alg_monogram_price', " + result[0].MONPRICE + ");", 1000);
            setTimeout("GenerateMonogram2();", 1000);



        }
        else {
            $get("yesmon").checked = false;
            $get("nomon").checked = true;
            $get("initials_disabled").className = 'boxOverlay';
            $get("refresh22").className = 'hidden';

        }
    }
    else {
        GetMONchoice();
    }


    if (result[0].MONSQPOS != null && result[0].MONSQPOS != "") {
        
        setTimeout("SetSQsel('" + result[0].MONSQPOS + "');", 1000); //140006
    }

    if (result[0].MONSQCOL != null && result[0].MONSQCOL != "") {
        //alert('b1: ' + result[0].MONSQCOL);
        //alert('b2: ' + result[0].MONSQCOL.replace("000", "0000").replace("00", "000"));
        GetSQimg(result[0].MONSQCOL); //140006
        SetColsel2(result[0].MONSQCOL); //140006
    }

//    if (result[0].MONSQCOL != null && result[0].MONSQCOL != "") {
//        setTimeout("GetSQimg('" + result[0].MONSQCOL.replace("000", "0000").replace("00", "000") + "');", 2000); //140006
//    }

    if (result[0].MEASMTMID != null && result[0].MEASMTMID != "") {
        $get("ctl00_cph1_ctrlCONF_hiddenfields_hidselmeasmtmid").value = result[0].MEASMTMID;
    }

    //alert('result.MEASFIT: ' + result[0].MEASFIT);
    document.getElementById('fithid').value = result[0].MEASFIT;
    
    //set fit
    var fit2 = document.getElementById('allFits');
    var elfit2 = getElementsByClassName('highlight', fit2);
    if (elfit2) {
        var fitname = elfit2.alt;
        var fit = document.getElementById('fithid').value;
        var fullfit = 'fit' + fit;
        if (fit) {
            if (fit == 8018020) {
                ChangeText('measFit', fitname);
                SetSizeFitInfo(fullfit);
            }
            else if (fit == 8018015) {
                ChangeText('measFit', fitname);
                SetSizeFitInfo(fullfit);
            } else if (fit == 8018010) {
                ChangeText('measFit', fitname);
                SetSizeFitInfo(fullfit);
            }
        }
    }

  
    setTimeout("show14();", 1000);
    setTimeout("menuclick(5);", 1000);

    if (getQueryVariable('COL')) {
        show2();
    }


    
}


function setreview() {


}


function LoadInitShirt() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.LoadInitShirt(CID, SuccesCallbackLoadInitShirt, ErrorHandler, TimeOutHandler);
}

//LoadInitShirt
function SuccesCallbackLoadInitShirt(result, eventArgs) {

    //EMPTY MONOGRAM
    document.images["refresh22"].src = 'img/leeg.png';
    if (document.images["refresh2"])
        document.images["refresh2"].src = 'img/leeg.png';

    if (result.length <= 0) {
        alert('Configurator not complete, check options');
    }
    else {
        //Fill zoom back
        var src1001 = 'ren2/men_back_p5_' + result[0].FABID + '_zoom.png';
        document['img1001'].src = src1001;
        checkImage('img1001');

        var src1002 = 'ren2/men_back_p5_top-back_' + result[0].FABID + '_zoom.png';
        document['img1002'].src = src1002;
        checkImage('img1002');

        var src1003 = 'ren2/men_back_p5_collar_' + result[0].FABID + '_zoom.png';
        document['img1003'].src = src1003;
        checkImage('img1003');

        var src1004 = 'ren2/men_back_p5_leftsleeve_' + result[0].FABID + '_zoom.png';
        document['img1004'].src = src1004;
        checkImage('img1004');

        var src1005 = 'ren2/men_back_p5_rightsleeve_' + result[0].FABID + '_zoom.png';
        document['img1005'].src = src1005;
        checkImage('img1005');

        //http://staging.bivolino.com:8080/Bivolino_3D/ren2/men_front_p14_8018020_90001_R_10101.png
        var src1 = 'ren2/men_front_p14_8018020_90001_R_' + result[0].FABID + '.png';
        document['img1'].src = src1;
        checkImage('img1');

        var src101 = 'ren2/men_front_p14_8018020_90001_R_' + result[0].FABID + '_zoom.png';
        document['img101'].src = src101;
        checkImage('img101');

        var src2 = 'ren2/men_front_p14_8018020_90001_L_' + result[0].FABID + '.png';
        document['img2'].src = src2;
        checkImage('img2');

        var src102 = 'ren2/men_front_p14_8018020_90001_L_' + result[0].FABID + '_zoom.png';
        document['img102'].src = src102;
        checkImage('img102');

        var src3 = 'ren2/men_front_p14_longsleeve_L_' + result[0].FABID + '.png';
        document['img3'].src = src3;
        checkImage('img3');

        var src103 = 'ren2/men_front_p14_longsleeve_L_' + result[0].FABID + '_zoom.png';
        document['img103'].src = src103;
        checkImage('img103');

        var src30001 = 'ren2/men_front_p3_8018020_90005_R_' + result[0].FABID + '_zoom.png';
        document['img30001'].src = src30001;
        checkImage('img30001');

        var src4 = 'ren2/men_front_p14_longsleeve_R_' + result[0].FABID + '.png';
        document['img4'].src = src4;
        checkImage('img4');

        var src104 = 'ren2/men_front_p14_longsleeve_R_' + result[0].FABID + '_zoom.png';
        document['img104'].src = src104;
        checkImage('img104');

        var src30004 = 'ren2/men_front_p3_longsleeve_R_' + result[0].FABID + '_zoom.png';
        document['img30004'].src = src30004;
        checkImage('img30004');

        var src5 = 'ren2/men_front_p14_placket_' + result[0].FABID + '.png';
        document['img5'].src = src5;
        checkImage('img5');

        var src105 = 'ren2/men_front_p14_placket_' + result[0].FABID + '_zoom.png';
        document['img105'].src = src105;
        checkImage('img105');

        var col = result[0].COLID;
        if (col == 20052) {
            col = 20015;
        } else if (col == 20035) {
            col = 20053;
        } else if (col == 20050) {
            col = 20061;
        } else if (col == 20001) {
            col = 20041;
        } else if (col == 20017) {
            col = 20015;
        } else if (col == 20020) {
            col = 20015;
        } else if (col == 20005) {
            col = 20056;
        } else if (col == 20060) {
            col = 20056;
        }

        //Collar load
        var src6 = 'ren2/men_front_p14_' + col + '_' + result[0].FABID + '.png';
        document['img6'].src = src6;
        checkImage('img6');

        var src106 = 'ren2/men_front_p14_' + col + '_' + result[0].FABID + '_zoom.png';
        document['img106'].src = src106;
        checkImage('img106');

        var src20006 = 'ren2/men_front_p2_' + col + '_' + result[0].FABID + '_zoom.png';
        document['img20006'].src = src20006;
        checkImage('img20006');

        //Cuff load
        var src7 = 'ren2/men_front_p14_' + result[0].CUFID + '_' + result[0].FABID + '.png';
        document['img7'].src = src7;
        checkImage('img7');

        var src107 = 'ren2/men_front_p14_' + result[0].CUFID + '_' + result[0].FABID + '_zoom.png';
        document['img107'].src = src107;
        checkImage('img107');

        var src30007 = 'ren2/men_front_p3_' + result[0].CUFID + '_' + result[0].FABID + '_zoom.png';
        document['img30007'].src = src30007;
        checkImage('img30007');

        //Backyoke load
        var src9 = 'ren2/men_front_p14_backyoke_C_' + result[0].FABID + '.png';
        document['img9'].src = src9;
        checkImage('img9');

        var src109 = 'ren2/men_front_p14_backyoke_C_' + result[0].FABID + '_zoom.png';
        document['img109'].src = src109;
        checkImage('img109');

        var src20009 = 'ren2/men_front_p2_backyoke_C_' + result[0].FABID + '_zoom.png';
        document['img20009'].src = src20009;
        checkImage('img20009');

        //load POCKET body + placket poczoom
        var src60002 = 'ren2/men_front_p6_8018020_90001_L_' + result[0].FABID + '_zoom.png';
        document['img60002'].src = src60002;
        checkImage('img60002');

        var src60005 = 'ren2/men_front_p6_50010_' + result[0].FABID + '_zoom.png';
        document['img60005'].src = src60005;
        checkImage('img60005');


        $get("fabhid").value = result[0].FABID;
        $get("cufhid").value = result[0].CUFID;
        $get("colhid").value = result[0].COLID;
        $get("plahid").value = result[0].PLAID;

        //$get("pochid").value = result[0].POCID;
        hidePockets();

        $get("bashid").value = result[0].BASID;
        $get("fithid").value = '8018015';

        $get("MONGUID").value = result[0].MONGUID;


        // $get("langhid").value = '2';


        $get("withid").value = '13801';
        $get("parthid").value = '14';
        $get("buthid").value = '640001';
        $get("hidsleeveshort").value = '0';
        $get("tapid").value = '0';

        $get("sq13hid").value = '130038';
        $get("sq14hid").value = '140002';

        $get("hideo15").value = '0';
        $get("hideo24").value = '0';
        $get("hideo401").value = '0';
        $get("hideo39").value = '0';

        $get("hideo4").value = '0';

        $get("hideo30").value = '0';
        $get("hideo31").value = '0';

        $get("hidcon62").value = '0';
        $get("hidcon58").value = '0';
        $get("hidcon61").value = '0';
        $get("hidcon54").value = '0';
        $get("hidcon17").value = '0';
        $get("hidcon87").value = '0';
        $get("hidcon91").value = '0';

        $get("hidcon162").value = '0';

        $get("pricepla").value = 0;
        $get("pricesti").value = 0;
        $get("pricemon").value = 0;
        $get("pricehid").value = 0;
        //pricepla
        //pricesti
        //pricemon
        //pricehid


        //show placket button, staat onderaan want heeft parthid nodig
        showpla_button(result[0].BUTID);
        showpla_stitch(770010);

        GetPriceInfo();
    }
}



// SET DESIGN PLACKET INFO DETAILS INTO REVIEW
function SuccesCallbackDesignSleeveInfo(result, eventArgs) {
    var CID = getQueryVariable('CID');
    ///if (!getQueryVariable('SELID')) 
    {
        var d = document.getElementById('sleevePicker');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("fabcuf" + result[0].FabID))
            $get("fabcuf" + result[0].FabID).className = 'highlight';

        //SET REVIEW COLLAR
        //SET REVIEW COLLAR
        if (result[0].B2C_price != 0) {
            if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('rev3', result[0].FabName + '  (£' + result[0].B2C_price + ')');
            }
            else {
                ChangeText('rev3', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
            }
        }
        else {
            ChangeText('rev3', result[0].FabName);
        }
    }

    $get("cufhid").value = result[0].MTMID;


    //Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    //Samples.AspNet.WebService.GetRuleCUF(result[0].MTMID, SuccesCallbackcufklik, ErrorHandler, TimeOutHandler);
    //BBB
    if ($get("yesmon")) {
        //if ($get("yesmon").checked && !getQueryVariable('SELID')) {
        if ($get("yesmon").checked) {
            GenerateMonogram2();
        }
    }

    //Change Price
    GetPriceInfo();
}





// RETURN GetDesignPocket
function SuccesCallbackDesignPocket(result, eventArgs) {
    var d = document.getElementById('pocketPicker');
    d.innerHTML = "";

    var index = 0;
    var oTbl = document.createElement("Table");
    for (i = 0; i < 40; i++) {
        var oTR = oTbl.insertRow(i);
        for (j = 0; j < 5; j++) {
            var oTD = oTR.insertCell(j);
            oTD.width = "90";
            oTD.valign = "top";
            if (result.length > 0) {
                if (result.length > index) {
                    if (index < 1) {
                        var CID = getQueryVariable('CID');
                        //TCHIBO EXCEPTION
                        if (CID != 36 && CID != 37 && CID != 50) {
                            //oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />       <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[index].FabInfoIcon + "</span><span class='bottom'></span></span></a>           </div><p class='pocket'>" + result[index].FabName + "</p></td>";
                            oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />               </div><p class='pocket'>" + result[index].FabName + "</p></td>";

                        }
                        else {
                            oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />               </div><p class='pocket'>" + result[index].FabName + "</p></td>";
                        }
                    }
                    else {
                        var CID = getQueryVariable('CID');
                        //TCHIBO EXCEPTION
                        if (CID != 36 && CID != 37 && CID != 50) {
                            //oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='Nohighlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />     <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'>" + result[index].FabInfoIcon + "</span><span class='bottom'></span></span></a>      </div><p class='pocket'>" + result[index].FabName + "</p></td>";
                            oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='Nohighlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />          </div><p class='pocket'>" + result[index].FabName + "</p></td>";

                        }
                        else {
                            oTD.innerHTML = "<div> <img onclick='GetDesignPocketInfo(" + result[index].FabID + ");showpoc(" + result[index].MTMID + ");' class='Nohighlight' src='ren2/SOI_" + result[index].MTMID + ".jpg' alt='pocket style' width='64' height='58' class='pocket_preview' id='fabpoc" + result[index].FabID + "'  />          </div><p class='pocket'>" + result[index].FabName + "</p></td>";
                        }
                    }
                }
            }
            index++;
        }
    }

    d.appendChild(oTbl);

    if (result.length > 0) {
        //pocket visualisation
        //Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        //Samples.AspNet.WebService.GetDesignPocketInfo(result[0].FabID, SuccesCallbackDesignPocketInfo, ErrorHandler, TimeOutHandler);
    }
}

// This function calls the Web service method and 
// passes the event callback function.  
function GetDesignPocketFirst() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPocket(CID, SuccesCallbackDesignPocketFirst, ErrorHandler, TimeOutHandler);
}

// This is the callback function invoked if the Web service succeeded.
// It accepts the result object as a parameter.
function SuccesCallbackDesignPocketFirst(result, eventArgs) {
    if (result.length > 0) {
        $get("pocket").checked = true;
        $get("nopocket").checked = false;
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetDesignPocketInfo(result[0].FabID, SuccesCallbackDesignPocketInfo, ErrorHandler, TimeOutHandler);
    }
}

// passes the evSuccesCallbackDesignCollarent callback function.  
function GetDesignPocketInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPocketInfo(i, SuccesCallbackDesignPocketInfo, ErrorHandler, TimeOutHandler);
}

function GetDesignNoPockets() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignNoPockets(SuccesCallbackDesignNoPocket, ErrorHandler, TimeOutHandler);
}

// SET DESIGN PLACKET INFO DETAILS INTO REVIEW
function SuccesCallbackDesignPocketInfo(result, eventArgs) {
    var CID = getQueryVariable('CID');
    activate('69');

    //BBB
    if ($get("pocket")) {
        $get("pocket").checked = true;
    }
    if ($get("nopocket")) {
        $get("nopocket").checked = false;
    }
    if ($get("pocket_disabled")) {
        $get("pocket_disabled").className = 'leeg';
    }

    var d = document.getElementById('pocketPicker');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }
    if ($get("fabpoc" + result[0].FabID))
        $get("fabpoc" + result[0].FabID).className = 'highlight';

    $get("pochid").value = result[0].MTMID;

    //set visuals for pocket
    showpoc(result[0].MTMID);

    //SET REVIEW COLLAR
    //SET REVIEW COLLAR
    if (result[0].B2C_price != 0) {
        if (CID == 50 || CID == 53 || CID == 54) {
            ChangeText('rev7', result[0].FabName + '  (£'  + result[0].B2C_price + ')');
        }
        else {
            ChangeText('rev7', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
        }
    }
    else {
        ChangeText('rev7', result[0].FabName);
    }

    if ($get("yesmon")) {
        //if ($get("yesmon").checked && !getQueryVariable('SELID')) {
        if ($get("yesmon").checked) {
            GenerateMonogram2();
        }
    }

    //Change Price
    //GetPriceInfo();
    //JSPrice();
}

function SuccesCallbackDesignNoPocket(result, eventArgs) {

    deactivate('69', 1);
}

// SET DESIGN PLACKET INFO DETAILS INTO REVIEW
function hidePockets() {
    //pocket_disabled
    document['img8'].src = "img/leeg.png";
    document['img55'].src = 'img/leeg.png';
    document['img108'].src = "img/leeg.png";
    document['img60055'].src = 'img/leeg.png';
    document['img60008'].src = 'img/leeg.png';
    document['img155'].src = 'img/leeg.png';
    if ($get("pocket_disabled"))
        $get("pocket_disabled").className = 'boxOverlay';

    if ($get("pocket"))
        $get("pocket").checked = false;

    if ($get("nopocket"))
        $get("nopocket").checked = true;

    GetDesignNoPockets();


    var d = document.getElementById('pocketPicker');
    var el = getElementsByClassName('highlight', d);
    if (el) {
        el.className = '';
    }

    //hide pocket visuals
    $get("pochid").value = 'no';

    deactivate('69', 1);

    //SET REVIEW COLLAR

    var ggg = document.getElementById('langhid').value;
    if (ggg == 1 || document.URL.indexOf('deben') != -1) {
        ChangeText('rev7', 'No Pocket');
    }
    else if (ggg == 2) {
        ChangeText('rev7', 'Zonder zak');
    }
    else if (ggg == 3) {
        ChangeText('rev7', 'Sans poche');
    }
    else if (ggg == 4) {
        ChangeText('rev7', 'Ohne Tasche');
    }

    //Change Price
    //GetPriceInfo();
    //JSPrice();
}

// RETURN GetDesignPlacket
function SuccesCallbackDesignPlacket(result, eventArgs) {
    var d = document.getElementById('plackets');
    d.innerHTML = "";

    var index = 0;
    var oTbl = document.createElement("Table");
    for (i = 0; i < 40; i++) {
        if (result.length > i) {
            var oTR = oTbl.insertRow(i);
            for (j = 0; j < 5; j++) {
                var oTD = oTR.insertCell(j);
                oTD.width = "90";
                oTD.valign = "top";

                if (result.length > 0) {
                    if (result.length > index) {
                        if (index < 1) {
                            oTD.id = "platd" + result[index].MTMID + "";
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                //oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>      <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'> " + result[index].FabInfoIcon + " </span><span class='bottom'></span></span></a>         </div> <div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg'  id='fabpla" + result[index].FabID + "'  /></div>" + result[index].FabName + "</br>";
                                oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>            </div> <div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");placketextraCONruleINLINE();' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg'  id='fabpla" + result[index].FabID + "'  /></div>" + result[index].FabName + "</br>";

                            }
                            else {
                                oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>            </div> <div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");placketextraCONruleINLINE();' class='highlight' src='ren2/SOI_" + result[index].MTMID + ".jpg'  id='fabpla" + result[index].FabID + "'  /></div>" + result[index].FabName + "</br>";
                            }
                        }
                        else {
                            oTD.id = "platd" + result[index].MTMID + "";
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                //oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>    <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'> " + result[index].FabInfoIcon + " </span><span class='bottom'></span></span></a>         </div><div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");' class='Nohighlight' id='fabpla" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' /></div>" + result[index].FabName + "</br>";
                                oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>           </div><div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");placketextraCONruleINLINE();' class='Nohighlight' id='fabpla" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' /></div>" + result[index].FabName + "</br>";

                            }
                            else {
                                oTD.innerHTML = "<div id='pladivinfo" + result[index].MTMID + "' class='info_placket'>           </div><div id='pladiv" + result[index].MTMID + "' class='placket_style'> <img onclick='GetDesignPlacketInfo(" + result[index].FabID + ");showpla(" + result[index].MTMID + ");placketextraCONruleINLINE();' class='Nohighlight' id='fabpla" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' /></div>" + result[index].FabName + "</br>";
                            }
                        }
                    }
                }
                index++;
            }
        }
    }


    d.appendChild(oTbl);

    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetDesignPlacketInfo(result[0].FabID, SuccesCallbackDesignPlacketInfo, ErrorHandler, TimeOutHandler);
    }
}

// CONFID  
function GetDesignPlacketInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPlacketInfo(i, SuccesCallbackDesignPlacketInfo, ErrorHandler, TimeOutHandler);
    //alert('GetDesignPlacketInfo');
}

// MTMID for setting from collars  
function GetDesignPlacketInfo2(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignPlacketInfo2(i, SuccesCallbackDesignPlacketInfo2, ErrorHandler, TimeOutHandler);
    //alert('GetDesignPlacketInfo2');
}

//STARTING FROM CONFID
function SuccesCallbackDesignPlacketInfo(result, eventArgs) {
    var CID = getQueryVariable('CID');
    if (document.getElementById('plackets')) {
        var d = document.getElementById('plackets');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("fabpla" + result[0].FabID))
            $get("fabpla" + result[0].FabID).className = 'highlight';

        $get("plahid").value = result[0].MTMID;
        //SET REVIEW PLACKET
        if (result[0].B2C_price != 0) {
            if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('rev5', result[0].FabName + '  (£' + result[0].B2C_price + ')');
            }
            else {
                ChangeText('rev5', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
            }
        }
        else {
            ChangeText('rev5', result[0].FabName);
        }


        ////////////////////EO PLACKET///////////////////////
        var hideo171 = document.getElementById('hideo171').value;
        if (hideo171 == 1) {
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }
        var hideo172 = document.getElementById('hideo172').value;
        if (hideo172 == 1) {
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
        }
        var hidPAT = document.getElementById('hidPATFAB').value;
        var plahid = document.getElementById('plahid').value;
        if (plahid != 50002) { //hide 167/169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }
        //LINES = 3 => show 167/169
        else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
            //do nothing
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = false;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = false;
            }
        } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
        //CHECKS = 2 => show 167, hide 169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = false;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        } else {//UNI = 1/8/11 => hide 167/169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }   //////////////////////////////////////
    }
}


//STARTING FROM (5)+2
function SuccesCallbackDesignPlacketInfo2(result, eventArgs) {
    var CID = getQueryVariable('CID');
    /////////////////if (!getQueryVariable('SELID')) 
    {
        var d = document.getElementById('plackets');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("fabpla" + result[0].FabID))
            $get("fabpla" + result[0].FabID).className = 'highlight';

        $get("plahid").value = result[0].MTMID;

        //SET REVIEW PLACKET
        if (result[0].B2C_price != 0) {
            if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('rev5', result[0].FabName + '  (£' + result[0].B2C_price + ')');
            }
            else {
                ChangeText('rev5', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
            }
        }
        else {
            ChangeText('rev5', result[0].FabName);
        }
    }
    showpla(result[0].MTMID);
}




// STARTUP FUNCTION
function GetDesignBasehem() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignBasehem(CID, SuccesCallbackDesignBasehem, ErrorHandler, TimeOutHandler);


}

// STARTUP FUNCTION
function GetCurLangID() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetCurLangID(SuccesCallbackCurLangID, ErrorHandler, TimeOutHandler);
}

//RETURN GetDesignBasehem
function SuccesCallbackCurLangID(result, eventArgs) {
    if (document.URL.toLowerCase().indexOf('deben') != -1) {
        $get("langhid").value = '1';
    }
    else if (result.length > 0) {
        $get("langhid").value = result[0].FabID;
        //result[i].FabID
    }


}

// STARTUP FUNCTION
function GetStiButtons() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetStiButtons(CID, SuccesCallbackStiButtons, ErrorHandler, TimeOutHandler);
}

// RETURN GetStiButtons
function SuccesCallbackStiButtons(result, eventArgs) {
    var d = document.getElementById('knoopsgaten');
    d.innerHTML = "";


    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
       
            var oTbl2 = document.createElement("div");
            // <div class="knoopsgat"><img id="knoopsgat_770011" onclick="showpla_stitch(770011);" src="images/770011.jpg" alt="" /><br /></div>

            oTbl2.innerHTML = "<div class='knoopsgat'><img id='knoopsgat_" + result[i].FabID + "' alt='" + result[i].FabName + "' src='images/" + result[i].FabID + ".png' onclick='showpla_stitch(" + result[i].FabID + ");'><br>" + result[i].FabName + "</div>";
            d.appendChild(oTbl2);
        }
    }

    //PLAATS BLAUWE KADER ROND EERSTE ITEM
    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetStiButtonsInfo(77010, SuccesCallbackStiButtonsInfo, ErrorHandler, TimeOutHandler);
    }
}

// SET DESIGN BASEHEM INFO DETAILS INTO REVIEW
function SuccesCallbackStiButtonsInfo(result, eventArgs) {
    if (result.length > 0) {
        var d = document.getElementById('knoopsgaten');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("knoopsgat_" + result[0].FabID))
            $get("knoopsgat_" + result[0].FabID).className = 'highlight';
    }
}

// STARTUP FUNCTION
function GetPlaButtons() {
    //CID
    var CID = getQueryVariable('CID');

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetPlaButtons(CID, SuccesCallbackPlaButtons, ErrorHandler, TimeOutHandler);
}

// RETURN GetPlaButtons
function SuccesCallbackPlaButtons(result, eventArgs) {
    var d = document.getElementById('knopen');
    d.innerHTML = "";


    for (i = 0; i < result.length; i++) {
        if (result.length > i) {
            var oTbl2 = document.createElement("div");
            //<div class="knop"><img id="knoop_640003" onclick="showpla_button(640003);" src="images/640003.png" alt="" /></div>

            oTbl2.innerHTML = "<div class='knop'><img id='knoop_" + result[i].FabID + "' alt='" + result[i].FabName + "' src='images/" + result[i].FabID + ".png' onclick='showpla_button(" + result[i].FabID + ");'><br>" + result[i].FabName + "</div>";
            d.appendChild(oTbl2);
        }
    }

    //PLAATS BLAUWE KADER ROND EERSTE ITEM
    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetPlaButtonsInfo(result[0].FabID, SuccesCallbackPlaButtonsInfo, ErrorHandler, TimeOutHandler);
    }
}

// SET DESIGN BASEHEM INFO DETAILS INTO REVIEW
function SuccesCallbackPlaButtonsInfo(result, eventArgs) {
    if (result.length > 0) {
        var d = document.getElementById('knopen');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("knoop_" + result[0].FabID))
            $get("knoop_" + result[0].FabID).className = 'highlight';
    }
}


//RETURN GetDesignBasehem
function SuccesCallbackDesignBasehem(result, eventArgs) {
    var d = document.getElementById('basehemPicker');
    d.innerHTML = "";

    var index = 0;
    var oTbl = document.createElement("Table");
    for (i = 0; i < 40; i++) {
        if (result.length > i) {
            var oTR = oTbl.insertRow(i);
            for (j = 0; j < 4; j++) {
                var oTD = oTR.insertCell(j);
                oTD.width = "100";
                if (result.length > 0) {
                    if (result.length > index) {
                        if (index < 1) {
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                //oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='highlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />     <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'> " + result[index].FabInfoIcon + " </span><span class='bottom'></span></span></a>         </div><div class='tail_text'>" + result[index].FabName + "</div>";
                                oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='highlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />           </div><div class='tail_text'>" + result[index].FabName + "</div>";

                            }
                            else {
                                oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='highlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />           </div><div class='tail_text'>" + result[index].FabName + "</div>";
                            }
                        }
                        else {
                            var CID = getQueryVariable('CID');
                            //TCHIBO EXCEPTION
                            if (CID != 36 && CID != 37 && CID != 50) {
                                //oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='Nohighlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />    <a class='tt' href='#'><img  src='img/information.png' class='information' alt='collar' /><span class='tooltip'><span class='top'></span><span class='middle'> " + result[index].FabInfoIcon + " </span><span class='bottom'></span></span></a>      </div><div class='tail_text'>" + result[index].FabName + "</div>";
                                oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='Nohighlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />         </div><div class='tail_text'>" + result[index].FabName + "</div>";
                            }
                            else {
                                oTD.innerHTML = "<div class='tail'><img onclick='GetDesignBasehemInfo(" + result[index].FabID + ");showbas(" + result[index].MTMID + ");' class='Nohighlight' id='fabhem" + result[index].FabID + "' src='ren2/SOI_" + result[index].MTMID + ".jpg' />         </div><div class='tail_text'>" + result[index].FabName + "</div>";
                            }
                        }
                    }
                }
                index++;
            }
        }
    }


    d.appendChild(oTbl);

    //PLAATS BLAUWE KADER ROND EERSTE ITEM
    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetDesignBasehemInfo(result[0].FabID, SuccesCallbackDesignBasehemInfo, ErrorHandler, TimeOutHandler);
    }
}

// passes the evSuccesCallbackDesignCollarent callback function.  
function GetDesignBasehemInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetDesignBasehemInfo(i, SuccesCallbackDesignBasehemInfo, ErrorHandler, TimeOutHandler);
}


// SET DESIGN BASEHEM INFO DETAILS INTO REVIEW
function SuccesCallbackDesignBasehemInfo(result, eventArgs) {

    ///////////if (!getQueryVariable('SELID')) 
    {
        var d = document.getElementById('basehemPicker');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("fabhem" + result[0].FabID))
            $get("fabhem" + result[0].FabID).className = 'highlight';

        //SET REVIEW BASE HEM
        if (result[0].B2C_price != 0) {
            var CID = getQueryVariable('CID');
            //TCHIBO EXCEPTION
            if (CID != 36 && CID != 37) {
                ChangeText('rev9', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
            }
            else if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('rev9', result[0].FabName + '  (£' + result[0].B2C_price + ')');
            }
            else {
                ChangeText('rev9', result[0].FabName + '  (' + result[0].B2C_price + ' €)');
            }
        }
        else {
            ChangeText('rev9', result[0].FabName);
        }
    }

    $get("bashid").value = result[0].MTMID;

}


// BUILD OPTION CONTRASTING FABS
function SuccesCallbackContrastFabrics(result, eventArgs) {

    // alert('ok: ' + result.length);

    var d = document.getElementById('contrastPicker');
    d.innerHTML = "";
    var index = 0;
    var oTbl = document.createElement("Table");

    var CID = getQueryVariable('CID');
    for (i = 0; i < 40; i++) {
        if (result.length > i) {
            var oTR = oTbl.insertRow(i);
            var col = 5;
            if (CID == 50 || CID == 53 || CID == 54) {
                col = 4;
            }
            for (j = 0; j < col; j++) {

                var oTD = oTR.insertCell(j);
                oTD.width = "102";
                if (result.length > 0) {
                    if (result.length > index) {
                        if (index < 1) {

                            if (CID == 50 || CID == 53 || CID == 54) {
                                oTD.innerHTML = "<div class='fabric_preview'><img onclick=GetFabricContrastInfo(0); id='fabcon0' src='Images/0_ms.png'  alt='0' title='0' class='stofsel' rel='00000' /></div>";
                            }
                            else if (CID == 65 || CID == 66) {
                                oTD.innerHTML = "<div class='fabric_preview'><img onclick=GetFabricContrastInfo(0); id='fabcon0' src='Images/0_baur.png'  alt='0' title='0' class='stofsel' rel='00000' /></div>";
                            }
                            else {
                                oTD.innerHTML = "<div class='fabric_preview'><img onclick=GetFabricContrastInfo(0); id='fabcon0' src='Images/0.png'  alt='0' title='0' class='stofsel' rel='00000' /></div>";
                            }
                        }
                        else {
                            oTD.innerHTML = "<div class='fabric_preview'><img onclick='GetFabricContrastInfo(" + result[index].FabID + ");' id='fabcon" + result[index].FabID + "' src='Images/" + result[index].FabIMG + "'  alt='" + result[index].FabName + "' title='" + result[index].FabName + "' class='stof' rel='" + result[index].FabIMG.substring(0, 5) + "' /></div>";
                        }
                    }
                }
                index++;
            }
        }
    }

    d.appendChild(oTbl);

    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetFabricContrastInfo(0, SuccesCallback3, ErrorHandler, TimeOutHandler);
    }
}

// RETURN GetFabricContrastInfo
function SuccesCallback3(result, eventArgs) 
{


    $get("hidPAT").value = result[0].PAT;
    
    var d = document.getElementById('contrastPicker');
    var el = getElementsByClassName('stofsel', d);
    if (el) {
        el.className = 'stof';
    }
    $get("fabcon" + result[0].FabID).className = 'stofsel';

    $get("conhid").value = result[0].FabIMG.substring(0, 5);

    //RULES OUTER PLACKET, FABRIC DESIGN PATTERN////////////////////////////////
    placketextraCONrule();
    ///////////////////////////////////////////////////////////////////////////


    //get current highlighted icon (imgContrast_active) binnen ctl00_cph1_ctrlCONF_design_ctrlCONF_design_contrasting_design1

    var ac = document.getElementById('hidconactive').value;
    //alert('ac: ' + ac);
    if (result[0].FabID == 0) {
        GetPriceInfoExtra(ac, 0);
        showcon(ac);
    }
    else if (ac != "") {
        //alert('ac[' + ac + ']');
        GetPriceInfoExtra(ac, 1);
        showcon(ac);
    }

    //RULE 28/11/2011 C162 extern placket contrast choice not possible if C54 is already chosen
    var hideo54 = "";
    if (document.getElementById('hideo54'))
    hideo54 = document.getElementById('hideo54').value;

    if (hideo54 == 1) 
    {
        deactivate('162', 1);
    }

}

// This function calls the Web service method and 
// passes the event callback function.  
function GetFabricContrastInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetFabricContrastInfo(i, SuccesCallback3, ErrorHandler, TimeOutHandler);
}


//STARTUP FUNCTION
function GetFabrics() {
    //CID
    var CID = getQueryVariable('CID');
    if (document.getElementById("selcollection")) {
        var selcollection = document.getElementById("selcollection");
        var collection = selcollection.options[selcollection.selectedIndex].value;
    }
    else {
        var collection = 0;
    }
    if (document.getElementById("selcolour")) {
        var selcolour = document.getElementById("selcolour");
        var colour = selcolour.options[selcolour.selectedIndex].value;
    }
    else {
        var colour = 0;
    }
    if (document.getElementById("seldesign")) {
        var seldesign = document.getElementById("seldesign");
        var design = seldesign.options[seldesign.selectedIndex].value;
    }
    else {
        var design = 0;
    }
    if (document.getElementById("selfinishing")) {
        var selfinishing = document.getElementById("selfinishing");
        var finish = selfinishing.options[selfinishing.selectedIndex].value;
    }
    else {
        var finish = 0;
    }

    if (document.getElementById("selmaterial")) {
        var selmaterial = document.getElementById("selmaterial");
        var material = selmaterial.options[selmaterial.selectedIndex].value;
    }
    else {
        var material = 0;
    }

    if (document.getElementById("selstructure")) {
        var selstructure = document.getElementById("selstructure");
        var structure = selstructure.options[selstructure.selectedIndex].value;
    }
    else {
        var structure = 0;
    }
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetFabrics(CID, collection, colour, design, finish, material, structure, SuccesCallback, ErrorHandler, TimeOutHandler);
}


//RETURN FROM GetFabrics
function SuccesCallback(result, eventArgs) {
    var d = document.getElementById('fabricPicker');
    d.innerHTML = "";

    var index = 0;
    var oTbl = document.createElement("Table");
    for (i = 0; i < 40; i++) {
        if (result.length > i) {
            var oTR = oTbl.insertRow(i);
            var CID = getQueryVariable('CID');
            if (CID == 50 || CID == 53 || CID == 54)
                var numbercol = 4;
            else
                var numbercol = 5;
            for (j = 0; j < numbercol; j++) {
                var oTD = oTR.insertCell(j);
                oTD.width = "102";
                if (result.length > 0) {
                    if (result.length > index) {
                        if (index < 1) {
                            oTD.innerHTML = "<div class='fabric_preview'><img onclick='GetFabricInfo(" + result[index].FabID + ");cfab(" + result[index].FabIMG.substring(0, 5) + ");' id='fab" + result[index].FabID + "' src='Images/" + result[index].FabIMG + "' data-magnifysrc='Images/kendwa_big.jpg'    alt='" + result[index].FabName + "' title='" + result[index].FabName + "' class='stofsel' /></div>";
                        }
                        else {
                            oTD.innerHTML = "<div class='fabric_preview'><img onclick='GetFabricInfo(" + result[index].FabID + ");cfab(" + result[index].FabIMG.substring(0, 5) + ");' id='fab" + result[index].FabID + "' src='Images/" + result[index].FabIMG + "' data-magnifysrc='Images/kendwa_big.jpg'  alt='" + result[index].FabName + "' title='" + result[index].FabName + "' class='stof'  /></div>";
                        }
                    }
                }
                index++;
            }
        }
    }

    d.appendChild(oTbl);

    //eerste keer fabrics gezet + hidden field gevuld voor eerste stoffentoon
    if (result.length > 0) {
        Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
        Samples.AspNet.WebService.GetFabricInfo(result[0].FabID, SuccesCallback2, ErrorHandler, TimeOutHandler);

        GetMONcolsqdefaultfab(result[0].FabIMG.substring(0, 5));
    }
}




// passes the event callback function.  
function CreateXmlDocument() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.CreateXmlDocument();
}

function CreateXmlSaveconfpage() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.CreateXmlSave();
}

function CreateXmlSave(pvid) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.CreateXmlSave2(pvid);
}

function adbtn(conid, str) {

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertPlacketButtons(conid, str);
}


function adsti(conid, str) {

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertStitchButtons(conid, str);
}

function adtap(conid, str) {

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertTape(conid, str);
}

function setvalue(divid, txt) {
    var newdiv = document.createElement("div");
    newdiv.innerHTML = txt.toLocaleString();
    var container = document.getElementById(divid);
    container.appendChild(newdiv);
}






// passes the event callback function.  
function GetFabricInfo(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetFabricInfo(i, SuccesCallback2, ErrorHandler, TimeOutHandler);
}

// SET DESIGN COLLAR INFO DETAILS INTO REVIEW
function SuccesCallbackDesignCollarInfo(result, eventArgs) {
    //not for gallery
    //////if (!getQueryVariable('SELID')) 
    {
        var d = document.getElementById('collarCollection');
        var el = getElementsByClassName('highlight', d);
        if (el) {
            el.className = '';
        }
        if ($get("fabcol" + result[0].FabID))
            $get("fabcol" + result[0].FabID).className = 'highlight';

        //SET REVIEW COLLAR
        if (result[0].B2C_price != 0) {
            ChangeText('rev2', result[0].FabName + '  (' + result[0].B2C_price + ' €/£)');
        }
        else {
            ChangeText('rev2', result[0].FabName);
        }
    }

    //SET HIDFAB
    $get("colhid").value = '' + result[0].MTMID;

    if ($get("yesmon")) {
        //if ($get("yesmon").checked && !getQueryVariable('SELID')) {
        if ($get("yesmon").checked) {
            GenerateMonogram2();
        }
    }

    //CHANGE PRICE
    //GetPriceInfo();
    //JSPrice();


}

function setextrapricesizing1(id) {

}

function setextrapricesizing2(id) {

}


// SET FABRIC INFO DETAILS
function SuccesCallback2(result, eventArgs) {

    $get("hidPATFAB").value = result[0].PATFAB;
    
    if (result.length > 0) {
        var id = result[0].FabIMG.substring(0, result[0].FabIMG.lastIndexOf("."));
        if (id.length == 4) {
            id = "1" + id;
        }

        if ($get("confExtraBoxConLeft")) {
            $get("confExtraBoxConLeft").src = "ren6/men_boxer_p14_C59_c1_1_" + id + ".png";
        }
        if ($get("confExtraBoxConRight")) {
            $get("confExtraBoxConRight").src = "ren6/men_boxer_p14_C59_c1_2_" + id + ".png";
        }
        if ($get("confExtraBoxFabLeft")) {
            $get("confExtraBoxFabLeft").src = "ren6/men_boxer_p14_1_" + id + ".png";
        }
        if ($get("confExtraBoxFabRight")) {
            $get("confExtraBoxFabRight").src = "ren6/men_boxer_p14_2_" + id + ".png";
        }
        /* -> 4 pieces ^
        if ($get("confExtraBoxImg")) {
        $get("confExtraBoxImg").src = "./ren6/men_boxer_p14_1" + result[0].FabIMG.substring(0, result[0].FabIMG.lastIndexOf(".")) + ".png";
        }
        */
        if ($get("confExtraTieImg")) {
            $get("confExtraTieImg").src = "./ren7/men_tiefixer_p14_" + id + ".png";
        }
        if ($get("confExtraChiefImg")) {
            $get("confExtraChiefImg").src = "./ren7/men_pochette_p14_" + id + ".png";
        }

        var d = document.getElementById('fabricPicker');
        var el = getElementsByClassName('stofsel', d);
        if (el) {
            el.className = 'stof';
        }
        if ($get("fab" + result[0].FabID))
            $get("fab" + result[0].FabID).className = 'stofsel';
        //////////////////////////////////////////////////////////////////////


        ////////////////////EO PLACKET///////////////////////
        var hideo171 = document.getElementById('hideo171').value;
        if (hideo171 == 1) {
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }
        var hideo172 = document.getElementById('hideo172').value;
        if (hideo172 == 1) {
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
        }
        var hidPAT = document.getElementById('hidPATFAB').value;
        var plahid = document.getElementById('plahid').value;
        if (plahid != 50002) { //hide 167/169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }
        else if (hidPAT == 3 || hidPAT == 13 || hidPAT == 14 || hidPAT == 16 || hidPAT == 19 || hidPAT == 20 || hidPAT == 22 || hidPAT == 23 || hidPAT == 26 || hidPAT == 33 || hidPAT == 34 || hidPAT == 35 || hidPAT == 40 || hidPAT == 43 || hidPAT == 44 || hidPAT == 45) {
        //LINES = 3 => show 167/169
            //do nothing
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = false;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = false;
            }
        } else if (hidPAT == 2 || hidPAT == 12 || hidPAT == 39 || hidPAT == 41 || hidPAT == 42) {
        //CHECKS = 2 => show 167, hide 169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = false;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        } else {//UNI = 1/8/11 => hide 167/169
            if ($get("171")) {
                $get("171").checked = false;
                $get("171").disabled = true;
            }
            if ($get("172")) {
                $get("172").checked = false;
                $get("172").disabled = true;
            }
        }   //////////////////////////////////////
        
        /////////////////////////////////////////////////////////////
        if ($get("dry")) {
            //fabric_zoom

            if ($get("fabric_zoom")) {
                $get("fabric_zoom").src = "img/" + result[0].ZOOM + ".png";
            }
            
            $get("dry").src = "img/dry" + result[0].CaredryID + ".jpg";
            $get("wash").src = "img/wash" + result[0].CarewashID + ".jpg";
            $get("iron").src = "img/irn" + result[0].CareironID + ".jpg";
            
            //M&S Fabric info alt texts//
            var CID = getQueryVariable('CID');
            if (CID == 50 || CID == 53 || CID == 54) {
                $get("dry").alt = "Tumble Dry. LOW HEAT";
                $get("dry").title = "Tumble Dry. LOW HEAT";
                $get("wash").alt = "Machine Wash. WARM";
                $get("wash").title = "Machine Wash. WARM";
                if (result[0].CareironID == '1') {
                    $get("iron").alt = "Iron, Steam or Dry. with LOW HEAT";
                    $get("iron").title = "Iron, Steam or Dry. with LOW HEAT";
                }
                else {
                    $get("iron").alt = "Iron, Steam or Dry. with MEDIUM HEAT";
                    $get("iron").title = "Iron, Steam or Dry. with MEDIUM HEAT";
                }
            }
            ///////////////////////////////

            if (result[0].WeightCM < 50) {
                $get("weight1").src = "img/gram0.jpg";
                $get("weight2").src = "img/gram0.jpg";
            }
            else if (result[0].WeightCM < 75) {
                $get("weight1").src = "img/gram1.jpg";
                $get("weight2").src = "img/gram1.jpg";
            }
            else if (result[0].WeightCM < 100) {
                $get("weight1").src = "img/gram2.jpg";
                $get("weight2").src = "img/gram2.jpg";
            }
            else if (result[0].WeightCM < 125) {
                $get("weight1").src = "img/gram3.jpg";
                $get("weight2").src = "img/gram3.jpg";
            }
            else if (result[0].WeightCM < 150) {
                $get("weight1").src = "img/gram4.jpg";
                $get("weight2").src = "img/gram4.jpg";
            }
            else {
                $get("weight1").src = "img/gram5.jpg";
                $get("weight2").src = "img/gram5.jpg";
            }

            if (result[0].WWCM1 < 25) {
                $get("WW1").src = "img/thread0.jpg";
                $get("WW2").src = "img/thread0.jpg";
            }
            else if (result[0].WWCM1 < 50) {
                $get("WW1").src = "img/thread1.jpg";
                $get("WW2").src = "img/thread1.jpg";
            }
            else if (result[0].WWCM1 < 75) {
                $get("WW1").src = "img/thread2.jpg";
                $get("WW2").src = "img/thread2.jpg";
            }
            else if (result[0].WWCM1 < 100) {
                $get("WW1").src = "img/thread3.jpg";
                $get("WW2").src = "img/thread3.jpg";
            }
            else if (result[0].WWCM1 < 125) {
                $get("WW1").src = "img/thread4.jpg";
                $get("WW2").src = "img/thread4.jpg";
            }
            else {
                $get("WW1").src = "img/thread5.jpg";
                $get("WW2").src = "img/thread5.jpg";
            }
        }

        // var s = "foo"; 
        // alert(s.indexOf("oo") != -1);

        if ($get("ColFab")) {
            if (result[0].Collection.indexOf("Clearance") != -1 || result[0].Collection.indexOf("clearance") != -1 || result[0].Collection.indexOf("Sale") != -1 || result[0].Collection.indexOf("Soldes") != -1) {
                $get("ColFab").className = 'firstLineFabricDetailsRED';
            }
            else {
                $get("ColFab").className = 'firstLineFabricDetails';
            }


            var CID = getQueryVariable('CID');
            if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('ColFab', '' + result[0].Collection + ' ' + result[0].FabName);
            }
            else {
                ChangeText('ColFab', result[0].Collection + ' ' + result[0].FabName);
            }
            //FABNAME + 'is a' + FINISH + ', '+ MATERIAL + 'fabric from the ' + COLLECTION. This ' + DESIGN + ' ' +  STRUCTURE + 'fabric has a ' + COLOUR

            var g = document.getElementById('langhid').value;
            var affvar = gup('affid');

            //alert(g + ' | ' + affvar + ' | ' + document.URL.toLowerCase().indexOf('deben'));

            if (g == 1 || document.URL.toLowerCase().indexOf('10004') != -1 || document.URL.toLowerCase().indexOf('10006') != -1) {

                ChangeText('FabDet', result[0].FabName + ' is a ' + result[0].Finishing + ', ' + result[0].Material + ' fabric from the ' + result[0].Collection + ' collection. This ' + result[0].Design + ' ' + result[0].Structure + ' fabric has a ' + result[0].Colour + ' colour.');
            }
            else if (g == 2) {

                ChangeText('FabDet', result[0].FabName + ' is een ' + result[0].Finishing + ', ' + result[0].Material + ' stof van de ' + result[0].Collection + ' collectie. Deze ' + result[0].Design + ' ' + result[0].Structure + ' stof heeft als kleur ' + result[0].Colour + '.');
            }
            else if (g == 3 || document.URL.toLowerCase().indexOf('10005') != -1) {

                ChangeText('FabDet', result[0].FabName + ' est un tissu ' + result[0].Finishing + ', ' + result[0].Material + ' de la collection ' + result[0].Collection + '. Ce tissu ' + result[0].Design + ' ' + result[0].Structure + ' est de couleur ' + result[0].Colour + '.');
            }
            else if (g == 4) {

                ChangeText('FabDet', result[0].FabName + ' ist ein ' + result[0].Finishing + ', ' + result[0].Material + ' Stoff aus der ' + result[0].Collection + '-Kollektion. Der ' + result[0].Design + ' ' + result[0].Structure + ' Stoff ist ' + result[0].Colour + '.');
            }
            else if (g == 5) {
                ChangeText('FabDet', result[0].FabName + ' es un ' + result[0].Finishing + ', tejido de ' + result[0].Material + ' de la colección ' + result[0].Collection + '. Este tejido ' + result[0].Design + ' de ' + result[0].Structure + ' es de color ' + result[0].Colour + '.');
            }
            else {

                ChangeText('FabDet', result[0].FabName + ' is a ' + result[0].Finishing + ', ' + result[0].Material + ' fabric from the ' + result[0].Collection + ' collection. This ' + result[0].Design + ' ' + result[0].Structure + ' fabric has a ' + result[0].Colour + ' colour.');
            }


            //WWCMinfo
            ChangeText('WWCMinfo', result[0].WWCM1 + ' / ' + result[0].WWCM2 + ' * ' + result[0].WWCM3 + ' / ' + result[0].WWCM4);
            //WWCMinfo
            ChangeText('WeightCMinfo', result[0].WeightCM + ' g/m<sup>2</sup>');
            //WWCMinfo
            ChangeText('WWINCHinfo', result[0].WWINCH1 + ' / ' + result[0].WWINCH3);
            //WWCMinfo
            ChangeText('WeightINCHinfo', result[0].WeightINCH + ' inch');

            var CID = getQueryVariable('CID');
            //TCHIBO EXCEPTION
            if (CID != 36 && CID != 37 && CID != 50 && CID != 53 && CID != 54 && CID != 42 && CID != 56 && CID != 59 && CID != 60 && CID != 65  && CID != 67 && CID != 68 && CID != 69) {
                //FILL ReviewFabIMG
                ChangeText('rev1', result[0].FabName + ' <br /> ' + result[0].Collection + ' (' + result[0].B2C_price + ' €/£)<br> ' + result[0].Finishing + ' <br> ' + result[0].Material + ' <br> ' + result[0].Design + ' <br> ' + result[0].Structure + ' <br> ' + result[0].Colour);
            }
            else if (CID == 50 || CID == 53 || CID == 54) {
                ChangeText('rev1', result[0].FabName + ' <br /> ' + result[0].Collection + ' (£' + result[0].B2C_price + ')<br> ' + result[0].Finishing + ' <br> ' + result[0].Material + ' <br> ' + result[0].Design + ' <br> ' + result[0].Structure + ' <br> ' + result[0].Colour);
            }
            else {
                ChangeText('rev1', result[0].FabName + ' <br /> ' + result[0].Collection + ' (' + result[0].B2C_price + ' €)<br> ' + result[0].Finishing + ' <br> ' + result[0].Material + ' <br> ' + result[0].Design + ' <br> ' + result[0].Structure + ' <br> ' + result[0].Colour);
            }
            //4324.jpg
            if (result[0].FabIMG.length == 8) {
                $get("rev_fabimg").src = 'Images/1' + result[0].FabIMG.substring(0);
                $get("rev_fabimg2").src = 'Images/1' + result[0].FabIMG.substring(0);
            }
            else {
                $get("rev_fabimg").src = 'Images/' + result[0].FabIMG.substring(0);
                $get("rev_fabimg2").src = 'Images/' + result[0].FabIMG.substring(0);
            }
        }

        //first karakter from fabIMG check
        //alert('len[' + result[0].FabIMG.length + ']');
        //alert('img[' + result[0].FabIMG + ']');

        //4324.jpg
        if (result[0].FabIMG.length == 8) {
            //set hidfab
            $get("fabhid").value = '1' + result[0].FabIMG.substring(0, 4);
            //alert('fabhid value1: ' + $get("fabhid").value);
        }
        else {
            $get("fabhid").value = '' + result[0].FabIMG.substring(0, 5);
            //alert('fabhid value2: ' + $get("fabhid").value);
        }


    }
}

function toggleClassname(el1, el2) {
    //alert("toggle js");
    //don't forget runat=server
    var ClassnameHidden = 'RowHidden';
    var ClassnameShown = 'RowShown';

    var elmetric1 = document.getElementById(el1);
    var elmetric2 = document.getElementById(el2);

    if (elmetric1.style.display != 'none') {
        elmetric1.style.display = 'none';
        elmetric2.style.display = 'block';
    }
    else if (elmetric2.style.display != 'none') {
        elmetric1.style.display = 'block';
        elmetric2.style.display = 'none';
    }
    return false;
}

function ChangeText(field, val) {
    if ($get(field))
        $get(field).innerHTML = val;
}



function getElementsByClassName(classname, node) {
    if (!node) node = document.getElementsByTagName("body")[0];
    var a;
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for (var i = 0, j = els.length; i < j; i++)
        if (re.test(els[i].className))
        a = (els[i]);
    return a;
}

// This is the callback function invoked if the Web service succeeded.
// It accepts the result object as a parameter.
function SucceededCallback(result, eventArgs) {
    $get("fabtest").src = result;
}

// This is the callback function invoked if the Web service failed.
// It accepts the error object as a parameter.
function FailedCallback(error) {
    // Display the error.    
    var RsltElem = document.getElementById("ResultId");
    RsltElem.innerHTML = "Service Error: " + error.get_message();
}

function TimeOutHandler(result) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertJSERROR(result);
}
function TimeOutHandler1(result) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertJSERROR(result);
}

function ErrorHandler(result) {

    var msg = result.get_exceptionType() + "\r\n";
    msg += result.get_message() + "\r\n";
    msg += result.get_stackTrace();

    //alert("l5585: " + msg); 

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.InsertJSERROR(msg);
}

///////////////////////////////////////////////
///////////////////////////////////////////////
///////////////////////////////////////////////

function FillCollectionDDL(result) {
    if (document.getElementById("selcollection")) {
        var select = document.getElementById("selcollection");
        for (var i = 0; i < result.length; i++) {
            var option = new Option(result[i].Name, result[i].ID);
            select.options.add(option);
        }
    }
}

function FillColourDDL(result) {
    if (document.getElementById("selcolour")) {
        var select = document.getElementById("selcolour");
        for (var i = 0; i < result.length; i++) {
            var option = new Option(result[i].Name, result[i].ID);
            select.options.add(option);
        }
    }
}

function FillDesignDDL(result) {
    if (document.getElementById("seldesign")) {
        var select = document.getElementById("seldesign");
        for (var i = 0; i < result.length; i++) {
            var affvar = gup('affid');
            if ((affvar == '10008') && (result[i].ID != '8')) {
                //alert('[-' + result[i].Name + '- en -' + result[i].ID + '-]');
                var option = new Option(result[i].Name, result[i].ID);
                select.options.add(option);
            }
            else if (affvar != '10008') {
                //alert('[-' + result[i].Name + '* en *' + result[i].ID + '-]');
                var option = new Option(result[i].Name, result[i].ID);
                select.options.add(option);
            }
        }
    }
}

function FillStructureDDL(result) {
    if (document.getElementById("selstructure")) {
        var select = document.getElementById("selstructure");
        for (var i = 0; i < result.length; i++) {
            var option = new Option(result[i].Name, result[i].ID);
            select.options.add(option);
        }
    }
}

function FillFinishingDDL(result) {
    if (document.getElementById("selfinishing")) {
        var select = document.getElementById("selfinishing");
        for (var i = 0; i < result.length; i++) {
            var option = new Option(result[i].Name, result[i].ID);
            select.options.add(option);
        }
    }
}

function FillMaterialDDL(result) {
    if (document.getElementById("selmaterial")) {
        var select = document.getElementById("selmaterial");
        for (var i = 0; i < result.length; i++) {
            var option = new Option(result[i].Name, result[i].ID);
            select.options.add(option);
        }
    }
}

// SET DESIGN PLACKET INFO DETAILS INTO REVIEW
function gatherxml() {

    if ($get("yesmon")) {
        //if JA
        if ($get("yesmon").checked) {
            //Get highlighted FONT
            var d = document.getElementById('monogramFont2');
            var el = getElementsByClassName('highlight', d);
            if (el) {
                //SetParam('alg_monogramfont', el.id.substring(4) + '');
                var alg_monogramfont = el.id.substring(4) + '';
                ob_post.AddParam('alg_monogramfont', alg_monogramfont);

                //SetParam('extra_monogramfont', el.defaultValue + '');
                var extra_monogramfont = el.defaultValue + '';
                ob_post.AddParam('extra_monogramfont', extra_monogramfont);
            }

            //Get highlighted COLOR
            var d2 = document.getElementById('allCollors1');
            var el2 = getElementsByClassName('collorssel', d2);
            if (el2) {
                //SetParam('alg_monogramcolor', el2.id.substring(5));
                var alg_monogramcolor = el2.id.substring(5) + '';
                ob_post.AddParam('alg_monogramcolor', alg_monogramcolor);
            }

            //Get highlighted PLACE
            var d3 = document.getElementById('postionMonogram');
            var el3 = getElementsByClassName('highlight', d3);
            if (el3) {
                //SetParam('alg_monogramplace', el3.id.substring(4));
                var alg_monogramplace = el3.id.substring(4) + '';
                ob_post.AddParam('alg_monogramplace', alg_monogramplace);
            }

            //Get highlighted TEXT
            var d4 = document.getElementById('inputtxt2');
            //SetParam('alg_monogram', d4.value);
            var alg_monogram = d4.value + ' ';
            ob_post.AddParam('alg_monogram', alg_monogram);
        }
    }

    //FIT
    var fit = document.getElementById('fithid').value;
    //SetParam("alg_fit", fit);
    ob_post.AddParam('alg_fit', fit);
    
    var cidvar = gup('CID');
    if (fit == '8018010') {
        var fixfit = "8010001";
        ob_post.AddParam('alg_twobackfitseams', fixfit);
    }

    
    if (cidvar != '50' && cidvar != '53' && cidvar != '54') {
        //SQUIRREL//////////////////////
        //Get SQUIRREL COLOR for XML
        var d2 = document.getElementById('allCollors2');
        var el2 = getElementsByClassName('collorssel', d2);
        if (el2) {
            //SetParam('alg_squirrelcolor', '140' + el2.id.substring(7));
            ob_post.AddParam('alg_squirrelcolor', '140' + el2.id.substring(7));
        }

        //Get SQUIRREL PROD for XML
        var d2 = document.getElementById('allCollors2');
        var el2 = getElementsByClassName('collorssel', d2);
        if (el2) {
            //SetParam('alg_squirrelcolor_prod', el2.getAttribute('alt'));
            ob_post.AddParam('alg_squirrelcolor_prod', el2.getAttribute('alt'));
        }

        //Get SQUIRREL POSITION for XML
        var d2 = document.getElementById('postionMonogram2');
        var el2 = getElementsByClassName('highlight', d2);
        if (el2) {
            //SetParam('alg_squirrelplace', '130' + el2.id.substring(8));
            ob_post.AddParam('alg_squirrelplace', '130' + el2.id.substring(8));
        }
        //////////////////////////////////
    }

    //Get alg_cufflinks for XML
    var d2 = document.getElementById('allCollors2');
    var el2 = getElementsByClassName('collorssel', d2);
    if (el2) {

        var hidsleeveshort = document.getElementById('hidsleeveshort').value;
        if (hidsleeveshort != 1) {
            var e = document.getElementById('cufhid').value;
            if (e == 30003 || e == 30015 || e == 30013 || e == 30027 || e == 30031 || e == 30032) {
                //4031821
                //SetParam('alg_cufflinks', '403' + el2.getAttribute('rel'));
                ob_post.AddParam('alg_cufflinks', '403' + el2.getAttribute('rel'));
            }
        }

    }

    //Get tape color
    var eltaphid = document.getElementById('taphid');
    if (eltaphid) {
        //SetParam('extra_taphid', eltaphid.value);
        ob_post.AddParam('extra_taphid', eltaphid.value);
    }

    //SET knopen
    var d2 = document.getElementById('knopen');
    var elknoop = getElementsByClassName('highlight', d2);
    if (elknoop) {
        //SetParam('extra_knoop', elknoop.alt);
        ob_post.AddParam('extra_knoop', elknoop.alt);
        //SetParam('alg_button_colour', elknoop.id.substring(6));
        ob_post.AddParam('alg_button_colour', elknoop.id.substring(6));
    }


    //SET stitch
    //knoopsgaten
    var d222 = document.getElementById('knoopsgaten');
    var elknoopsgat = getElementsByClassName('highlight', d222);
    if (elknoopsgat) {
        //SetParam('extra_knoopsgat', elknoopsgat.alt);
        ob_post.AddParam('extra_knoopsgat', elknoopsgat.alt);
        //SetParam('alg_button_yarncolour', elknoopsgat.id.substring(10));
        ob_post.AddParam('alg_button_yarncolour', elknoopsgat.id.substring(10));
    }

    //POC
    var poc = document.getElementById('pochid').value;
    if (poc == '70099') 
    {
        var fixpoc = "80002";
        ob_post.AddParam('alg_twopockets', fixpoc);
    }
    //SetParam("alg_fit", fit);
    //ob_post.AddParam('alg_poc', poc.replace("99", "04"));
    //ob_post.post(null, "gatherxml", ResultComputeAge);
    //ob_post.post("Confpage.aspx", "gatherxml");
    //ob_post.post(null, "gatherxml");

    try {
        ob_post.post(null, "gatherxml");
    }
    catch (ex) {
        //alert("bert: " + ex);
    }

}



//one new shirts are created with gallery wizard
function gatherxmlGAL() {
    //FIT
    var fit = document.getElementById('fithid').value;
    ob_post.AddParam('alg_fit', fit);

    if (fit == '8018010') {
        var fixfit = "8010001";
        ob_post.AddParam('alg_twobackfitseams', fixfit);
    }




    //Get SQUIRREL COLOR for XML
    //    var d2 = document.getElementById('allCollors2');
    //    var el2 = getElementsByClassName('collorssel', d2);
    //    if (el2) {
    //        ob_post.AddParam('alg_squirrelcolor', '140' + el2.id.substring(7));
    //    }

    //Get SQUIRREL PROD for XML
    //    var d2 = document.getElementById('allCollors2');
    //    var el2 = getElementsByClassName('collorssel', d2);
    //    if (el2) {
    //        ob_post.AddParam('alg_squirrelcolor_prod', el2.getAttribute('alt'));
    //        var el2 = document.getElementById('sq14hid').value;
    //        ob_post.AddParam('alg_squirrelcolor_prod', el2);

    //        var hidsleeveshort = document.getElementById('hidsleeveshort').value;
    //        if (hidsleeveshort != 1) {
    //            var e = document.getElementById('cufhid').value;
    //            if (e == 30003 || e == 30015 || e == 30013 || e == 30027 || e == 30031 || e == 30032) {
    //                ob_post.AddParam('alg_cufflinks', '403' + el2.getAttribute('rel'));
    //            }
    //        }
    //    }

    //$get("sq13hid").value = '130038';
    //$get("sq14hid").value = '140002';
    var d2 = document.getElementById('sq14hid').value.substring(2);
    ob_post.AddParam('alg_squirrelcolor', '140' + d2);



    //ALWAYS POCKET 130038
    ob_post.AddParam('alg_squirrelplace', '1300038');
    //Get SQUIRREL POSITION for XML
    //    var d2 = document.getElementById('postionMonogram2');
    //    var el2 = getElementsByClassName('highlight', d2);
    //    if (el2) {
    //        //ob_post.AddParam('alg_squirrelplace', '130' + el2.id.substring(8));
    //        var el2 = document.getElementById('sq14hid').value;
    //        ob_post.AddParam('alg_squirrelplace', el2);
    //    }

    //Get tape color
    var eltaphid = document.getElementById('taphid');
    if (eltaphid) {
        ob_post.AddParam('extra_taphid', eltaphid.value);
    }

    //SET knopen
    var d2 = document.getElementById('knopen');
    var elknoop = getElementsByClassName('highlight', d2);
    if (elknoop) {
        ob_post.AddParam('extra_knoop', elknoop.alt);
        ob_post.AddParam('alg_button_colour', elknoop.id.substring(6));
    }


    //SET stitch
    //knoopsgaten
    var d222 = document.getElementById('knoopsgaten');
    var elknoopsgat = getElementsByClassName('highlight', d222);
    if (elknoopsgat) {
        ob_post.AddParam('extra_knoopsgat', elknoopsgat.alt);
        ob_post.AddParam('alg_button_yarncolour', elknoopsgat.id.substring(10));
    }


    try {
        ob_post.post(null, "gatherxml");
    }
    catch (ex) {
        //alert("bertW: " + ex);
    }

    sleep(2000);
    return true;

}

function ResultComputeAge(result, ex) {

}


function deelNaTimeOut() {
    // doe nog meer dingen 
}



// passes the event callback function.
function SetParam(i, j) {


    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.SetParam(i, j);


}

// passes the event callback function.
function RemoveParam(i) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.RemoveParam(i);
}



//*********************TIES***********************

//GET TIES BY DEFINING THE PATTERN OR COLOUR
function GetByFilter(filter, language, label, instr) {


    //hide all filters

    /*   document.getElementById("Striped").style.display = 'none';
    document.getElementById("Plain").style.display = 'none';
    document.getElementById("Spotted").style.display = 'none';
    document.getElementById("Patterned").style.display = 'none';
    document.getElementById("Wedding").style.display = 'none';
    document.getElementById("Blue").style.display = 'none';
    document.getElementById("Red").style.display = 'none';
    document.getElementById("Green").style.display = 'none';
    document.getElementById("Orange").style.display = 'none';
    document.getElementById("Pink").style.display = 'none';
    document.getElementById("Black").style.display = 'none';
    document.getElementById("Grey").style.display = 'none';
    document.getElementById("Purple").style.display = 'none';
    */
    //UPDATE BREADCRUMBS
    var t = document.getElementById('title');
    var t2 = document.getElementById('imageTitle');
    var crumb2 = document.getElementById('breadCrumb2');
    var crumb3 = document.getElementById("breadCrumb3");
    var crumb4 = document.getElementById("breadCrumb4");
    var c3 = document.getElementById("breadCrumb3Container");
    var c4 = document.getElementById("breadCrumb4Container");

    if (filter == 'all') {
        c3.style.display = 'none';
        crumb2.removeAttribute('class');
        crumb2.className = "current";
        crumb2.setAttribute("class", "current");


    } else {
        c3.removeAttribute('style');
        crumb3.setAttribute('onclick', "GetByFilter('" + filter + "','" + language + "','" + label + "','" + instr + "')");
        crumb3.innerHTML = label.toUpperCase();
        crumb3.removeAttribute('class');
        crumb3.className = "current";
        crumb3.setAttribute("class", "current");
        crumb2.removeAttribute('class');
        crumb2.className = "notcurrent";
        crumb2.setAttribute("class", "notcurrent");
    }
    t.innerHTML = label.toUpperCase();
    t2.innerHTML = label.toUpperCase();

    c4.style.display = 'none';


    var instruction = document.getElementById("instructions");
    if (filter == 'all') {
        instruction.innerHTML = "<b>" + instr + "</b> " + document.getElementById("instructionsTemplate2").innerHTML;
    } else {
        instruction.innerHTML = "<b>" + instr + "</b> " + document.getElementById("instructionsTemplate2").innerHTML;
    }


    // UPDATE INSTRUCTIONS
    //  var instr = document.getElementById("instructions");
    //  instr.innerHTML = document.getElementById("instructionsTemplate").innerHTML + "<b>" +label.toLowerCase() + "</b> " + document.getElementById("instructionsTemplate2").innerHTML;

    // HIGHLIGHT FILTER
    var f1 = document.getElementById("filter1");
    var f2 = document.getElementById("filter2");

    if (filter == 'all') {
        document.getElementById(f1.innerHTML).className = "notCurrentFilter";
        document.getElementById(f2.innerHTML).className = "notCurrentFilter";
        f1.innerHTML = "all_ties";
        document.getElementById(f1.innerHTML).className = "currentFilter";

    } else {
        document.getElementById(f1.innerHTML).className = "notCurrentFilter";

        if (filter == 'Striped' || filter == 'Plain' || filter == 'Spotted' || filter == 'Patterned' || filter == 'Wedding') {
            document.getElementById(f2.innerHTML).className = "notCurrentFilter";
            f2.innerHTML = filter;
            document.getElementById(f2.innerHTML).className = "currentFilter";
            document.getElementById(f1.innerHTML).className = "notCurrentFilter";
            f1.innerHTML = "pattern02";
            document.getElementById(f1.innerHTML).className = "currentFilter";
        }

        else {
            document.getElementById(f2.innerHTML).className = "notCurrentFilter";
            f2.innerHTML = filter;
            document.getElementById(f2.innerHTML).className = "currentFilter";
            document.getElementById(f1.innerHTML).className = "notCurrentFilter";
            f1.innerHTML = "colour";
            document.getElementById(f1.innerHTML).className = "currentFilter";
        }
    }


    //SHOW TIES DIV
    document.getElementById("TieDetail").style.display = 'none';
    document.getElementById("TiePicker").removeAttribute('style');
    document.getElementById("page_continue").style.display = 'none';
    document.getElementById("page_up").removeAttribute('style');
    document.getElementById("page_continue").removeAttribute('style');

    //CALL WEBSERVICE METHOD
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetByFilter(filter, language, onRequestGetByFilterComplete, ErrorHandler, TimeOutHandler);
}

//DISPLAY THE RETRIEVED TIES IN A TABLE
function onRequestGetByFilterComplete(result, eventArgs) {

    var d = document.getElementById('TiePicker');
    d.innerHTML = "";

    var shoppingButton = document.getElementById('ShoppingcartLabel').innerHTML;
    var detailsButton = document.getElementById('DetailsLabel').innerHTML;

    var index = 0;
    var innerHtml = "";


    innerHtml = innerHtml + "<DIV id=RomeoStripes>";

    for (i = 0; i < 40; i++) {
        if (result.length > i) {

            innerHtml = innerHtml + "<tr>";
            for (j = 0; j < 4; j++) {
                if (j != 0) {

                }
                if (result.length > 0) {
                    if (result.length > index) {
                        innerHtml = innerHtml + "<DIV id=RomeoStripes01>";
                        var lang = "'" + document.getElementById('language').innerHTML + "'";
                        var buttDetails = "   onClick=\"showDetails(" + result[index].tieId + "," + lang + "," + "'" + result[index].Name + "'," + result[index].ColourId + ")\"";
                        var buttPurchase = "   onClick=\"addTieToBasket(" + result[index].tieId + "," + result[index].Price + ")\"";
                        innerHtml = innerHtml + "<p id='price'>" + document.getElementById("currency").innerHTML + " " + result[index].Price + "<span>" + result[index].Name.toString().toUpperCase() + "</span></p><div id='ties'><img   src=" + result[index].ImgSrcSmall + "></img></div><DIV id=button><DIV id=button01><a href=\"#\"  style=\"margin-left:10px;\"" + buttDetails + ">" + detailsButton + "</a></DIV><DIV id = button02><a href=\"#\" style=\"float:left;margin-left:10px;\"" + buttPurchase + ">" + shoppingButton + "</a></div></div></div>";
                        //innerHtml = innerHtml + "<p id='price'>" + document.getElementById("currency").innerHTML + " " + result[index].Price + "<span>" + result[index].Name.toString().toUpperCase() + "</span></p><div id='ties'><img   src=" + result[index].ImgSrcSmall + "></img></div><DIV id=button><DIV id=button01><a href=\"#\"  style=\"margin-left:10px;\"" + buttDetails + ">" + detailsButton + "</a></DIV></div></div>";

                    }
                }
                if (j != 0) {

                }
                index++;
            }


        }
    }

    innerHtml = innerHtml + "</div>";

    d.innerHTML = innerHtml;

}


//GET THE DETAILS OF THE SELECTED TIE
function showDetails(TieId, language, name, Colour) {



    // SHOW DETAILS DIV
    document.getElementById("TiePicker").style.display = 'none';
    document.getElementById("TieDetail").removeAttribute('style');

    //REMOVe FILTERHIGHLIGHTS
    var f1 = document.getElementById("filter1");
    var f2 = document.getElementById("filter2");

    document.getElementById(f1.innerHTML).className = "notCurrentFilter";
    document.getElementById(f2.innerHTML).className = "notCurrentFilter";

    //CALL WEBSERVICE METHOD
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.ShowDetails(TieId, language, onRequestShowDetailsComplete, ErrorHandler, TimeOutHandler);


}

//DISPLAY DETAILS OF THE TIE
function onRequestShowDetailsComplete(result, eventArgs) {

    try {
        if (result[0] == null) {
            alert("Item does not exist");

        }

        //SET PARAMETERS FOR SHARE BUTTON

        var shareDescription = result[0].Description;
        var t = document.getElementById('addTie2').innerHTML.toLowerCase();
        var shareTitle = result[0].Name + " " + t + " @ bivolino.com";

        var headID = document.getElementsByTagName("head")[0];

        var tit = document.createElement('meta');

        tit.name = "title";
        tit.content = shareTitle;

        var des = document.createElement('meta');
        des.name = "description";
        des.content = shareDescription;


        var img = document.createElement('link');
        img.rel = "image_src";
        img.href = "http://localhost:54082/bivo/images_Cufflinks/IMG_3132.png";

        headID.appendChild(tit);
        headID.appendChild(des);
        headID.appendChild(img);

        var parameters = "?TieId=" + result[0].tieId + "&language=" + document.getElementById('language').innerHTML;
        parameters = parameters.replace(/\s+/g, "+");


        document.getElementById('testdiv').innerHTML = "<div class=\"addthis_toolbox addthis_default_style\"><a href=\"http://www.addthis.com/bookmark.php?v=250&amp;pub=bivolino\" class=\"addthis_button_compact\"  addthis:url=\"http://localhost:54082/bivo/Ties.aspx" + parameters + "\" addthis:title=\"" + shareTitle + "\"  addthis:description=\"" + shareDescription + "\">Share</a></div><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=bivolino\"></script>";



        //alert("dit is voor ReinitializeAddThis");
        ReinitializeAddThis();

        //SHOW DETAILS
        var price = document.getElementById('priceLabel');
        var zoom = document.getElementById('Romeo_Stripes');
        var name = document.getElementById('name');
        var description = document.getElementById('descriptionLabel');
        var material = document.getElementById('materialLabel');
        var colour = document.getElementById('colourLabel');
        var pattern = document.getElementById('patternLabel');
        var length = document.getElementById('lengthLabel');
        var width = document.getElementById('widthLabel');
        var purchaseButton = document.getElementById('purchaseButton');
        var videoButton = document.getElementById('videoButton');
        var imgb = document.getElementById('bigImage');
        //  var imgUrl = "background:url(" + result[0].ImgSrcBig +") no-repeat center transparent";
        //   var imgStyle = "width:274px;height:265px;margin-top:2px;border:1px solid #CBCBCB;"+ imgUrl ;

        price.innerHTML = "&nbsp;" + result[0].Price + "&nbsp;&nbsp;";
        name.innerHTML = result[0].Name.toString().toUpperCase() + " " + document.getElementById("addTie2").innerHTML.toUpperCase();
        // zoom.setAttribute('style',imgStyle );
        imgb.src = result[0].ImgSrcBig;
        description.innerHTML = result[0].Description;
        material.innerHTML = result[0].Material;
        colour.innerHTML = result[0].Colour;
        pattern.innerHTML = result[0].Pattern;
        lengthcm = result[0].LengthCm;
        widthcm = result[0].WidthCm;
        lengthinch = result[0].LengthInch;
        widthinch = result[0].WidthInch

        length.innerHTML = lengthcm + " cm / " + Math.round(lengthinch * 100) / 100 + " inch";
        width.innerHTML = widthcm + " cm / " + Math.round(widthinch * 100) / 100 + " inch";
        var purchaseButtonString = "addTieToBasket(" + result[0].tieId + "," + result[0].Price + ")";
        purchaseButton.setAttribute("onclick", purchaseButtonString);


        document.getElementById("page_up").style.visibility = 'hidden';
        document.getElementById("page_continue").style.display = 'none';

        //CREATE BREADCRUMBS
        var t = document.getElementById('title');
        var t2 = document.getElementById('imageTitle');
        var crumb2 = document.getElementById('breadCrumb2');
        var crumb3 = document.getElementById("breadCrumb3");
        var crumb4 = document.getElementById("breadCrumb4");
        var c3 = document.getElementById("breadCrumb3Container");
        var c4 = document.getElementById("breadCrumb4Container");
        c4.removeAttribute('style');
        crumb4.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();

        crumb4.removeAttribute('class');
        crumb4.className = "current";
        crumb4.setAttribute("class", "current");

        crumb2.removeAttribute('class');
        crumb3.removeAttribute('class');
        crumb2.className = "notcurrent";
        crumb3.className = "notcurrent";
        t.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();
        t2.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();


        ShowSuggestion(result[0].ColourId, document.getElementById('language').innerHTML);
    }
    catch (exc) {

        GetByFilter('all', document.getElementById('language').innerHTML, document.getElementById('title').innerHTML, document.getElementById('defaultInstructionsTies').innerHTML);

    }
}


//GET THE SHIRT THAT GOES WHITH THE TIE
function ShowSuggestion(Colour, language) {

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.ShowSuggestion(Colour, language, onRequestShowSuggestionComplete, ErrorHandler, TimeOutHandler);
}

//DISPLAY THE SHIRT THAT GOES WHITH THE TIE OR CUFFLINKS
function onRequestShowSuggestionComplete(result, eventArgs) {

    if (result.length == 0) {

        document.getElementById('view').style.display = 'none';
    } else {
        document.getElementById('view').removeAttribute('style');
        var index = 0;
        var innerHtml = "";
        //innerHtml = innerHtml + "<table style=\"margin-left:auto;margin-right:auto;text-align: center;\"><tr height='9'width='700' />";

        for (i = 0; i < 40; i++) {
            if (result.length > i) {
                //  innerHtml = innerHtml + "<tr>";
                for (j = 0; j < 5; j++) {
                    //     innerHtml = innerHtml + "<td'>";
                    if (result.length > 0) {
                        if (result.length > index) {
                            var name = result[index].ShirtName1.substring(0, 12);
                            var sid = result[index].SELID;
                            var gid = result[index].ID;
                            var shirtImg = "<img id='mouseover" + result[index].ID + "' src='imgGal/galshirt" + sid.substring(0, 7) + ".jpg' alt='shirts gallery' class='shirtPrev' width='100%' />";
                            //  innerHtml = innerHtml +  "<td style=\"width:140px; margin-left:0;\"><h4>" + result[index].ShirtName1 + "</h4><br/> "+ shirtImg +"<br/><br/>" + "<table style=\"margin-left:auto;margin-right:auto;text-align: center;\"><tr><td><div id='button_view'><a href='#' onclick=\"GetShirtUrlParameters('" +gid+"','"+  document.getElementById("language").innerHTML +"');\">" + document.getElementById("ViewShirtLabel").innerHTML + "</a></td></tr></table></div>";

                            innerHtml = innerHtml + "<div id ='shirt_0" + (index + 1) + "'><h4>" + name + "</h4><div id='shirt01'>" + shirtImg + "</div><div id ='button_view'><a href='#' onclick=\"GetShirtUrlParameters('" + gid + "','" + document.getElementById("language").innerHTML + "');\">" + document.getElementById("ViewShirtLabel").innerHTML + "</a></div></div>";

                        }
                    }
                    //     innerHtml = innerHtml + "</td>";
                    index++;
                }
                //    innerHtml = innerHtml + "</tr>";
            }
        }

        //  innerHtml = innerHtml + "<tr height='6' /></table>";
        document.getElementById("shirts").innerHTML = innerHtml;
    }
}

//GET THE CID SELID AND FIT FOR THE SHIRT DEFINED BY SHIRTID
function GetShirtUrlParameters(gid, lang) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetShirtUrlParameters(gid, lang, onRequestGetShirtUrlParametersComplete, ErrorHandler, TimeOutHandler);
}


//GO TO THE GALCONFPAGE
function onRequestGetShirtUrlParametersComplete(result, eventArgs) {
    window.location = "Galconfpage.aspx?CID=" + result[1] + "&SELID=" + result[0] + "&FIT=" + result[2];

}


//ADD THE SELECTED TIE TO THE SHOPPINGBASKET
function addTieToBasket(tieId, price) {

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.addTieToBasket(tieId, price, onRequestAddToBasketComplete, ErrorHandler, TimeOutHandler);
}

//REDIRECT TO THE SHOPPINGBASKET
function onRequestAddToBasketComplete(result, eventArgs) {

    window.location = "SC_ShoppingCart.aspx";

}



//***********************CUFFLINKS*****************************


//GET THE CUFFLINKS BY DEFINING THE STYLE OR COLOUR
function GetCufflinksByFilter(filter, language, label, instr) {

    //UPDATE BREADCRUMBS
    var t = document.getElementById('title');
    var t2 = document.getElementById('imageTitle');
    var crumb2 = document.getElementById('breadCrumb2');
    var crumb3 = document.getElementById("breadCrumb3");
    var crumb4 = document.getElementById("breadCrumb4");
    var c3 = document.getElementById("breadCrumb3Container");
    var c4 = document.getElementById("breadCrumb4Container");

    if (filter == 'all') {
        c3.style.display = 'none';
        crumb2.removeAttribute('class');
        crumb2.className = "current";
        crumb2.setAttribute("class", "current");

    } else {
        c3.removeAttribute('style');
        crumb3.setAttribute('onclick', "GetCufflinksByFilter('" + filter + "','" + language + "','" + label + "')");
        crumb3.innerHTML = label.toUpperCase();
        crumb3.removeAttribute('class');
        crumb3.className = "current";
        crumb3.setAttribute("class", "current");
        crumb2.removeAttribute('class');
        crumb2.className = "notcurrent";
        crumb2.setAttribute("class", "notcurrent");
    }
    t.innerHTML = label.toUpperCase();
    t2.innerHTML = label.toUpperCase();
    c4.style.display = 'none';

    // UPDATE INSTRUCTIONS
    var instruction = document.getElementById("instructions");
    if (filter == 'all') {
        instruction.innerHTML = "<b>" + instr + "</b> " + document.getElementById("instructionsTemplate2").innerHTML;
    } else {
        instruction.innerHTML = "<b>" + instr + "</b> " + document.getElementById("instructionsTemplate2").innerHTML;
    }

    // HIGHLIGHT FILTER
    var f1 = document.getElementById("filter1");
    var f2 = document.getElementById("filter2");
    if (filter == 'all') {
        document.getElementById(f1.innerHTML).setAttribute('class', 'notCurrentFilter');
        document.getElementById(f2.innerHTML).setAttribute('class', 'notCurrentFilter');
        f1.innerHTML = "all_cufflinks";
        document.getElementById(f1.innerHTML).setAttribute('class', 'currentFilter');
    } else {
        document.getElementById(f1.innerHTML).setAttribute('class', 'notCurrentFilter');

        if (filter == 'Enamel' || filter == 'Optic' || filter == 'Gem' || filter == 'Gold' || filter == 'Pearl' || filter == 'Silk' || filter == 'Silver' || filter == 'Solid' || filter == 'Woven') {
            document.getElementById(f2.innerHTML).setAttribute('class', 'notCurrentFilter');
            f2.innerHTML = filter;
            document.getElementById(f2.innerHTML).setAttribute('class', 'currentFilter');
            document.getElementById(f1.innerHTML).setAttribute('class', 'notCurrentFilter');
            f1.innerHTML = "pattern02";
            document.getElementById(f1.innerHTML).setAttribute('class', 'currentFilter');
        }
        else {
            document.getElementById(f2.innerHTML).setAttribute('class', 'notCurrentFilter');
            f2.innerHTML = filter;
            document.getElementById(f2.innerHTML).setAttribute('class', 'currentFilter');
            document.getElementById(f1.innerHTML).setAttribute('class', 'notCurrentFilter');
            f1.innerHTML = "colour";
            document.getElementById(f1.innerHTML).setAttribute('class', 'currentFilter');
        }
    }

    //SHOW CUFfLINKS DIV
    document.getElementById("CufflinksDetail").style.display = 'none';
    document.getElementById("CufflinksPicker").removeAttribute('style');
    document.getElementById("page_continue").style.display = 'none';
    document.getElementById("page_up").removeAttribute('style');
    document.getElementById("page_continue").removeAttribute('style');

    //CALL WEBSERVICE METHOD
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetCufflinksByFilter(filter, language, onRequestGetCufflinksByFilterComplete, ErrorHandler, TimeOutHandler);
}

//DISPLAY CUFFLINKS IN A TABLE
function onRequestGetCufflinksByFilterComplete(result, eventArgs) {


    var d = document.getElementById('CufflinksPicker');
    d.innerHTML = "";

    var shoppingButton = document.getElementById('ShoppingcartLabel').innerHTML;
    var detailsButton = document.getElementById('DetailsLabel').innerHTML;

    var index = 0;
    var innerHtml = "";



    innerHtml = innerHtml + "<DIV id=RomeoStripes>";

    for (i = 0; i < 40; i++) {
        if (result.length > i) {


            for (j = 0; j < 4; j++) {
                if (j != 0) {

                }
                if (result.length > 0) {
                    if (result.length > index) {
                        innerHtml = innerHtml + "<DIV id=RomeoStripes01>";
                        var lang = "'" + document.getElementById('language').innerHTML + "'";
                        var buttDetails = "   onClick=\"showCufflinksDetails(" + result[index].CufflinksId + "," + lang + "," + "'" + result[index].Name + "'," + result[index].ColourId + ")\"";
                        var buttPurchase = "   onClick=\"addCufflinksToBasket(" + result[index].CufflinksId + "," + result[index].Price + ")\"";
                        innerHtml = innerHtml + "<p id='price'>" + document.getElementById("currency").innerHTML + " " + result[index].Price + "<span>" + result[index].Name.toString().toUpperCase() + "</span></p><div id='cufflinks'><img   src=" + result[index].ImgSrcSmall + "></img></div> <DIV id=button><div id='button01'><a href='#' style=\"margin-left:10px;\"" + buttDetails + ">" + detailsButton + "</a></div><div id='button02'><a href='#' style=\"float:left;margin-left:10px;\"" + buttPurchase + ">" + shoppingButton + "</a></div></div></div>";
                        //innerHtml = innerHtml + "<p id='price'>" + document.getElementById("currency").innerHTML + " " + result[index].Price + "<span>" + result[index].Name.toString().toUpperCase() + "</span></p><div id='cufflinks'><img   src=" + result[index].ImgSrcSmall + "></img></div> <DIV id=button><div id='button01'><a href='#' style=\"margin-left:10px;\"" + buttDetails + ">" + detailsButton + "</a></div></div></div>";

                    }
                }
                if (j != 0) {

                }
                index++;
            }


        }
    }

    innerHtml = innerHtml + "</div>";

    d.innerHTML = innerHtml;

}

//GET THE DETAILS OF THE SELECTED CUFFLINKS
function showCufflinksDetails(CufflinksId, language) {

    // SHOW DETAILS DIV
    document.getElementById("CufflinksPicker").style.display = 'none';
    document.getElementById("CufflinksDetail").removeAttribute('style');




    //REMOVE FILTERHIGHLIGHTS
    var f1 = document.getElementById("filter1");
    var f2 = document.getElementById("filter2");
    document.getElementById(f1.innerHTML).setAttribute('class', 'notCurrentFilter');
    document.getElementById(f2.innerHTML).setAttribute('class', 'notCurrentFilter');


    //CALL WEBSERVICE METHOD

    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.ShowCufflinksDetails(CufflinksId, language, onRequestShowCufflinksDetailsComplete, ErrorHandler, TimeOutHandler);


}

//DISPLAY DETAILS OF THE SELECTED CUFFLINKS
function onRequestShowCufflinksDetailsComplete(result, eventArgs) {

    try {
        if (result[0] == null) {
            alert("Item does not exist");

        }

        //SET PARAMETERS FOR SHARE BUTTON

        var shareDescription = result[0].Description;
        var cuff = document.getElementById('addCufflinks').innerHTML.toLowerCase();
        var shareTitle = result[0].Name + " " + cuff + " @ bivolino.com";

        var headID = document.getElementsByTagName("head")[0];

        var tit = document.createElement('meta');

        tit.name = "title";
        tit.content = shareTitle;

        var des = document.createElement('meta');
        des.name = "description";
        des.content = shareDescription;


        var img = document.createElement('link');
        img.rel = "image_src";
        img.href = "http://www.bivolino.com/images_Cufflinks/IMG_3132.png";

        headID.appendChild(tit);
        headID.appendChild(des);
        headID.appendChild(img);




        var parameters = "?CufflinksId=" + result[0].CufflinksId + "&language=" + document.getElementById('language').innerHTML;
        parameters = parameters.replace(/\s+/g, "+");

        //probeer language ander naam te geven, misschien is dees bezet
        document.getElementById('testdiv').innerHTML = "<div class=\"addthis_toolbox addthis_default_style\"><a id=\"btn1\"></a></div><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=bivolino\"></script>";
        // document.getElementById('testdiv').innerHTML = "<div class=\"addthis_toolbox addthis_default_style\"><a <a href=\"http://api.addthis.com/oexchange/0.8/forward/facebook/offer?swfurl=http://www.example.com/test.swf&url=http://localhost:54082/bivo/cufflinks.aspx"+    parameters    + "&title=My Custom Title&description=My Custom description that will go here&height=1&width=1&screenshot=http://localhost:54082/bivo/images_Cufflinks/IMG_3132.png?q=tbn:1Xot2cGj_zPGMM\" target=\"_blank\">Facebook</a></div><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=bivolino\"></script>";



        //alert("dit is voor ReinitializeAddThis");

        var addthis_ui_config = { services_compact: 'facebook, myspace, igoogle, netvibes, squidoo, more' }

        var addthis_share_config = { url: "http://www.bivolino.com/cufflinks.aspx" + parameters, title: shareTitle, description: shareDescription, swfurl: "http://www.example.com/test.swf", width: "1", height: "1", screenshot: "http://localhost:54082/bivo/images/640005.png" }
        addthis.button("#btn1", addthis_ui_config, addthis_share_config);
        ReinitializeAddThis();


        /*
        var parameters = "?CufflinksId=" + result[0].CufflinksId +  "&language=" + document.getElementById('language').innerHTML;
        parameters = parameters.replace(/\s+/g,"+");

    //probeer language ander naam te geven, misschien is dees bezet
        document.getElementById('testdiv').innerHTML = "<div class=\"addthis_toolbox addthis_default_style\"><a href=\"http://www.addthis.com/bookmark.php?v=250&amp;pub=bivolino\" class=\"addthis_button_compact\"  addthis:url=\"http://localhost:54082/bivo/cufflinks.aspx"+    parameters    + "\" addthis:title=\""+ shareTitle + "\"  addthis:description=\""+ shareDescription + "\">Share</a></div><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=bivolino\"></script>";
        // document.getElementById('testdiv').innerHTML = "<div class=\"addthis_toolbox addthis_default_style\"><a <a href=\"http://api.addthis.com/oexchange/0.8/forward/facebook/offer?swfurl=http://www.example.com/test.swf&url=http://localhost:54082/bivo/cufflinks.aspx"+    parameters    + "&title=My Custom Title&description=My Custom description that will go here&height=1&width=1&screenshot=http://localhost:54082/bivo/images_Cufflinks/IMG_3132.png?q=tbn:1Xot2cGj_zPGMM\" target=\"_blank\">Facebook</a></div><script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pub=bivolino\"></script>";


ReinitializeAddThis();
        */

        //SHOW DETAILS

        var price = document.getElementById('priceLabel');
        var zoom = document.getElementById('Romeo_Stripes');
        var name = document.getElementById('name');
        var description = document.getElementById('descriptionLabel');
        var colour = document.getElementById('colourLabel');
        var style = document.getElementById('styleLabel');
        var purchaseButton = document.getElementById('purchaseButton');
        var videoButton = document.getElementById('videoButton');
        var imgb = document.getElementById('bigImage');



        //   var imgUrl = "background:url(" + result[0].ImgSrcBig +") no-repeat center transparent";
        // var imgStyle = "width:274px;height:265px;margin-top:2px;border:1px solid #CBCBCB;"+ imgUrl 

        price.innerHTML = "&nbsp;" + result[0].Price + "&nbsp;&nbsp;";
        name.innerHTML = result[0].Name.toString().toUpperCase() + " " + document.getElementById("addCufflinks").innerHTML.toUpperCase();
        //zoom.setAttribute('style',imgStyle );
        imgb.src = result[0].ImgSrcBig;
        description.innerHTML = result[0].Description;
        colour.innerHTML = result[0].Colour;
        style.innerHTML = result[0].Style;
        var purchaseButtonString = "addCufflinksToBasket(" + result[0].CufflinksId + "," + result[0].Price + ")";
        purchaseButton.setAttribute("onclick", purchaseButtonString);

        document.getElementById("page_up").style.visibility = 'hidden';
        document.getElementById("page_continue").style.display = 'none';


        //CREATE BREADCRUMBS

        var t = document.getElementById('title');
        var t2 = document.getElementById('imageTitle');
        var crumb2 = document.getElementById('breadCrumb2');
        var crumb3 = document.getElementById("breadCrumb3");
        var crumb4 = document.getElementById("breadCrumb4");
        var c3 = document.getElementById("breadCrumb3Container");
        var c4 = document.getElementById("breadCrumb4Container");

        c4.removeAttribute('style');
        crumb4.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();
        crumb4.removeAttribute('class');
        crumb4.className = "current";
        crumb4.setAttribute("class", "current");
        crumb2.removeAttribute('class');
        crumb3.removeAttribute('class');
        crumb2.className = "notcurrent";
        crumb3.className = "notcurrent";
        t.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();
        t2.innerHTML = result[0].Name.toString().replace(/\++/g, " ").toUpperCase();

        ShowCufflinksSuggestion(result[0].ColourId, document.getElementById('language').innerHTML);
    }
    catch (exc) {

        GetCufflinksByFilter('all', document.getElementById('language').innerHTML, document.getElementById('addCufflinks').innerHTML, document.getElementById('instructionsAll').innerHTML);

    }
}

//GET THE SUGGESTED SHIRTS THAT GO WITH THE CUFFLINKS
function ShowCufflinksSuggestion(Colour, language) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.ShowSuggestion(Colour, language, onRequestShowSuggestionComplete, ErrorHandler, TimeOutHandler);
}

//DISPLAY THE SUGGESTED SHIRTS THAT GO WITH THE CUFFLINKS
function onRequestShowCufflinksSuggestionComplete(result, eventArgs) {

    var index = 0;
    var innerHtml = "";
    innerHtml = innerHtml + "<table style=\"margin-left:auto;margin-right:auto;text-align: center;\"><tr height='9' />";

    for (i = 0; i < 40; i++) {
        if (result.length > i) {
            innerHtml = innerHtml + "<tr>";
            for (j = 0; j < 5; j++) {
                innerHtml = innerHtml + "<td'>";
                if (result.length > 0) {
                    if (result.length > index) {
                        var sid = result[index].SELID;
                        var shirtImg = "<img id='mouseover" + result[index].ID + "' src='imgGal/galshirt" + sid.substring(0, 7) + ".jpg' alt='shirts gallery' class='shirtPrev' width='75%' />";
                        innerHtml = innerHtml + "<td width='140'><h4>" + result[index].ShirtName1 + "</h4><br/> " + shirtImg + "<br/><br/>" + "<table style=\"margin-left:auto;margin-right:auto;text-align: center;\"><tr><td><div id='button_view'><a href='Galpage.aspx?RECSHIRTID=" + result[index].ID + "'>" + document.getElementById("ViewShirtLabel").innerHTML + "</a></td></tr></table></div>";
                    }
                }
                innerHtml = innerHtml + "</td>";
                index++;
            }
            innerHtml = innerHtml + "</tr>";
        }
    }
    innerHtml = innerHtml + "<tr height='6' /></table>";
    document.getElementById("recShirts").innerHTML = innerHtml;
}

//ADD THE CUFFLINKS TO THE SHOPPINGBASKET
function addCufflinksToBasket(cufflinksId, price) {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.addCufflinksToBasket(cufflinksId, price, onRequestAddCufflinksToBasketComplete, ErrorHandler, TimeOutHandler);
}

//REDIRECT TO THE SHOPPINGBASKET
function onRequestAddCufflinksToBasketComplete(result, eventArgs) {

    window.location = "SC_ShoppingCart.aspx";

}

//CHECK WHICH FILTERS TO DISPLAY, IF THERE IS A FILTER CATEGORY WHICH IS EMPTY (E.G. THERE ARE NO GREEN TIES) THEN THIS FILTER SHOULDN'T BE DISPALYED
function GetListOfTieFilterElements() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetListOfTieFilterElements(onRequestGetListOfTieFilterElementsComplete, ErrorHandler, TimeOutHandler);

}
function onRequestGetListOfTieFilterElementsComplete(result, eventArgs) {
    for (i = 0; i < result.length; i++) {

        if (result[i].match("Striped")) {
            document.getElementById("Striped").removeAttribute("style");
        } else if (result[i].match("Plain")) {
            document.getElementById("Plain").removeAttribute("style");
        } else if (result[i].match("Spotted")) {
            document.getElementById("Spotted").removeAttribute("style");
        } else if (result[i].match("Patterned")) {
            document.getElementById("Patterned").removeAttribute("style");
        } else if (result[i].match("Wedding")) {
            document.getElementById("Wedding").removeAttribute("style");
        } else if (result[i].match("Blue")) {
            document.getElementById("Blue").removeAttribute("style");
        } else if (result[i].match("Red")) {
            document.getElementById("Red").removeAttribute("style");
        } else if (result[i].match("Green")) {
            document.getElementById("Green").removeAttribute("style");
        } else if (result[i].match("Orange")) {
            document.getElementById("Orange").removeAttribute("style");
        } else if (result[i].match("Pink")) {
            document.getElementById("Pink").removeAttribute("style");
        } else if (result[i].match("Black")) {
            document.getElementById("Black").removeAttribute("style");
        } else if (result[i].match("Grey")) {
            document.getElementById("Grey").removeAttribute("style");
        } else if (result[i].match("Purple")) {
            document.getElementById("Purple").removeAttribute("style");
        }

    }
}


//CHECK WHICH FILTERS TO DISPLAY, IF THERE IS A FILTER CATEGORY WHICH IS EMPTY (E.G. THERE ARE NO GREEN TIES) THEN THIS FILTER SHOULDN'T BE DISPALYED
function GetListOfCufflinksFilterElements() {
    Samples.AspNet.WebService.set_path("ConfiguratorWebService.asmx");
    Samples.AspNet.WebService.GetListOfCufflinksFilterElements(onRequestGetListOfCufflinksFilterElementsComplete, ErrorHandler, TimeOutHandler);

}
function onRequestGetListOfCufflinksFilterElementsComplete(result, eventArgs) {
    for (i = 0; i < result.length; i++) {


        if (result[i].match("Enamel")) {
            document.getElementById("Enamel").removeAttribute("style");
        } else if (result[i].match("Optic")) {
            document.getElementById("Optic").removeAttribute("style");
        } else if (result[i].match("Spotted")) {
            document.getElementById("Spotted").removeAttribute("style");
        } else if (result[i].match("Gem")) {
            document.getElementById("Gem").removeAttribute("style");
        } else if (result[i].match("Wedding")) {
            document.getElementById("Wedding").removeAttribute("style");
        } else if (result[i].match("GoldS")) {
            document.getElementById("Gold").removeAttribute("style");
        } else if (result[i].match("Pearl")) {
            document.getElementById("Pearl").removeAttribute("style");
        } else if (result[i].match("Silk")) {
            document.getElementById("Silk").removeAttribute("style");
        } else if (result[i].match("Orange")) {
            document.getElementById("Orange").removeAttribute("style");
        } else if (result[i].match("SilverS")) {
            document.getElementById("Silver").removeAttribute("style");
        } else if (result[i].match("Solid")) {
            document.getElementById("Solid").removeAttribute("style");
        } else if (result[i].match("Woven")) {
            document.getElementById("Woven").removeAttribute("style");
        } else if (result[i].match("Black")) {
            document.getElementById("Black").removeAttribute("style");
        } else if (result[i].match("Blue")) {
            document.getElementById("Blue").removeAttribute("style");
        } else if (result[i].match("Black")) {
            document.getElementById("Black").removeAttribute("style");
        } else if (result[i].match("Black")) {
            document.getElementById("Black").removeAttribute("style");
        } else if (result[i].match("GoldS")) {
            document.getElementById("GoldM").removeAttribute("style");
        } else if (result[i].match("Green")) {
            document.getElementById("Green").removeAttribute("style");
        } else if (result[i].match("Grey")) {
            document.getElementById("Grey").removeAttribute("style");
        } else if (result[i].match("Multi")) {
            document.getElementById("Multi").removeAttribute("style");
        } else if (result[i].match("Black")) {
            document.getElementById("Black").removeAttribute("style");
        } else if (result[i].match("Navy")) {
            document.getElementById("Navy").removeAttribute("style");
            document.getElementById("Blue").removeAttribute("style");
        } else if (result[i].match("Orange")) {
            document.getElementById("Orange").removeAttribute("style");
        } else if (result[i].match("Pink")) {
            document.getElementById("Pink").removeAttribute("style");
        } else if (result[i].match("Purple")) {
            document.getElementById("Purple").removeAttribute("style");
        } else if (result[i].match("Red")) {
            document.getElementById("Red").removeAttribute("style");
        } else if (result[i].match("Purple")) {
            document.getElementById("Purple").removeAttribute("style");
        } else if (result[i].match("Royal")) {
            document.getElementById("Royal").removeAttribute("style");
            document.getElementById("Blue").removeAttribute("style");
        } else if (result[i].match("SilverC")) {
            document.getElementById("SilverC").removeAttribute("style");
        } else if (result[i].match("Sky")) {
            document.getElementById("Sky").removeAttribute("style");
            document.getElementById("Blue").removeAttribute("style");
        } else if (result[i].match("White")) {
            document.getElementById("White").removeAttribute("style");
        } else if (result[i].match("Yellow")) {
            document.getElementById("Yellow").removeAttribute("style");
        }

    }
}



function insertParam2(key, value) {
    key = escape(key); value = escape(value);

    var s = document.location.search;
    var kvp = key + "=" + value;

    var r = new RegExp("(&|\\?)" + key + "=[^\&]*");

    s = s.replace(r, "$1" + kvp);

    if (!RegExp.$1) { s += (s.length > 0 ? '&' : '?') + kvp; };

    //again, do what you will here 
    document.location.search = s;
}



function insertParam(key, value) {
    key = escape(key); value = escape(value);

    var kvp = document.location.search.substr(1).split('&');

    var i = kvp.length; var x; while (i--) {
        x = kvp[i].split('=');

        if (x[0] == key) {
            x[1] = value;
            kvp[i] = x.join('=');
            break;
        }
    }

    if (i < 0) { kvp[kvp.length] = [key, value].join('='); }

    //this will reload the page, it's likely better to store this until finished 
    document.location.search = kvp.join('&');
}


function gup(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) return ""; else return results[1]; }


function getQueryParams(val) {
    //Use the window.location.search if we don't have a val. 
    var query = val || window.location.search;
    query = query.split('?')[1]
    var pairs = query.split('&');
    var retval = {};
    var check = [];
    for (var i = 0; i < pairs.length; i++) {
        check = pairs[i].split('=');
        retval[decodeURIComponent(check[0])] = decodeURIComponent(check[1]);
    }

    return retval;
}
function ReinitializeAddThis() {
    if (window.addthis) {
        window.addthis.ost = 0;
        try {
            window.addthis.ready();
        } catch (exc) {

        }
    }
}


////////////////////////////////////////////////////////////////////  
//////////////////////////////////////////////////////////////////// 
//////////////////////////////////////////////////////////////////// 


if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();



// 2 fonctions added for Baur site by Anouar //

function menuclickminbaur() {
    $get("next_button_baur").className = "";
    $get("next_button_baur").src = "Baurm/images/B1_baur__06.png";
    var hidmenu = parseInt(document.getElementById('hidmenu').value) - 1; 
    if (hidmenu == 1) {
        $get("previous_button_Design_collar_page_baur").className = "hidden";
    }
    else {
        $get("previous_button_Design_collar_page_baur").className = "previousBtn previous_button_baur";
    }

    if (hidmenu == 6) {
        hidmenu = 4;
        menuclick(hidmenu);
    }
     else {
        menuclick(hidmenu);
    }
}

function menuclickplusbaur() {
    $get("previous_button_Design_collar_page_baur").className = "previousBtn previous_button_baur";
    var hidmenu = parseInt(document.getElementById('hidmenu').value) + 1;
    if (hidmenu == 7 || hidmenu == 8) {
        hidmenu = 6;
        menuclick(hidmenu);
    }
    else if (hidmenu == 6) {
        hidmenu = 4;
        menuclick(hidmenu);
    }
    else {
        menuclick(hidmenu);
    }
}
