with (document) {
  write("<Div id='popCal' style='POSITION:absolute;visibility:hidden;'>");
  write("<iframe name='popCalF' frameborder=0 marginwidth=0 marginheight=0 scrolling='no' width=180 height=175></iframe>");
  write("</DIV>");
}

dateBox   = null;
function viewCalendar(dateBox){
  this.dateBox = dateBox;
  popCalF.location="/inc/html/calendar.html";
  stylePosition();
  popCal.style.visibility = "visible";
  popCalF.focus();
  self.event.cancelBubble=true;
}

function visibilityCalendar(){
  popCal.style.visibility = "hidden";
}

function stylePosition(){
  obj   = dateBox;
  xleft = 0;
  xtop  = 0;
  for(;;){
    xleft += obj.offsetLeft;
    xtop  += obj.offsetTop;
    obj    = obj.offsetParent;
    if (obj.tagName == "BODY") break;
  }


  //scrCenterY = Math.round(screen.Height/2);
  //xTop2 = scrCenterY - 100 ;

  popCal.style.left = xleft;

  //alert(xtop);

  if (xtop < 300)
  	//popCal.style.top  = xtop + dateBox.offsetHeight + 1;
	popCal.style.top  = xtop + dateBox.offsetHeight ;
  else
  	popCal.style.top  = xtop - 203;
  //popCal.style.top = xTop2 ;

	  
  if (xleft > 500)
  {
  	//popCal.style.left  = xleft - dateBox.offsetWidth + 1;
    popCal.style.left  = xleft - dateBox.offsetWidth + 1;  
  }
  else
  	popCal.style.left  = xleft ;
  		
}
