ews.Login = ews.Login || {}; ews.Login.Input = ""; ews.Login.Count = 0; $(document).ready(function() { $(".ews_login_h_bg").appendTo("body"); $(".ews_login_h_username").keydown(function(event) { $(".ews_login_h_wrongusername").hide(); if (!$.browser.msie) { $(".ews_login_h_username").attr("placeholder","Email Address"); } var k = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (k == 13) { $(".ews_login_h_password").focus(); return false; } $(".ews_login_h_wrongusername").hide(); }); $(".ews_login_h_wrongusername").click(function() { $(".ews_login_h_wrongusername").hide(); $(".ews_login_h_username").focus(); }); if ($.browser.msie) { $(".ews_login_h_password_real").removeAttr("placeholder"); if ($(".ews_login_h_password_real").val() == "") { $(".ews_login_h_password_overlay").val("Password"); $(".ews_login_h_password_overlay").addClass('placeholder'); $(".ews_login_h_password_real").hide(); $(".ews_login_h_password_overlay").show(); $(".ews_login_h_password_overlay").focus(); } $(".ews_login_h_password_overlay").keydown(function(event) { if ($(".ews_login_h_password_overlay").val() == "Invalid Password") $(".ews_login_h_password_overlay").val("Password"); $(".ews_login_h_password_real").val($(".ews_login_h_password_overlay").val().substring(0,$(".ews_login_h_password_overlay").val().length - $(".ews_login_h_password_overlay").attr('placeholder').length)); //$(".ews_login_h_password_real").val($(".ews_login_h_password_overlay").val()); $(".ews_login_h_password_overlay").val(""); $(".ews_login_h_password_overlay").hide(); $(".ews_login_h_password_real").show(); $(".ews_login_h_password_real").focus(); $(".ews_login_h_wrongpassword").hide(); }); $(".ews_login_h_password_real").keyup(function(event) { var input = $(this); if (input.val() == "") { $(".ews_login_h_password_overlay").val("Password"); $(".ews_login_h_password_overlay").addClass('placeholder'); $(".ews_login_h_password_real").hide(); $(".ews_login_h_password_overlay").show(); $(".ews_login_h_password_overlay").focus(); } }); } $(".ews_login_h_password").keydown(function(event) { var k = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (k == 13) { ews.Login.Submit_Click(); return false; } $(".ews_login_h_wrongpassword").hide(); if (!$.browser.msie) { $(".ews_login_h_password").attr("placeholder","Password"); } }); $(".ews_login_h_wrongpassword").click(function() { $(".ews_login_h_wrongpassword").hide(); $(".ews_login_h_password").focus(); }); $(".ews_login_h_submit").click(ews.Login.Submit_Click); $(".ews_login_h_cancel").click(ews.Login.Cancel_Click); $(".ews_login_h_forget").click(ews.Login.Forget_Click); if ($.browser.msie) { ews.Login.MakePlaceHolders(); } }); ews.Login.SetCursorIE = function(input) { if (input.createTextRange) { var FieldRange = input.createTextRange(); FieldRange.moveStart('character', 0); FieldRange.collapse(); FieldRange.select(); } else { input.setSelectionRange(0, 0); } } ews.Login.MakePlaceHolders = function() { if ($(".ews_login_h_username").val() == "") { $(".ews_login_h_username").addClass("placeholder"); $(".ews_login_h_username").val("Email Address"); } $('[placeholder]').focus(function() { var input = $(this); if (input.hasClass("placeholder")) { ews.Login.SetCursorIE(input[0]); } }).click(function() { var input = $(this); if (input.hasClass("placeholder")) { ews.Login.SetCursorIE(input[0]); } }).keyup(function() { var input = $(this); if (input.hasClass("placeholder") && input.val() != input.attr('placeholder')) { input.val(input.val().substring(0,input.val().length - input.attr('placeholder').length)); input.removeClass('placeholder'); } if (input.val() == "") { input.addClass('placeholder'); input.val(input.attr('placeholder')); ews.Login.SetCursorIE(input[0]); } $(".ews_login_h_username").attr("placeholder","Email Address"); }).change(function() { var input = $(this); if (input.hasClass("placeholder") && input.val() != input.attr('placeholder')) { input.val(input.val().substring(0,input.val().length - input.attr('placeholder').length)); input.removeClass('placeholder'); } if (input.val() == "") { input.addClass('placeholder'); input.val(input.attr('placeholder')); ews.Login.SetCursorIE(input[0]); } }); $('[placeholder]').parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); } }) }); } $(document).keyup(function(event) { if (event.currentTarget.activeElement.nodeName != "INPUT" && event.currentTarget.activeElement.nodeName != "TEXTAREA" && event.currentTarget.activeElement.id != "wEditorArea") { var k = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (k == 76 && ews.Login.Input == "") { ews.Login.Input = "l"; } else if (k == 79 && ews.Login.Input == "l") { ews.Login.Input = "lo"; } else if (k == 71 && ews.Login.Input == "lo") { ews.Login.Input = "log"; } else if (k == 73 && ews.Login.Input == "log") { ews.Login.Input = "logi"; } else if (k == 78 && ews.Login.Input == "logi") { ews.Login.Input = ""; if (window.location.protocol === "https:") { ews.Login.Show(); } else { window.location = "https://www.elexiopulse.com/websitelogin.aspx?return-url=" + window.location; } } else { ews.Login.Input = ""; } } }); ews.Login.SetLoginBoxBgPosition = function() { var w = document.documentElement.clientWidth; var h = document.documentElement.clientHeight; $(".ews_login_h_bg").css({ height: h + "px", width: w + "px" }); $(".ews_login_h_box").css({ top: (h / 2 - 334 / 2) + "px", left: (w / 2 - 453 / 2) + "px" }); } ews.Login.Show = function() { $(window).resize(ews.Login.SetLoginBoxBgPosition); ews.Login.SetLoginBoxBgPosition(); ews.Login.LoadNews(); $(".ews_login_h_bg").fadeIn(500); //if ($(".ews_login_h_username").val() == $(".ews_login_h_username").attr("placeholder")) $(".ews_login_h_username").focus(); //else //$(".ews_login_h_password").focus(); } ews.Login.Submit_Click = function() { var sPath = '/ControlPanel/Login.aspx'; var sUsername = $(".ews_login_h_username").val(); var sPassword = $(".ews_login_h_password").val(); var sRemember = $(".ews_login_h_remember").is(":checked"); $(".ews_login_h_wrongusername").hide(); $(".ews_login_h_wrongpassword").hide(); ews.Login.LastReturnUrl = null; $.post(sPath, { username:sUsername, password:sPassword, remember:sRemember }, ews.Login.Finish); } ews.Login.Finish = function(data) { if (data == "Success") { if (window.location.search.indexOf("ReturnUrl") > 0) { var urlParams = {}; var e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, q = window.location.search.substring(1); while (e = r.exec(q)) urlParams[d(e[1])] = d(e[2]); window.location = urlParams["ReturnUrl"]; } else if (window.location.search.indexOf('portal-token=') > 0) window.location = window.location.href.substr(0, window.location.href.indexOf('portal-token=') - 1); else window.location.reload(); } else if (data == "Invalid Username."){ ews.Login.ShowWrongUsername(); $(".ews_login_h_username").focus().select(); } else if (data == "Invalid Password.") { ews.Login.Count++; if (ews.Login.Count > 1) { $(".ews_login_h_wrongpassword").html("If you are having difficulty logging in, click here."); } ews.Login.ShowWrongPassword(); $(".ews_login_h_password").focus().select(); } else if (data == "Used Example.") { alert("Accessing your Amp Vibe site as a new administrator is now more personalized and secure. Please log in using your email address. If you are not sure of your password, click the “Reset my password” link. For further questions, contact your site administrator or support@elexio.com."); } else if (data == "Valid User No Email") { ews.Login.OldPassword(); } else { $(".ews_login_h_username").focus().select(); ews.Login.ShowWrongUsername(); ews.Login.ShowWrongPassword(); } } if (window.location.search.indexOf('portal-token=') > 0) { var sPath = '/ControlPanel/Login.aspx'; var token = window.location.search.substr(window.location.search.indexOf('portal-token=') + 13); $.post(sPath, { PortalToken:token }, ews.Login.Finish); } ews.Login.ShowWrongPassword = function() { $(".ews_login_h_wrongpassword").show(); $(".ews_login_h_password").val(""); if ($(".ews_login_h_password").attr("oldplaceholder") != $(".ews_login_h_password").attr("placeholder")) { $(".ews_login_h_password").attr("oldplaceholder", $(".ews_login_h_password").attr("placeholder")); } $(".ews_login_h_password").attr("placeholder","Invalid Password"); if ($.browser.msie) { $(".ews_login_h_password").hide(); $(".ews_login_h_password_overlay").show(); $(".ews_login_h_password_overlay").addClass('placeholder'); $(".ews_login_h_password_overlay").val( $(".ews_login_h_password_overlay").attr("placeholder")); } //if ($.browser.ie) // ews.Login.MakePlaceHolders(); } ews.Login.ShowWrongUsername = function() { $(".ews_login_h_wrongusername").show(); if ($.browser.msie ) { $(".ews_login_h_username").val("Invalid Email Address"); $(".ews_login_h_username").addClass('placeholder'); } else { $(".ews_login_h_username").val(""); } $(".ews_login_h_username").attr("oldplaceholder", "Email Address"); $(".ews_login_h_username").attr("placeholder","Invalid Email Address"); } ews.Login.Cancel_Click = function() { $(".ews_login_h_bg").fadeOut(500); $(".ews_login_h_wrongusername").hide(); $(".ews_login_h_wrongpassword").hide(); } /// Forgot Password ews.Login.Forget_Click = function() { var eLitebox = $( '