function User(user) {
  var me = this;
  me.uid = user.uid;
  me.createDate = new Date();
  me.createDate.setTime(user.createDate * 1000);
  me.dispName = user.dispName;
  me.iwiwName = user.iwiwName;
  me.weburl = user.weburl;
  me.blogurl = user.blogurl;
  me.videoCount = user.videoCount;
  me.videoCount168 = user.videoCount168;
  me.viewCount = user.viewCount;
  me.viewCount168 = user.viewCount168;
  me.ratingCount = user.ratingCount;
  me.ratingSum = user.ratingSum;
  me.ratingAvg = user.ratingAvg;
  me.ratingCount168 = user.ratingCount168;
  me.ratingSum168 = user.ratingSum168;
  me.ratingAvg168 = user.ratingAvg168;
  me.commentCount = user.commentCount;
  me.commentedCount = user.commentedCount;
  me.favouritedCount = user.favouritedCount;
  me.videosFavouritedCount = user.videosFavouritedCount;
  me.flaggedCount = user.flaggedCount;
  me.thumbnailUrl = user.thumbnailUrl;
  me.userUrl = user.userUrl;
  
  me.avatar_count = user.avatar_count;
  me.blogurl_visibility = user.blogurl_visibility;
  me.comment_count_visibility = user.comment_count_visibility;
  me.embed_count_visibility = user.embed_count_visibility;
  me.facebook_profile_url_visibility = user.facebook_profile_url_visibility;
  me.favourite_users_visibility = user.favourite_users_visibility;
  me.favourite_videos_visibility = user.favourite_videos_visibility;
  me.friends_visibility = user.friends_visibility;
  me.has_avatar = user.has_avatar;
  me.iwiw_profile_url = user.iwiw_profile_url;
  me.iwiw_profile_url_visibility = user.iwiw_profile_url_visibility;
  me.facebook_profile_url = user.facebook_profile_url;
  me.likes_visibility = user.likes_visibility;
  me.rating_count_visibility = user.rating_count_visibility;
  me.send_count_visibility = user.send_count_visibility;
  me.share_count_visibility = user.share_count_visibility;
  me.video_count_visibility = user.video_count_visibility;
  me.videolists_visibility = user.videolists_visibility;
  me.videos_visibility = user.videos_visibility;
  me.view_count_visibility = user.view_count_visibility;
  me.weburl_visibility = user.weburl_visibility;
  me.last_login_date = user.last_login_date;
  me.visibility = user.visibility;

  me.formatNumber = function(number) {
    var s = new String(number);
    var r = "";
    var c = 0;
    for (var i = s.length - 1; i >= 0; i--) {
      r = s.charAt(i) + r;
      c++;
      if (i != 0 && c != 0 && c % 3 == 0) r = " " + r;
    }
    return r;
  }
  
  me.getAvatarUrl = function() {
    if (me.has_avatar == 0) {
      return "/static/uis/default/gfx/default_avatar.png";
    } else {
      return "/static/avatar/" + me.has_avatar + "." + me.uid + "." + me.avatar_count;
    }
  }

  me.getDispName = function() {
    return me.dispName;
  }

  me.getUserLink = function() {
    return me.userUrl;
  }

  me.getVideoCount = function() {
    return me.videoCount;
  }

  me.getViewCount = function() {
    return me.viewCount;
  }

  me.getFlaggedCount = function() {
    return me.flaggedCount;
  }

  me.getRoundedAvg = function(interval) {
    if (interval == 1) return Math.round(100 * me.ratingAvg168) / 100;
    return Math.round(100 * me.ratingAvg) / 100;
  }

  me.getStarsCount = function(interval) {
    if (interval == 1) return me.formatNumber(me.ratingAvg168);
    return Math.round(me.ratingAvg);
  }

  me.getRatingAvg = function() {
    return me.ratingAvg;
  }

  me.getRatingCount = function() {
    return me.ratingCount;
  }

  me.getCommentCount = function() {
    return me.commentCount;
  }

  me.getThumbnailUrl = function() {
    return me.thumbnailUrl;
  }

  me.getFormattedVideoCount = function(interval) {
    if (interval == 1) return me.formatNumber(me.videoCount168);
    return me.formatNumber(me.videoCount);
  }

  me.getFormattedViewCount = function(interval) {
    if (interval == 1) return me.formatNumber(me.viewCount168);
    return me.formatNumber(me.viewCount);
  }

  me.getFormattedRatingCount = function(interval) {
    if (interval == 1) return me.formatNumber(me.ratingCount168);
    return me.formatNumber(me.ratingCount);
  }

  me.getFormattedCommentCount = function() {
    return me.formatNumber(me.commentCount);
  }

  me.getFormattedCommentedCount = function() {
    return me.formatNumber(me.commentedCount);
  }

  me.getFormattedFavouritedCount = function() {
    return me.formatNumber(me.favouritedCount);
  }

  me.getFormattedVideosFavouritedCount = function() {
    return me.formatNumber(me.videosFavouritedCount);
  }

  me.getFormattedFlaggedCount = function() {
    return me.formatNumber(me.flaggedCount);
  }
  
  me.getFormattedDateAndTime = function() {
    var year = me.createDate.getYear();
    if(year < 1900) year += 1900;
    var month = me.createDate.getMonth() + 1;
    var day = me.createDate.getDate();
    var datestring = '' + year + '.';
    if(month < 10) datestring += '0';
    datestring += month + '.';
    if(day < 10) datestring += '0';
    datestring += day;
    datestring += '. ';
    var hours = me.createDate.getHours();
    if(hours < 10) datestring += '0';
    datestring += hours + ':';
    var minutes = me.createDate.getMinutes();
    if(minutes < 10) datestring += '0';
    datestring += minutes;
    var seconds = me.createDate.getSeconds();
    return datestring;
  }
  
  me.getFormattedLastLoginDateAndTime = function() {
    if(me.last_login_date==null)
      return "ismeretlen";
          
    var logindate = new Date();
    logindate.setTime(me.last_login_date * 1000);
  
    var year = logindate.getYear();
    if(year < 1900) year += 1900;
    var month = logindate.getMonth() + 1;
    var day = logindate.getDate();
    var datestring = '' + year + '.';
    if(month < 10) datestring += '0';
    datestring += month + '.';
    if(day < 10) datestring += '0';
    datestring += day;
    datestring += '. ';
    var hours = logindate.getHours();
    if(hours < 10) datestring += '0';
    datestring += hours + ':';
    var minutes = logindate.getMinutes();
    if(minutes < 10) datestring += '0';
    datestring += minutes;
    var seconds = logindate.getSeconds();
    return datestring;
  }

}

