﻿/// <reference path="~/Scripts/IntelliSense/jquery-1.2.3-intellisense.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.js" />

/// <reference path="~/Scripts/ByteStorm/BSC.D.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.C.js" />


/// <reference path="~/Scripts/ByteStorm/BSC.D.JSON.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.Ws.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.D.Ws.I.js" />

/// <reference path="~/Scripts/ByteStorm/BSC.F.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.M.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.P.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.R.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.T.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.U.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Ts.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Ws.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.W.js" />
/// <reference path="~/Scripts/ByteStorm/BSC.UI.Cropper.js" />

(function()
{
	BSC.UI.Bookmark = function()
	{
		return {
			Add: function(data)
			{
				if (!BSC.D.P.IsLoggedIn())
				{
					BSC.UI.AlertLogin();
					return;
				}
				var p = new BSC.D.Param("BSC.WS.JS.Bookmark.Add");
				p.Add("id", data.id);
				p.Add("key", data.key);
				p.Add("type", data.type);
				p.Add("uri", data.uri);
				p.Add("title", data.title);
				if (!data.callback)
					data.callback = BSC.UI.Bookmark.Confirm;
				if (!data.data)

					data.data = { header: BSC.T.Get("JS.BSC.UI.Bookmark.Add.Saved") };
				BSC.D.Send(p, "Content.Bookmark", "Add", data.callback, null, data.data);
			},
			Confirm: function(res)
			{
				var data = this.d;
				if (!res.d.success)
				{
					alert("ERROR: \n\n" + res.d.message);
					return false;
				}
				BSC.UI.TwoOptionAlert(BSC.T.Get("JS.BSC.UI.Bookmark.Confirm.OK"), BSC.T.Get("JS.BSC.UI.Bookmark.Confirm.View"), BSC.T.Get("JS.BSC.UI.Bookmark.Confirm.Header"), "", null, null, GO, '/home/bookmarks', "info"); //data.header
			}
		};
	} ();
})();
