﻿$(function () {
    $("input.date-picker").datepicker({
        showOn: "button",
        buttonImageOnly: true,
        buttonImage: "../../img/calendar_icon.png",
        buttonText: "",
        dateFormat: "dd/mm/yy",
        changeMonth: true,
        changeYear: true,
        yearRange: "-120:-18",
        defaultDate: -10950   // 30 years from today
    });
    $("input.date-picker").attr('title', 'Enter date in dd/mm/yyyy format,eg: 13/12/1995.');

    // stops login screen from showing in modal
    $('.modal').each(function () {
        if ($(this).css('display') != 'none') {
            document.body.style.display = 'none';
            window.location.reload();
        }
    });

    // stops login screen from showing in the your dogs table
    if ($('#dogs-grid').length > 0) {
        document.body.style.display = 'none';
        window.location.reload();
    }

    // stops login screen from showing in iframe
    var isInIFrame = (window.location != window.parent.location) ? true : false;
    if (isInIFrame) {
        parent.document.body.style.display = 'none';
        parent.location = window.location;
    }
});