/* --------- /javascripts/home/login.js --------- */ 

var sign_in_state=true;function sign_in_submit(flag){var login_name=trim($F('login_name'))
var login_password=trim($F('login_password'))
if(isNull(login_name)==true){$("error_info_for_UserID_null").className="display";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="hide";sign_in_top_notice_control(flag);$("div_header_common").style.visibility="visible";check_header_style_display();return sign_in_state=false;}
if(isNull(login_password)==true){$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="display";$("error_info_for_login").className="hide";sign_in_top_notice_control(flag);$("div_header_common").style.visibility="visible";check_header_style_display();return sign_in_state=false;}
new Ajax.Request('/home/login_authenticate',{method:'post',parameters:$('login_name').serialize()+'&'+$('login_password').serialize()+'&authenticity_token='+encodeURIComponent(document.getElementsByName("authenticity_token").item(0).value),asynchronous:false});login_by_sign_in_state(flag);}
function login_by_sign_in_state(flag){if(sign_in_state==true){$('login_submit').submit();return true;}else{sign_in_top_notice_control(flag);$("div_header_common").style.visibility="visible";check_header_style_display();return false;}}
function sign_in_top_notice_control(flag){if(flag){$("div_header_sign_in").style.visibility="visible";$("error_head_style_top_notice").className="top_notice";}else{$("error_head_style_top_notice").className="top_notice";}}
function check_header_style_display(){for(var i=1;i<10;i++){if($('error_head_style_display').childNodes[i]!=null&&$('error_head_style_display').childNodes[i].className=="display"){setTimeout("$('error_head_style_display').childNodes["+i+"].className='hide';$('error_head_style_top_notice').className='hide';",9000);}}}
function user_login_authenticate(state){if(state[0]){switch(state[1]){case 1:$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="hide";$("error_info_for_deny").className="hide";$("error_info_for_hold").className="display";$("error_head_style_top_notice").className="top_notice";return sign_in_state=false;case 2:$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="hide";$("error_info_for_deny").className="display";$("error_info_for_hold").className="hide";$("error_head_style_top_notice").className="top_notice";return sign_in_state=false;case 3:$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="hide";$("error_info_for_deny").className="hide";$("error_info_for_hold").className="hide";$("error_head_style_top_notice").className="hide";return sign_in_state=true;default:$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="hide";$("error_info_for_deny").className="hide";$("error_info_for_hold").className="display";$("error_head_style_top_notice").className="hide";return sign_in_state=false;}}else{$("error_info_for_UserID_null").className="hide";$("error_info_for_pwd_null").className="hide";$("error_info_for_login").className="display";$("error_info_for_deny").className="hide";$("error_info_for_hold").className="hide";$("error_head_style_top_notice").className="hide";return sign_in_state=false;}}
function clickbutton(e){e=(!e)?window.event:e;if(e.keyCode==13)
{$('link_to_login').click();}}
function $D2(){var d=$('div_header_sign_in');var h=d.offsetHeight;var maxh=150;function dmove(){h-=6;check_move="moving";if(h<=0){d.style.visibility="hidden"
clearInterval(iIntervalId);check_move="stop";}else{d.style.height=h+'px';}}
iIntervalId=setInterval(dmove,2);}
function $D(){var d=$('div_header_sign_in');var h=d.offsetHeight;var maxh=150;function dmove(){h+=6;check_move="moving";if(h>=maxh){d.style.height='140px';clearInterval(iIntervalId);check_move="stop";}else{d.style.visibility="visible"
d.style.height=h+'px';}}
iIntervalId=setInterval(dmove,2);}
var check_move="stop"
function sign_in_onclick(){var d=$('div_header_sign_in');if(check_move=="stop"){if(d.style.visibility=="visible"){$D2();}else{$D();}
var login_name=readCookie('userapp_login');var login_pwd=readCookie('userapp_login_pass');if(login_name!=null&&login_pwd!=null){$('remember_me').checked=true;}
if(login_name==null){$('login_name').value=""}else{$('login_name').value=login_name;}
if(login_pwd==null){$('login_password').value=""}else{$('login_password').value=login_pwd;}}}
function sign_in_cancel(){$D2();}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}/* --------- /javascripts/windowtool.js --------- */ 

var WindowTool={}
if(window.screenLeft){WindowTool.getWindowX=function(){return window.screenLeft;};WindowTool.getWindowY=function(){return window.screenTop;};}
else if(window.screenX){WindowTool.getWindowX=function(){return window.screenX;};WindowTool.getWindowY=function(){return window.screenY;};}
if(window.innerWidth){WindowTool.getViewportWidth=function(){return window.innerWidth;};WindowTool.getViewportHeight=function(){return window.innerHeight;};WindowTool.getHorizontalScroll=function(){return window.pageXOffset;};WindowTool.getVerticalScroll=function(){return window.pageYOffset;};}
else if(document.documentElement&&document.documentElement.clientWidth){WindowTool.getViewportWidth=function(){return document.documentElement.clientWidth;};WindowTool.getViewportHeight=function(){return document.documentElement.clientHeight;};WindowTool.getHorizontalScroll=function(){return document.documentElement.scrollLeft;};WindowTool.getVerticalScroll=function(){return document.documentElement.scrollTop;};}
else if(document.body.clientWidth){WindowTool.getViewportWidth=function(){return document.body.clientWidth;};WindowTool.getViewportHeight=function(){return document.body.clientHeight;};WindowTool.getHorizontalScroll=function(){return document.body.scrollLeft;};WindowTool.getVerticalScroll=function(){return document.body.scrollTop;};}
if(document.documentElement&&document.documentElement.scrollWidth){WindowTool.getDocumentWidth=function(){return document.documentElement.scrollWidth;};WindowTool.getDocumentHeight=function(){return document.documentElement.scrollHeight;};}
else if(document.body.scrollWidth){WindowTool.getDocumentWidth=function(){return document.body.scrollWidth;};WindowTool.getDocumentHeight=function(){return document.body.scrollHeight;};}
