function ajaxPublishUnpublishOnMain(obj,idTopic,publishIndex) {
    if (publishIndex)
        conf=true;
    else
        conf=confirm("Ваша сила будет уменьшена после публикации на главной. Вы уверены, что хотите выполнить это действие?")
    if (conf) {
	obj=$(obj);
	JsHttpRequest.query(
            'POST '+DIR_WEB_ROOT+'/include/ajax/publishUnpublishOnMain.php',
            { idTopic: idTopic, security_ls_key: LIVESTREET_SECURITY_KEY },
            function(result, errors) {
                    if (!result) {
                        msgErrorBox.alert('Error','Please try again later');
                    }
                    if (result.bStateError) {
                        msgErrorBox.alert(result.sMsgTitle,result.sMsg);
                    } else {
                        msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
                        if (obj)  {
                            item = new Element('li',{'html':result.sToggleText});
                            item.getElement('li').inject(obj.getParent('ul'),'bottom');
                            obj.dispose();
                        }
                    }
            },
            true
        );
    }
}

