imgobj.style.left = "-1px";
imgobj.style.top = "-1px";
}
}
}
else if(cmd == 'out') {
obj.children(0).classname = "ltdexit";
obj.children(1).classname = "mtdexit";
obj.children(2).classname = "rtdexit";
if(imgobj)
{
if(imgobj.tagname.touppercase() == "img")
{
imgobj.style.left = "0px";
imgobj.style.top = "0px";
}
}
}
}
catch (e) {}
}
function showmenu()
{
var x, y, w, h, ox, oy;
x = event.clientx;
y = event.clienty;
var obj = document.getelementbyid("rightmenu");
if (obj == null)
return true;
ox = document.body.clientwidth;
oy = document.body.clientheight;
if(x > ox || y > oy)
return false;
w = obj.offsetwidth;
h = obj.offsetheight;
if((x + w) > ox)
x = x - w;
if((y + h) > oy)
y = y - h;
obj.style.posleft = x + document.body.scrollleft;
obj.style.postop = y + document.body.scrolltop;
obj.style.visibility = "visible";
return false;
}
function hidemenu()
{
if(event.button == 0)
{
var obj = document.getelementbyid("rightmenu");
if (obj == null)
return true;
obj.style.visibility = "hidden";
obj.style.posleft = 0;
obj.style.postop = 0;
}
}
function writestyle()
{
var strstyle = "";
strstyle += "<style type=text/css>";
strstyle += "table {font-family: \"tahoma\",\"verdana\",\"宋体\"; font-size: 9pt}";
strstyle += ".mtdfocus {background-color: #ccccff; border-bottom: #000000 1px solid; border-top: #000000 1px solid; cursor: hand}";
strstyle += ".mtdexit {background-color: #ffffff; border-bottom: #ffffff 1px solid; border-top: #ffffff 1px solid}";
strstyle += ".ltdfocus {background-color: #ccccff; border-bottom: #000000 1px solid; border-top: #000000 1px solid; border-left: #000000 1px solid; cursor: hand}";
strstyle += ".ltdexit {background-color: #d0d0ce; border-bottom: #d0d0ce 1px solid; border-top: #d0d0ce 1px solid; border-left: #d0d0ce 1px solid}";
strstyle += ".rtdfocus {background-color: #ccccff; border-bottom: #000000 1px solid; border-top: #000000 1px solid; border-right: #000000 1px solid; cursor: hand}";
strstyle += ".rtdexit {background-color: #ffffff; border-bottom: #ffffff 1px solid; border-top: #ffffff 1px solid; border-right: #ffffff 1px solid}";
strstyle += "</style>";
document.write(strstyle);
}
function makemenu()
{
var mymenu, item;
var homepage_cmd = "this.style.behavior='url(#default#homepage)';this.sethomepage('http://gamethinking.yeah.net/'); return false;";
var favorate_cmd = "window.external.addfavorite('http://gamethinking.yeah.net/','游戏思想'); return false;";
var viewcode_cmd = "window.location = 'view-source:' + window.location.href";
mymenu = new contextmenu();
item = new contextitem("返回主页", "images/main.gif", "top.location='http://gamethinking.yeah.net/';", "menu");
mymenu.additem(item);
item = new contextitem("设为主页", "images/myhome.gif", homepage_cmd, "menu");
mymenu.additem(item);
item = new contextitem("添加到收藏夹", "images/fav_add.gif", favorate_cmd, "menu");
mymenu.additem(item);
item = new contextitem("联系作者", "images/mail.gif", "location.href='mailto:avlee@163.com'", "menu");
mymenu.additem(item);
item = new contextitem("", "", "", "separator");
mymenu.additem(item);
item = new contextitem("察看源码", "images/edit.gif", viewcode_cmd, "menu");
mymenu.additem(item);
mymenu.show(this.document);
delete item;
delete mymenu;
}
function togglemenu(isenable)
{
if(isenable)
document.oncontextmenu = showmenu;
else
document.oncontextmenu = new function() {return true;};
}
writestyle();
makemenu();
document.onclick = hidemenu;
document.oncontextmenu = showmenu;