{"html":"<div class=\"gallery-outer col1\">\n    \n    <div class=\"gallery-arrow-left\"><<\/div>\n    <div class=\"gallery-container\">\n        <div class=\"gallery-slides\">\n            <div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"35\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG2017031122561501.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"34\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20161224112447.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"33\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20161009104742.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"32\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20161009104730.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"31\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160819191348.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"30\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160819160144.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"29\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160819153215.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"28\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160805183310.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"27\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160805182535.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"26\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160805182013.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"25\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160805180647.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"24\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160721185511.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"23\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160721181020.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"22\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160716151223.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"21\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160708143309.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"20\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160708141937.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"19\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160625122212.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"18\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160528151854.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide active\" style=\"width:800px\" slide-id=\"17\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160528151829.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"16\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG2016052715315301.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"15\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160527153054.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"14\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20160220161138.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"13\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20151218153902.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"12\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20151218153348.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"11\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMG20151214174234.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"10\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMAG2259.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"9\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMAG2254.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"8\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMAG2252.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"7\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMAG2248.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"6\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/IMAG1645.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"5\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/HARRIETSPAD---WIN20141007155328.JPG\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"4\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/HARRIETSPAD---WIN20141007155000.JPG\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"3\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/HARRIETSPAD---WIN20141007153457.JPG\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"2\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/HARRIETSPAD---WIN20141007153322.JPG\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"1\" slide-size=\"800x600\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/800-x-600\/FBIMG1466515294048.jpg\" alt=\"View\"\/>\n    <label><span>View<\/span><\/label>\n<\/div>\n        <\/div>\n    <\/div>\n    \n    <div class=\"gallery-arrow-right\">><\/div>\n    \n    <div class=\"thumb-container\">\n        <div class=\"gallery-thumbs\">\n            <div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"35\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG2017031122561501.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"34\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20161224112447.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"33\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20161009104742.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"32\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20161009104730.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"31\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160819191348.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"30\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160819160144.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"29\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160819153215.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"28\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160805183310.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"27\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160805182535.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"26\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160805182013.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"25\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160805180647.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"24\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160721185511.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"23\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160721181020.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"22\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160716151223.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"21\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160708143309.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"20\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160708141937.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"19\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160625122212.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"18\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160528151854.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb active\" style=\"width:400px\" slide-id=\"17\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160528151829.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"16\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG2016052715315301.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"15\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160527153054.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"14\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20160220161138.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"13\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20151218153902.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"12\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20151218153348.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"11\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMG20151214174234.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"10\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMAG2259.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"9\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMAG2254.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"8\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMAG2252.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"7\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMAG2248.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"6\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/IMAG1645.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"5\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/HARRIETSPAD---WIN20141007155328.JPG\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"4\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/HARRIETSPAD---WIN20141007155000.JPG\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"3\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/HARRIETSPAD---WIN20141007153457.JPG\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"2\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/HARRIETSPAD---WIN20141007153322.JPG\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:400px\" slide-id=\"1\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/249\/\/84\/expand-crop\/400-x-300\/FBIMG1466515294048.jpg\" alt=\"View\"\/>\n    <label>View<\/label>\n<\/div>\n        <\/div>\n    <\/div>\n    <\/div>","type":"dialogue","class":"gallery","js":"\/\/this goes into directory_gallery via a demand dialogue.\n\nvar view_width = 0;\nvar max_width = 0;\nvar ddiv = arguments[0];\n\nvar load_count = 0;\nvar img_count = $(\".gallery-outer\", ddiv).find(\"img\").length;\n\n$(\".gallery-outer\", ddiv).find(\"img\").on(\"load\", function(){\n    load_count++;\n    if(load_count >= img_count){\n        \n        \/\/set up the gallery dimensions\n        $(\".gallery-slide\", ddiv).each(function(i, e) {\n            var slide_width = $(e).outerWidth(true);\n            if (slide_width > max_width) {\n                max_width = slide_width;\n            }\n        });\n\n        var slide_count = $(\".gallery-slide\", ddiv).length;\n        var view_width = slide_count * (max_width);\n        $(\".gallery-container\", ddiv).width(max_width);\n        $(\".gallery-slides\", ddiv).width(view_width);\n\n\n        $(\".gallery-outer\", ddiv).width($(\".gallery-container\").width() + $(\".gallery-arrow-left\").width() + $(\".gallery-arrow-right\").width());\n\n\n        \/\/set up the thumbnail dimensions\n\n        var container_width = $(\".gallery-outer\").width();\n        var max_thumb_width = 0;\n        var thumb_width = 0;\n\n        $(\".gallery-thumb\", ddiv).each(function(i, e) {\n            var thumb_width = $(e).outerWidth(true);\n            if (thumb_width > max_thumb_width) {\n                max_thumb_width = thumb_width;\n            }\n        });\n\n\n        var thumb_width = slide_count * (max_thumb_width);\n        $(\".thumb-container\", ddiv).width(container_width);\n        $(\".gallery-thumbs\", ddiv).width(thumb_width);\n\n        $(ddiv).dialog(\"option\", \"position\", {\n            my: \"center\", \n            at: \"center\", \n            of: window\n        });\n\n        \/\/end dimension setup\n\n        var drag_drift = 0;\n        var start_pos = 0;\n        var dx_direction = \"left\";\n        var min_left = -(view_width - max_width);\n        var frame_width = max_width;\n        var min_thumb_left = -(thumb_width - container_width);\n\n        \/\/load active slide if any\n\n        var change_view = function(index) {\n            if(!index){\n                index = 0;\n            }\n            view_index = index;\n            var finish = -(index * frame_width);\n    \n            var slides = $(\".gallery-slide\", ddiv);\n            slides.removeClass(\"active\");\n\n            $(slides[index]).addClass(\"active\");\n\n            var thumbs = $(\".gallery-thumb\", ddiv);\n            thumbs.removeClass(\"active\");\n            $(thumbs[index]).addClass(\"active\");\n    \n            $(\".gallery-slides\").stop(true);\n    \n            $(\".gallery-slides\", ddiv).animate({\n                left: finish\n            }, 500);\n        }\n\n        $(\".gallery-arrow-left\").on(\"click\", function(e) {\n            e.preventDefault();\n\n            dx_direction = \"right\";\n            drag_drift = 21;\n            var position = parseInt($(\".gallery-slides\", ddiv).css(\"left\"));\n            $(\".gallery-slides\", ddiv).css({\n                left: (position + 21) + \"px\"\n                });\n            var ui = {\n                position: {\n                    left: position + 21\n                }\n            };\n            stop(null, ui);\n        });\n\n        $(\".gallery-arrow-right\").on(\"click\", function(e) {\n            e.preventDefault();\n\n            dx_direction = \"left\";\n            drag_drift = 21;\n            var position = parseInt($(\".gallery-slides\", ddiv).css(\"left\"));\n            $(\".gallery-slides\", ddiv).css({\n                left: (position - 21) + \"px\"\n                });\n            var ui = {\n                position: {\n                    left: position - 21\n                }\n            };\n            stop(null, ui);\n        });\n\n        var start = function(e, ui) {\n            drag_drift = 0;\n            start_pos = ui.position.left;\n        }\n\n        var drag = function(e, ui) {\n            var diff = (ui.position.left - start_pos);\n            drag_drift = diff;\n            if (drag_drift > 0)\n                dx_direction = \"right\";\n            else\n                dx_direction = \"left\";\n        }\n\n        var stop = function(e, ui) {\n            if (Math.abs(drag_drift) > 20 && ui.position.left < 0 && ui.position.left > min_left) {\n                var finish = 0;\n                if (dx_direction == \"right\") {\n                    finish = ui.position.left + ((Math.abs(ui.position.left) % frame_width));\n                }\n                else {\n                    finish = ui.position.left - (frame_width - (Math.abs(ui.position.left) % frame_width));\n                }\n            } else {\n                if (ui.position.left <= min_left && dx_direction == \"left\") {\n                    finish = min_left;\n                }\n                else if (ui.position.left >= 0 && dx_direction == \"right\") {\n                    finish = 0;\n                }\n                else if (dx_direction == \"left\") {\n                    finish = ui.position.left + ((Math.abs(ui.position.left) % frame_width));\n                }\n                else {\n                    finish = ui.position.left - (frame_width - (Math.abs(ui.position.left) % frame_width));\n                }\n            }\n\n            view_index = Math.abs(finish) \/ frame_width;\n            if (view_index < 0) {\n                view_index = 0;\n            }\n\n            var slides = $(\".gallery-slide\", ddiv);\n            slides.removeClass(\"active\");\n            $(slides[view_index]).addClass(\"active\");\n\n            center_thumbs();\n\n            $(\".gallery-slides\", ddiv).animate({\n                left: finish\n            }, 500);\n        }\n\n        $(\".gallery-slides\").draggable({\n            axis: 'x',\n            start: function(e, ui) {\n                start(e, ui);\n            },\n            drag: function(e, ui) {\n                drag(e, ui);\n            },\n            stop: function(e, ui) {\n                stop(e, ui);\n            }\n\n        });\n\n        \/\/gallery thumbs code\n        var thumb_drag_drift = 0;\n        var thumb_start_pos = 0;\n        var thumb_dragged = false;\n        var thumb_clicked = false;\n\n        $(\".gallery-thumbs\").draggable({\n            axis: 'x',\n            start: function(e, ui) {\n                thumb_start(e, ui);\n            },\n            drag: function(e, ui) {\n                thumb_drag(e, ui);\n            },\n            stop: function(e, ui) {\n                thumb_stop(e, ui);\n            }\n\n        });\n\n        var thumb_start = function(e, ui) {\n            thumb_drag_drift = 0;\n            thumb_start_pos = ui.position.left;\n            thumb_dragged = true;\n        }\n\n        var thumb_drag = function(e, ui) {\n            var diff = (ui.position.left - thumb_start_pos);\n            thumb_drag_drift = diff;\n            if (thumb_drag_drift > 0) {\n                dx_direction = \"right\";\n            }\n            else {\n                dx_direction = \"left\";\n            }\n        }\n\n        var thumb_stop = function(e, ui) {\n            var finish = 0;\n            if (Math.abs(thumb_drag_drift) > 20 && ui.position.left < 0 && ui.position.left > min_thumb_left) {\n                if (dx_direction == \"right\") {\n                    finish = ui.position.left + ((Math.abs(ui.position.left) % max_thumb_width));\n                }\n                else {\n                    finish = ui.position.left - (max_thumb_width - (Math.abs(ui.position.left) % max_thumb_width));\n                }\n            } else {\n\n                if (dx_direction == \"left\" && Math.abs(thumb_drag_drift) > 20) {\n                    if (ui.position.left <= min_thumb_left) {\n                        finish = min_thumb_left;\n                    }\n                }\n            }\n\n            $(\".gallery-thumbs\", ddiv).animate({\n                left: finish\n            }, 500);\n        }\n\n        $(\".gallery-thumb\", ddiv).on(\"click\", function(e) {\n            if (thumb_dragged && Math.abs(thumb_drag_drift) > 5) {\n                thumb_dragged = false;\n                e.preventDefault();\n                return;\n            }\n            change_view($(this).index());\n            center_thumbs();\n        });\n\n        var center_thumbs = function() {\n            var thumbs = $(\".gallery-thumb\", ddiv);\n            thumbs.removeClass(\"active\");\n            $(thumbs[view_index]).addClass(\"active\");\n\n            \/\/console.log($(thumbs[view_index]).position());\n\n            var center = container_width \/ 2;\n            var overleft = -(view_index * max_thumb_width - (center - (max_thumb_width \/ 2)));\n\n            if (overleft > 0) {\n                overleft = 0;\n            } else if (overleft < min_thumb_left) {\n                overleft = min_thumb_left;\n            }\n\n            $(\".gallery-thumbs\", ddiv).stop(true);\n\n            $(\".gallery-thumbs\", ddiv).animate({\n                left: overleft\n            }, 500);\n        }\n\n        var view_index = $(\".gallery-slide.active\", ddiv).index();\n\n        if (view_index > 0) {\n            change_view(view_index);\n        }\n    }\n});"}