document.write('<iframe id=MessFrame name=MessFrame frameborder=0 src=blank.html style=display:none;position:absolute;z-index:100000></iframe>');

document.onclick=hideCalendar;
document.onmousedown=mousedn;

var mx=0,my=0;

function showmess(url)
{
  var cf=document.getElementById("MessFrame");
  var wcf=window.frames.MessFrame;

  wcf.document.open();
  wcf.document.write("<html><body bgcolor=#daede7><center>正在打开...</center><body></html>");

  if(cf.style.display=="block") { cf.style.display="none"; return; }
  
  var eT=0,eL=0;
  var eH=0,eW=0;

  var sT=document.body.scrollTop;
  var sL=document.body.scrollLeft;

  eT+=my+10;
  eL+=mx+50;

  //BOTTOM 10
  cf.style.top=(document.body.clientHeight-eT>=cf.height)?eT+sT:document.body.clientHeight+sT-cf.height-10;

  //TOP 10
  //cf.style.top=(document.body.clientHeight-eT>=cf.height)?eT+sT:sT+10;

  cf.style.left=(document.body.clientWidth-(eL-sL)>=cf.width)?eL:document.body.clientWidth-cf.width-10;

  //cf.style.top=my+15+sT;
  //xx=(my+15+sT)+parseInt(cf.height)

  //if(xx>document.body.clientHeight)
  //  cf.style.top=(xx-document.body.clientHeight-sT)/2+sT;

  //cf.style.left=mx+50+sL;
  //xx=(mx+50+sL)+parseInt(cf.width)

  //if(xx>document.body.clientWidth)
  //  cf.style.left=(xx-document.body.clientWidth-sL)/2-sL;

  cf.style.display="block";
  wcf.location=url;
}

function showimg(url)
{
  var cf=document.getElementById("MessFrame");
  var wcf=window.frames.MessFrame;

  wcf.document.open();
  wcf.document.write("<html><body bgcolor=#daede7><center>正在加载图片...</center><body></html>");

  if(cf.style.display=="block") { cf.style.display="none"; return; }
  
  var eT=0,eL=0;
  var eH=0,eW=0;

  var sT=document.body.scrollTop;
  var sL=document.body.scrollLeft;

  eT+=my+10;
  eL+=mx+50;

  cf.style.top=(document.body.clientHeight-eT>=cf.height)?eT+sT:document.body.clientHeight+sT-cf.height-10;

  cf.style.left=(document.body.clientWidth-(eL-sL)>=cf.width)?eL:document.body.clientWidth-cf.width-10;

  cf.style.display="block";
  wcf.location=url;
}
function hideCalendar()
{
  var cf=document.getElementById("MessFrame");
  cf.style.display="none";
}

function mousedn()
{
  mx=window.event.x;
  my=window.event.y;
}
