/*
	Programmer: Lukasz Czerwinski
	CodeCanyon: http://codecanyon.net/user/Lukasz_Czerwinski
	
	If this script you like, please put a comment on codecanyon.
	
*/
(function (_0x6ee0x1) {
    _0x6ee0x1['fn']['viewbox'] = function (_0x6ee0x2) {
        _0x6ee0x2 = _0x6ee0x1['extend']({
            Speed: 400,
            heightWindow: 450,
            widthWindow: 650,
            arrayEl: [],
            arrayActEl: 0,
            IMG: 1,
            frame: 0,
            inline: 0,
            inlineBg: '#fff',
            inlinePadding: 5,
            inlineScroll: 1,
            ajax: 0,
            ajaxType: 0,
            ajaxData: 0,
            ajaxSuccess: 0,
            titleThumb: 1,
            navigation: 1,
            keyboard: 1,
            keyClose: 'c',
            keyPrev: 'p',
            keyNext: 'n',
            numberEl: 1
        }, _0x6ee0x2);
        var _0x6ee0x3 = _0x6ee0x1(this);

        function _0x6ee0x4() {
            _0x6ee0x5(this, _0x6ee0x3);
            return false;
        };

        function _0x6ee0x5(_0x6ee0x6, _0x6ee0x3) {
            _0x6ee0x2['arrayEl']['length'] = 0;
            _0x6ee0x2['arrayActEl'] = 0;
            if (_0x6ee0x3['length'] == 1) {
                _0x6ee0x2['arrayEl']['push'](new Array(_0x6ee0x6['getAttribute']('href'), _0x6ee0x6['getAttribute']('title'), _0x6ee0x1(_0x6ee0x6)['children']('img')['attr']('alt')));
            } else {
                for (var _0x6ee0x7 = 0; _0x6ee0x7 < _0x6ee0x3['length']; _0x6ee0x7++) {
                    _0x6ee0x2['arrayEl']['push'](new Array(_0x6ee0x3[_0x6ee0x7]['getAttribute']('href'), _0x6ee0x3[_0x6ee0x7]['getAttribute']('title'), _0x6ee0x1(_0x6ee0x3[_0x6ee0x7])['children']('img')['attr']('alt')));
                };
            };
            while (_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0] != _0x6ee0x6['getAttribute']('href')) {
                _0x6ee0x2['arrayActEl']++;
            };
            _0x6ee0x8();
        };

        function _0x6ee0x8() {
            _0x6ee0x1('body')['append']('<div id=\'viewbox\'></div><div class=\'vb_wrap\'><div class=\'content\'><div class=\'close\'><a href=\'#\'>close</a></div><div class=\'next\'><a href=\'#\'> Next</a></div><div class=\'prev\'><a href=\'#\'>Previous</a></div></div>');
            _0x6ee0x1('#viewbox, .vb_wrap, .vb_wrap .content, .vb_wrap .content .next, .vb_wrap .content .prev')['hide']();
            if (_0x6ee0x2['navigation']) {
                _0x6ee0x20();
            };
            _0x6ee0x1('.vb_wrap .prev')['unbind']()['bind']('click', function () {
                _0x6ee0x2a();
                return false;
            });
            _0x6ee0x1('.vb_wrap .next')['unbind']()['bind']('click', function () {
                _0x6ee0x2b();
                return false;
            });
            _0x6ee0x28();
            _0x6ee0x1('#viewbox')['css']('opacity', 0.7)['fadeIn'](_0x6ee0x2['Speed'] / 1.6, function () {
                arraySizeBrowser = _0x6ee0x36();
                var _0x6ee0x9;
                if (_0x6ee0x1(document)['scrollTop']() == 0) {
                    _0x6ee0x9 = arraySizeBrowser[0] / 2.4;
                } else {
                    _0x6ee0x9 = _0x6ee0x1(document)['scrollTop']() + arraySizeBrowser[0] / 2.3;
                };
                _0x6ee0x1('.vb_wrap')['css']({
                    top: _0x6ee0x9 + arraySizeBrowser[0],
                    left: arraySizeBrowser[1]
                });
                _0x6ee0x1('.vb_wrap')['fadeIn'](_0x6ee0x2['Speed'] / 1.2, function () {
                    _0x6ee0x1(this)['animate']({
                        height: _0x6ee0x2['heightWindow'],
                        width: _0x6ee0x2['widthWindow'],
                        top: _0x6ee0x9,
                        left: arraySizeBrowser[1] - _0x6ee0x2['widthWindow'] / 2
                    }, _0x6ee0x2['Speed'] / 1.2, function () {
                        _0x6ee0xa();
                        _0x6ee0x1('.vb_wrap .content')['delay'](290)['fadeIn'](_0x6ee0x2['Speed'] / 1.5);
                    });
                });
            });
            _0x6ee0x1('#viewbox, .vb_wrap .content .close a')['click'](function () {
                _0x6ee0x34();
                return false;
            });
        };

        function _0x6ee0xa() {
            if (_0x6ee0xb(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x13(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0xd(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x18(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0xe(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x1a(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0xf(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x1c(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0x10(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x1e(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0x11(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x21(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
            if (_0x6ee0x12(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                _0x6ee0x23(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]);
            };
        };

        function _0x6ee0xb(_0x6ee0xc) {
            return _0x6ee0xc['indexOf']('jpg', '.') > 0 || _0x6ee0xc['indexOf']('png', '.') > 0 || _0x6ee0xc['indexOf']('gif', '.') > 0;
        };

        function _0x6ee0xd(_0x6ee0xc) {
            return _0x6ee0xc['indexOf']('youtube', '.') > 0;
        };

        function _0x6ee0xe(_0x6ee0xc) {
            return _0x6ee0xc['indexOf']('vimeo', '.') > 0;
        };

        function _0x6ee0xf(_0x6ee0xc) {
            return _0x6ee0xc['indexOf']('mp3', '.') > 0 || _0x6ee0xc['indexOf']('vmw', '.') > 0 || _0x6ee0xc['indexOf']('avi', '.') > 0;
        };

        function _0x6ee0x10(_0x6ee0xc) {
            return _0x6ee0x2['frame'] != 0 || _0x6ee0xc['indexOf']('html', '.') > 0;
        };

        function _0x6ee0x11(_0x6ee0xc) {
            return _0x6ee0x2['inline'] != 0 || _0x6ee0xc['indexOf']('#') >= 0;
        };

        function _0x6ee0x12(_0x6ee0xc) {
            return _0x6ee0x2['ajax'] != 0 || _0x6ee0xc['indexOf']('txt', '.') > 0 || _0x6ee0xc['indexOf']('js', '.') > 0;
        };

        function _0x6ee0x13(_0x6ee0x14) {
            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'image\'><img /></div>');
            _0x6ee0x1('.vb_wrap .image')['hide']();
            var _0x6ee0x15 = new Image();
            _0x6ee0x15['onload'] = function () {
                _0x6ee0x1('.vb_wrap .content .image img')['attr']('src', _0x6ee0x15['src']);
                _0x6ee0x2['heightWindow'] = _0x6ee0x15['height'];
                _0x6ee0x2['widthWindow'] = _0x6ee0x15['width'];
                _0x6ee0x2e(_0x6ee0x15['height'], _0x6ee0x15['width']);
                _0x6ee0x15['onload'] = function () {};
            };
            _0x6ee0x15['src'] = _0x6ee0x14;
            var _0x6ee0x16 = _0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][2];
            var _0x6ee0x17 = _0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][1];
            if (_0x6ee0x17) {
                _0x6ee0x1('.vb_wrap .content .image')['append']('<div class=\'text\'><h1>' + _0x6ee0x17 + '</h1></div>');
                _0x6ee0x1('.vb_wrap .content .text')['hide']();
                _0x6ee0x1('.vb_wrap')['hover'](function () {
                    _0x6ee0x1('.vb_wrap .content .text')['stop'](true, true)['delay'](200)['slideDown'](200);
                }, function () {
                    _0x6ee0x1('.vb_wrap .content .text')['stop'](true, true)['delay'](200)['slideUp'](180);
                });
            };
            if (_0x6ee0x16) {
                _0x6ee0x1('.vb_wrap .content .text')['append']('<div class=\'description\'>' + _0x6ee0x16 + '</div>');
            };
        };

        function _0x6ee0x18(_0x6ee0x19) {

            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'object\'></div>');
            hrefY = 'http://www.youtube.com/v/' + _0x6ee0x19['substring'](31, 42) + '&autoplay=1&loop=1&feature=related&showsearch=0';
            _0x6ee0x1('.vb_wrap .object')['append']('<object width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'><param name=\'movie\' value=\'' + hrefY + '\'></param><param name=\'allowFullScreen\' value=\'true\'></param><param name=\'allowscriptaccess\' value=\'always\'></param><embed src=\'' + hrefY + '\' type=\'application/x-shockwave-flash\' allowscriptaccess=\'always\' allowfullscreen=\'true\' width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'></embed></object>');
        };

        function _0x6ee0x1a(_0x6ee0x1b) {
            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'object\'></div>');
            hrefV = _0x6ee0x1b['substring'](21, 29);
            _0x6ee0x1('.vb_wrap .object')['append']('<object width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'><param name=\'allowfullscreen\' value=\'true\' /><param name=\'allowscriptaccess\' value=\'always\' /><param name=\'movie\' value=\'http://vimeo.com/moogaloop.swf?clip_id=' + hrefV + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1\' /><embed src=\'http://vimeo.com/moogaloop.swf?clip_id=' + hrefV + '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1\' type=\'application/x-shockwave-flash\' allowfullscreen=\'true\' allowscriptaccess=\'always\' width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'></embed></object>');
        };

        function _0x6ee0x1c(_0x6ee0x1d) {
            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'object\'></div>');
            _0x6ee0x1('.vb_wrap .object')['append']('<object id=\'player\' classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' name=\'player\' width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'> <param name=\'movie\' value=\'player/player.swf\' /><param name=\'allowfullscreen\' value=\'true\' /> <param name=\'flashvars\' value=\'file=' + _0x6ee0x1d + '&amp;skin=player/modieus.zip\' /> <object type=\'application/x-shockwave-flash\' data=\'player/player.swf\' width=\'' + _0x6ee0x2['widthWindow'] + '\' height=\'' + _0x6ee0x2['heightWindow'] + '\'> <param name=\'movie\' value=\'player/player.swf\' /> <param name=\'allowfullscreen\' value=\'true\' /> <param name=\'flashvars\' value=\'file=' + _0x6ee0x1d + '&amp;skin=player/modieus.zip\' /></object>');
        };

        function _0x6ee0x1e(_0x6ee0x1f) {
            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'content\'></div>');
            _0x6ee0x1('.vb_wrap .content .content')['css']('background', _0x6ee0x2['inlineBg'])['hide']();
            _0x6ee0x1('.vb_wrap .content .content')['append']('<iframe hspace=\'0\' src=\'' + _0x6ee0x1f + '\' scrolling=\'auto\' frameborder=\'0\' height=\'' + _0x6ee0x2['heightWindow'] + '\' width=\'' + _0x6ee0x2['widthWindow'] + '\' ></iframe>');
        };

        function _0x6ee0x20() {
            if (_0x6ee0x2['arrayActEl'] != 0) {
                _0x6ee0x1('.vb_wrap .prev')['css']('top', _0x6ee0x2['heightWindow'] / 2)['show']();
            } else {
                _0x6ee0x1('.vb_wrap .prev')['hide']();
            };
            if (_0x6ee0x2['arrayActEl'] != _0x6ee0x2['arrayEl']['length'] - 1) {
                _0x6ee0x1('.vb_wrap .next')['css']('top', _0x6ee0x2['heightWindow'] / 2)['show']();
            } else {
                _0x6ee0x1('.vb_wrap .next')['hide']();
            };
            _0x6ee0x2c();
        };

        function _0x6ee0x21(_0x6ee0x22) {
            _0x6ee0x26();
            _0x6ee0x1('.vb_wrap .content .content')['append'](_0x6ee0x1(_0x6ee0x22)['html']());
        };

        function _0x6ee0x23(_0x6ee0x24) {
            _0x6ee0x26();
            _0x6ee0x1['ajax']({
                type: (!_0x6ee0x2['ajaxType']) ? 'GET' : _0x6ee0x2['ajaxType'],
                url: _0x6ee0x24,
                data: _0x6ee0x2['ajaxData'],
                success: (!_0x6ee0x2['ajaxSuccess']) ? (function (_0x6ee0x25) {
                    _0x6ee0x1('vb_wrap .content .content')['html'](_0x6ee0x25);
                }) : _0x6ee0x2['ajaxSuccess']
            });
        };

        function _0x6ee0x26() {
            _0x6ee0x1('.vb_wrap')['css']('background-color', 'transparent');
            _0x6ee0x1('.vb_wrap .content .number')['hide']();
            var _0x6ee0x27 = (_0x6ee0x2['inlineScroll']) ? 'auto' : 'hidden';
            _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'content\'></div>');
            _0x6ee0x1('.vb_wrap .content .content')['css']({
                background: _0x6ee0x2['inlineBg'],
                padding: _0x6ee0x2['inlinePadding'],
                overflow: _0x6ee0x27
            });
            _0x6ee0x1('.vb_wrap .content .content')['height'](_0x6ee0x2['heightWindow'] - 10);
        };

        function _0x6ee0x28() {
            if (_0x6ee0x2['keyboard']) {
                _0x6ee0x1(document['documentElement'])['unbind']()['bind']('keyup', function (_0x6ee0x29) {
                    if (_0x6ee0x1['browser']['msie']) {
                        codeAscii = _0x6ee0x29['keyCode'];
                    } else {
                        codeAscii = _0x6ee0x29['keyCode'];
                    };
                    KeyCode = String['fromCharCode'](codeAscii)['toLowerCase']();
                    if (_0x6ee0x29['keyCode'] == 37 || KeyCode == _0x6ee0x2['keyPrev']) {
                        _0x6ee0x2a();
                    };
                    if (_0x6ee0x29['keyCode'] == 39 || KeyCode == _0x6ee0x2['keyNext']) {
                        _0x6ee0x2b();
                    };
                    if (_0x6ee0x29['keyCode'] == 27 || KeyCode == _0x6ee0x2['keyClose']) {
                        _0x6ee0x34();
                    };
                });
            };
        };

        function _0x6ee0x2a() {
            if (_0x6ee0x2['arrayActEl'] != 0) {
                _0x6ee0x1('.vb_wrap .content')['fadeOut'](_0x6ee0x2['Speed'] / 1.4, function () {
                    _0x6ee0x1('.vb_wrap .content .image, .content .object')['remove']();
                    _0x6ee0x2['arrayActEl'] = _0x6ee0x2['arrayActEl'] - 1;
                    _0x6ee0x2c();
                    _0x6ee0xa();
                    _0x6ee0x1(this)['fadeIn'](_0x6ee0x2['Speed'] / 1.2);
                    _0x6ee0x20();
                });
            };
        };

        function _0x6ee0x2b() {
            if (_0x6ee0x2['arrayActEl'] != _0x6ee0x2['arrayEl']['length'] - 1) {
                _0x6ee0x1('.vb_wrap .content')['fadeOut'](_0x6ee0x2['Speed'] / 1.4, function () {
                    _0x6ee0x1('.vb_wrap .content .image, .vb_wrap .content .object')['remove']();
                    _0x6ee0x2['arrayActEl'] = _0x6ee0x2['arrayActEl'] + 1;
                    _0x6ee0x2c();
                    _0x6ee0xa();
                    _0x6ee0x1(this)['fadeIn'](_0x6ee0x2['Speed'] / 1.2);
                    _0x6ee0x20();
                });
            };
        };

        function _0x6ee0x2c() {
            if (_0x6ee0x2['numberEl']) {
                _0x6ee0x1('.vb_wrap .content .number')['remove']();
                if (_0x6ee0x2['arrayEl']['length'] != 0) {
                    function _0x6ee0x2d() {
                        if (_0x6ee0xb(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                            return 'Image ';
                        };
                        if (_0x6ee0xd(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0]) || _0x6ee0xe(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                            return 'Film ';
                        };
                        if (_0x6ee0xf(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                            return 'Item ';
                        };
                        if (_0x6ee0x10(_0x6ee0x2['arrayEl'][_0x6ee0x2['arrayActEl']][0])) {
                            return 'Page ';
                        };
                    };
                    _0x6ee0x1('.vb_wrap .content')['append']('<div class=\'number\'>' + _0x6ee0x2d() + (_0x6ee0x2['arrayActEl'] + 1) + ' / ' + _0x6ee0x2['arrayEl']['length'] + '</div>');
                };
            };
        };

        function _0x6ee0x2e(_0x6ee0x2f, _0x6ee0x30, _0x6ee0x31) {
            var _0x6ee0x32 = _0x6ee0x1('.vb_wrap')['height']();
            var _0x6ee0x33 = _0x6ee0x1('.vb_wrap')['width']();
            _0x6ee0x1('.vb_wrap')['stop'](true, true)['animate']({
                left: document['documentElement']['clientWidth'] / 2 - _0x6ee0x30 / 2,
                width: _0x6ee0x30,
                height: _0x6ee0x2f
            }, _0x6ee0x2['Speed'] / 1.5);
            _0x6ee0x1('.vb_wrap .image')['hide']()['delay'](_0x6ee0x2['Speed'] / 1.1)['fadeIn'](300);
            _0x6ee0x1('.vb_wrap .next, .vb_wrap .prev')['css']('top', _0x6ee0x2f / 2);
        };

        function _0x6ee0x34() {
            var _0x6ee0x35 = _0x6ee0x36();
            _0x6ee0x2['arrayEl']['length'] = 0;
            _0x6ee0x2['arrayActEl'] = 0;
            _0x6ee0x1('.vb_wrap .content')['fadeOut'](_0x6ee0x2['Speed'] / 1.6, function () {
                _0x6ee0x1('.vb_wrap')['animate']({
                    left: _0x6ee0x35[1],
                    top: _0x6ee0x35[0],
                    height: 20,
                    width: 20
                }, _0x6ee0x2['Speed'] / 1.3, function () {
                    _0x6ee0x1(this)['fadeOut'](_0x6ee0x2['Speed'] / 1.2, function () {
                        _0x6ee0x1(this)['remove']();
                        _0x6ee0x1('#viewbox')['fadeOut'](_0x6ee0x2['Speed'] / 1.5, function () {
                            _0x6ee0x1('#viewbox')['remove']();
                        });
                    });
                });
            });
        };

        function _0x6ee0x36() {
            var _0x6ee0x37 = new Array;
            _0x6ee0x37[0] = document['documentElement']['clientHeight'] / 2;
            _0x6ee0x37[1] = document['documentElement']['clientWidth'] / 2;
            return _0x6ee0x37;
        };
        if (_0x6ee0x2['titleThumb']) {
            jQuery['each'](_0x6ee0x3, function () {
                var _0x6ee0x38 = _0x6ee0x1(this)['attr']('title');
                if (_0x6ee0x38 != '') {
                    _0x6ee0x1(this)['children']('img')['parent']('a')['wrap']('<div class=\'thumbdiv\'></div>');
                    _0x6ee0x1(this)['parent']('.thumbdiv')['append']('<div class=\'title\'>' + _0x6ee0x38 + '</div>');
                    _0x6ee0x1(this)['parent']('.thumbdiv')['children']('.title')['hide']();
                };
            });
            _0x6ee0x1('.thumbdiv')['hover'](function () {
                _0x6ee0x1(this)['children']('.title')['stop'](true, true)['delay'](150)['slideDown'](200);
            }, function () {
                _0x6ee0x1(this)['children']('.title')['stop'](true, true)['delay'](150)['slideUp'](200);
            });
        };
        return this['unbind']('click')['click'](_0x6ee0x4);
    };
})(jQuery);
