﻿/// <reference path="../doco.js" />
/// <reference path="~/User_Control/PropertyDetails.ascx" />

$(function () {
    $("#lightboxlinks a").lightbox({
        fitToScreen: true,
        fileLoadingImage: m_fileLoadingImage,
        fileBottomNavCloseImage: m_fileBottomNavCloseImage
    });

   


    //Scrolling Pricing Table
    var oTable = $('table.datestable');

    //Work out the width of the scroll area based on how many pricing cells
    var reqWidth = 60 * ($('tr:eq(1) td', oTable).length - 1);



    //If less that width of the of the available space minus 212px then don't use the scrolling datatable
    if (reqWidth > 360) {
        //Scrolling Pricing Table
        oTable.dataTable({
            "sDom": "t",
            "sScrollX": "100%",
            "sScrollXInner": reqWidth,
            "bScrollCollapse": true,
            "bPaginate": false,
            "bSort": false
        });
        new FixedColumns(oTable, {
            "sLeftWidth": "fixed",
            "iLeftWidth": 212
        });
    } else {
        oTable.dataTable({

            "sDom": "t",
            "bPaginate": false,
            "bSort": false
        });
    }

    if (oTable.length)
    { oTable.fnFilter($('select.stayOptions option:selected').val() + '.nights'); }


    //Filter the table to show the rows with
    $('p.propInterest .stayOptions').change(function () {
        var nightVal = $(this).val();

        if (nightVal == 0) {
            oTable.fnFilter('');
        }
        else {
            oTable.fnFilter(nightVal + '.nights');
        }
    });

    // Next 
   // Season
    //Scrolling Pricing Table

    
    var  oTable1 = $('table.datestablenext');

    //Work out the width of the scroll area based on how many pricing cells
    var reqWidth1 = 60 * ($('tr:eq(1) td', oTable1).length - 1);



    //If less that width of the of the available space minus 212px then don't use the scrolling datatable
    if (reqWidth1 > 360) {
        //Scrolling Pricing Table
        oTable1.dataTable({
            "sDom": "t",
            "sScrollX": "100%",
            "sScrollXInner": reqWidth,
            "bScrollCollapse": true,
            "bPaginate": false,
            "bSort": false
        });
        new FixedColumns(oTable1, {
            "sLeftWidth": "fixed",
            "iLeftWidth": 212
        });
    } else {
        oTable1.dataTable({

            "sDom": "t",
            "bPaginate": false,
            "bSort": false
        });
    }

    if (oTable1.length)
    { oTable1.fnFilter($('select.stayOptionsnext option:selected').val() + '.nights'); }


    //Filter the table to show the rows with
    $('p.propInterest .stayOptionsnext').change(function () {
        var nightVal = $(this).val();

        if (nightVal == 0) {
            oTable1.fnFilter('');
        }
        else {
            oTable1.fnFilter(nightVal + '.nights');
        }
    });

//    $('#summarydiv #moredetails').click(function () {

//        $('#summarydiv').addClass("hidden");
//        $('#fullsummarydiv').removeClass("hidden");
//    });

//    $('#fullsummarydiv #lessdetails').click(function () {

//        $('#fullsummarydiv').addClass("hidden");
//        $('#summarydiv').removeClass("hidden");
//    });



    $('div.propOffer li:nth-child(odd)').addClass('altLI');

    //Kendo tabstrip
    var tabstrip = $('.tabStrip').kendoTabStrip().data('kendoTabStrip');
    tabstrip.select(tabstrip.tabGroup.children('li:first'));




});


 





