/* Minification failed. Returning unminified contents.
(2,1): run-time error CSS1019: Unexpected token, found '$'
(2,2): run-time error CSS1019: Unexpected token, found '('
(2,11): run-time error CSS1031: Expected selector, found ')'
(2,11): run-time error CSS1025: Expected comma or open brace, found ')'
(36,2): run-time error CSS1019: Unexpected token, found ')'
(39,10): run-time error CSS1031: Expected selector, found 'postTracking('
(39,10): run-time error CSS1025: Expected comma or open brace, found 'postTracking('
(42,10): run-time error CSS1031: Expected selector, found 'postTracking('
(42,10): run-time error CSS1025: Expected comma or open brace, found 'postTracking('
(45,10): run-time error CSS1031: Expected selector, found 'postTracking('
(45,10): run-time error CSS1025: Expected comma or open brace, found 'postTracking('
(73,10): run-time error CSS1031: Expected selector, found 'postSelectTracking('
(73,10): run-time error CSS1025: Expected comma or open brace, found 'postSelectTracking('
 */

$(document).ready(function () {
    $.ajax({
        type: "POST",
        dataType: 'json',
        cache: false,
        url: '/Tracking',
        beforeSend: function () {
        },
        data: {
            'url': window.location.href,
            'type': "VIEW",
        },
        datatype: "html",
        timeout: 10000,
        success: function (data) {
        }
    })
    .fail(function () {
    })
    .always(function () {
    });

    $('input').change(function () {
        var name = $(this).attr("name") != null ? $(this).attr("name") : $(this).attr("id");
        if ($(this).attr('type') == 'radio') {
            postTracking("TYPING", name + ": " + $(this).parent().text() + ' - ' + $(this).val() + ' - ' + $('#priceTotalID').html());
        } else {
            postTracking("TYPING", name + ": " + $(this).val() + ' - ' + $('#priceTotalID').html());
        }
    });
    $('select').on('change', function () {
        var name = $(this).attr("name") != null ? $(this).attr("name") : $(this).attr("id");
        postTracking("TYPING", name + ": " + $(this).find(":selected").text() + ' - ' + $('#priceTotalID').html());
    })
});
//End document ready

function postTracking(type) {
    postTracking(type, null, null);
}
function postTracking(type, detail) {
    postTracking(type, detail, null);
}
function postTracking(type, detail, url) {
    var device = screen.width + "x" + screen.height;
    if (url == null) {
        url = window.location.href;
    }
    $.ajax({
        type: "POST",
        dataType: 'json',
        cache: false,
        url: '/Tracking',
        beforeSend: function () {
        },
        data: {
            'Url': url,
            'Type': type,
            'Detail': detail,
            'ScreenSize': device
        },
        datatype: "html",
        timeout: 10000,
        success: function (data) {
        }
    })
        .fail(function () {
        })
        .always(function () {
        });
}
function postSelectTracking(inputSelected) {
    var inputSelectedValueArr = inputSelected.attr('id').split('__');
    var segmentArr = inputSelectedValueArr[1].split('_');
    var priceArr = inputSelectedValueArr.pop().split('_');
    postTracking("SELECT", null, segmentArr[1] + ' ' + segmentArr[2] + '-' + segmentArr[3] + ' ' + segmentArr[5] + '-' + segmentArr[6] + ' $' + priceArr[0] + ' ' + GetSeatClassName(priceArr[1]) + ' (' + priceArr[2] + ')');
}
