<!--
// menu object
function contextMenu()
{
 this.items   = new Array();
 
 this.addItem = function (item)
 {
  this.items[this.items.length] = item;
 }

 this.show = function (oDoc)
 {
  var strShow = "";
  var i;
  
  strShow = "<div id=\"rightmenu\" style=\"width:110px;height:155px;LEFT: 0px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; Z-INDEX:1000\">";
  strShow += "<div style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Inc/Rightkey/bj.png');width:110px;height:155px;width:110px;height:139px;LEFT: 0px; POSITION: absolute; TOP:0px;Z-INDEX:-1\"></div><table border=\"0\" height=\"155\" width=\"110\" cellpadding=\"0\" cellspacing=\"0\">";
  strShow += "<tr><td style=\"padding-top:20px\">";
  strShow += "<table border=\"0\" width=\"100%\" height=\"70%\" cellpadding=0 cellspacing=0>";
  oDoc.write(strShow);
  for(i=0; i<this.items.length; i++)
  {
   this.items[i].show(oDoc);
  }
  strShow = "</table></td></tr>";
  strShow += "<tr><td>";
  strShow += "</td><td></td></tr>";
  strShow += "</table></div>\n";
  oDoc.write(strShow);
 }
}

// menu Item object
function contextItem(text, icon, cmd, type)
{
 this.text = text ? text : "";
 this.icon = icon ? icon : "";
 this.cmd = cmd ? cmd : "";
 this.type = type ? type : "menu";
 
 this.show = function (oDoc)
 {
  var strShow = "";
  
  if(this.type == "menu")
  {
   strShow += "<tr ";
   strShow += "onmouseover=\"changeStyle(this, 'on');\" ";
   strShow += "onmouseout=\"changeStyle(this, 'out');\" ";
   strShow += "onclick=\"";
   strShow += this.cmd;
   strShow += "\">";
   strShow += "<td class=\"mtdexit\" valign=\"top\">";
   strShow += this.text;
   if (this.icon == "")
    strShow += "&nbsp;";
   else {
    strShow += "<img border=\"0\" src=\"";
    strShow += this.icon;
    strShow += "\" style=\"POSITION: relative\"></img>";
   }
   strShow += "</td></tr>";
  }
  else if (this.type == "separator")
  {
   strShow += "<tr><td width=\"125\" height=\"8\" class=\"line\"></td>";
   strShow += "</tr>";
  }
  
  oDoc.write(strShow);
 }
}

function changeStyle(obj, cmd)
{ 
 if(obj) try {
  var imgObj = obj.children(0).children(0);
  
  if(cmd == 'on') {
   obj.children(0).className = "ltdfocus";
   obj.children(1).className = "mtdfocus";
   obj.children(2).className = "rtdfocus";
   if(imgObj)
   {
    if(imgObj.tagName.toUpperCase() == "IMG")
    {
     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: \"Arial\"; FONT-SIZE: 7pt}";

 strStyle += ".mtdfocus {padding:2px 0px 0px 26px;height:13px;background-image:url(Inc/Rightkey/kaven.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#C8BF7B}";

 strStyle += ".mtdexit {padding:2px 0px 0px 16px;height:13px;color:#92956f}";

 strStyle += ".ltdfocus {padding:2px 0px 0px 26px;height:13px;background-image:url(Inc/Rightkey/kaven.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#C8BF7B}";

 strStyle += ".ltdexit {padding:2px 0px 0px 16px;height:13px;color:#92956f}";

 strStyle += ".rtdfocus {padding:2px 0px 0px 26px;height:13px;background-image:url(Inc/Rightkey/kaven.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#ffffff}";

 strStyle += ".rtdexit {padding:2px 0px 0px 26px;height:13px;color:#141198}";

 strStyle += "</STYLE>";
 
 document.write(strStyle);
}

function makeMenu()
{
 var myMenu, item;
 
 var homepage_cmd = "this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.web-designers.cn/'); return false;";
 var favorate_cmd = "window.external.addFavorite('http://www.web-designers.cn','web-designers'); return false;";
 var viewcode_cmd = "window.location = 'view-source:' + window.location.href";
 
 myMenu = new contextMenu();
 
 item = new contextItem("about us", "Inc/Rightkey/han.gif", "location.href='http://www.web-designers.cn/blog/LoadMod.asp?plugins=AboutMeForPJBlog'", "menu");
 myMenu.addItem(item);
 
 item = new contextItem("kaven demo", "Inc/Rightkey/han.gif", "location.href='http://www.web-designers.cn/blog/default.asp?cateID=11'", "menu");
 myMenu.addItem(item);

 item = new contextItem("my works", "Inc/Rightkey/han.gif",  "location.href='http://www.web-designers.cn/blog/default.asp?cateID=9'", "menu");
 myMenu.addItem(item);
 
 item = new contextItem("e-mail", "Inc/Rightkey/han.gif",  "location.href='mailto:kaven_115@126.com'", "menu");
 myMenu.addItem(item);
 
  item = new contextItem("favorate", "Inc/Rightkey/han.gif", favorate_cmd, "menu");
 myMenu.addItem(item);
 
 item = new contextItem("kaven115", "Inc/Rightkey/han.gif", "location.href='http://www.kaven115.com'", "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;
file://-->