$(document).ready(function() {
  Core.init();
});

var Preferenses = {
  root: '',
  infoSection: 'info',
  videoSection: '12',
  depth: 2
}

var Core = (function() {

  function initiate() {
    Events.firstLoad();
  }

  ;

  var result = {
    init: function() {
      initiate();
    }
  };
  return result;

})();

function debouncer(func, timeout) {
  var timeoutID , timeout = timeout || 200;
  return function () {
    var scope = this , args = arguments;
    clearTimeout(timeoutID);
    timeoutID = setTimeout(function () {
      func.apply(scope, Array.prototype.slice.call(args));
    }, timeout);
  }
}


var Vector = (function() {
  var v = {
    canvas: 0, block: 0, line: 0, lineAngle: 33,
    createCanvas: function() {
      v.canvas = Raphael('l02', $(window).width(), $(window).height());
      v.createLine(v.canvas, $(window).width(), $(window).height())
    },
    redrawCanvas: function(e, canvas) {
      var x = e.width();
      var y = e.height();
      var wx = $(window).width()
      var wy = $(window).height()
      canvas.setSize(x, y)
      Events.returnToBase('none')
    },
    createLine: function(canvas, x, y) {
      $('#l02').width(x).height(y);
//            var color = $('.lineColor').css('color');
      var pth = 'M 0 ' + y + ' L ' + x + ' 0';
      v.line = canvas.path(pth);
      v.line.attr({'stroke-opacity': 1});
      v.line.attr({'stroke': Core.color});
    },
    animateLine: function(line, path) {
      line.animate({
        path: path
      }, 2600, 'elastic')
    },
    changeAngle: function(line, state) {
//            line.rotate(angle)
      var x = 0;
      var y = $(window).height();
      switch (state) {
        case 'angle':
          x = 500;
          y = $(window).height() / 2;
          v.line.attr('stroke', '#555');
          break;
        case 'diagonal':
          x = $(window).width();
          v.line.attr('stroke', Core.color);
          break;
      }
      var path = 'M 0 ' + y + ' L ' + x + ' 0';
      line.animate({'path': path}, 500)
    },
    changeOpacity: function(line, opacity) {
      line.animate({opacity: opacity});
    }
  };
  return v;
})();

var Events = (function() {
  var event = {

    firstLoad: function() {
      Task.initiatePlayer();
      Core.color = $('#lineColor').css('color');
      Vector.createCanvas();
      Events.resizeContainer();
      if (window.location.pathname != '/user/') Events.menuEvents();
      if (window.location.pathname != '/user/') {
        if ($('#l04 li').css('float') == 'left') {
          Events.returnToBase('pc');
        } else {
          Events.returnToBase('mobile');
        }
      }
      Events.animateLayersOnMouseOver();
      Events.clickOnBlackOverlay();
      Events.clickOnNextBack();
      Events.hoverOnThumb();
      Events.clickOnVideoThumb();
      Task.checkWidth();


//            Events.returnToBase('pc');
      var popr = 17;
      if ($.browser.mozilla) popr = 17;
      $('.w').width($(window).width() + popr);
      $('.container').height($(window).height()); //qqq
      $('.prev, .next').height($(window).height());
      Events.clickOnZoom();
      Events.clickOnMaximumImage();
      Task.checkWidth();
      Task.attachAll();
      Task.fadeButtons();

      if ($('body').css('background-color') == 'rgb(0, 0, 0)') {
        $('.logo').hide();
        $('.logo-w').show();
        $('.copyright, .by a').css('color', '#ffffff');
      } else {
        $('.logo').hide();
        $('.logo-b').show();
        $('.copyright, .by a').css('color', '#000000');
      }
      Cufon.refresh();
    },


    resizeContainer: function() {
      $('.content').width($(window).width() * 0.8);
      $(window).resize(debouncer(function() {

        Task.attachAll();
        Task.setMenuPosition();
        $('.container').height($(window).height())
      }));

    },

    menuEvents: function() {
      $('#l044').mouseleave(function() {
        if (!$('.overlay').is(':visible')) {
          $('#l04, #l02, #l01').stop()
          if ($('#l04 li').css('float') == 'left') {
            event.returnToBase('pc');
          } else {
            event.returnToBase('mobile');
          }
//                    $("#jquery_jplayer_1").jPlayer('stop');
        }
      });

//            $('#l04').find('li a').mouseover(function(){
//                $("#jquery_jplayer_1").jPlayer('play');
//            })
      /* Click on menu item */
      $('#l04').find('li a').click(function(e) {

//              $('body').animate({backgroundColor: '#000000'}, 100) //qqq

        $('#l02').stop();
        $('#l04').stop().find('li').unbind('mouseenter');
        $('#l02').css({left: 0, top: 0});
        $(this).parent().addClass('current');
        var id = $(this).attr('href').split('/')[Preferenses.depth];
        var element = $(this).parent();

        var angle = -Vector.lineAngle;
        Vector.changeAngle(Vector.line, 'angle');

        Vector.changeOpacity(Vector.line, 0.2);

        Task.showLoader(element, id)
        $('.blocker').show().width($('#l04').width()).height($('#l04').height());
        $('.overlay').width($(document).width()).show();

//                $('#l04').unbind('mouseleave')

        return false;
      });
    },

    animateLayersOnMouseOver: function(state) {
      Events.fadeOnMouseover()
      return false;
      if (state == 'on') {
        // использование Math.round() даст неравномерное распределение!
        function getRandomInt(min, max) {
          return Math.floor(Math.random() * (max - min + 1)) + min;
        }

        var py = 0;
        $('#l044 li').mouseenter(function(e) {
//                    $("#jquery_jplayer_1").jPlayer('play');
          var el = $(this);
          py = e.pageY;
          var childPos = $(this).position().top + $(this).height() / 3;
          var parentPos = $('#l04').offset();
          var pos = py - childPos;
          $('#l04').stop().animate({
            top: pos,
            left: $('#l04').position().left + getRandomInt(-20, 20)
          }, 200);
          $('#l02').stop().animate({
            top: $(this).offset().top - $('#l02').height() / 2 + getRandomInt(-30, 80)
          }, 1000);

          $('#l01').stop().animate({
            top: $(this).offset().top + 90,
            left: $(this).offset().left - $('#l01').width() / 2 + getRandomInt(-10, 10)
          }, 700);
        });
      } else {
        $('#l04').stop().find('li').unbind('mouseenter');
//                event.returnToBase('mobile')
      }
    },

    fadeOnMouseover: function() {
      $('#l044 li').mouseenter(
              function(e) {
                var el = $(this);
                $('#l044 li').not(el).stop().fadeTo(500, 0.2);
              }).mouseleave(function() {
                var el = $(this);
                $('#l044 li').not(el).stop().fadeTo(800, 1);
              })
    },

    returnToBase: function(platform) {
      var p = platform || 'none';
      var pointHalf = Vector.line.getPointAtLength(Vector.line.getTotalLength() / 2);
      var pointThird = Vector.line.getPointAtLength(Vector.line.getTotalLength() / 3);
      var x = 0, y = 0;
      switch (p) {
        case 'mobile':
          anim(10, 1);
          break;
        case 'pc':
          anim($(window).width() / 4, $(window).height() / 3 - 25);
          break;
        default:
          ret();
          break;
      }

      function anim(x, y) {
        $('#l04').animate({top: y, left: x}, 1000);
        $('#l02').animate({top: 0,left: 0}, 1000);
        $('#l01').animate({ top: $(window).height() / 1.3, left: x }, 1000, function() {
        });

      }

      function ret() {
        x = $(window).width() / 4,y = $(window).height() / 3;
        $('#l04').css({top: y,left: x});
        $('#l01').css({
          top: $(window).height() / 1.3,
          left: x
        });
        $('#l02').css({top: 0,left: 0});
      }
    },

    clickOnThumb: function() {
      $('.thumb').live('click', function(e) {
        var el = $(this);
        var index = $('.content').find('a').index(this);
        var url = el.attr('href');
        Task.showMediumImage(el);
        $('.imageinfo').show();
//                Task.attachAll();
        return false;
      });

    },

    hoverOnThumb: function() {
      $('.content img').live('mouseenter',
              function() {
                $(this).stop().fadeTo(500, 1);
              }).live('mouseleave', function() {
                $(this).stop().fadeTo(500, 0.6)
              })
    },

    clickOnVideoThumb: function() {
      $('.video').live('click', function() {
        var filename = $(this).attr('id');
        var cen = $(window).height();
        var im = 390;
        var margin = (cen - im) / 2;
//                $('.mediumimgwrapper').css({marginTop: margin});
        $('.prev, .next, .imageinfo').hide();
        Task.showVideo(filename);

        return false;
      });
    },

    clickOnBlackOverlay: function() {
      $('.blackoverlay').click(function(e) {
        if ($(e.target).hasClass('blackoverlay')) {
          Task.toggleBlackOverlay('hide');
        }
      });
    },
    clickOnNextBack: function() {
      $('.prev, .next').click(function() {

        $('.zoomin').hide();
        Task.attachMetr();
        var dir = '';
        if ($(this).hasClass('prev')) {
          dir = 'prev'
        } else {
          dir = 'next'
        }
        var curimg = $('.mediumimgwrapper img').filter(':visible');
        var index = curimg.attr('data-index') * 1, total = curimg.attr('data-total') * 1;
        switch (dir) {
          case 'prev':
            if (index > 1) {
              $($('.thumb').get(index - 2)).trigger('click');
            } else {
              Task.toggleBlackOverlay('hide');
            }
            ;
            break;
          case 'next':
            if (index < total) {
              $($('.thumb').get(index)).trigger('click');
            } else {
              Task.toggleBlackOverlay('hide');
            }
            ;
            break;
        }
        $('#play')[0].play();
      });
    },

    clickOnBack: function() {
      $('.back').live('click', function() {
        Task.toggleBlackOverlay('hide');
        $('#play')[0].play();
      });
    },

    clickOnZoom: function() {
      $('.zoomin').live('click', function() {
        Task.showMaximumImage();
        $('.copyright').hide();
        $('#play')[0].play();

      });
    },

    clickOnMaximumImage: function() {
      $('.zoomout').live('click', function() {
        $(this).hide();

        $('.maximumimage').fadeOut('fast', function() {
          $(this).html();
//          $('.copyright').show();
        })
      });
      $('#play')[0].play();
    }
  };

  return event;
})();

var Task = (function() {
  var tasks = {

    attachMetr: function() {
      var cen = $(window).height();

      if ($('.mediumimgwrapper img').size()) {
        var im = $('.mediumimgwrapper img').height();
      } else {
        var im = $('.mediumimgwrapper iframe').height();
      }

      var margin = (cen / 2 - im / 2);
      var bpos = Math.floor(cen / 2) - 39 + 'px'
      $('.prev').css({backgroundPosition: 'left ' + bpos});
      $('.next').css({backgroundPosition: 'right ' + bpos});
//            $('.mediumimgwrapper').css({marginTop: margin});
//            $('.mediumimgwrapper').css({top: margin});

      Task.checkWidth();

    },

    attachAll: function() {
      var e = $('.w');
      var w = $(window);
      e.height(w.height() - 20);
      var x = w.width();
      var y = w.height();
      Vector.canvas.setSize(x, y)
      var pth = 'M 0 ' + y + ' L ' + x + ' 0';
      Vector.animateLine(Vector.line, pth);
      Task.stretchToView($('.blackoverlay'));
//      $('.overlay').height($(window).height() - $(window).height() * 0.35)
//      $('.overlay').height($(window).height())
//      $('.overlay').css({'paddingTop': '15%'});
      
      $('.content').width($(window).width() * 0.8)
      $('.prev, .next').height($(window).height())
      Task.attachMetr();
      if ($('.overlay').is(':visible') || $('.blackoverlay').is(':visible')) {
        Task.setMenuPosition();
      } else {
        if ($('#l04 li').css('float') == 'left') {
          Events.returnToBase('pc');
        } else {
          Events.returnToBase('mobile');
        }
      }

      Task.attachZoom();

      function fixCurrent(block, el) {
        var block = $(block);
        block.width($(window).width() * 0.9)
        var offset = block.offset();
        var pos = $(el).position();
        var y = offset.top - pos.top - $(el).height();
        var x = offset.left - pos.left;
        $('#l04').css({top: y, left: x});
      }


    },

    attachZoom: function() {
      var lposa = $('.mediumimgwrapper').width() / 2 - $('.zoomin').width() / 2;
      var mediumimg = $('.mediumimgwrapper img').height();
      var rposa = mediumimg / 2 - $('.zoomin').height() / 2;
      var lposb = $('.maximumimage img').width() / 2 - $('.zoomout').width() / 2;
      var maximg = $(window).height();
      var rposb = maximg / 2 - $('.zoomout').height() / 2;
//            $('.zoomin').css({left: lposa, top: rposa});
      //$('.zoomout').css({left: lposb, top: rposb});
    },
    checkWidth: function() {
      var w = $(window).width();
      var m = $('#l04').width();

      if (w < 600) {
        $('#l04 li').css({'float': 'none'});
//        $('.mediumimgwrapper').height($(window).height()) //qqq
        //$('.mediumimgwrapper img').width($(window).width()*0.8);
        $('.mediumimgwrapper img').css({'height': $(window).height() * 0.75, marginTop: ''}); //qqq
        Events.animateLayersOnMouseOver('off');


      } else {
        $('#l04 li').css({'float': 'left'});
        $('.mediumimgwrapper img').css('width', '').css({'height': '500px', marginTop: ''})
        Events.animateLayersOnMouseOver('on');
      }
      var im = $('.mediumimgwrapper').find('img').filter(':visible');
      var hh = $(window).height() * 0.8;
      if (im.height() > hh) {
//        $('.mediumimgwrapper').height($(window).height()) //qqq
        im.height($(window).height() * 0.79);

        $('.mediumimgwrapper img').css({'width': '', marginTop: '18%'});
      }
    },

    fadeButtons: function() {
//            $('.prev, .next, .back, .zoomin').fadeTo(1,0.2);
      $('.prev, .next, .back, .zoomin').live('mouseenter',
              function() {
                $(this).stop().fadeTo(200, 1);
              }).live('mouseleave', function() {
                $(this).stop().fadeTo(200, 0.2);
              });
    },
    showLoader: function(el, id) {
      $('#l04, #l02').stop();
      $('.content').fadeIn(1, function() {

        var block = $(this);
        block.width($(window).width() * 0.9)
        var offset = block.offset();
        var pos = $(el).position();
        var y = offset.top - pos.top - $(el).height() - 3;
        var x = offset.left - pos.left - 3;

        $('body').addClass('white');
        $('#initBgColor').val($('body').css('backgroundColor')); // Set initial bg color
        var overlayBg = $('#overlayBgColor').css('backgroundColor');
        $('body').animate({backgroundColor: overlayBg}, 500);
        Cufon.refresh();

        $('.whatsnew').hide();

        $('.logo').hide();
        $('.logo-w').show();
        Events.clickOnBack();

        $('.overlay').click(function(e) {
          if ($(e.target).hasClass('overlay')) {
            $('.blocker').hide()
            tasks.hideContent();
          };
        });
        $('#l04').animate({top: y, left: x}, 500, function() {
          switch (id) {
            case '9':
              Ajax.loadInfo('/contentasjson/node/9', el);
              break;
            case '12':
              Ajax.loadVideo(Preferenses.root + '/contentasjson/node/' + id, el);
              break;
            default:
              Ajax.loadImages(Preferenses.root + '/contentasjson/node/' + id, el);
              break;
          }
        });


        if (overlayBg == 'rgb(0, 0, 0)') {
          $('.logo').hide();
          $('.logo-w').show();
          $('.copyright, .by a').css('color', '#ffffff');
        } else {
          $('.logo').hide();
          $('.logo-b').show();
          $('.copyright, .by a').css('color', '#000000');
        }
        Cufon.refresh();
      });
    },

    setMenuPosition: function() {
      var b = $('.content');
      var ofst = b.offset();
      var pos = $('.current').position();
      var y = ofst.top - pos.top - $('.current').height() - 3;
      var x = ofst.left - pos.left - 3;
      $('#l04').animate({top: y, left: x}, 500);
    },
    showContent: function(data) {
      var html = '<div class="reveal">' + data + '</div>';
      $('.content').prepend(html);
      Cufon.refresh();
      $('.content').find('img').first().load(function() {
        $('.reveal').fadeIn(1000, function() {
          $('.loader').fadeOut(500);
          Events.clickOnThumb();
        });

      });

      Cufon.refresh();

    },

    hideContent: function() {
      var oldbgcolor = $('#initBgColor').val(); // Первоначальный цвет фона
      var angle = Vector.lineAngle; // Первоначальный угол линии
      $('.reveal').hide().detach();

      $('.whatsnew').show();
      $('body').removeClass('white').animate({backgroundColor: oldbgcolor}, 500, function() {


      }); // Вернуть фону первоначальный цвет
      $('.current').removeClass('current'); // Снять флаг с текущего пункта меню

      if (oldbgcolor == 'rgb(0, 0, 0)') {
        $('.logo').hide();
        $('.logo-w').show();
        $('.copyright').css('color', '#ffffff');
      } else {
        $('.logo').hide();
        $('.logo-b').show();
        $('.copyright, .by a').css('color', '#000000');
      }


//            if($('#l04').find('li').css('float') == 'left') { Events.returnToBase('pc');} else {Events.returnToBase('mobile');}
      $('.overlay').unbind('click').hide(); // Скрыть оверлей
      Events.animateLayersOnMouseOver('on'); // Включить анимацию слоев
      Vector.changeAngle(Vector.line, 'diagonal'); // Повернуть линию на обычный угол
      Vector.changeOpacity(Vector.line, 1); // Восстановить прозрачность линии
      if ($('#l04 li').first().css('float') == 'left') {
        Events.returnToBase('pc');
      } else {
        Events.returnToBase('mobile');
      }
//            $("#jquery_jplayer_1").jPlayer('stop');

      Cufon.refresh();
    },

    /* Показывает среднее изображение и считает его индекс */
    showMediumImage: function(el) {
      Task.toggleBlackOverlay('show');
      $('.mediumimgwrapper').find('img').hide();
      $('.prev, .next').hide();
      var current = el;
      var src = el.attr('data-image') || '';
      var title = el.attr('data-title') || '';
      var full = el.attr('data-full') || '';
      var index = el.attr('data-index') * 1 || '';
      var total = el.attr('data-total') * 1 || '';
      var mediums = '';
      mediums += '<div class="ww"><img src="' + src + '" alt="' + title + '" class="' + full + '" data-index="' + index + '" data-total="' + total + '" /><div class="zoomin zoom"></div></div>';
      mediums += '<div class="back"></div><div class="loading"></div>';

      $('.mediumimgwrapper').html(mediums);
      $('.loading').show();
      $('.mediumimgwrapper').find('img').hide();
      $('.mediumimgwrapper').find('img').load(function() {
        $('.loading').hide();
        Task.attachMetr();
        $(this).fadeIn(1000, function() {
          if (full) {
            $('.zoomin').show()
            Task.attachZoom();
          } else {
            $('.zoomin').hide()
          }
        });
        var im = $('.mediumimgwrapper').find('img').filter(':visible');
        var hh = $(window).height() * 0.8;
        if (im.height() > hh) {
//          $('.mediumimgwrapper').height($(window).height()) //qqq
          im.height($(window).height() * 0.75);
          $('.mediumimgwrapper img').css({'width': '', marginTop: ''}); //qqq
        }
      });


      $('#iif').find('strong').text(title);
      $('#iif').find('span').text(index + '/' + total);
      if (index > 1) {
        $('.prev').show();
      } else {
        $('.prev').hide();
      }
      if (index < total) {
        $('.next').show()
      } else {
        $('.next').hide()
      }

    },

    showMaximumImage: function() {
      var curimg = $('.mediumimgwrapper img').filter(':visible');
      var bigsrc = curimg.attr('src').replace('/medium/', '/large/');
      var img = '<div class="loading"></div><img src="' + bigsrc + '" />';
      $('.maximumimage').show().html(img);

      $('.maximumimage img').load(function() {
        $('.loading').hide();
        $(this).fadeIn('fast');
        $('.zoomout').show();
        Task.attachZoom();
      })
    },

    showVideo: function(name) {
      Task.toggleBlackOverlay('show');
      $('.mediumimgwrapper').html('');
      var video = '<iframe src="http://player.vimeo.com/video/' + name + '?title=0&amp;byline=0&amp;portrait=0" width="710" height="400" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe><div class="back"></div>';
      $('.mediumimgwrapper').html(video);
      Task.attachMetr();

    },

    toggleBlackOverlay: function(key) {
      var k = key || 'hide';
      var hide = function() {
        $('.overlay').show();
        $('#copyrightId').show();
        $('.blackoverlay').fadeOut('fast');
        Vector.changeOpacity(Vector.line, 0.2);
        $('#l04').show();
        $('.mediumimgwrapper iframe').detach()
        $('#iif').css({'bottom': ''})
      };
      var show = function() {
        $('.overlay').hide();
        $('#copyrightId').hide();
        $('#l04').hide();
        $('.blackoverlay').height($(window).height()).fadeIn('fast', function() {
          Vector.changeOpacity(Vector.line, 1);
        });
        $('#iif').css({'bottom': '20px'})
      }
      switch (k) {
        case 'hide':
          hide();
          break;
        case 'show':
          show();
          break;
      }
    },

    initiatePlayer: function() {
      $('#l044 li a').mouseenter(function() {
        $('#play')[0].play();
      });

    },

    // Растягивает размер передаваемого элемента на размер экрана
    stretchToView: function(element) {
      var x = $(window).width();
      var y = $(window).height();
      $(element).height(y).width(x);
            $('.container').height($(window).height()) //qqq
//            $('#l01').css({top: y / 1.8});
//            $('#l04').css({left: x / 2,top: 100});
//            Events.returnToBase('pc')
    },

    stretchToViewDelayed: function(element, canvas) {
      var x = $(window).width();
      var y = $(window).height();
      $(element).stop().animate({
        width: x,
        height: y
      }, 1000, function() {
        Vector.redrawCanvas(element, canvas);
      });
    }
  };
  return tasks;
})();

var Ajax = (function() {
  var ajax = {
    loadImages: function(url, el) {
      $('.content').html('<div class="loader">Loading...</div> ');
      var e = el;
      $.ajax({
        url: url,
        asyns: true,
//                cache: false,
        error: function(data) {
          alert('Error while loading images from server. Try to reload page.')
        },
        success: function(data) {
          var dj = data;

          var srcimg = data.field_img.und;
          var list = '', mediums = '';
          for (var i = 0; i < srcimg.length; i++) {
            var alt = srcimg[i].alt.split('|');

            var title = alt[0] || '';
            var full = alt[1] || '';
            var src = srcimg[i].filename || '';
            list += '<div data-image="' + Preferenses.root + '/sites/default/files/styles/medium/public/' + src + '" ' +
                    'data-title="' + title + '" data-full="' + full + '" data-index="' + (i + 1) + '" data-total="' + srcimg.length + '" class="thumb"><img src="' + Preferenses.root + '/sites/default/files/styles/thumbnail/public/' + src + '" alt="' + alt[0] + '" /></div>';
          }
          Task.showContent(list);
        }});
    },
    loadInfo: function(url, el) {
      $('.content').html('<div class="loader">Loading...</div> ');
      var e = el;
      $.ajax({url: url,asyns: true,cache: false,
        error: function() {
          alert('Error while loading info from server. Try to reload page.')
        },
        success: function(data) {
          var dj = data;
          var txt = data.field_txt.und;
          var list = '';

          for (var i = 0; i < txt.length; i++) {
            list += txt[i].value;
          }
          var html = '<div class="info">' + list + '</div>';
          var newhtml = html.replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&')

//                     $('.content').html(newhtml);
          Task.showContent(html)
        }
      });
    },
    loadVideo: function(url, el) {
      $('.content').html('<div class="loader">Loading...</div> ');
      var e = el;
      $.ajax({
        url: url,
        asyns: true,
        error: function(data) {
          alert('Error while loading videos from server. Try to reload page.')
        },
        success: function(data) {
          var dj = data;
          var srcimg = data.field_vid.und;
          var list = '', mediums = '';
          for (var i = 0; i < srcimg.length; i++) {
            var alt = srcimg[i].alt;
            var src = srcimg[i].filename;
            var title = srcimg[i].title;
            list += '<div id="' + src + '" href="' + Preferenses.root + '/sites/default/files/styles/medium/public/' + src + '.jpg" class="video"><img src="' + Preferenses.root + '/sites/default/files/styles/square_thumbnail/public/media-vimeo/' + src + '.jpg" alt="' + alt + '" /></div>';
          }
          Task.showContent(list);

        }});
    }
  };

  return ajax;
})();
