if($.cookie('exp__currency') === 'GB' ) { 
	var jsonfile = '/json/2000_json_gb'
}
if($.cookie('exp__currency') === 'US' ) { 
	var jsonfile = '/json/2000_json_us'
}
if($.cookie('exp__currency') === 'EU' ) { 
	var jsonfile = '/json/2000_json_eu'
}

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
	var vars = [],
		hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	for (var i = 0; i < hashes.length; i++) {
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}
	return vars;
}

$.getJSON(jsonfile, (function(data) {
    console.log(data);
    var price2204 = data.priceData[0].price;
    var price2205 = data.priceData[1].price;
    var price2204d = data.priceData[2].price;
    var price2205d = data.priceData[3].price;
    var price2205mso = data.priceData[4].price;
    var price2405a = data.priceData[5].price;
    var price2206b = data.priceData[6].price;
    var price2206mso = data.priceData[7].price;
    var price2406b = data.priceData[8].price;
    var price2207b = data.priceData[9].price;
    var price2207mso = data.priceData[10].price;
    var price2407b = data.priceData[11].price;
    var price2208b = data.priceData[12].price;
    var price2208mso = data.priceData[13].price;
    var price2408b = data.priceData[14].price;
    
    var val2204 = data.priceData[0].price_val;
    var val2205 = data.priceData[1].price_val;
    var val2204d = data.priceData[2].price_val;
    var val2205d = data.priceData[3].price_val;
    var val2205mso = data.priceData[4].price_val;
    var val2405a = data.priceData[5].price_val;
    var val2206b = data.priceData[6].price_val;
    var val2206mso = data.priceData[7].price_val;
    var val2406b = data.priceData[8].price_val;
    var val2207b = data.priceData[9].price_val;
    var val2207mso = data.priceData[10].price_val;
    var val2407b = data.priceData[11].price_val;
    var val2208b = data.priceData[12].price_val;
    var val2208mso = data.priceData[13].price_val;
    var val2408b = data.priceData[14].price_val;
    
    var kitOpt = getUrlVars()['kit'];
    var loc = $(location).attr('href');
    var currency = $.cookie("exp__currenCook");
    
	if (kitOpt == "2208b") {
		//Initialise widget - 2208B
        $("#total").html(price2208b);
        $("#model").text("2208B");
        $("#cat").val("PQ014");
        $("#buff").text("128 MS");
        $("#samp").text("1 GS/s");
        $("input[name='entry_id']").val("57741");
        $("#probeHead").addClass("hideBut");
        $("#probeButtons").addClass("hideBut");
        $("#2mso").attr("disabled", false);
        $("#4cha").attr("disabled", false);
        $(".band:last-child").addClass("active");
    	$(".chan").first().addClass("active");
        $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
        $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2208b+".00', 'items': [{'item_id': 'PQ014', 'item_url': '"+loc+"', 'item_name': '2208B', 'price': '"+val2208b+".00', 'quantity': '1'}]}});");
        //calibration upsell
        $(".calCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '99.00', 'items': [{'item_id': 'CC017', 'item_url': '"+loc+"', 'item_name': 'Calibration certificate: PicoScope 2000/3000/4000 (excl. 4824/4444)', 'price': '99.00', 'quantity': '1'}]}});");
        $("#calibration_id").val("9821");
        
	} else {
        //Initialise widget - 2204A with Probes
        $("#total").html(price2204);
        $("#priceval").val(val2204);
        $("#model").text("2204A");
        $("#cat").val("PP906");
        $("#buff").text("8 kS");
        $("#samp").text("100 MS/s");
        $("input[name='entry_id']").val("21");
        $("#2mso").attr("disabled", true);
        $("#4cha").attr("disabled", true);
    	$(".band").first().addClass("active");
    	$(".chan").first().addClass("active");
    	$("#probeButA").addClass("active");
        $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204+".00', 'items': [{'item_id': 'PP906', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204+".00', 'quantity': '1'}]}});");

        $(".calCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '99.00', 'items': [{'item_id': 'CC017', 'item_url': '"+loc+"', 'item_name': 'Calibration certificate: PicoScope 2000/3000/4000 (excl. 4824/4444)', 'price': '99.00', 'quantity': '1'}]}});");
        $("#calibration_id").val("9821");
    }

    //$('#image360').reel({images:'/images/uploads/threesixty/2200/picoscope_2200_##.jpg', frames:36, frame:35, loops:true, entry:1, opening:1 });

    $("label").removeAttr("disabled");
    $("#2mso, #4cha").attr("disabled", true);

    $(".band").click(function() {
        var bandCheck = $(this).find("input").val();
        var probeCheck = $(".probe.active").find("input").val();
        var chanCheck = $(".chan.active").find("input").val();
        //2204A with Probes
        if (bandCheck == "four" && probeCheck == "yes") {
            $("#total").html(price2204);
            $("#priceval").val(val2204);
            $("#model").text("2204A");
            $("#cat").val("PP906");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("21");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            $("#2cha").addClass("active");
            $("#2mso, #4cha").removeClass("active");
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204+".00', 'items': [{'item_id': 'PP906', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204+".00', 'quantity': '1'}]}});");
            //2204A-DA without probes
        } else if (bandCheck == "four" && probeCheck == "no") {
            $("#total").html(price2204d);
            $("#priceval").val(val2204d);
            $("#model").text("2204A");
            $("#cat").val("PP917");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("8291");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            $("#2cha").addClass("active");
            $("#2mso, #4cha").removeClass("active");
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204d+".00', 'items': [{'item_id': 'PP917', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204d+".00', 'quantity': '1'}]}});");
            //2205A with Probes
        } else if (bandCheck == "five" && chanCheck == "2" && probeCheck == "yes") {
            $("#total").html(price2205);
            $("#priceval").val(val2205);
            $("#model").text("2205A");
            $("#cat").val("PP907");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("20");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205+".00', 'items': [{'item_id': 'PP907', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205+".00', 'quantity': '1'}]}});");
            //2205A-DA without probes
        } else if (bandCheck == "five" && chanCheck == "2" && probeCheck == "no") {
            $("#total").html(price2205d);
            $("#priceval").val(val2205d);
            $("#model").text("2205A");
            $("#cat").val("PP966");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("16461");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205d+".00', 'items': [{'item_id': 'PP966', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205d+".00', 'quantity': '1'}]}});");
            //2206B
        } else if (bandCheck == "six" && chanCheck == "2") {
            $("#total").html(price2206b);
            $("#priceval").val(val2206b);
            $("#model").text("2206B");
            $("#cat").val("PQ012");
            $("#buff").text("32 MS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57681");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2206b+".00', 'items': [{'item_id': 'PQ012', 'item_url': '"+loc+"', 'item_name': '2206B', 'price': '"+val2206b+".00', 'quantity': '1'}]}});");
            //2207B
        } else if (bandCheck == "seven" && chanCheck == "2") {
            $("#total").html(price2207b);
            $("#priceval").val(val2207b);
            $("#model").text("2207B");
            $("#cat").val("PQ013");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57711");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2207b+".00', 'items': [{'item_id': 'PQ013', 'item_url': '"+loc+"', 'item_name': '2207B', 'price': '"+val2207b+".00', 'quantity': '1'}]}});");
            //2208B
        } else if (bandCheck == "eight" && chanCheck == "2") {
            $("#total").html(price2208b);
            $("#priceval").val(val2208b);
            $("#model").text("2208B");
            $("#cat").val("PQ014");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57741");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2208b+".00', 'items': [{'item_id': 'PQ014', 'item_url': '"+loc+"', 'item_name': '2208B', 'price': '"+val2208b+".00', 'quantity': '1'}]}});");
            //2206B MSO
        } else if (bandCheck == "six" && chanCheck == "2mso") {
            $("#total").html(price2206mso);
            $("#priceval").val(val2206mso);
            $("#model").text("2206B MSO");
            $("#cat").val("PQ009");
            $("#buff").text("32 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57691");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2206mso+".00', 'items': [{'item_id': 'PQ009', 'item_url': '"+loc+"', 'item_name': '2206B MSO', 'price': '"+val2206mso+".00', 'quantity': '1'}]}});");
            //2207B MSO
        } else if (bandCheck == "seven" && chanCheck == "2mso") {
            $("#total").html(price2207mso);
            $("#priceval").val(val2207mso);
            $("#model").text("2207B MSO");
            $("#cat").val("PQ013");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57721");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2207mso+".00', 'items': [{'item_id': 'PQ010', 'item_url': '"+loc+"', 'item_name': '2207B MSO', 'price': '"+val2207mso+".00', 'quantity': '1'}]}});");
            //2208B MSO
        } else if (bandCheck == "eight" && chanCheck == "2mso") {
            $("#total").html(price2208mso);
            $("#priceval").val(val2208mso);
            $("#model").text("2208B MSO");
            $("#cat").val("PQ011");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57751");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2208mso+".00', 'items': [{'item_id': 'PQ011', 'item_url': '"+loc+"', 'item_name': '2208B MSO', 'price': '"+val2208mso+".00', 'quantity': '1'}]}});");
            //2205A MSO
        } else if (bandCheck == "five" && chanCheck == "2mso") {
            $("#total").html(price2205mso);
            $("#priceval").val(val2205mso);
            $("#model").text("2205A MSO");
            $("#cat").val("PQ008");
            $("#buff").text("48 kS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57661");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205mso+".00', 'items': [{'item_id': 'PQ008', 'item_url': '"+loc+"', 'item_name': '2205B MSO', 'price': '"+val2205mso+".00', 'quantity': '1'}]}});");
            
            //2406B
        } else if (bandCheck == "six" && chanCheck == "4") {
            $("#total").html(price2406b);
            $("#priceval").val(val2406b);
            $("#model").text("2406B");
            $("#cat").val("PQ016");
            $("#buff").text("32 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57701");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2406b+".00', 'items': [{'item_id': 'PQ016', 'item_url': '"+loc+"', 'item_name': '2406B', 'price': '"+val2406b+".00', 'quantity': '1'}]}});");
            //2407B
        } else if (bandCheck == "seven" && chanCheck == "4") {
            $("#total").html(price2407b);
            $("#priceval").val(val2407b);
            $("#model").text("2407B");
            $("#cat").val("PQ017");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57731");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2407b+".00', 'items': [{'item_id': 'PQ017', 'item_url': '"+loc+"', 'item_name': '2407B', 'price': '"+val2407b+".00', 'quantity': '1'}]}});");
            //2408B
        } else if (bandCheck == "eight" && chanCheck == "4") {
            $("#total").html(price2408b);
            $("#priceval").val(val2408b);
            $("#model").text("2408B");
            $("#cat").val("PQ018");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57761");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204d+".00', 'items': [{'item_id': 'PQ018', 'item_url': '"+loc+"', 'item_name': '2408B', 'price': '"+val2408b+".00', 'quantity': '1'}]}});");
            //2405A
        } else if (bandCheck == "five" && chanCheck == "4") {
            $("#total").html(price2405a);
            $("#priceval").val(val2405a);
            $("#model").text("2405A");
            $("#cat").val("PQ015");
            $("#buff").text("48 kS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57671");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2405a+".00', 'items': [{'item_id': 'PQ015', 'item_url': '"+loc+"', 'item_name': '2405A', 'price': '"+val2405a+".00', 'quantity': '1'}]}});");
        }
    });

    $(".chan").click(function() {
        var chanCheck = $(this).find("input").val();
        var probeCheck = $(".probe.active").find("input").val();
        var bandCheck = $(".band.active").find("input").val();
        //2204A with Probes
        if (bandCheck == "four" && probeCheck == "yes") {
            $("#total").html(price2204);
            $("#priceval").val(val2204);
            $("#model").text("2204A");
            $("#cat").val("PP906");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("21");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204+".00', 'items': [{'item_id': 'PP906', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204+".00', 'quantity': '1'}]}});");
            //2204A-DA without probes
        } else if (bandCheck == "four" && probeCheck == "no") {
            $("#total").html(price2204d);
            $("#priceval").val(val2204d);
            $("#model").text("2204A");
            $("#cat").val("PP917");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("8291");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204d+".00', 'items': [{'item_id': 'PP917', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204d+".00', 'quantity': '1'}]}});");
            //2205A with Probes
        } else if (bandCheck == "five" && chanCheck == "2" && probeCheck == "yes") {
            $("#total").html(price2205);
            $("#priceval").val(val2205);
            $("#model").text("2205A");
            $("#cat").val("PP907");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("20");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205+".00', 'items': [{'item_id': 'PP907', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205+".00', 'quantity': '1'}]}});");
            //2205A-DA without probes
        } else if (bandCheck == "five" && chanCheck == "2" && probeCheck == "no") {
            $("#total").html(price2205d);
            $("#priceval").val(val2205d);
            $("#model").text("2205A");
            $("#cat").val("PP966");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("16461");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2200/picoscope_2200_##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205d+".00', 'items': [{'item_id': 'PP966', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205d+".00', 'quantity': '1'}]}});");
            //2206B
        } else if (bandCheck == "six" && chanCheck == "2") {
            $("#total").html(price2206b);
            $("#priceval").val(val2206b);
            $("#model").text("2206B");
            $("#cat").val("PQ012");
            $("#buff").text("32 MS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57681");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2206b+".00', 'items': [{'item_id': 'PQ012', 'item_url': '"+loc+"', 'item_name': '2206B', 'price': '"+val2206b+".00', 'quantity': '1'}]}});");
            //2207B
        } else if (bandCheck == "seven" && chanCheck == "2") {
            $("#total").html(price2207b);
            $("#priceval").val(val2207b);
            $("#model").text("2207B");
            $("#cat").val("PQ013");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57711");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2207b+".00', 'items': [{'item_id': 'PQ013', 'item_url': '"+loc+"', 'item_name': '2207B', 'price': '"+val2207b+".00', 'quantity': '1'}]}});");
            //2208B
        } else if (bandCheck == "eight" && chanCheck == "2") {
            $("#total").html(price2208b);
            $("#priceval").val(val2208b);
            $("#model").text("2208B");
            $("#cat").val("PQ014");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57741");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000b/2000b-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2208b+".00', 'items': [{'item_id': 'PQ014', 'item_url': '"+loc+"', 'item_name': '2208B', 'price': '"+val2208b+".00', 'quantity': '1'}]}});");
            //2206B MSO
        } else if (bandCheck == "six" && chanCheck == "2mso") {
            $("#total").html(price2206mso);
            $("#priceval").val(val2206mso);
            $("#model").text("2206B MSO");
            $("#cat").val("PQ009");
            $("#buff").text("32 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57691");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2206mso+".00', 'items': [{'item_id': 'PQ009', 'item_url': '"+loc+"', 'item_name': '2206B MSO', 'price': '"+val2206mso+".00', 'quantity': '1'}]}});");
            //2207B MSO
        } else if (bandCheck == "seven" && chanCheck == "2mso") {
            $("#total").html(price2207mso);
            $("#priceval").val(val2207mso);
            $("#model").text("2207B MSO");
            $("#cat").val("PQ013");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57721");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2207mso+".00', 'items': [{'item_id': 'PQ010', 'item_url': '"+loc+"', 'item_name': '2207B MSO', 'price': '"+val2207mso+".00', 'quantity': '1'}]}});");
            //2208B MSO
        } else if (bandCheck == "eight" && chanCheck == "2mso") {
            $("#total").html(price2208mso);
            $("#priceval").val(val2208mso);
            $("#model").text("2208B MSO");
            $("#cat").val("PQ011");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57751");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2208mso+".00', 'items': [{'item_id': 'PQ011', 'item_url': '"+loc+"', 'item_name': '2208B MSO', 'price': '"+val2208mso+".00', 'quantity': '1'}]}});");
            //2205A MSO
        } else if (bandCheck == "five" && chanCheck == "2mso") {
            $("#total").html(price2205mso);
            $("#priceval").val(val2205mso);
            $("#model").text("2205A MSO");
            $("#cat").val("PQ008");
            $("#buff").text("48 kS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57661");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000mso/2000mso-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205mso+".00', 'items': [{'item_id': 'PQ008', 'item_url': '"+loc+"', 'item_name': '2205B MSO', 'price': '"+val2205mso+".00', 'quantity': '1'}]}});");
            //2406B
        } else if (bandCheck == "six" && chanCheck == "4") {
            $("#total").html(price2406b);
            $("#priceval").val(val2406b);
            $("#model").text("2406B");
            $("#cat").val("PQ016");
            $("#buff").text("32 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57701");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2406b+".00', 'items': [{'item_id': 'PQ016', 'item_url': '"+loc+"', 'item_name': '2406B', 'price': '"+val2406b+".00', 'quantity': '1'}]}});");
            //2407B
        } else if (bandCheck == "seven" && chanCheck == "4") {
            $("#total").html(price2407b);
            $("#priceval").val(val2407b);
            $("#model").text("2407B");
            $("#cat").val("PQ017");
            $("#buff").text("64 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57731");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2407b+".00', 'items': [{'item_id': 'PQ017', 'item_url': '"+loc+"', 'item_name': '2407B', 'price': '"+val2407b+".00', 'quantity': '1'}]}});");
            //2408B
        } else if (bandCheck == "eight" && chanCheck == "4") {
            $("#total").html(price2408b);
            $("#priceval").val(val2408b);
            $("#model").text("2408B");
            $("#cat").val("PQ018");
            $("#buff").text("128 MS");
            $("#samp").text("1 GS/s");
            $("input[name='entry_id']").val("57761");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/150-mhz-scope-probe'>TA132</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204d+".00', 'items': [{'item_id': 'PQ018', 'item_url': '"+loc+"', 'item_name': '2408B', 'price': '"+val2408b+".00', 'quantity': '1'}]}});");
            //2405A
        } else if (bandCheck == "five" && chanCheck == "4") {
            $("#total").html(price2405a);
            $("#priceval").val(val2405a);
            $("#model").text("2405A");
            $("#cat").val("PQ015");
            $("#buff").text("48 kS");
            $("#samp").text("500 MS/s");
            $("input[name='entry_id']").val("57671");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").addClass("hideBut");
            $("#probeButtons").addClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $('#image360').reel('images', '/images/uploads/threesixty/2000/2000-##.jpg');
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2405a+".00', 'items': [{'item_id': 'PQ015', 'item_url': '"+loc+"', 'item_name': '2405A', 'price': '"+val2405a+".00', 'quantity': '1'}]}});");
        }
    });

    $(".probe").click(function() {
        var bandCheck = $(".band.active").find("input").val();
        var probeCheck = $(this).find("input").val();
        //2204A with Probes
        if (bandCheck == "four" && probeCheck == "yes") {
            $("#total").html(price2204);
            $("#priceval").val(val2204);
            $("#model").text("2204A");
            $("#cat").val("PP906");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("21");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204+".00', 'items': [{'item_id': 'PP906', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204+".00', 'quantity': '1'}]}});");
            //2204A-DA without probes
        } else if (bandCheck == "four" && probeCheck == "no") {
            $("#total").html(price2204d);
            $("#priceval").val(val2204d);
            $("#model").text("2204A");
            $("#cat").val("PP917");
            $("#buff").text("8 kS");
            $("#samp").text("100 MS/s");
            $("input[name='entry_id']").val("8291");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", true);
            $("#4cha").attr("disabled", true);
            //2205A with Probes
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2204d+".00', 'items': [{'item_id': 'PP917', 'item_url': '"+loc+"', 'item_name': '2204A', 'price': '"+val2204d+".00', 'quantity': '1'}]}});");
        } else if (bandCheck == "five" && probeCheck == "yes") {
            $("#total").html(price2205);
            $("#priceval").val(val2205);
            $("#model").text("2205A");
            $("#cat").val("PP907");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("20");
            //$("#probeOpt").html("<a href='/accessories/passive-oscilloscope-probes/60-mhz-scope-probe'>MI007</a> Oscilloscope probes included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            //2205A-DA without probes
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205+".00', 'items': [{'item_id': 'PP907', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205+".00', 'quantity': '1'}]}});");
        } else if (bandCheck == "five" && probeCheck == "no") {
            $("#total").html(price2205d);
            $("#priceval").val(val2205d);
            $("#model").text("2205A");
            $("#cat").val("PP966");
            $("#buff").text("16 kS");
            $("#samp").text("200 MS/s");
            $("input[name='entry_id']").val("16461");
            $("#probeOpt").html("Oscilloscope probes <span>not</span> included");
            $("#probeHead").removeClass("hideBut");
            $("#probeButtons").removeClass("hideBut");
            $("#2mso").attr("disabled", false);
            $("#4cha").attr("disabled", false);
            $(".confCartBut").attr("onclick", "dataLayer.push({'event': 'add_to_cart', 'ecommerce':  {'currency': '"+currency+"', 'value': '"+val2205d+".00', 'items': [{'item_id': 'PP966', 'item_url': '"+loc+"', 'item_name': '2205A', 'price': '"+val2205d+".00', 'quantity': '1'}]}});");
        }
    });

    $('.distip').tooltip();

    

}));

$(window).scroll(function() {
    if ($(this).scrollTop() > 100) {$('.scrollup').fadeIn();} else {$('.scrollup').fadeOut();}
});
$(function() {
    $('.scrollup').click(function() {
        $("html, body").animate({
            scrollTop: 0
        }, 600);
        return false;
    });
});

$(document).ready(function() {
    $('.fancybox').fancybox({
        openEffect: 'fade',
        openSpeed: 150,
        closeEffect: 'fade',
        closeSpeed: 150,
        aspectRatio: true,
        scrolling: 'no',
        helpers: {
            title: {
                type: 'inside'
            },
            overlay: {
                css: {
                    'background': 'rgba(87,120,165,0.55)'
                }
            }
        }
    });
});
$("a.zoom").append("<span></span>");
$(function() {
    $('.popover-link').popover({
            html: true,
            placement: 'right'
        })
        .click(function(e) {e.preventDefault();});
    $(':not(#anything)').on('click', function(e) {
        $('.popover-link').each(function() {
            //the 'is' for buttons that trigger popups
            //the 'has' for icons and other elements within a button that triggers a popup
            if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                $(this).popover('hide');
                return;
            }
        });
    });
});
$(".accsTabs li:first").addClass("active");
$(".tab-pane:first").addClass("active");
//Reviews product selector
$('select#prod_id').on('change', function() {
    $(".hiddenFields input[name='entry_id']").val(this.value);
});

$(document).ready(function() {
    $('.picarousel').slick({
        slidesToShow: 5,
        slidesToScroll: 1,
        autoplay: true,
        autoplaySpeed: 2000,
        arrows: true,
        infinite: true,
        responsive: [{
                breakpoint: 1025,
                settings: {
                    slidesToShow: 4,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    arrows: true,
                    infinite: true
                }
            },
            {
                breakpoint: 769,
                settings: {
                    slidesToShow: 3,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    arrows: false,
                    infinite: true
                }
            },
            {
                breakpoint: 426,
                settings: {
                    slidesToShow: 2,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    arrows: false,
                    infinite: true
                }
            },
            {
                breakpoint: 376,
                settings: {
                    slidesToShow: 1,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    arrows: false,
                    infinite: true
                }
            },
            {
                breakpoint: 321,
                settings: {
                    slidesToShow: 1,
                    slidesToScroll: 1,
                    autoplay: true,
                    autoplaySpeed: 2000,
                    arrows: false,
                    infinite: true
                }
            }
        ]
    });

    $('.gallery').fancybox({
        beforeLoad: function() {
            var el, id = $(this.element).data('title-id');
            if (id) {
                el = $('#' + id);

                if (el.length) {
                    this.title = el.html();
                }
            }
        },
        openEffect: 'fade',
        openSpeed: 150,
        closeEffect: 'fade',
        closeSpeed: 150,
        aspectRatio: true,
        scrolling: 'no',
        helpers: {
            title: {
                type: 'inside'
            },
            buttons: {
                position: 'bottom'
            },
            overlay: {
                css: {
                    'background': 'rgba(87,120,165,0.55)'
                }
            }
        }
    });
});

$('#msomap2000 li a').click(function(e) {e.preventDefault();});


//Calibration modal alert
var scope_atc = getUrlVars()['atc'];

if (scope_atc == "true") {
	var modalId = $('.calModal').prop('id');
	console.log("modalId is "+modalId);
    $("#"+modalId).modal('show');
}