function initMenu () 
{
	$('.menuitem .button').hover(
		function(){
			$(this).css("background-image","url('"+options.host+"images/menu/buttonbg_o.png')");
		},
		function(){
			$(this).css("background-image","url('"+options.host+"images/menu/buttonbg.png')");
	});
	
	$('.menuitem .button').click(function(){
		var self = this;
		$('.menuitem .button').each(function(){
			if(self != this) {
				$(this).next().slideUp("fast");
			}
		})
		$(this).next().slideToggle("fast");
	});
}

function formatEmoticons(text)
{
	text = text.replace(/:\)\)/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/21.gif"/>');
	text = text.replace(/:\)/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif"/>');
	text = text.replace(/:D/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/4.gif"/>');
	text = text.replace(/;;\)/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/5.gif"/>');
	text = text.replace(/:x/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/8.gif"/>');
	text = text.replace(/(:P|:p)/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif"/>');
	text = text.replace(/:-O/, '<img src="http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/13.gif"/>');
	
	return text;
}

function addVideoComment(userid, videoid,user,date)
{
	$.post("http://cs.megainternet.ro/video/addcomment", {comment:$('#commentText').val(), userid:userid, videoid:videoid }, function(rez) {
	
		if(rez=='FALSE') return;
		
		var commentClone = $('.videoCommentItem:eq(0)').clone();
		commentClone.css("display","block");
		$('span', commentClone).html(user);
		$('div div', commentClone).html(date);
		$('p', commentClone).html(formatEmoticons($('#commentText').val()));
		
		$('#commentsHolder').append( commentClone );
		$('#commentAddHolder').remove();
		$(commentClone).colorBlend([{cycles:1, fromColor:"black", toColor:"#793913", param:"background-color"}]);
	});
}