var YHC = {}; YHC.$=function(id){ return document.getElementById(id); }; YHC.Config = { 'partnerid' : '1', 'sitename' : '乐趣视频游戏' }; YHC.TagHelper = { 'getHtml':function(){ var txt = ''; txt += '
萤火虫登录关闭
'; txt += '

用萤火虫帐号即可免注册直接登录“' + YHC.Config.sitename +'” 。

'; txt += ' '; txt += '
萤火虫一号通,免注册通行所有网站,欢迎您的使用。
'; return txt; }, 'setMiddle': function(element){ var bodyWidth=parseInt(document.body.offsetWidth); var bodyHeight=parseInt(document.body.offsetHeight); var documentClientWidth=parseInt(document.documentElement.clientWidth); var documentClientHeight=parseInt(document.documentElement.clientHeight); var elementWidth=parseInt(element.offsetWidth); var elementHeight=parseInt(element.offsetHeight); var elementLeft=(documentClientWidth-elementWidth)/2+'px'; var elementTop=YHC.TagHelper.getScrollTop()+(documentClientHeight-elementHeight)/2+'px'; element.style.top=elementTop; element.style.left=elementLeft; }, 'getScrollTop':function(){ var scrollTop=0; if(document.documentElement&&document.documentElement.scrollTop){ scrollTop=document.documentElement.scrollTop; } else if(document.body){ scrollTop=document.body.scrollTop; } return scrollTop; } }; YHC.Forms = {}; YHC.Forms.LogonForm = { 'open':function(){ if (document.all && document.body.readyState != 'complete') { return; } var url = 'http://www.3637.com/api/yhc_action.js.aspx?act=getLoginState&callback=YHC.Forms.LogonForm.onOpen'; url += '&' + Math.random(); YHC.Funs.addScriptElement('',url); }, 'onOpen':function(isOnline){ if(isOnline){ YHC.Funs.onLogonSuccess(); return; } var yhcLogonForm = YHC.$('yhc_logonFrom'); if(!yhcLogonForm){ var headerTag = document.getElementsByTagName('head')[0]; var bodyTag = document.getElementsByTagName('body')[0]; //添加样式 var tempCss = document.createElement('link'); tempCss.rel = 'stylesheet'; tempCss.href = 'http://www.3637.com/api/yhc_login.css'; headerTag.appendChild(tempCss); //添加标签 var tempDiv = document.createElement('div'); tempDiv.id = 'yhc_logonFrom'; tempDiv.className = 'yhc_popping'; tempDiv.innerHTML = YHC.TagHelper.getHtml(); tempDiv.style.position='absolute'; tempDiv.style.zIndex=100000; tempDiv.style.width = '420px'; tempDiv.style.height = '300px'; bodyTag.appendChild(tempDiv); YHC.TagHelper.setMiddle(tempDiv); yhcLogonForm=tempDiv; } yhcLogonForm.style.display='block'; }, 'close':function(){ var yhcLogonForm = YHC.$('yhc_logonFrom'); yhcLogonForm.style.display = 'none'; } }; YHC.Funs = { 'login':function(){ var userid = YHC.$('yhc_uid').value; var password = YHC.$('yhc_pwd').value; var vcode = ''; if(userid=='' || password==''){ alert('请输入用户名密码'); return; } var url = 'http://www.3637.com/api/yhc_login.aspx?'; url += 'act=logon&uid=' + encodeURIComponent(userid) + '&pwd='+encodeURIComponent(password)+'&vcode='+vcode; url += '&' + Math.random(); YHC.Funs.addScriptElement('yhc_logonJs',url); return false; }, 'onLogonSuccess':function(){ window.location.href = 'http://www.3637.com/passport/go.aspx?act=login&i=' + YHC.Config.partnerid; }, 'onLogonError':function(message,errorCount){ alert(message); }, 'addScriptElement':function(id,url){ var headerTag = document.getElementsByTagName('head')[0]; var tempJs = document.createElement('script'); tempJs.id = id; tempJs.type = 'text/javascript'; tempJs.setAttribute("charset", "gbk"); tempJs.src = url; headerTag.appendChild(tempJs); } };