{"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=\"160\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/Rodman1040Adv-SBT.png\" alt=\"Rodman 1040 Adv - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Rodman 1040 Adv - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"217\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruisingSouthamptonNetleyDome.png\" alt=\"Motor Cruising Southampton Netley Dome\" width=\"800\" height=\"500\" \/>\n    <label><span>Motor Cruising Southampton Netley Dome<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"216\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherMotor.png\" alt=\"Kingfisher Motor - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Kingfisher Motor - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"155\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherMotorboat-SBT.png\" alt=\"Kingfisher Motorboat - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Kingfisher Motorboat - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"159\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/APerfectView-SBT.png\" alt=\"A Perfect View - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>A Perfect View - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"150\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorCruising-SBT.png\" alt=\"RYA Motor Cruising At Anchor - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>RYA Motor Cruising At Anchor - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"154\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorboatTraining-SBT\" alt=\"Motorboat Training - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Motorboat Training - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"153\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruising-SBT.png\" alt=\"RYA Motor Cruising - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>RYA Motor Cruising - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"204\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruisingCourses-Raymarine.png\" alt=\"Motor Cruising Courses - Raymarine - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Motor Cruising Courses - Raymarine - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"207\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorboatCourses-RaymarineNav-SBT.png\" alt=\"RYAMotorboatCourses-RaymarineNav-SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>RYAMotorboatCourses-RaymarineNav-SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"212\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherHelm-SBT.png\" alt=\"Kingfisher Helm - Solent Boat Training\" width=\"800\" height=\"500\" \/>\n    <label><span>Kingfisher Helm - Solent Boat Training<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"205\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorCruising-RaymarineRadar-SBT.png\" alt=\"RYA Motor Cruising - Raymarine Radar - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>RYA Motor Cruising - Raymarine Radar - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"209\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineRadar-SBT.png\" alt=\"Raymarine Radar - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Radar - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"206\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineElectronics-SBT.png\" alt=\"Raymarine Electronics - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Electronics - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide active\" style=\"width:800px\" slide-id=\"208\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineVHF-SBT.png\" alt=\"Raymarine Autopilot &amp; VHF - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Autopilot &amp; VHF - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"211\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineCamera-SBT.png\" alt=\"Raymarine Camera - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Camera - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"210\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineCameraView-SBT.png\" alt=\"Raymarine Camera View - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Camera View - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"214\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/IMG0312.png\" alt=\"Raymarine Camera View - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Raymarine Camera View - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"213\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/NavigationUsingRaymarine-SBT.png\" alt=\"Navigation Using Raymarine - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Navigation Using Raymarine - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"158\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/PickingUptheMOB-SBT.png\" alt=\"Picking Up the MOB - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Picking Up the MOB - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"215\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/YachtmasterMotorCoCPrep-SolentBoatTraining.png\" alt=\"Yachtmaster Motor CoC Prep - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Yachtmaster Motor CoC Prep - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"156\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/EnjoyingtheSights-SBT.png\" alt=\"Enjoying the Sights - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Enjoying the Sights - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"164\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MooredUp-SBT.png\" alt=\"Kingfisher Moored Up - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>Kingfisher Moored Up - SBT<\/span><\/label>\n<\/div><div class=\"gallery-slide\" style=\"width:800px\" slide-id=\"157\" slide-size=\"800x500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/Cruising-SBT.png\" alt=\"RYA Motor Cruising - SBT\" width=\"800\" height=\"500\" \/>\n    <label><span>RYA Motor Cruising - SBT<\/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:800px\" slide-id=\"160\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/Rodman1040Adv-SBT.png\" alt=\"Rodman 1040 Adv - SBT\"\/>\n    <label>Rodman 1040 Adv - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"217\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruisingSouthamptonNetleyDome.png\" alt=\"Motor Cruising Southampton Netley Dome\"\/>\n    <label>Motor Cruising Southampton Netley Dome<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"216\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherMotor.png\" alt=\"Kingfisher Motor - SBT\"\/>\n    <label>Kingfisher Motor - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"155\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherMotorboat-SBT.png\" alt=\"Kingfisher Motorboat - SBT\"\/>\n    <label>Kingfisher Motorboat - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"159\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/APerfectView-SBT.png\" alt=\"A Perfect View - SBT\"\/>\n    <label>A Perfect View - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"150\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorCruising-SBT.png\" alt=\"RYA Motor Cruising At Anchor - SBT\"\/>\n    <label>RYA Motor Cruising At Anchor - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"154\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorboatTraining-SBT\" alt=\"Motorboat Training - SBT\"\/>\n    <label>Motorboat Training - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"153\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruising-SBT.png\" alt=\"RYA Motor Cruising - SBT\"\/>\n    <label>RYA Motor Cruising - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"204\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MotorCruisingCourses-Raymarine.png\" alt=\"Motor Cruising Courses - Raymarine - SBT\"\/>\n    <label>Motor Cruising Courses - Raymarine - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"207\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorboatCourses-RaymarineNav-SBT.png\" alt=\"RYAMotorboatCourses-RaymarineNav-SBT\"\/>\n    <label>RYAMotorboatCourses-RaymarineNav-SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"212\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/KingfisherHelm-SBT.png\" alt=\"Kingfisher Helm - Solent Boat Training\"\/>\n    <label>Kingfisher Helm - Solent Boat Training<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"205\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RYAMotorCruising-RaymarineRadar-SBT.png\" alt=\"RYA Motor Cruising - Raymarine Radar - SBT\"\/>\n    <label>RYA Motor Cruising - Raymarine Radar - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"209\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineRadar-SBT.png\" alt=\"Raymarine Radar - SBT\"\/>\n    <label>Raymarine Radar - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"206\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineElectronics-SBT.png\" alt=\"Raymarine Electronics - SBT\"\/>\n    <label>Raymarine Electronics - SBT<\/label>\n<\/div><div class=\"gallery-thumb active\" style=\"width:800px\" slide-id=\"208\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineVHF-SBT.png\" alt=\"Raymarine Autopilot &amp; VHF - SBT\"\/>\n    <label>Raymarine Autopilot &amp; VHF - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"211\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineCamera-SBT.png\" alt=\"Raymarine Camera - SBT\"\/>\n    <label>Raymarine Camera - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"210\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/RaymarineCameraView-SBT.png\" alt=\"Raymarine Camera View - SBT\"\/>\n    <label>Raymarine Camera View - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"214\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/IMG0312.png\" alt=\"Raymarine Camera View - SBT\"\/>\n    <label>Raymarine Camera View - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"213\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/NavigationUsingRaymarine-SBT.png\" alt=\"Navigation Using Raymarine - SBT\"\/>\n    <label>Navigation Using Raymarine - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"158\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/PickingUptheMOB-SBT.png\" alt=\"Picking Up the MOB - SBT\"\/>\n    <label>Picking Up the MOB - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"215\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/YachtmasterMotorCoCPrep-SolentBoatTraining.png\" alt=\"Yachtmaster Motor CoC Prep - SBT\"\/>\n    <label>Yachtmaster Motor CoC Prep - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"156\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/EnjoyingtheSights-SBT.png\" alt=\"Enjoying the Sights - SBT\"\/>\n    <label>Enjoying the Sights - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"164\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/MooredUp-SBT.png\" alt=\"Kingfisher Moored Up - SBT\"\/>\n    <label>Kingfisher Moored Up - SBT<\/label>\n<\/div><div class=\"gallery-thumb\" style=\"width:800px\" slide-id=\"157\" width=\"800\" height=\"500\">\n    <img src=\"\/userfiles\/image_cache\/modules\/gallery\/160\/shrink-fill\/800-x-500\/Cruising-SBT.png\" alt=\"RYA Motor Cruising - SBT\"\/>\n    <label>RYA Motor Cruising - SBT<\/label>\n<\/div>\n        <\/div>\n    <\/div>\n    <\/div>","type":"dialogue","class":"gallery","js":"var 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        \n        ddiv.dialog(\"option\", \"width\", container_width);\n        \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});"}