(function(){function m(a){return typeof a=="string"?n.document.getElementById(a):a}function o(a,b,c,d){a=m(a);typeof d=="undefined"&&(d=!1);typeof c=="undefined"&&(c="click");if(a.addEventListener)return a.addEventListener(c,b,d),!0;else if(a.attachEvent)return a.attachEvent("on"+c,b),!0;else a["on"+c]=b}var q=navigator.userAgent.toLowerCase(),t=/msie/.test(q),g=/gecko/.test(q),u=/safari/.test(q),i=function(a,b){switch(b){case "opacity":var c=100;try{c=a.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(d){try{c=
a.filters("alpha").opacity}catch(i){}}return c;case "float":b="styleFloat";default:return c=a.currentStyle?a.currentStyle[b]:null,a.style[b]||c}};g&&(i=function(a,b){b=="float"&&(b="cssFloat");try{var c=document.defaultView.getComputedStyle(a,"")}catch(d){traceError(d)}return a.style[b]||c?c[b]:null});var r=function(a){var c;if((a.parentNode==null||a.offsetParent==null||i(a,"display")=="none")&&a!=document.body)return!1;var b;b=a.getBoundingClientRect();c=(a=a.ownerDocument)||document,a=c;a=[Math.max(a.documentElement.scrollTop,
a.body.scrollTop),Math.max(a.documentElement.scrollLeft,a.body.scrollLeft),Math.max(a.documentElement.scrollWidth,a.body.scrollWidth),Math.max(a.documentElement.scrollHeight,a.body.scrollHeight)];return[b.left+a[1],b.top+a[0]]};g&&(r=function(a){if((a.parentNode==null||a.offsetParent==null||i(a,"display")=="none")&&a!=document.body)return!1;var b=null,c=[],c=[a.offsetLeft,a.offsetTop],b=a.offsetParent,d=i(a,"position")=="absolute";if(b!=a)for(;b;)c[0]+=b.offsetLeft,c[1]+=b.offsetTop,u&&!d&&i(b,"position")==
"absolute"&&(d=!0),b=b.offsetParent;u&&d&&(c[0]-=a.ownerDocument.body.offsetLeft,c[1]-=a.ownerDocument.body.offsetTop);for(b=a.parentNode;b.tagName&&!/^body|html$/i.test(b.tagName);)i(b,"display").search(/^inline|table-row.*$/i)&&(c[0]-=b.scrollLeft,c[1]-=b.scrollTop),b=b.parentNode;return c});var p=function(){return window.event};g&&(p=function(){for(var a=arguments.callee.caller,b,c=0;a!=null&&c<40;){if((b=a.arguments[0])&&(b.constructor==Event||b.constructor==MouseEvent))break;c++;a=a.caller}return b});
var s=function(){var a=p();a.cancelBubble=!0;a.returnValue=!1};g&&(s=function(){var a=p();a.preventDefault();a.stopPropagation()});var n=window;window.passcardOBJ=new function(){var a=null,b=null,c=null,d=null,i=parseInt(Math.random()*100),k=[],g=null,j=-1,l="";this._overfcolor="#000000";this._overbgcolor="#E8F4FC";this._outfcolor="#000000";this._outbgcolor="#FFFFFF";this._menuStatus={"vip.sina.com":!0,"my3ia.sina.com":!0};this.create=function(){var v=n.document,b=v.createElement("div");b.innerHTML=
'<ul class="passCard" id="sinaNote" style="display:none;"></ul>';(a||v.body).appendChild(b);c=m("sinaNote");return b};this.arrowKey=function(a){if(a==38){if(j<=0)j=k.length;j--;this.activeItem(m(k[j]))}a==40&&(j>=k.length-1&&(j=-1),j++,this.activeItem(m(k[j])))};this.showList=function(){var a=p().keyCode;if(a==38||a==40)return this.arrowKey(a),!1;var a=b.value,e="",d="",h=a.indexOf("@");h>-1&&(e=a.substr(h+1),d=a.substr(0,h));l="";j=0;k=[];var h='<li class="note">请选择登录类型</li>',f;for(f in this._menuStatus)if(this._menuStatus[f]=
!0,e!=""&&e!=f.substr(0,e.length))this._menuStatus[f]=!1;else{var g=(d||a)+"@"+f,w="sinaNote_item_"+f+"_"+i;k.push(w);h+='<li id="'+w+'" title="'+g+'">'+g+"</li>"}c.innerHTML=h;for(f=0;f<a.length;f++)a.charCodeAt(f)<160?(this.setVisible(!0),this.initItems()):this.setVisible(!1);f=a=0;n!=window&&(f=r(window.frameElement),a=f[0],f=f[1]);e=b.offsetWidth;e<200&&(e=200);c.style.width=e-2+"px";e=r(b);c.style.left=e[0]-(t?2:-1)+a+"px";c.style.top=e[1]+b.offsetHeight-(t?2:-1)+f+"px"};this.initItems=function(){for(var a=
this,e=c.getElementsByTagName("li"),d=1;d<e.length;d++){var h=e[d];h.onmousedown=function(){var a=this.innerHTML;a.indexOf("非新浪邮箱")>-1?(a=a.split("@"),b.value=a[0]):b.value=this.innerHTML;s()};h.onmouseover=function(){a.activeItem(this)};h=null}e[1]&&this.activeItem(e[1])};this.activateItem=function(a){if(a)a.style.color=this._overfcolor,a.style.backgroundColor=this._overbgcolor,l=a.innerHTML};this.deactivateItem=function(a){a.style.color=this._outfcolor;a.style.backgroundColor=this._outbgcolor};
this.activeItem=function(a){g!=a&&(g&&this.deactivateItem(g),a&&this.activateItem(a),g=a)};this.getVisible=function(){return c.style.display!="none"};this.setVisible=function(a){c.style.display=a?"":"none"};this.onKeyDown=function(a){a=a.keyCode;if(a==13||a==9){if(l!="")a=l,a.indexOf("非新浪邮箱")>-1?(a=a.split("@"),b.value=a[0]):b.value=l;d!=null&&d.focus();s()}};this.init=function(c,e,g,h,f){function i(){k.setVisible(!1)}this.create();for(var j in e)this["_"+j]=e[j];b=c;var k=this;o(document,i,"click");
o(c,i,"blur");o(c,function(){k.showList()},"keyup");o(c,function(a){return k.onKeyDown(a||window.event)},"keydown");h&&(n=h);f&&(a=f);g&&(d=g)}}})();

