$(document).ready(function () {

    //If the cookie does not exist display the overlay		
    if (!$.cookie('swp_cookie')) {

        // select the overlay element - and "make it an overlay"
        $(".splash").overlay({

            // custom top position
            top: 130,
            right: 50,

            // some mask tweaks suitable for facebox-looking dialogs
            mask: {

                // you might also consider a "transparent" color for the mask
                color: '#000',

                // load mask a little faster
                loadSpeed: 200,

                // very transparent
                opacity: 0.7
            },

            // disable this for modal dialog-type of overlays
            closeOnClick: false,

            // load it immediately after the construction
            load: true

        });

        //If close is clicked this also sets a cookie 
        //        $(".splash").overlay().onClose(function () {
        //            debugger;
        //            jQuery.cookie('swp_cookie', 'English');
        //            $(".splash").overlay().close();
        //        });

        //Set the cookie when ENGLISH language option is clicked in the overlay
        $(".select1").click(function () {
            
            jQuery.cookie('swp_cookie', 'English', { expires: 70 });
            $(".splash").overlay().close();
        });

        //Set the cookie when WELSH language option is clicked in the overlay
        $(".select2").click(function () {
            //create the Welsh cookie
            jQuery.cookie('swp_cookie', 'Welsh', { expires: 70 });
            $(".splash").overlay().close();
        });

        $(".close").click(function () {
            //Create the English cookie
            jQuery.cookie('swp_cookie', 'English', { expires: 70 });
            $(".splash").overlay().close();
        });

    }

});





