function Miniprops() {
	var me = this;
	
	me.menuId = 3;
	me.shown = false;
	
	initialize();
	
	function initialize() {
		$jq(document).ready(function() {
			$jq('a.miniprops-count').click(function() {
				toggle();
			});
			$jq('div.miniprops span.arrow').click(function() {
				toggle();
			});
			$jq('a.miniprops-link').hover(
				function() { $jq('div.miniprops div.tooltip').fadeIn(); },
				function() { $jq('div.miniprops div.tooltip').fadeOut(); }
			);
			
			$jq('div.miniprops').bind('onSuccess', function() {
				me.update();
				$jq('div.miniprops')
					.unbind('onUpdated')
					.bind('onUpdated', function() {
						carousel
							.updateSize()
							.setSlideDirection('horizontal');
					
						$jq('a.miniprops-count').text('(' + me.ratingCount + ')');
						$jq('a.miniprops-comments').text('(' + me.commentCount + ')');
						me.show();
					});
			});
			$jq('div.miniprops').bind('onError', function() {
				me.toggle();
			});
			$jq('a.miniprops-link').click(function() {
				if (loggedIn == '1') {
					try {
						me.give();
					} catch (e) {}
				} else {
					$jq('#main_nav_login').trigger('click');
				}
			});
		});
	}
	function setCyId(cyid) {
		this.cyid = cyid;
		
		return me;
	}
	function setPostId(postId) {
		me.postId = postId;
		
		return me;
	}
	function hide() {
		$jq('div.miniprops span.arrow')
			.removeClass('up')
			.addClass('down');
		$jq('div.miniprops ul li.buttons').hide();
		$jq('div.carousel').animate({height: '0px'}, function() {
		});
	}
	function show() {
		$jq('div.miniprops span.arrow')
			.removeClass('down')
			.addClass('up');
		$jq('div.carousel').animate({height: '50px'}, function() {
			$jq('div.miniprops ul li.buttons').fadeIn();
		});
	}
	function toggle() {
		if (me.shown == false) {
			show();
			me.shown = true;
		} else {
			hide();
			me.shown = false;
		}
	}
	function give() {
		if (me.cyid == undefined) { throw 'CyID is undefined.'; }
		if (me.postId == undefined) { throw 'Post ID is undefined.'; }
		
		var err = undefined;
		
		$jq.get('http://us.cyworld.com/profile/rating_write.php?cyid=' + me.cyid + '&menuid=' + me.menuId + '&postid=' + me.postId,
			function(data) {
				switch (data) {
					case '0':
						$jq('div.miniprops').trigger('onError');
						err = 'Unsuccessful';
						break;
					case '1':
						$jq('div.miniprops').trigger('onSuccess');
						$jq('div.miniprops div.tooltip div.repeat')
							.addClass('already-given');
						$jq('div.miniprops div.tooltip div.content')
							.text('You\'ve already given this miniroom miniprops.');
						pageTracker._trackPageview('/profile/miniprops/receive');	
						break;
				}
			});
		
		if (err) { throw err; }
		
		return me;
	}
	function update() {
		if (me.cyid == undefined) { throw 'CyID is undefined.'; }
		if (me.postId == undefined) { throw 'Post ID is undefined.'; }
		$jq.getJSON('http://us.cyworld.com/profile/rating.php?cyid=' + me.cyid + '&menuid=' + me.menuId + '&postid=' + me.postId,
			function(data) {
				me.commentCount	= data.commentCount;
				me.ratingCount	= data.ratingCount;
				me.list			= data.list;
				
				$jq('div.miniprops div.carousel ul li').remove();
				for (var s = 0; s < parseInt(me.ratingCount); s++) {
					var li	= document.createElement('li');
					var img	= document.createElement('img');
					var a	= document.createElement('a');
					
					img.src		= me.list[s][8];
					img.width	= 40;
					img.height	= 40;
					
					a.href	= 'http://us.cyworld.com/' + me.list[s][9];
					
					$jq(a).append(img);
					$jq(li).append(a);
					$jq('div.miniprops div.carousel ul').append(li);
				}
				$jq('div.miniprops').trigger('onUpdated');
			});
		
		return me;
	}
	this.setCyId = setCyId;
	this.initialize = initialize;
	this.toggle = toggle;
	this.hide = hide;
	this.show = show;
	this.setPostId = setPostId;
	this.give = give;
	this.update = update;
}