﻿/********* TURN ON OR OFF DEBUG ***********/
var debugging = true; // or true
if (typeof console == "undefined") var console = { log: function () { } };
else if (!debugging || typeof console.log == "undefined") console.log = function () { };


/*********** AJAX SETUP **************/
$.ajaxSetup({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    data: "{}",
    dataFilter: function (data) {
        var msg;

        if (typeof (JSON) !== 'undefined' &&
        typeof (JSON.parse) === 'function')
            msg = JSON.parse(data);
        else
            msg = eval('(' + data + ')');

        if (msg.hasOwnProperty('d'))
            return msg.d;
        else
            return msg;
    }
});


$(document).ready(function () {

    $("#ddlPrint").change(function () {
        if ($(this).val() != "0") {
            $("#txtPrintQuantity").attr('value', '1');
        } else {
            $("#txtPrintQuantity").attr('value', '0');
        }
    });

    $("#ddlBinder").change(function () {
        if ($(this).val() != "0") {
            $("#txtBinderQuantity").attr('value', '1');
        }
        else {
            $("#txtBinderQuantity").attr('value', '0');
        }
    });

    $("#ddlDigital").change(function () {
        if ($(this).val() != "0") {
            $("#txtDigitalQuantity").attr('value', '1');
        } else {
            $("#txtDigitalQuantity").attr('value', '0');
        }
    });

    //$("#rblDelivery").change(function () {
    //    console.log($("#rblDelivery").val());
    //});

    //ValidatorEnable($("#rfvDeliveryName"), $("#rblDelivery").val() == 2);
    //ValidatorEnable($("#rfvDeliveryAddress"), $("#rblDelivery").val() == 2);
    //ValidatorEnable($("#rfvDeliveryCounty"), $("#rblDelivery").val() == 2);
});

