function include(scriptUrl) {
    document.write('<script src="' + scriptUrl + '"></script>');
}

function isIE() {
    var myNav = navigator.userAgent.toLowerCase();
    return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
};

/* cookie.JS
 ========================================================*/
include('/design/abingdonsmiles_theme/js/jquery.cookie.js');

/* Easing library
 ========================================================*/
include('/design/abingdonsmiles_theme/js/jquery.easing.1.3.js');

/* Stick up menus
 ========================================================*/
;
(function ($) {
    var o = $('html');
    if (o.hasClass('desktop')) {
        include('/design/abingdonsmiles_theme/js/tmstickup.js');

        $(document).ready(function () {
            $('#stuck_container').TMStickUp({})
        });
    }
})(jQuery);

/* ToTop
 ========================================================*/
;
(function ($) {
    var o = $('html');
    if (o.hasClass('desktop')) {
        include('/design/abingdonsmiles_theme/js/jquery.ui.totop.js');

        $(document).ready(function () {
            $().UItoTop({
                easingType: 'easeOutQuart',
                containerClass: 'toTop fa fa-angle-up',
                text: ''
            });
        });
    }
})(jQuery);

/* EqualHeights
 ========================================================*/
;
(function ($) {
    var o = $('[data-equal-group]');
    if (o.length > 0) {
        include('/design/abingdonsmiles_theme/js/jquery.equalheights.js');
    }
})(jQuery);


/* Magnific
 ========================================================*/
;
(function ($) {
    var o = $('.magnific');
    if (o.length > 0) {
        include('/design/abingdonsmiles_theme/js/magnific.js');
        
        if($('.modalpopup').length > 0){
            $(document).ready(function () {
                $('.modalpopup').magnificPopup( {
                    type: 'inline', 
                    fixedContentPos: true, 
                    fixedBgPos: true, 
                    overflowY: 'auto', 
                    closeBtnInside: true, 
                    preloader: false, midClick: true, 
                    removalDelay: 300, 
                    mainClass: 'my-mfp-zoom-in'
                });
            });
        }
    }
})(jQuery);

/* SMOOTH SCROLLIG
 ========================================================*/
;
(function ($) {
    var o = $('html');
    if (o.hasClass('desktop')) {
        include('/design/abingdonsmiles_theme/js/jquery.mousewheel.min.js');
        include('/design/abingdonsmiles_theme/js/jquery.simplr.smoothscroll.min.js');

        $(document).ready(function () {
            $.srSmoothscroll({
                step: 150,
                speed: 800
            });
        });
    }
})(jQuery);


/* OWL CAROUSEL
 ========================================================*/
;
(function ($) {
    var o = $('.owl-carousel');
    if (o.length > 0) {
        include('/design/abingdonsmiles_theme/js/owl-carousel.js');
        
        $(document).ready(function () {
            o.owlCarousel({
                loop: true,
                margin: 10,
                rewindNav:false,
                responsiveClass: true,
                autoplay: true,
                autoplaySpeed:500,
                responsive: {
                  0: {
                    items: 1,
                    nav: false
                  },
                  600: {
                    items: 1,
                    nav: false
                  },
                  800: {
                    items: 2,
                    nav: false
                  },
                  1000: {
                    items: 3,
                    nav: false,
                    loop: false,
                    margin: 20
                  }
                }
            })
        });
    }
})(jQuery);


/* Copyright Year
 ========================================================*/
;
(function ($) {
    var currentYear = (new Date).getFullYear();
    $(document).ready(function () {
        $("#copyright-year").text((new Date).getFullYear());
    });
})(jQuery);


/* Superfish menus
 ========================================================*/
;
(function ($) {
    include('/design/abingdonsmiles_theme/js/superfish.js');    
})(jQuery);

/* Navbar
 ========================================================*/
;
(function ($) {
    include('/design/abingdonsmiles_theme/js/jquery.rd-navbar.js');
})(jQuery);


/* Google Map
 ========================================================*/
;
(function ($) {
    var o = document.getElementById("google-map");
    if (o) {
        include('//maps.google.com/maps/api/js?sensor=false');
        include('/design/abingdonsmiles_theme/js/jquery.rd-google-map.js');

        $(document).ready(function () {
            var o = $('#google-map');
            if (o.length > 0) {
                o.googleMap();
            }
        });
    }
})
(jQuery);

/* WOW
 ========================================================*/
;
(function ($) {
    var o = $('html');

    if ((navigator.userAgent.toLowerCase().indexOf('msie') == -1 ) || (isIE() && isIE() > 9)) {
        if (o.hasClass('desktop')) {
            include('/design/abingdonsmiles_theme/js/wow.js');

            $(document).ready(function () {
                new WOW().init();
            });
        }
    }
})(jQuery);

/* Contact Form
 ========================================================*/
;
(function ($) {
    var o = $('#contact-form');
    if (o.length > 0) {
        include('/design/abingdonsmiles_theme/js/modal.js');
        include('/design/abingdonsmiles_theme/js/TMForm.js'); 

        if($('#contact-form .recaptcha').length > 0){
            include('//www.google.com/recaptcha/api/js/recaptcha_ajax.js');
        }
    }
})(jQuery);

/* Camera
========================================================*/
;(function ($) {

var o = $('#camera');
    if (o.length > 0) {
        if (!(isIE() && (isIE() > 9))) {
            include('/design/abingdonsmiles_theme/js/jquery.mobile.customized.min.js');
        }
        include('/design/abingdonsmiles_theme/js/camera.js');
        $(document).ready(function () {
            o.camera({
                autoAdvance: true,
                height: '50%',
                time: 3000,
                minHeight: '350px',
                pagination: false,
                thumbnails: false,
                playPause: true,
                hover: true,
                loader: 'none',
                navigation: true,
                navigationHover: true,
                mobileNavHover: false,
                fx: 'simpleFade',
                overlayer: true,
                portrait: true
            });
        });
    }
})(jQuery);

/* Parallax
========================================================*/
;(function ($) {
    include('/design/abingdonsmiles_theme/js/jquery.rd-parallax.js');
})(jQuery); 

/* Google Map
 ========================================================*/
;
(function ($) {
    var o = document.getElementById("google-map");
    if (o) {
        include('//maps.google.com/maps/api/js?sensor=false');
        include('/design/abingdonsmiles_theme/js/jquery.rd-google-map.js');

        $(document).ready(function () {
            var o = $('#google-map');
            if (o.length > 0) {
                o.googleMap();
            }
        });
    }
})
(jQuery);

/* Orientation tablet fix
 ========================================================*/
$(function () {
    // IPad/IPhone
    var viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]'),
        ua = navigator.userAgent,

        gestureStart = function () {
            viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6, initial-scale=1.0";
        },

        scaleFix = function () {
            if (viewportmeta && /iPhone|iPad/.test(ua) && !/Opera Mini/.test(ua)) {
                viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
                document.addEventListener("gesturestart", gestureStart, false);
            }
        };

    scaleFix();
    // Menu Android
    if (window.orientation != undefined) {
        var regM = /ipod|ipad|iphone/gi,
            result = ua.match(regM);
        if (!result) {
            $('.sf-menus li').each(function () {
                if ($(">ul", this)[0]) {
                    $(">a", this).toggle(
                        function () {
                            return false;
                        },
                        function () {
                            window.location.href = $(this).attr("href");
                        }
                    );
                }
            })
        }
    }
});
var ua = navigator.userAgent.toLocaleLowerCase(),
    regV = /ipod|ipad|iphone/gi,
    result = ua.match(regV),
    userScale = "";
if (!result) {
    userScale = ",user-scalable=0"
}
document.write('<meta name="viewport" content="width=device-width,initial-scale=1.0' + userScale + '">');

//Add alt attributes to slider images to meet accessibility standards
$('img.imgLoaded').attr('alt', 'Slide Image');
//$('*').css('color', 'maroon');

