var promo;
(function($) {
    promo = {
		set_template: function (nDefaultId, nPersonalId, sRedirect, oButton)
		{
			if (confirm('Активировать шаблон?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'Sites',
						_Component: 'Templates',
						DefaultTemplates: nDefaultId,
						PersonalTemplates: nPersonalId,
						_IsSended: 1
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		},

		remove_news: function (nItemId, sRedirect, oButton)
		{
			if (confirm('Удалить новость?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'News',
						_Component: 'PublicDelete',
						Id: nItemId
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		},

		remove_page: function (nItemId, sRedirect, oButton)
		{
			if (confirm('Удалить страницу?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'Pages',
						_Component: 'PublicDelete',
						Id: nItemId
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		},

		remove_faq: function (nItemId, sRedirect, oButton)
		{
			if (confirm('Удалить вопрос?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'Faq',
						_Component: 'PublicDelete',
						Id: nItemId
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		},

		remove_contacts: function (nItemId, sRedirect, oButton)
		{
			if (confirm('Удалить адрес?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'Contacts',
						_Component: 'PublicDelete',
						Id: nItemId
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		},

		remove_portfolio: function (nItemId, sRedirect, oButton)
		{
			if (confirm('Удалить работу?')) {
				oButton.disabled = "disabled";
				Rx.ajax({
					Url: Rx.sReturnActionUrl,
					Params:
					{
						_Module: 'Promo',
						_Model: 'Portfolio',
						_Component: 'PublicDelete',
						Id: nItemId
					},
					OnReady: function ()
					{
						oButton.disabled = null;
						location.href = sRedirect;
					}
				});
			}

			return;
		}
    }
})(jQuery);
