﻿$(document).ready(function () {

    function resize(winHeight) {

        if (!navigator.userAgent.match(/iPad/i)) {
            if (winHeight > 864 && winHeight < 1050) {
                $('#CntntCntnr').addClass('Medium').removeClass('Small');
                // alert('1 ' + winHeight);
            } else if (winHeight >= 1050) {
                $('#CntntCntnr').addClass('Large').removeClass('Small');
                // alert('2 ' + winHeight);
            } else {
                //do nothing
                // alert('3 ' + winHeight);
                $('#CntntCntnr').addClass('Small'); //.removeClass('Small');
            }
        } else {
            //alert('Ipad');
            $('#CntntCntnr').addClass('Ipad').removeClass('Small');

        }
    }

    resize(screen.height);

    //HIDE UNECESSARY PADDING ON FIRST AND LAST NAV LIST ITEMS
    $("a.Women, a.Men, a.SpecialBookings").next().find('li:first').css('padding', '0 5px 0 0');
    $("a.About").next().find('li:first').css('padding', '0 0 0 5px');

    //RESULT THUMB HOVER
    $(".ResultCntnr").hover(
        function () {
            $(this).find('div.MdlNm').attr('class', 'MdlNm2');
            $(this).css("cursor", "pointer");

        },
        function () {
            $(this).find('div.MdlNm2').attr('class', 'MdlNm');
        }
     );

});

$(window).load(function () {
    

    /*If large image version is used  for thumbnail*/
    $('.ResultThmb img').each(function (index) {
        //set width and height of thumbnail if original width of image is less than container div
        var width, height
        width = $(this).width();
        height = 450; //medium image 

        if (width <= 346) {//narrow portrait
            //alert("1");
            $(this).css('width', 146 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 190 + 'px');
        } else if (width <= height && width > 362) { //square
            //alert("3");
            $(this).css('height', 190 + 'px');
        } else { 
            //alert("4");
            $(this).css('height', 190 + 'px');
        }
    });

    /*If medium image version is used  for thumbnail
    $('.ResultThmb img').each(function (index) {
        //set width and height of thumbnail if original width of image is less than container div
        var width, height
        width = $(this).width();
        height = 225; //medium image 

        if (width <= 173) {//narrow portrait
            //alert("1");
            $(this).css('width', 146 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 190 + 'px');
        } else if (width <= height && width > 173) { //square
            //alert("3");
            $(this).css('height', 190 + 'px');
        } else {
            //alert("4");
            $(this).css('height', 190 + 'px');
        }
    });*/




});
