document.write("\u003cspan class=\"vegas_countdown\"\u003e\r\n\u003cspan class=\"Countdown-box-last-hour_vegas\"\u003e\r\n\u003cspan class=\"Countdown-Dh_vegas\"\u003e\u003c/span\u003e\r\n\u003cspan class=\"Countdown-m_vegas\"\u003e\u003c/span\u003e\r\n\u003cspan class=\"Countdown-s_vegas\"\u003e\u003c/span\u003e\r\n\u003c/span\u003e\r\n\u003c/span\u003e");


var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = "/*文言差し込み*/\r\n/*vegas_test*/\r\n.Countdown-box-before_vegas::before{\r\n\tcontent:\"7月30日（日）まで\";\r\n\tfont-weight: normal;\r\n}\r\n.Countdown-Dh_vegas::before{\r\n\tcontent:\"残り\";\r\n\tmargin-right: 0.2em;\r\n\tfont-weight: normal;\r\n}\r\n.Countdown-Dh_vegas::after{\r\n\tcontent:\"時間\";\r\n\tmargin-right: 0.2em;\r\n\tmargin-left: 0.2em;\r\n\tfont-weight: normal;\r\n}\r\n.Countdown-m_vegas::after{\r\n\tcontent:\"分\";\r\n\tmargin-right: 0.2em;\r\n\tmargin-left: 0.2em;\r\n\tfont-weight: normal;\r\n}\r\n.Countdown-s_vegas::after{\r\n\tcontent:\"秒\";\r\n\tmargin-left: 0.2em;\r\n\tfont-weight: normal;\r\n}\r\n.Countdown-D_vegas::before,\r\n.Countdown-Dh_vegas::before,\r\n.Countdown-D_vegas::after,\r\n.Countdown-Dh_vegas::after,\r\n.Countdown-m_vegas::after,\r\n.Countdown-s_vegas::after\r\n{\r\n\tfont-size:0.8em;\r\n}\r\n.Countdown-D_vegas,\r\n.Countdown-Dh_vegas,\r\n.Countdown-m_vegas,\r\n.Countdown-s_vegas{\r\n\tvertical-align: middle;\r\n\tfont-weight: bold;\r\n\tdisplay: inline-block;\r\n\tfont-size: 1.2em;\r\n}\r\n\r\n\r\n\r\n/*座標調整*/\r\n/*PC、タブレット共通*/\r\n@media screen and (min-width: 768px){\r\n\t.vegas_countdown{\r\n\t\tdisplay:block;\r\n\t\tposition:absolute;\r\n\t\t/*background: rgba(0,0,0,0.5);*/\r\n\t\tpadding: 10px;\r\n\t\tright: 0;\r\n\t\tbottom: 0;\r\n\t}\r\n\ta:hover .vegas_countdown span{\r\n\t\ttext-decoration: none !important;\r\n\t\topacity: 0.8;\r\n\t}\r\n}\r\n/*PC*/\r\n@media screen and (min-width: 1200px) {\r\n\t.vegas_countdown{\r\n\t\tfont-size: 28px;\r\n\r\n\t}\r\n}\r\n/*タブレット*/\r\n@media screen and (min-width: 768px) and (max-width: 1199px) {\r\n\t.vegas_countdown{\r\n    \tfont-size: 28px;\r\n\t}\r\n}\r\n/*スマホ*/\r\n@media screen and (max-width: 767px) {\r\n\t#vegas.item \u003e a \u003e span {\r\n\t\tbackground: none;\r\n\t\tpadding: 0 0 8px 0;\r\n\t}\r\n\t.vegas_countdown{\r\n    \tfont-size: 21px;\r\n\t\tcolor: #fff !important;\r\n\t}\r\n}\r\n\r\n.vegas_countdown{\r\n\t\tcolor: #000;\r\n\r\n\t}\r\n";
document.head.appendChild(style);

if (typeof jQuery ==='undefined') document.write('<scr' + 'ipt src="/js_sc/jq/jQuery-latest" type="text/javascript"></scr' + 'ipt>');
(function (){
var jQueryCheck = setInterval(function () {
    if(typeof jQuery !=='undefined') {
        clearInterval(jQueryCheck);
        (function ($) {
            jQuery('body').addClass('vegas_countdown-days-days-days-0 vegas_countdown-days-days-hours-11');
            var base_countdown = function () {
                var elementSelectors = {
                    day: '.Countdown-D_vegas',       //日を表示するセレクタ
                    day_hour: '.Countdown-Dh_vegas',  //日（時間）を表示するセレクタ
                    hour: '.Countdown-h_vegas',      //時を表示するセレクタ
                    minute: '.Countdown-m_vegas',    //分を表示するセレクタ
                    second: '.Countdown-s_vegas'     //秒を表示するセレクタ
                };
                var Initialize = 1;
                var target_time = new Date('2017/07/31 0:00:00');//ターゲット時間
                var local_time = new Date();
                var now_time = new Date('2017/07/30 12:46:56');//現在時刻時間
                var server_time = new Date('2017/07/30 12:46:56');//サーバー時間
                var reload_time = new Date('2017/07/30 23:59:59');//リロード時間
                var difference = (local_time - server_time) + (local_time - now_time);
                target_time.setMilliseconds(target_time.getMilliseconds() + difference);
                reload_time.setMilliseconds(reload_time.getMilliseconds() + difference);
                var date = {
                    day: null,
                    hour: null,
                    minute: null,
                    second: null
                };

                var setDate = function () {
                    local_time = new Date();
                    var countDown = target_time - local_time;
                    var day = Math.floor(countDown / (1000 * 60 * 60 * 24));
                    var hour = Math.floor((countDown - (day * 1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                    var minute = Math.floor((countDown - (day * 1000 * 60 * 60 * 24) - (hour * 1000 * 60 * 60)) / (1000 * 60));
                    var second = Math.floor((countDown - (day * 1000 * 60 * 60 * 24) - (hour * 1000 * 60 * 60) - (minute * 1000 * 60)) / 1000);
                    date = {
                        day: day,
                        hour: hour,
                        minute: minute,
                        second: second
                    };
                };
                setDate();

                return {
                    Get: function () {
                        setDate();
                        return {
                            local_time: local_time,
                            target_time: target_time,
                            server_time: server_time,
                            reload_time: reload_time,
                            countDown: countDown,
                            Origin: {
                                target_time: '2017/07/31 0:00:00',
                                reload_time: '2017/07/30 23:59:59'
                            },
                            date: {
                                day: date.day,
                                day_hour: date.day * 24 + date.hour,
                                hour: date.hour,
                                minute: date.minute,
                                second: date.second
                            }
                        };
                    },
                    Selector: elementSelectors
                };
            };
            var countdownFunction = base_countdown();
            countDown = setInterval(function () {
                var countDownObj = countdownFunction.Get();
                //console.log(countDownObj.date.day + '( ' + countDownObj.date.day_hour + ' ) / ' + countDownObj.date.hour + ' / ' + countDownObj.date.minute + ' / ' + countDownObj.date.second );
                if (countDownObj.local_time >= countDownObj.reload_time) {
                    $(countdownFunction.Selector.day).text(0);
                    $(countdownFunction.Selector.hour).text('00');
                    $(countdownFunction.Selector.minute).text('00');
                    $(countdownFunction.Selector.second).text('00');
                    $(countdownFunction.Selector.day_hour).text(0);
                    clearInterval(countDown);
                    //location.href = '?' + '';
                } else if (countDownObj.date.day >= 0) {
                    $(countdownFunction.Selector.day).text(countDownObj.date.day);
                    $(countdownFunction.Selector.hour).text(( '0'  + countDownObj.date.hour ).slice( -2 ));
                    $(countdownFunction.Selector.minute).text(( '0'  + countDownObj.date.minute ).slice( -2 ));
                    $(countdownFunction.Selector.second).text(( '0'  + countDownObj.date.second ).slice( -2 ));
                    $(countdownFunction.Selector.day_hour).text(countDownObj.date.day_hour);
                    //console.log(countDownObj.local_time + ' : ' + countDownObj.target_time + ' : ' + countDownObj.reload_time);
                } else {
                    //console.log('x');
                }
            }, 500);
        })(jQuery);
    }
},100);
})();
