﻿/// <reference path="~/Scripts/ByteStorm/_BSC_Interface.js" />
(function()
{
    BSC.UI = function()
    {
        var AlertCallback = {};
        var StatusTimer = {};
        var LoaderTimer = null;

        var loadingBox = "<div class=\"box\"><div class=\"top\"><table cellpadding=\"0\" cellspacing=\"0\" ><tr><tr><td class=\"icon\" valign=\"top\"><div class=\"icon\"></div></td><td class=\"content\" valign=\"top\"><h5>Please wait.</h5><div class=\"c\"> Getting product description. </div><div class=\"b\"></div></td></tr></tr></table></div><div class=\"bottom\"></div></div>";

        return {
            GetFlash: function(movieName)
            {
                if (navigator.appName.indexOf("Microsoft") != -1)
                    return window[movieName];
                else
                    return document[movieName];
            },
            SetSelectIndexByValue: function(id, value)
            {
                var cbo = document.getElementById(id);
                for (var i = 0; i < cbo.length; i++)
                {
                    if (cbo.options[i].value == value)
                    {
                        cbo.selectedIndex = i;
                        return;
                    }
                }
            },

            DisableSelection: function(el)
            {
                el.css("-moz-user-select", "none");
                //el.css("-khtml-user-select","none");
                el.css("user-select", "none");
            },

            EnableSelection: function(el)
            {
                el.css("-moz-user-select", "");
                //el.css("-khtml-user-select", "");
                el.css("user-select", "");
            },

            Loader: function(guid, time)
            {
                $("#" + guid + "_alertstatus").show();
                $("#" + guid + "_alertstatustext").show();

                if (time)
                {
                    LoaderTimer = setTimeout(function()
                    {
                        $("#" + guid + "_alertstatus").hide();
                        $("#" + guid + "_alertstatustext").hide();
                    }, time);
                }
            },

            HideLoader: function(guid)
            {
                if (LoaderTimer)
                    clearTimeout(LoaderTimer);
                $("#" + guid + "_alertstatus").hide();
                $("#" + guid + "_alertstatustext").hide();
                LoaderTimer = null;
            },

            // ***************************************************************
            // Window Alerts

            ShowWindowAlert: function(guid, ok_key, cancel_key, header, description, callback, data, icon)
            {
                var basic = BSC.D.Ts.Get("Alert.Basic");

                var data = {
                    id: guid,
                    callback: callback,
                    data: data
                };

                var basic = BSC.D.Ts.Get("Alert.Basic");
                if (!icon) icon = "alert";
                basic = basic.replace(/\{id\}/g, guid);
                basic = basic.replace(/\{icon\}/g, icon);
                basic = basic.replace(/\{header\}/g, header);
                basic = basic.replace(/\{content\}/g, description);

                if (!ok_key) ok_key = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.OK");
                var btn_ok = "<a class='button green' id='" + guid + "_yes'><span>" + ok_key + "</span></a>";
                var btn_cancel = (cancel_key) ? "<a class='button red' id='" + guid + "_no'><span>" + cancel_key + "</span></a>" : "";
                basic = basic.replace(/\{buttons\}/g, btn_ok + btn_cancel);

                var alert = "<div class=\"alert\">" + basic + "</div>";
                $("#" + guid + "_alertcontent .spinner").html(alert);

                $("#" + guid + "_alertoverlay").show().click(function() { return false; });
                $("#" + guid + "_alertcontent").show().bind("click", data, function(e)
                {
                    var el = BSC.E.GetElement(e, "div", "a");
                    var t = (el.id).split("_");
                    var guid = e.data.guid;
                    var action = t[1];
                    var data = e.data.data;

                    $("#AlertOverlay").unbind().css({ display: 'none' });
                    $("#Alert").unbind().css({ display: 'none' });

                    if (action === "yes")
                    {
                        if (data.callback)
                            data.callback.apply(null, [data.data]);
                    }
                    return false;
                });
            },

            HideWindowAlert: function(guid)
            {
                $("#" + guid + "_alertoverlay").hide();
                $("#" + guid + "_alertcontent").hide();
                $("#" + guid + "_alertcontent .spinner").html("");
                $("#" + guid + "_alertcontent").unbind();
            },

            // ***************************************************************
            // Window Status

            ShowStatus: function(guid, text, delay, fadeInSpeed, fadeOutSpeed)
            {

                $("#" + guid + "_statusbar span").html(text);
                $("#" + guid + "_statusbar").show();
                return;

                //				if (!delay) delay = 2000;
                //				if (!fadeInSpeed) fadeInSpeed = 200;
                //				if (!fadeOutSpeed) fadeOutSpeed = fadeInSpeed;

                //				if (StatusTimer[guid])
                //				{
                //					clearTimeout(StatusTimer[guid]);
                //					$("#" + guid + "_statusbar span").fadeOut(fadeOutSpeed);
                //				}

                //				$("#" + guid + "_statusbar span").css("display", "none").html(text).fadeIn(fadeInSpeed);
                //				StatusTimer[guid] = setTimeout("BSC.UI.HideStatus('" + guid + "'," + fadeOutSpeed + ")", delay);
            },
            HideStatus: function(guid, speed)
            {
                setTimeout(function()
                {
                    $("#" + guid + "_statusbar span").html("");
                    $("#" + guid + "_statusbar").hide();
                }, 500);
                return;

                //				$("#" + guid + "_statusbar span").fadeOut(speed);
                //				StatusTimer[guid] = null;
            },

            // ***************************************************************
            // Help Bubbles

            ShowHelpBubble: function(id, type, header, html, css, offset)
            {
                var offset = (id && !offset) ? $("#" + id).offset() : { top: 0, left: 0 };
                if (!css) css = { top: -10, left: 200 };
                var hb = $("#HelpBubble");
                $("#HelpBubble h1").html(header);
                $("#HelpBubble div.c").html(html);
                hb.removeClass();
                hb.addClass(type);
                hb.css({ display: 'block', top: offset.top + css.top, left: offset.left + css.left });
                return false;
            },
            HideHelpBubble: function()
            {
                var hb = $("#HelpBubble");
                $("#HelpBubble h1").html("");
                $("#HelpBubble div.c").html("");
                hb.removeClass();
                hb.css({ display: 'none' });
                return false;
            },

            // ***************************************************************
            // Page Alerts

            Alert: function(ok_key, cancel_key, header, description, callback, data, icon)
            {
                var guid = BSC.U.NewGUID();

                var data = {
                    guid: guid,
                    callback: callback,
                    data: data
                };

                var basic = BSC.D.Ts.Get("Alert.Basic");
                if (!icon) icon = "alert";
                basic = basic.replace(/\{id\}/g, guid);
                basic = basic.replace(/\{icon\}/g, icon);
                basic = basic.replace(/\{header\}/g, header);
                basic = basic.replace(/\{content\}/g, description);

                if (!ok_key) ok_key = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.OK");
                var btn_ok = "<a class='button green' id='" + guid + "_yes'><span>" + ok_key + "</span></a>";
                var btn_cancel = (cancel_key) ? "<a class='button red' id='" + guid + "_no'><span>" + cancel_key + "</span></a>" : "";

                basic = basic.replace(/\{buttons\}/g, btn_ok + btn_cancel);

                $("#Alert").html(basic);
                // Event binding
                $("#" + guid + "_alert").bind("click", data, function(e)
                {
                    var el = BSC.E.GetElement(e, "div", "a");
                    if (!el.id) return;
                    var t = (el.id).split("_");
                    var guid = e.data.guid;
                    var action = t[1];
                    var data = e.data;

                    if (action === "yes")
                    {
                        if (data && data.callback)
                        {
                            var result = data.callback.apply(null, [data.data]);
                            if (result == false)
                                return false;
                        }
                    }

                    $("#AlertOverlay").unbind().css({ display: 'none' });
                    $("#Alert").unbind().css({ display: 'none' });
                    $("#Alert").html("");

                    return false;
                });
                // UI: display alert
                $("#AlertOverlay").click(function() { }).css({ display: 'block' });
                $("#Alert").css({ display: 'block' });
                BSC.E.MapHrefs();
                return;
            },

            AlertConfirmPurchase: function(data, callback, error_callback)
            {
                var guid = BSC.U.NewGUID();

                $("#Alert").unbind().html(loadingBox).css({ display: 'block', top: "40%" });
                $("#AlertOverlay").click(function() { }).css({ display: 'block' });

                var alertHtml = BSC.D.Ts.GetView("Alert.ConfirmPurchase");
                $("#Alert").html(alertHtml).bind("click", { productid: data.productid }, function(e)
                {
                    var el = BSC.E.GetElement(e, "div", "button");
                    if (el.id == "alert_confirmpurchase_cancel")
                    {
                        $("#Alert").hide(); $("#AlertOverlay").hide();
                    }

                    if (el.id == "alert_confirmpurchase_confirm")
                    {
                        var password = $("#alert_confirmpurchase_password").val();
                        if (!password || password.length == 0)
                        {
                            alert(BSC.T.Get("JS.BSC.UI.AlertConfirmPurchase.EnterPassword"));
                            return false;
                        }

                        data.password = password;

                        // hide button & show alert
                        $("#Alert button").hide();
                        $("#alert_loader").show();

                        BSC.D.AjaxPost("/dopayment", data, function(res)
                        {
                            delete data.password;
                            if (!res.success)
                            {
                                $("#Alert button").show();
                                $("#alert_loader").hide();
                                if (error_callback)
                                {
                                    data.response = res;
                                    var result = error_callback.apply(null, [data]);
                                    if (result == false)
                                        return false;
                                }
                                else
                                {
                                    alert(res.message);
                                    return false;
                                }
                            }
                            else if (callback && res.success)
                            {
                                data.response = res;
                                var result = callback.apply(null, [data]);
                                if (result == false)
                                {
                                    $("#Alert button").show();
                                    $("#alert_loader").hide();
                                    $("#Alert").hide(); $("#AlertOverlay").hide();
                                    return false;
                                }
                            }
                            $("#Alert button").show();
                            $("#alert_loader").hide();
                            //$("#Alert").hide(); 
                            //$("#AlertOverlay").hide();
                        }, "json", guid);
                    }

                    return false;
                })
                $("#bigloader").remove();

                return false;
            },

            AlertActivation: function(data)
            {
                var guid = BSC.U.NewGUID();
                var data = {
                    guid: guid,
                    data: data
                };
                var basic = BSC.D.Ts.Get("Alert.ActivateProfile");
                $("#Alert").html(basic);
                $("#ActivationAlert_Email").val($("#login_email").val());

                $("#AlertOverlay").click(function() { }).css({ display: 'block' });
                $("#ActivationAlert_Email").focus(function(e)
                {
                    BSC.UI.HideHelpBubble();
                    BSC.UI.ShowHelpBubble(this.id, "info", BSC.T.Get("JS.BSC.UI.AlertActivation.TypeEmail"), "", { top: -10, left: 180 });
                }).blur(function(e)
                {
                    BSC.UI.HideHelpBubble();
                });

                // Event binding
                $("#Alert").css({ display: 'block', top: "40%" }).bind("click", data, function(e)
                {
                    var guid = e.data.guid;
                    var el = BSC.E.GetElement(e, "div", "a");
                    if (el.id == "LoginAlert_Resend")
                    {
                        var email = $("#ActivationAlert_Email").val();
                        if (!BSC.R.Email.test(email))
                        {
                            BSC.UI.ShowHelpBubble("email_activation", "alert", BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.InvalidEmail"), "", { top: -10, left: 180 });
                            return false;
                        }

                        var p = new BSC.D.Param("BSC.WS.JS.Public.Login");
                        p.Add("email", email);
                        BSC.D.Send(p, "Public", "ResendActivationEmail",
                        function(r)
                        {
                            $("#AlertOverlay").click(function() { }).css({ display: 'none' });
                            $("#Alert").unbind().html("").css({ display: 'none' });
                            BSC.UI.HideHelpBubble();
                            if (r.d.success)
                            {
                                BSC.UI.Alert(BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.OK"), null, BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.EmailSend"), BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.EmailSendDesc"), null, null, "info");
                                return;
                            }
                            else
                            {
                                BSC.UI.Alert(BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.OK"), null, BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.InvalidLogin"), BSC.T.Get("JS.BSC.UI.OnAlertActivationClick.LoginAgain"));
                            }
                        }
                    );
                        return;
                    }
                    $("#AlertOverlay").click(function() { }).css({ display: 'none' });
                    $("#Alert").unbind().html("").css({ display: 'none' });
                    BSC.UI.HideHelpBubble();
                });

                $("#bigloader").remove();
                return;
            },

            AlertClose: function()
            {
                $("#AlertOverlay").unbind().css({ display: 'none' });
                $("#Alert").unbind().css({ display: 'none' });
                $("#Alert h5").html("");
                $("#Alert .c").html("");
                $("#Alert .b").html("");
            },

            AlertOnlyFullMembers: function()
            {
                var id = BSC.D.P.GetData().id;
                var ok = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.OK");
                var header = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.H");
                var message = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.M");

                BSC.UI.Alert(ok, null, header, message, null, null, "info");
                return;
            },

            AlertBeautyFilter: function(name, gender, filter, score)
            {
                var id = BSC.D.P.GetData().id;
                var ok = "Learn more";  //BSC.T.Get("JS.BSC.UI.Upgrade");
                var cancel = BSC.T.Get("JS.BSC.UI.AlertLogin.Cancel");
                var header = "Beauty Filter enabled"; // BSC.T.Get("JS.BSC.UI.AlertCurrentlyFREE.H");
                var message = (gender == 1) ? name + " has enabled his Beauty Filtering and he only wants to communicate with her friends or profiles with a Beauty Score of minimumm " + filter + ". <br/>Your current score is " + score
                : name + " has enabled her Beauty Filtering and she only wants to communicate with her friends or profiles with a Beauty Score of minimumm " + filter + ". <br/>Your current score is " + score; //BSC.T.Get("JS.BSC.UI.AlertCurrentlyFREE.M");

                BSC.UI.Alert(ok, cancel, header, message, function(e) { GO("/home/accountsettings/beautyscore"); BSC.UI.AlertClose(); return false; }, null, "info");

                BSC.E.MapHrefs();
                return;
            },

            AlertCurrentlyFREE: function()
            {
                var id = BSC.D.P.GetData().id;
                var ok = BSC.T.Get("JS.BSC.UI.Upgrade");
                var cancel = BSC.T.Get("JS.BSC.UI.AlertLogin.Cancel");
                var header = BSC.T.Get("JS.BSC.UI.AlertCurrentlyFREE.H");
                var message = BSC.T.Get("JS.BSC.UI.AlertCurrentlyFREE.M");

                BSC.UI.Alert(ok, cancel, header, message, function(e) { GO("/subscription"); BSC.UI.AlertClose(); return false; }, null, "info");
                return;
            },

            AlertCurrentlyApplicant: function()
            {
                var id = BSC.D.P.GetData().id;
//                var ok = BSC.T.Get("JS.BSC.UI.Upgrade");
//                var cancel = BSC.T.Get("JS.BSC.UI.AlertLogin.Cancel");
//                var header = BSC.T.Get("JS.BSC.UI.AlertCurrentlyApplicant.H");
//                var message = BSC.T.Get("JS.BSC.UI.AlertCurrentlyApplicant.M");

                //BSC.UI.Alert(ok, cancel, header, message, function(e) { GO("/subscription"); BSC.UI.AlertClose(); return false; }, null, "info");
                var ok = BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembers.OK");
                BSC.UI.Alert(ok, null,"This feature is not available", "This feature is not available for applicants", null, null, "info");
                return;
            },

            AlertOnlyFullMembersMail: function()
            {
                var id = BSC.D.P.GetData().ID;
                BSC.UI.Alert(BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembersMail.OK"), null, BSC.T.Get("JS.BSC.UI.AlertOnlyFullMembersMail.Desc"), null, null, "info");
                return;
            },

            AlertOnlyFullMembersClose: function()
            {
                $("#AlertOverlay").unbind().css({ display: 'none' });
                $("#Alert").unbind().css({ display: 'none' });
                $("#Alert h5").html("");
                $("#Alert .c").html("");
                $("#Alert .b").html("");
            },


            AlertLogin: function(data)
            {
                var guid = BSC.U.NewGUID();
                var data = { guid: guid, data: data };

                var loginalert = BSC.D.Ts.Get("Alert.Login"); //Signup
                $("#Alert").html(loginalert);

                $("#Alert .box .top.login").css({ width: "350px" });
                //                alert(loginalert);
                //                return;
                // Keyboard
                //                $("#Alert").bind('keydown', 'esc', function(e) {
                //                    $("#AlertOverlay").click(function() { }).hide();
                //                    $("#Alert").unbind().html("").hide();
                //                   });
                //
                //
                $("#form_login").submit(function(e)
                {
                    $(this).ajaxSubmit({
                        dataType: "json",
                        // Validate
                        beforeSubmit: function(formArray, jqForm)
                        {
                            // Email
                            var login_email = $("#login_email");
                            login_email.removeClass("error");
                            if (!login_email.getValue())
                            {
                                login_email.addClass("error").trigger("focus");
                                return false;
                            }

                            // Password
                            var login_password = $("#login_password");
                            login_password.removeClass("error");
                            if (!login_password.getValue())
                            {
                                login_password.addClass("error").trigger("focus");
                                return false;
                            }
                        },
                        // Result
                        success: function(res)
                        {
                            // Success
                            if (res.valid)
                            {
                                top.location.reload(); // = "/site";
                                return;
                            }

                            // Failed
                            var email_field = $("#login_email");
                            email_field.removeClass("error");
                            var password_field = $("#login_password");
                            password_field.setValue("").removeClass("error").addClass("error");

                            if (res.reason == 2)
                            {
                                alert("Invalid Password");
                                password_field.trigger("focus");
                            }
                            else
                            {
                                alert("Invalid login");
                                email_field.setValue("").addClass("error").trigger("focus");
                            }
                        }
                    });
                    return false;
                });

                $("#AlertOverlay").click(function() { }).css({ display: 'block' });
                $("#Alert").css({ display: 'block', top: "20%" }).bind("click", data, function(e)
                {
                    var el = BSC.E.GetElement(e, "div", "a");
                    if (!el.id) return;

                    if (el.id == "LoginAlert_Cancel")
                    {
                        $("#email_login").val("");
                        $("#password_login").val("");
                        $("#AlertOverlay").click(function() { }).hide();
                        $("#Alert").unbind().html("").hide();
                        BSC.UI.HideHelpBubble();
                        return false;
                    }
                    else if (el.id == "LoginAlert_BecomeMember")
                    {
                        $("#email_login").val("");
                        $("#password_login").val("");
                        $("#Alert").unbind().html("").hide();
                        BSC.UI.HideHelpBubble();
                        //BSC.UI.ShowSignup();
                        GO("/splash");
                        return false;
                    }
                });
                $("#LoginAlert_Email").trigger("focus");
                return;
            },


            AlertForgotPassword: function(data)
            {
                var forgotpasswd = BSC.D.Ts.Get("Alert.ForgotPassword");
                $("#AlertOverlay").css({ display: 'block' });
                $("#Alert").html(forgotpasswd);
                //BSC.UI.Ws.Signup.Init();
                $("#Alert").css({ display: 'block' });
                $("#Alert").css({ top: "20%" });
                $("#Alert a").click(OnResetPasswordClick);
                //				var guid = BSC.U.NewGUID();
                //				var data = { guid: guid, data: data };

                //				var basic = BSC.D.Ts.Get("Alert.Basic");
                ////				basic = basic.replace(/\{id\}/g, guid);
                ////				basic = basic.replace(/\{icon\}/g, "lock");
                ////				basic = basic.replace(/\{header\}/g, BSC.T.Get("JS.BSC.UI.AlertForgotPassword.ForgotPassword"));
                ////				basic = basic.replace(/\{content\}/g, "Insert your email and get your password. <br/><input type='text' id='email' style='width:180px; margin-top:8px;' />");

                //				var links = new BSC.U.StringBuffer();
                //				links.append("<a class='button alert blue' id='" + key + "_resendpasswd'><span>" + BSC.T.Get("JS.BSC.UI.AlertForgotPassword.Resend") + "</span></a>");
                //				links.append("<a class='button alert red' id='" + key + "_cancel'><span>" + BSC.T.Get("JS.BSC.UI.AlertForgotPassword.Cancel") + "</span></a>");
                //				basic = basic.replace(/\{buttons\}/g, links.toString());

                //				$("#AlertOverlay").click(function() { }).css({ display: 'block' });
                //				$("#Alert").html(basic).bind("click", data, function(e)
                //				{
                //					var el = BSC.E.GetElement(e, "div", "a");
                //					if (!el.id) return;
                //					if (el.id == "cancel")
                //					{

                //						$("#email").val("");
                //						//$("#password_login").val("");
                //						$("#Alert .b").html("");
                //						$("#AlertOverlay").click(function() { }).css({ display: 'none' });
                //						$("#Alert a").unbind();
                //						$("#Alert").css({ display: 'none' });
                //						BSC.UI.HideHelpBubble();
                //						return false;
                //					}
                //					else if (action === "becomemember")
                //					{
                //						$("#email_login").val("");
                //						$("#password_login").val("");
                //						$("#Alert .b").html("");
                //						//$("#AlertOverlay").click(function(){}).css({display:'none'});
                //						$("#Alert a").unbind();
                //						$("#Alert").css({ display: 'none' });
                //						BSC.UI.HideHelpBubble();
                //						BSC.UI.ShowSignup();
                //						return false;
                //					}
                //				}).css({ display: 'block', top: "40%" });
                //				return;
            },


            InputError: function(guid, id, type, header, html, container, css)
            {
                var _id = id;
                var _guid = guid;
                var _type = type;
                var _header = header;
                var _html = html;
                if (!css) css = { top: 48, left: 0 }
                $("#" + guid + "_content").scrollTo(id, 350, { easing: 'swing', queue: true, axis: 'y', onAfter: function(target)
                {
                    var el = $(target);
                    var pos = el.position();
                    var width = parseInt(el.css("width"));
                    var w = BSC.UI.Ws.Get(_guid);
                    BSC.UI.ShowHelpBubble(target, _type, _header, _html, { top: (pos.top + w.top + css.top), left: (pos.left + w.left + width + css.left) }, true)
                }
                });
            },


            TwoOptionAlert: function(left_key, right_key, header, description, callback_left, data_left, callback_right, data_right, icon)
            {
                var guid = BSC.U.NewGUID();
                var data = { guid: guid, dataLeft: { callback: callback_left, data: data_left }, dataRight: { callback: callback_right, data: data_right} };

                var basic = BSC.D.Ts.Get("Alert.Basic");

                basic = basic.replace(/\{id\}/g, guid);
                if (!icon) icon = "alert";
                basic = basic.replace(/\{icon\}/g, icon);
                basic = basic.replace(/\{header\}/g, header);
                basic = basic.replace(/\{content\}/g, description);

                if (!left_key) left_key = "Ok";
                var btn_left = "<a class='button green' id='" + guid + "_left'><span>" + left_key + "</span></a>";
                var btn_right = (right_key) ? "<a class='button blue' id='" + guid + "_right'><span>" + right_key + "</span></a>" : "";
                $("#Alert .b").html(btn_left + btn_right);
                basic = basic.replace(/\{buttons\}/g, btn_left + btn_right);
                $("#Alert").html(basic);


                $("#AlertOverlay").click(function() { }).show();
                $("#Alert").bind("click", data, function(e)
                {
                    var el = BSC.E.GetElement(e, "div", "a");
                    var t = (el.id).split("_");
                    var action = t[1];
                    var guid = e.data.guid;

                    $("#AlertOverlay").unbind().css({ display: 'none' });
                    $("#Alert").unbind().html("").hide();

                    if (action === "left")
                    {
                        if (e.data.dataLeft && e.data.dataLeft.callback)
                            e.data.dataLeft.callback.apply(null, [e.data.dataLeft.data]);
                    }
                    else if (action === "right")
                    {
                        if (e.data.dataRight && e.data.dataRight.callback)
                            e.data.dataRight.callback.apply(null, [e.data.dataRight.data]);
                    }
                    return false;
                }).css({ display: 'block', top: "40%" });
                return;
            },

            Close: function()
            {
                $("#AlertOverlay").hide();
                $("#Alert").unbind().html("").hide();
                BSC.UI.HideHelpBubble();
            },

            ShowSignup: function()
            {
                var signup = BSC.D.Ts.Get("Alert.SigningUp");
                $("#AlertOverlay").css({ display: 'block' });
                $("#Alert").html("<a href=\"javascript:void(0);\" onclick=\"BSC.UI.Close();\" id=\"signupbox_close\"></a><br class=\"clear\" />" + signup);
                //BSC.UI.Ws.Signup.Init();
                $("#Alert").css({ display: 'block' });
                $("#Alert").css({ top: "20%" });
            }
        };
    } ();
})();

