var sb_event_doc = new Array();


var eTip = null;

function sb_event_over(thisId, text) {
 if(eTip != null) {
  sb_node_delete(eTip);
  eTip = null;
 }

 pos = getPos(thisId.parentNode);
 eTip = sb_node(document.body, "div", text);
 eTip.className = "tooltip";
 eTip.style.position = 'absolute';
 eTip.style.zIndex = 1000;
 eTip.style.top = pos.bottom+"px";
 eTip.style.left = pos.left +"px";



}

function sb_event_out(thisId) {
 if(eTip != null) {
  sb_node_delete(eTip);
  eTip = null;
 }
}

function sb_event_viewer(id, date, page, layout, module) {
 thisId = document.getElementById(id);
 var Months = new Array();
 Months[0]  = 'January';
 Months[1]  = 'February';
 Months[2]  = 'March';
 Months[3]  = 'April';
 Months[4]  = 'May';
 Months[5]  = 'June';
 Months[6]  = 'July';
 Months[7]  = 'August';
 Months[8]  = 'September';
 Months[9]  = 'October';
 Months[10] = 'November';
 Months[11] = 'December';

 var eDoc;
 escapeClear(0);



 var split = date.split("-");
 var year  = split[0];
 var month = parseInt(split[1], 10) - 1;
 var day   = split[2];

 for(var p = thisId; p.nodeName != 'TABLE'; p = p.parentNode);
 var table = p;

 var pos = getPos(table);

 var cont = document.createElement("div");
 cont.className = 'calendar_overlay';
 cont.style.position = 'absolute';
 cont.style.zIndex = '1000';
 cont.style.top  = pos.bottom + 'px';
 cont.style.left = pos.left + 'px';

 window.scroll(0, pos.bottom);

 escapeNode(cont, true);

 head = sb_node(cont, "div");
 head.className = "head";

 var out   = "/smallbox4/images5/close.png"
 var over  = "/smallbox4/images5/close_over.png"

 div = sb_node(head, "div");
 div.className = "close";
 img = sb_node(div, "img");
 img.src = out;
 img.style.cursor = 'pointer';
 img.onclick = escapeClear; 
 img.onload = new Function("iePNG(this);");

 div = sb_node(cont, "div", Months[month]+" "+day+", "+year);
 div.className = "date";

 var listing = sb_node(cont, "div", "Retrieving Data...");
 listing.className = "listing";




 if(eDoc = sb_get_xml("/smallbox4/modules5/events.php?date="+date+"&page="+page+"&module="+module+"&layout="+layout)) {
  sb_node_clear(listing);   
  var eInfo = eDoc.getElementsByTagName("document").item(0);
  var ul = sb_node(listing, "ul");

  for(var i = 0; i < eInfo.childNodes.length; i++) {
   var tag = eInfo.childNodes[i];

   var li = sb_node(ul, "li");
   
   var div = sb_node(li, "div");
   div.className = 'title';

   a = sb_node(div, "a", tag.getAttribute("title"));
   a.href = tag.getAttribute("href");
  }
 }
 else {
//  window.location.href = "/smallbox4/modules5/events.php?date="+date+"&page="+page+"&module="+module+"&layout="+layout;

  sb_node_clear(listing);   
  sb_node(listing, "div", "Error retrieving data from server.");
 }

 document.body.appendChild(cont);
 var tmp = new Image();
 tmp.src = "/smallbox4/images5/close_over.png"
}

