﻿var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
}
}
document.writeln("<link rel=\"stylesheet\" type=\"text\/css\" href=\"http:\/\/img1.walike.com\/js\/st.css\" \/>");
document.writeln("");
document.writeln("<div style=\"background:url(http:\/\/img1.walike.com\/UserCenter_new\/top_001.gif) repeat-x; width:100%; height:37px; overflow:hidden; color:#ccc; font-size:12px; \">");
document.writeln("  <div style=\" float:left; margin-left:10px; width:189px;\"><a href=\"http://www.walike.com\"><img src=\"http:\/\/img1.walike.com\/UserCenter_new\/top_logo.gif\" width=\"192\" height=\"37\" border=\"0\" \/><\/a><\/div>");
document.writeln(" <div style=\"float:left; padding-top:8px; width:190px; text-indent:8px; height:37px; line-height:25px; font-size:12px; text-decoration:none;  background:url(http:\/\/img1.walike.com\/UserCenter_new\/top_bk1.gif)\" class=\"cwhite\"><a href=\"http:\/\/txws2.walike.com\" target=\"_blank\"><font color=\"#FF0000\">天下无双2<\/font><\/a>|<a href=\"http:\/\/fswd.walike.com\" target=\"_blank\"><font color=\"#ff0000\">封神无敌<\/font><\/a>|<a href=\"http:\/\/yxzc.walike.com\" target=\"_blank\"><font color=\"#666666\">英雄之城<\/font><\/a><\/div>");
document.writeln("  <div style=\"float:right; margin-right:8px\" id=\"iframe\">");
document.writeln("    <iframe src=\"http://passport.walike.com/loginstatus.do\" name=\"test\" align=\"MIDDLE\" width=\"205\" height=\"37\" allowtransparency=\"true\" marginwidth=\"1\" marginheight=\"1\" frameborder=\"0\" scrolling=\"no\"><\/iframe>");
document.writeln("  <\/div>");
document.writeln("  <div style=\"float:right; font-size:12px; height:37px; line-height:37px; width:172px; background:url(http:\/\/img1.walike.com\/UserCenter_new\/top_nbk.gif) no-repeat center top;\" class=\"cwhite\">");
document.writeln("    <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-size:12px;\">");
document.writeln("      <tr>");
document.writeln("        <td height=\"37\" align=\"center\"><iframe src=\"http://passport.walike.com/MessageStatus.do\" name=\"test\" align=\"MIDDLE\" width=\"10\" height=\"8\" allowtransparency=\"true\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\"><\/iframe> <a href=\"http://passport.walike.com/inbox/\" target=\"_blank\"><font color=\"#666666\">站内信<\/font><\/a> | <a href=\"http://pay.walike.com\" target=\"_blank\"><font color=\"#666666\">充值<\/font><\/a> | <a href=\"http://passport.walike.com/ExchangeVIP.aspx\" target=\"_blank\"><font color=\"#ff0000\">VIP特权<\/font><\/a><\/td>");
document.writeln("      <\/tr>");
document.writeln("    <\/table>");
document.writeln("  <\/div>");
document.writeln("  <div class=\"chromestyle\" id=\"chromemenu\" > <a href=\"#\" rel=\"dropmenu1\">");
document.writeln("    <div class=\"but_text_m\"><img src=\"http:\/\/img1.walike.com\/UserCenter_new\/title_xl_ty2.gif\" width=\"128\" height=\"23\" border=\"0\" \/><\/div>");
document.writeln("  <\/a> <\/div>");
document.writeln("  <div id=\"dropmenu1\" class=\"float_h\">");
document.writeln("    <li><a href=\"http://txws2.walike.com\" class=\"txws\" target=\"_blank\">天下无双2<span>New!!<\/span><\/a><\/li>");
document.writeln("    <li><a href=\"http://txws.walike.com\" class=\"txws\" target=\"_blank\">天下无双<span>Hot!!<\/span><\/a><\/li>");
document.writeln("    <li><a href=\"http://fswd.walike.com\" class=\"fswd\" target=\"_blank\">封神无敌<span>Hot!!<\/span><\/a><\/li>");
document.writeln("    <li><a href=\"http://wlyx.walike.com\" class=\"wlyx\" target=\"_blank\">武林英雄<span>Hot!!<\/span><\/a><\/li>");
document.writeln("    <li><a href=\"http://yxzc.walike.com\" class=\"yxzc\" target=\"_blank\">英雄之城<span>Hot!!<\/span><\/a><\/li>");
document.writeln("    <li><a href=\"http://blcx.walike.com\" class=\"blcx\" target=\"_blank\">兵临城下<\/a><\/li>");
document.writeln("    <li><a href=\"http://kl.walike.com\" class=\"kl\" target=\"_blank\">昆仑世界<\/a><\/li>");
document.writeln("    <li><a href=\"http://wlzq2.walike.com\" class=\"wlzq2\" target=\"_blank\">武林足球II<\/a><\/li>");
document.writeln("    <li><a href=\"http://wlzq.walike.com\" class=\"wlzq\" target=\"_blank\">武林足球<\/a><\/li>");
document.writeln("    <li><a href=\"http://wlsg.walike.com\" class=\"wlsg\" target=\"_blank\">武林三国<\/a><\/li>");
document.writeln("  <\/div>");
document.writeln("<\/div>");

cssdropdown.startchrome("chromemenu");
