function VKCmnt_setDisplay(obj, act)
{
	if (typeof jQuery != 'undefined') {
		// jQuery
		obj.css('display', act);
	} else {
		// mootootls
		obj.setStyle('display', act);
	}
}

function VKCmnt_toogleNext(num)
{
	var VK = VKCmnt_getIsVK();
	var FB = VKCmnt_getIsFB();
	var jq = (typeof jQuery != 'undefined') ? '#' : '';

	var _na_comments     = $(jq+'na_comments');
	var _VKCmnt_toogleNA = $(jq+'VKCmnt_toogleNA');
	var _vk_comments     = $(jq+'vk_comments');
	var _VKCmnt_toogleVK = $(jq+'VKCmnt_toogleVK');
	var _fb_comments     = $(jq+'fb_comments');
	var _VKCmnt_toogleFB = $(jq+'VKCmnt_toogleFB');

	if (num == 1) {
		VKCmnt_setDisplay(_na_comments, 'block');
		_VKCmnt_toogleNA.addClass('VKCmnt_toogleActive');

		if (VK) {
			VKCmnt_setDisplay(_vk_comments, 'none');
			_VKCmnt_toogleVK.removeClass('VKCmnt_toogleActive');
		}

		if (FB) {
			VKCmnt_setDisplay(_fb_comments, 'none');
			_VKCmnt_toogleFB.removeClass('VKCmnt_toogleActive');
		}

		return 0;
	}
	if (num == 2) {
		if (VK) {
			VKCmnt_setDisplay(_vk_comments, 'block');
			_VKCmnt_toogleVK.addClass('VKCmnt_toogleActive');
		}

		VKCmnt_setDisplay(_na_comments, 'none');
		_VKCmnt_toogleNA.removeClass('VKCmnt_toogleActive');

		if (FB) {
			VKCmnt_setDisplay(_fb_comments, 'none');
			_VKCmnt_toogleFB.removeClass('VKCmnt_toogleActive');
		}
		return 0;
	}
	if (num == 3) {
		if (FB) {
			VKCmnt_setDisplay(_fb_comments, 'inline-block');
			_VKCmnt_toogleFB.addClass('VKCmnt_toogleActive');
		}

		VKCmnt_setDisplay(_na_comments, 'none');
		_VKCmnt_toogleNA.removeClass('VKCmnt_toogleActive');

		if (VK) {
			VKCmnt_setDisplay(_vk_comments, 'none');
			_VKCmnt_toogleVK.removeClass('VKCmnt_toogleActive');
		}

		return 0;
	}


	return -1;
}

function VKCmnt_toogleNA()
{
	VKCmnt_toogleNext(1);
}

function VKCmnt_toogleVK()
{
	VKCmnt_toogleNext(2);
}

function VKCmnt_toogleFB()
{
	VKCmnt_toogleNext(3);
}

function VKCmnt_UpdateCommentsVK(num, last_comment, date, api_secret)
{
	if (typeof jQuery != 'undefined') {
		// jQuery
		$.get(aRouter['blog']+'vkcomments/', { sig: api_secret, date: date, last_comment: last_comment, num: num, id: VKCmnt_getTopicId() } );
	} else {
		// mootootls
		var params = new Hash();
		params['sig']=api_secret;
		params['date']=date;
		params['last_comment']=last_comment;
		params['num']=num;
		params['id']=VKCmnt_getTopicId();

		new Request.JSON({
			url: aRouter['blog']+'vkcomments/',
			noCache: true,
			data: params
		}).send();
	}


}


