var ajax_login_loaded = false; document.write(''); function showAjaxLogin(){ if(ajax_login_loaded){ //temporarily hide flash video player var div = document.getElementById('pevPlayerContainer'); if(div!=null){ div.style.visibility = 'hidden'; } TB_show('ログイン', '/2g/user/ajax_login_form.jsp?height=260&width=300', false); }else alert('ページが表示されるまでお待ちください。'); } function ajaxLoginInit(){ document.ajaxLoginForm.username.focus(); } function endsWith(target, subs){ n = subs.length; lasts = target.substr(target.length-n,n); return lasts == subs; } function ajaxloginResponseHandler(response){ if(response == 'login_ok'){ //ログインに成功した場合、リロードする document.getElementById('errormsg').innerHTML = "認証されました。ログインしています・・"; TB_remove(); currentLocation = top.location.href; if(endsWith(currentLocation,'#')) currentLocation = currentLocation.substr(currentLocation, currentLocation.length -1); if(endsWith(currentLocation,'/') || endsWith(currentLocation,'/logout.jspx')){ //トップページまたはログアウト画面にてログインした場合は、マイページへ遷移する top.location.href = '/2g_mypage.jspx'; }else{ top.location.href = '/redirect.jspx?p=' + encodeURIComponent(top.location.href); } }else{ //ログインに失敗した場合 document.getElementById('errormsg').innerHTML = response; } } //サーバーにユーザ名・パスワードを送信、認証する function ajaxLogin(){ var username = document.ajaxLoginForm.username.value; var password = document.ajaxLoginForm.password.value; var autologin = document.ajaxLoginForm.autologin.value; document.getElementById('errormsg').innerHTML = "認証中・・"; var url = '/ajaxlogin.jspx?' + 'username=' + username + '&password=' + password + '&autologin=' + autologin + '&rnd=' + Math.random(); var myAjax = new Ajax(url, {method: 'get', onComplete: function(event) { ajaxloginResponseHandler(this.response.text); } }); myAjax.request(); return false; } function showLoading(){ document.getElementById("loading").style.display="block"; } function hideLoading(){ document.getElementById("loading").style.display="none"; }