/*----------------------------------------------------------------------
[Global JavaScript ] 
Desc: RED site wide JavaScript		
-----------------------------------------------------------------------*/

(function($) {
    $(document).ready(function() {
        try{
          geoIPWelcome();
         $('input[type=checkbox].switch').makeSwitch();
       }catch(Error ){}
        customScrollBar();
    });

    /* Global > Close welcome message and write cookie --------------------*/
    function geoIPWelcome() {
        if ($("#CloseWelcomeOverlay").length > 0) {
            $('#CloseWelcomeOverlay').click(function() {
                //Hide overlay and message box
                $('#welcomeMessageOverlay').fadeOut(200);
                $('#welcomeMessageOverlayBoxWrapper').hide().empty();

                //Create welcome cookie options
                var cookie_name = 'WelcomeMessage';
                var hostname = window.location.hostname;
                var expiryDate = new Date(10000, 0, 1, 0, 0, 0); //1 Jan 10000
                var options = { path: '/', expires: expiryDate };

                //Write cookie
                $.cookie(cookie_name, hostname, options);

                //Don't follow link
                return false;
            });
        }
    };

    /* AF: sort this out */
    //$(document).mouseenter(function() {
        //if (!videoPlayer.isPlaying()) videoPlayer.play();
    //}).mouseleave(function() {
        //videoPlayer.pause();
    //});
    
})(jQuery);
