<div class="col-lg-10 col-md-10 col-sm-10 col-xs-10 bodyitem">
    <div class="row no-padding">
        <fieldset>
            <div class="modal-header" style="margin-top: 10px;">
                <h5>Opening Hours</h5>
            </div>
            <form>
                <table class="table-bg-color table">
                    <tr>
                        <th style="width: 10%;text-align: center;">Day</th>
                        <th style="width: 10%;text-align: center;">Opened?</th>
                        <th style="width: 50%;text-align: center;">Move Slider To Fix Time Range</th>
                        <th style="width: 20%;text-align: center;">Time</th>
                        <th style="width: 5%;text-align: center;">Col</th>
                        <th style="width: 5%;text-align: center;">Del</th>
                        <th style="width: 10%;text-align: center;">Action</th>
                    </tr>
                    <tr>
                        <td>Mon</td>
                        <td><input type="checkbox" name="is_opened" id="mondayIsOpened" <?php $week['mon']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="mondayRange"></div></td>
                        <td> <span class="monday-slider-starttime"><?php echo $week['mon']->open ?></span> - <span class="monday-slider-endtime"><?php echo $week['mon']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="mondayCollectionTime" <?php $week['mon']->open . '-' . $week['mon']->closed == $week['mon']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="mondayDeliveryTime" <?php $week['mon']->open . '-' . $week['mon']->closed == $week['mon']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="mondayServiceTime">
                            <input type="hidden" name="day" value="mon"/>
                            <input type="hidden" name="open" id="mondayOpen" value="<?php echo $week['mon']->open ?>"/>
                            <input type="hidden" name="closed" id="mondayClosed" value="<?php echo $week['mon']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('monday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Tue</td>
                        <td><input type="checkbox" name="is_opened" id="tuesdayIsOpened" <?php $week['tue']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="tuesdayRange"></div></td>
                        <td> <span class="tuesday-slider-starttime"><?php echo $week['tue']->open ?></span> - <span class="tuesday-slider-endtime"><?php echo $week['tue']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="tuesdayCollectionTime" <?php $week['tue']->open . '-' . $week['tue']->closed == $week['tue']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="tuesdayDeliveryTime" <?php $week['tue']->open . '-' . $week['tue']->closed == $week['tue']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="tuesdayServiceTime">
                            <input type="hidden" name="day" value="tue"/>
                            <input type="hidden" name="open" id="tuesdayOpen" value="<?php echo $week['tue']->open ?>"/>
                            <input type="hidden" name="closed" id="tuesdayClosed" value="<?php echo $week['tue']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('tuesday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Wed</td>
                        <td><input type="checkbox" name="is_opened" id="wednesdayIsOpened" <?php $week['wed']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="wednesdayRange"></div></td>
                        <td> <span class="wednesday-slider-starttime"><?php echo $week['wed']->open ?></span> - <span class="wednesday-slider-endtime"><?php echo $week['wed']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="wednesdayCollectionTime" <?php $week['wed']->open . '-' . $week['wed']->closed == $week['wed']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="wednesdayDeliveryTime" <?php $week['wed']->open . '-' . $week['wed']->closed == $week['wed']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="wednesdayServiceTime">
                            <input type="hidden" name="day" value="wed"/>
                            <input type="hidden" name="open" id="wednesdayOpen" value="<?php echo $week['wed']->open ?>"/>
                            <input type="hidden" name="closed" id="wednesdayClosed" value="<?php echo $week['wed']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('wednesday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Thu</td>
                        <td><input type="checkbox" name="is_opened" id="thursdayIsOpened" <?php $week['thu']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="thursdayRange"></div></td>
                        <td> <span class="thursday-slider-starttime"><?php echo $week['thu']->open ?></span> - <span class="thursday-slider-endtime"><?php echo $week['thu']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="thursdayCollectionTime" <?php $week['thu']->open . '-' . $week['thu']->closed == $week['thu']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="thursdayDeliveryTime"  <?php $week['thu']->open . '-' . $week['thu']->closed == $week['thu']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="thursdayServiceTime">
                            <input type="hidden" name="day" value="thu"/>
                            <input type="hidden" name="open" id="thursdayOpen" value="<?php echo $week['thu']->open ?>"/>
                            <input type="hidden" name="closed" id="thursdayClosed" value="<?php echo $week['thu']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('thursday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Fri</td>
                        <td><input type="checkbox" name="is_opened" id="fridayIsOpened" <?php $week['fri']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="fridayRange"></div></td>
                        <td> <span class="friday-slider-starttime"><?php echo $week['fri']->open ?></span> - <span class="friday-slider-endtime"><?php echo $week['fri']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="fridayCollectionTime" <?php $week['fri']->open . '-' . $week['fri']->closed == $week['fri']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="fridayDeliveryTime" <?php $week['fri']->open . '-' . $week['fri']->closed == $week['fri']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="fridayServiceTime">
                            <input type="hidden" name="day" value="fri"/>
                            <input type="hidden" name="open" id="fridayOpen" value="<?php echo $week['fri']->open ?>"/>
                            <input type="hidden" name="closed" id="fridayClosed" value="<?php echo $week['fri']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('friday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Sat</td>
                        <td><input type="checkbox" name="is_opened" id="saturdayIsOpened" <?php $week['sat']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="saturdayRange"></div></td>
                        <td> <span class="saturday-slider-starttime"><?php echo $week['sat']->open ?></span> - <span class="saturday-slider-endtime"><?php echo $week['sat']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="saturdayCollectionTime"  <?php $week['sat']->open . '-' . $week['sat']->closed == $week['sat']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="saturdayDeliveryTime"  <?php $week['sat']->open . '-' . $week['sat']->closed == $week['sat']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="saturdayServiceTime">
                            <input type="hidden" name="day" value="sat"/>
                            <input type="hidden" name="open" id="saturdayOpen" value="<?php echo $week['sat']->open ?>"/>
                            <input type="hidden" name="closed" id="saturdayClosed" value="<?php echo $week['sat']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('saturday')">
                        </td>
                    </tr>
                    <tr>
                        <td>Sun</td>
                        <td><input type="checkbox" name="is_opened" id="sundayIsOpened" <?php $week['sun']->is_opened == 'yes' ? print "checked='true'" : '' ?>></td>
                        <td> <div id="sundayRange"></div></td>
                        <td> <span class="sunday-slider-starttime"><?php echo $week['sun']->open ?></span> - <span class="sunday-slider-endtime"><?php echo $week['sun']->closed ?></span></td>
                        <td><input type="checkbox" name="col_time" id="sundayCollectionTime"  <?php $week['sun']->open . '-' . $week['sun']->closed == $week['sun']->col_time ? print "checked=true" : '' ?>></td>
                        <td><input type="checkbox" name="del_time" id="sundayDeliveryTime"  <?php $week['sun']->open . '-' . $week['sun']->closed == $week['sun']->del_time ? print "checked=true" : '' ?>></td>
                        <td id="sundayServiceTime">
                            <input type="hidden" name="day" value="sun"/>
                            <input type="hidden" name="open" id="sundayOpen" value="<?php echo $week['sun']->open ?>"/>
                            <input type="hidden" name="closed" id="sundayClosed" value="<?php echo $week['sun']->closed ?>"/>
                            <input style="padding:5px 10px;" class="common-btn-bg" type="button" name="submit_form" value="<?php echo $this->lang->line('gkpos_save') ?>" onclick="saveServiceTime('sunday')">
                        </td>
                    </tr>
                </table>
            </form>
        </fieldset>
    </div>
</div>
<style>
    #time-range p {
        font-family:"Arial", sans-serif;
        font-size:14px;
        color:#333;
    }
    .ui-slider-horizontal {
        height: 8px;
        background: #D7D7D7;
        border: 1px solid #BABABA;
        box-shadow: 0 1px 0 #FFF, 0 1px 0 #CFCFCF inset;
        clear: both;
        margin: 8px 0;
        -webkit-border-radius: 6px;
        -moz-border-radius: 6px;
        -ms-border-radius: 6px;
        -o-border-radius: 6px;
        border-radius: 6px;
    }
    .ui-slider {
        position: relative;
        text-align: left;
    }
    .ui-slider-horizontal .ui-slider-range {
        top: -1px;
        height: 100%;
    }
    .ui-slider .ui-slider-range {
        position: absolute;
        z-index: 1;
        height: 8px;
        font-size: .7em;
        display: block;
        border: 1px solid #5BA8E1;
        box-shadow: 0 1px 0 #AAD6F6 inset;
        -moz-border-radius: 6px;
        -webkit-border-radius: 6px;
        -khtml-border-radius: 6px;
        border-radius: 6px;
        background: #81B8F3;
        background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
        background-size: 100%;
        background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #A0D4F5), color-stop(100%, #81B8F3));
        background-image: -webkit-linear-gradient(top, #A0D4F5, #81B8F3);
        background-image: -moz-linear-gradient(top, #A0D4F5, #81B8F3);
        background-image: -o-linear-gradient(top, #A0D4F5, #81B8F3);
        background-image: linear-gradient(top, #A0D4F5, #81B8F3);
    }
    .ui-slider .ui-slider-handle {
        border-radius: 50%;
        background: #F9FBFA;
        background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
        background-size: 100%;
        background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(0%, #C7CED6), color-stop(100%, #F9FBFA));
        background-image: -webkit-linear-gradient(top, #C7CED6, #F9FBFA);
        background-image: -moz-linear-gradient(top, #C7CED6, #F9FBFA);
        background-image: -o-linear-gradient(top, #C7CED6, #F9FBFA);
        background-image: linear-gradient(top, #C7CED6, #F9FBFA);
        width: 22px;
        height: 22px;
        -webkit-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset;
        -moz-box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset;
        box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.6), 0 -1px 0 1px rgba(0, 0, 0, 0.15) inset, 0 1px 0 1px rgba(255, 255, 255, 0.9) inset;
        -webkit-transition: box-shadow .3s;
        -moz-transition: box-shadow .3s;
        -o-transition: box-shadow .3s;
        transition: box-shadow .3s;
    }
    .ui-slider .ui-slider-handle {
        position: absolute;
        z-index: 2;
        width: 22px;
        height: 22px;
        cursor: default;
        border: none;
        cursor: pointer;
    }
    .ui-slider .ui-slider-handle:after {
        content:"";
        position: absolute;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        top: 50%;
        margin-top: -4px;
        left: 50%;
        margin-left: -4px;
        background: #30A2D2;
        -webkit-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF;
        -moz-box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 white;
        box-shadow: 0 1px 1px 1px rgba(22, 73, 163, 0.7) inset, 0 1px 0 0 #FFF;
    }
    .ui-slider-horizontal .ui-slider-handle {
        top: -.5em;
        margin-left: -.6em;
    }
    .ui-slider a:focus {
        outline:none;
    }
</style>

<script>
    $(document).ready(function () {
        mondaySlider();
        tuesdaySlider();
        wednessdaySlider();
        thursdaySlider();
        fridaySlider();
        saturdaySlider();
        sundaySlider();
    });
    function saveServiceTime(form) {
        

        var isOpened = 'no';
        if ($("#" + form + 'IsOpened').is(":checked")) {
            isOpened = 'yes';
        }
        var isColTime = 'no';
        if ($("#" + form + 'CollectionTime').is(":checked")) {
            isColTime = 'yes';
        }
        var isDelTime = 'no';
        if ($("#" + form + 'DeliveryTime').is(":checked")) {
            isDelTime = 'yes';
        }
        var day = $("#" + form + "ServiceTime input[name='day']").val();
        var open = $("#" + form + "ServiceTime input[name='open']").val();
        var closed = $("#" + form + "ServiceTime input[name='closed']").val();
        $.ajax({
            url: "<?php echo site_url('gkpos/online/save_openinghour') ?>",
            data: {
                day: day,
                is_opened: isOpened,
                open: open,
                closed: closed,
                isColTime: isColTime,
                isDelTime: isDelTime

            },
            type: "POST",
            dataType: "json",
            success: function (output) {
                if (output.success) {
                    ALERT_TITLE = "<?php echo $this->lang->line('gkpos_alert_title_success') ?>";
                    alert(output.message);
                } else {
                    ALERT_TITLE = "<?php echo $this->lang->line('gkpos_alert_title_error') ?>";
                    alert(output.message);

                }
            }
        });




    }
    function mondaySlider() {
        var open = Number('<?php echo $week['mon']->opentime ?>');
        var closed = Number('<?php echo $week['mon']->closedtime ?>');
        $("#mondayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.monday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#mondayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.monday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#mondayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function tuesdaySlider() {
        var open = Number('<?php echo $week['tue']->opentime ?>');
        var closed = Number('<?php echo $week['tue']->closedtime ?>');
        $("#tuesdayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.tuesday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#tuesdayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.tuesday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#tuesdayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function wednessdaySlider() {
        var open = Number('<?php echo $week['wed']->opentime ?>');
        var closed = Number('<?php echo $week['wed']->closedtime ?>');
        $("#wednesdayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.wednesday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#wednesdayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.wednesday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#wednesdayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function thursdaySlider() {
        var open = Number('<?php echo $week['thu']->opentime ?>');
        var closed = Number('<?php echo $week['thu']->closedtime ?>');
        $("#thursdayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.thursday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#thursdayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.thursday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#thursdayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function fridaySlider() {
        var open = Number('<?php echo $week['fri']->opentime ?>');
        var closed = Number('<?php echo $week['fri']->closedtime ?>');
        $("#fridayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.friday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#fridayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.friday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#fridayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function saturdaySlider() {
        var open = Number('<?php echo $week['sat']->opentime ?>');
        var closed = Number('<?php echo $week['sat']->closedtime ?>');
        $("#saturdayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 15,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.saturday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#saturdayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.saturday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#saturdayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }
    function sundaySlider() {
        var open = Number('<?php echo $week['sun']->opentime ?>');
        var closed = Number('<?php echo $week['sun']->closedtime ?>');
        $("#sundayRange").slider({
            range: true,
            min: 0,
            max: 1440,
            step: 5,
            values: [open, closed],
            slide: function (e, ui) {
                var hours1 = Math.floor(ui.values[0] / 60);
                var minutes1 = ui.values[0] - (hours1 * 60);
                if (hours1.length == 1)
                    hours1 = '0' + hours1;
                if (minutes1.length == 1)
                    minutes1 = '0' + minutes1;
                if (minutes1 == 0)
                    minutes1 = '00';
                if (hours1 >= 12) {
                    if (hours1 == 12) {
                        hours1 = hours1;
                        minutes1 = minutes1 + " PM";
                    } else {
                        hours1 = hours1 - 12;
                        minutes1 = minutes1 + " PM";
                    }
                } else {
                    hours1 = hours1;
                    minutes1 = minutes1 + " AM";
                }
                if (hours1 == 0) {
                    hours1 = 12;
                    minutes1 = minutes1;
                }
                $('.sunday-slider-starttime').html(hours1 + ':' + minutes1);
                $('#sundayOpen').val(hours1 + ':' + minutes1);
                var hours2 = Math.floor(ui.values[1] / 60);
                var minutes2 = ui.values[1] - (hours2 * 60);
                if (hours2.length == 1)
                    hours2 = '0' + hours2;
                if (minutes2.length == 1)
                    minutes2 = '0' + minutes2;
                if (minutes2 == 0)
                    minutes2 = '00';
                if (hours2 >= 12) {
                    if (hours2 == 12) {
                        hours2 = hours2;
                        minutes2 = minutes2 + " PM";
                    } else if (hours2 == 24) {
                        hours2 = 11;
                        minutes2 = "59 PM";
                    } else {
                        hours2 = hours2 - 12;
                        minutes2 = minutes2 + " PM";
                    }
                } else {
                    hours2 = hours2;
                    minutes2 = minutes2 + " AM";
                }
                $('.sunday-slider-endtime').html(hours2 + ':' + minutes2);
                $('#sundayClosed').val(hours2 + ':' + minutes2);
            }
        });
    }


</script>
