﻿$(document).ready(function () {


    $(' ul#results li div.imgcontainer a 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 = 170; //medium image

        if (width <= 150) {//narrow portrait
            //alert("1");
            $(this).css('height', 175 + 'px');
        } else if (width <= 150) {
            //alert("1.2");
            $(this).css('width', 125 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 175 + 'px');
        } else if (width <= height && width > 318) { //square
            //alert("3");
            $(this).css('height', 175 + 'px');
        } else {
            //alert("4");
            $(this).css('height', 175 + 'px');
        }
    });

    $(' .fav-img a 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 = 170; //medium image

        if (width <= 120) {//narrow portrait
            //alert("1");
            $(this).css('width', 119 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 170 + 'px');
        } else if (width <= height && width > 318) { //square
            // alert("3");
            $(this).css('height', 170 + 'px');
        } else {
            //alert("4");
            $(this).css('height', 170 + 'px');
        }
    });

    $(' .footer-articles a 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 = 130; //medium image

        if (width <= 231) {//narrow portrait
            //alert("1");
            $(this).css('width', 231 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 130 + 'px');
        } else if (width <= height && width > 130) { //square
            // alert("3");
            $(this).css('height', 130 + 'px');
        } else {
            //alert("4");
            $(this).css('height', 130 + 'px');
        }
    });

    $('div#slider ul li 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 >= 969) {//narrow portrait
            //alert("1");
            $(this).css('width', 970 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('width', 970 + 'px');
        } else if (width <= height && width > 130) { //square
            // alert("3");
            //$(this).css('height', 130 + 'px');
        } else {
            //alert("4");
            //$(this).css('height', 130 + 'px');
        }
    });
    if ($('#content').length) {

        /* Apply fancybox to multiple items */

        $("a[rel=group1]").fancybox({
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'width': 'auto',
            'height': 950,
            'speedIn': 600,
            'speedOut': 200,
            'overlayShow': false
        });
    }
});


$(window).load(function () {
    $(".scroll-hold").animate({ "left": "-958px" }, "slow");
});
