<!--
// 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:70px;height:150px;LEFT: 0px; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; Z-INDEX:0\">";
  strShow += "<div style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='flash/images/bg.gif');width:70px;height:150px;width:70px;height:150px;LEFT: 0px; POSITION: absolute; TOP:0px;Z-INDEX:-1\"></div><table border=\"0\" height=\"150\" width=\"70\" cellpadding=\"0\" cellspacing=\"0\">";
  strShow += "<tr><td style=\"padding-top:2px\">";
  strShow += "<table border=\"0\" width=\"100%\" height=\"100%\" 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=\"100\" 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\",\"Verdana\",\"Tahoma\"; FONT-SIZE: 9pt}";
 strStyle += ".mtdfocus {padding:2px 0px 0px 2px;height:16px;background-image:url(flash/images/bg.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#ffffff}";
 strStyle += ".mtdexit {padding:2px 0px 0px 2px;height:16px;color:ffffff}";
 strStyle += ".ltdfocus {padding:2px 0px 0px 2px;height:16px;background-image:url(flash/images/bg.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#ffffff}";
 strStyle += ".ltdexit {padding:2px 0px 0px 2px;height:16px;color:#ffffff}";
 strStyle += ".rtdfocus {padding:2px 0px 0px 2px;height:16px;background-image:url(flash/images/bg.gif);background-position:center;background-repeat:no-repeat;cursor:default;color:#ffffff}";
 strStyle += ".rtdexit {padding:2px 0px 0px 2px;height:16px;color:#ffffff}";
 strStyle += "</STYLE>";
 document.write(strStyle);
}
function makeMenu()
{
 var myMenu, item;
 var homepage_cmd = "this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.mxsf.net'); return false;";
 var favorate_cmd = "window.external.addFavorite('http://www.mxsf.net','Mxsf.net!'); return false;";
 var viewcode_cmd = "window.location = 'view-source:' + window.location.href";
 myMenu = new contextMenu();
 item = new contextItem("Homepage", "flash/images/menu.gif", homepage_cmd, "menu");
 myMenu.addItem(item); 
 item = new contextItem("Bookmark", "flash/images/menu.gif", favorate_cmd, "menu");
 myMenu.addItem(item); 
 item = new contextItem("Twei Blogs", "flash/images/menu.gif", "location.href='http://www.mxsf.net/index.php'", "menu");
 myMenu.addItem(item);
 item = new contextItem("Twei photo", "flash/images/menu.gif",  "location.href='http://www.mxsf.net/gallery'", "menu");
 myMenu.addItem(item);
 item = new contextItem("Twei Music", "flash/images/menu.gif",  "location.href='http://www.mxsf.net/web'", "menu");
 myMenu.addItem(item);
 item = new contextItem("Guestbook", "flash/images/menu.gif",  "location.href='http://www.mxsf.net/guestbook.php'", "menu");
 myMenu.addItem(item);
 item = new contextItem("Flash web1", "flash/images/menu.gif",  "location.href='http://www.mxsf.net/com'", "menu");
 myMenu.addItem(item); 
 item = new contextItem("Contact us", "flash/images/menu.gif",  "location.href='tencent://message/?uin=395215988'", "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://-->