﻿$(document).ready(function()
{
    initPopUp();
});

$("#allocated_benefit_details").live("click", function()
{
    $('#td_checkbox_company_car_second').hide();
});

function display_carcalculate()
{
    $.getScript("/js/core.js", function()
    {
        GoServer(null, 'GetDemoData', null);

        //YearStart = parseDate("06/04/2009");
        //YearEnd = parseDate("05/04/2010");

        CurrentEmployee = new Object();
        CurrentEmployee.EmployeeBenefits = new Object();
        SelectedAllocatedBenefit = new Object();
        SelectedAllocatedBenefit.Benefit = new Object();
        SelectedAllocatedBenefit.Payments = new Array();
        SelectedAllocatedBenefit.Mileages = new Array();
        SelectedAllocatedBenefit.Make = 'Demo';
        SelectedAllocatedBenefit.Model = 'Demo';
        SelectedAllocatedBenefit.RegistrationNumber = 'Demo';
        SelectedAllocatedBenefit.RegistrationDate = "01/01/2000";
        SelectedAllocatedBenefit.CO2MissingReason = 0;

        SelectedAllocatedBenefit.Benefit.BenefitType = BENEFIT_COMPANYCAR;
        var html = '<table style="vertical-align:top;height:100%;width:100%;">' +
        '<tr><td id="allocated_benefit_details" style="height: 100%; vertical-align:top;"></td></tr>' +
    '</table>';

        ShowModal(html, "Car and car fuel", 700, 400, null);
        display_employeebenefit_details(SelectedAllocatedBenefit);

        var html = '<table><tr>' +
            '<td style="width:75px;padding:0 0 7px 7px;" class="button">' + construct_button("bt1", "Calculate", "btn_allocated_b_calculate", "update_allocated_b(true)", null) + '</td>' +
            '<td style="width:75px;padding:0 0 7px 7px;" class="button">' + construct_button("bt1", "Close", "btn_allocated_b_cancel", "cancel_allocated_b_company_car()", null) + '</td>' +
            '</tr></table>';

        $('#allocated_b_details_buttons').html(html);

        $('#td_checkbox_company_car_second').hide();
        $('#companycar_mileage_side_tab').hide();
    });
}

function process_application_demodata(jdata)
{
    VehiclesMakeList = jdata[0];
    VehiclesModelList = jdata[1];
    VehiclesModelDescription = jdata[2];
    Year = jdata[3];
    YearStart = jdata[4];
    YearEnd = jdata[5];
    YearLong = jdata[6];
}