<!-- store position of mouse -->
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var mouseX = 0
var mouseY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    mouseX = event.clientX + document.body.scrollLeft
    mouseY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    mouseX = e.pageX
    mouseY = e.pageY
  }  
  // catch possible negative values in NS4
  if (mouseX < 0){mouseX = 0}
  if (mouseY < 0){mouseY = 0}  
  return true
}



<!-- Note functions -->
	function hideNote(obj){
		// hide object
		document.getElementById(obj).style.visibility='hidden';
		document.getElementById(obj).innerHTML = "";
	}
	function showNote(obj, text){
		// get object
		note = document.getElementById("" + obj + "note");
		// set position
		//note.style.top = (mouseY-5) + "px";
		//note.style.left= (mouseX-10) + "px";
		// set text
		note.innerHTML = text;
		// set visible
		note.style.visibility='visible';
	}
function IsLeapYear()
{
	if ((this.Year%4)==0)
	{
		if ((this.Year%100==0) && (this.Year%400)!=0)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return false;
	}
}
<!-- calendar functions -->

if(!IsLeapYear()){
	cal_DaysInMonth = new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
}else{
	cal_DaysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
}


	cal_Months		= new Array('January', 'Febuary', 'March', 
								'April', 'May', 'June', 
								'July', 'August', 'September', 
								'October', 'November', 'December');
	cal_DateNote = new Array();
	cal_month	= new Array();
	cal_year	= new Array();
	cal_past	= new Array();
	cal_future	= new Array();
	function calendar_create(obj, month, year, future, past){
		
		if (typeof(Sel_d_cur) == 'undefined') {
			Sel_d_cur = '';
			Sel_d_style = '';
		}	
		
		// get display information
		var year 		= year<2000 ? year+1900 : year;
		var month 		= month;
		var date 		= new Date(year, month, 1, 1,0,0,0);
		var firstDay	= date.getDay();
		var future 		= future == "undefined" ? 0 : future;
		var past 		= past == "undefined" ? 0 : past;
		// get the object
		var calOBJ		= document.getElementById(obj);
		
		// store values for later use
		cal_month[obj] = month;
		cal_year[obj] = year;
		cal_past[obj] = past;
		cal_future[obj] = future;
		
		// make calendar
		var output = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id='" + obj + "_cal'><tr><th colspan='7'>\n";
		output = output + "<table id='" + obj + "_cal_head' width=\"273\">\n<tr>\n";
		if(past>0){
			output = output + "<th><a href=\"javascript:calendar_past('" + obj + "')\"><img border=\"0\" src=\"/images/cal_b_arrow.png\"></a></th>\n";
		}
		output = output + "<th width='100%' class=\"cal_S_Header\">" + cal_Months[month] + " " + year + "</th>\n";
		if(future>0){
			output = output + "<th><a href=\"javascript:calendar_next('" + obj + "')\"><img border=\"0\" src=\"/images/cal_f_arrow.png\"></a></th>\n";
		}
		output = output + "</table></th>\n";
		output = output + "</tr><tr class=\"cal_header_tr\">\n";	
		// Print out headers
		
		output = output + "<td class=\"cal_header_day\">Sun</td>\n";
		output = output + "<td class=\"cal_header_day\">Mon</td>\n";
		output = output + "<td class=\"cal_header_day\">Tue</td>\n";
		output = output + "<td class=\"cal_header_day\">Wed</td>\n";
		output = output + "<td class=\"cal_header_day\">Thu</td>\n";
		output = output + "<td class=\"cal_header_day\">Fri</td>\n";
		output = output + "<td class=\"cal_header_day\">Sat</td>\n";
		
		output = output + "</tr><tr>\n";		
		// --- make calendar
		
		// -- new style table
		output = output + "</td> <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"cal_Style\"> <tr>\n";
		
		new_Style_color = '#969696';
		
		// pre First of month
		for(dw=0;dw<firstDay;dw++){
			if (dw == 0) {
				n_style = 'style = "border-bottom: 1px solid '+new_Style_color+'; border-right: 1px solid '+new_Style_color+'; border-left: 1px solid '+new_Style_color+';"';
			}
			else {
				n_style = 'style = "border-bottom: 1px solid '+new_Style_color+'; border-right: 1px solid '+new_Style_color+';"';
			}
			output = output + "<td "+n_style+" class='" + obj + "_cal_empty'>&nbsp;</td>\n";
		}
		
		if (typeof(Sel_d_cur) == 'undefined') {
			Sel_d_cur = '';
			Sel_d_style = '';
		}		
		
		current_Sel = function(tiv, curclass, s_day, s_month) {
			if (Sel_d_cur != '') {
				Sel_d_cur.className = 'calVenue'+Sel_d_style;
			}
			
			tiv.className = 'calVenue_cal_day_note_h';
			Sel_d_cur = tiv;
			Sel_d_style = curclass;
			store_day = s_day;
			store_month = s_month;
		}
		
		// Days in calendar	
		var classVal = "_cal_day";
		var extraVal = "";
		for(dm=1;dm<=cal_DaysInMonth[month];dw++, dm++){
			
			style_nset = 1;
			
			if(dw % 7 ==0){
				output = output + "</tr><tr>";
				style_nset = 0;
			}
			classVal = "_cal_day";
			extraVal = "";
			// notes
			
			if(isArray(cal_DateNote[obj])){
				if(isArray(cal_DateNote[obj][year])){
					if(isArray(cal_DateNote[obj][year][month+1])){
						if(cal_DateNote[obj][year][month+1][dm] != undefined){
							classVal = "_cal_day_note";
							extraVal = 'onmouseover="javascript:showNote(\'' + obj + '\', \'' +
										cal_DateNote[obj][year][month+1][dm] + '\'); current_Sel(this, \''+classVal+'\', \''+dm+'\', \''+month+'\');"';
						}
					}	
				}
			}
			
			if (style_nset == 0) {
				n_style2 = 'style = "border-bottom: 1px solid '+new_Style_color+'; border-right: 1px solid '+new_Style_color+'; border-left: 1px solid '+new_Style_color+';"';
				style_nset = 1;
			}
			else {
				n_style2 = 'style = "border-bottom: 1px solid '+new_Style_color+'; border-right: 1px solid '+new_Style_color+';"';
			}
			
			if (typeof(store_day) != 'undefined') {
				
				//alert (store_day+' = '+dm+' / '+store_month+' = '+month);
				
				if ((store_day == dm) && (store_month == month)) {
					loadclass = classVal;
					loadday = dm;
					loadmonth = month;
					idset = 'id = "selected_id"';
				}
				else {
					idset = '';
				}
			}
			else {
				idset = '';
			}
			
			output = output + "<td "+n_style2+" class='" + obj + classVal + "'" + extraVal + idset + ">" + dm + "</td>\n";	
		}
		
		// post last of month
		for(dw=dw;dw % 7 !=0;dw++){
			n_style2 = 'style = "border-bottom: 1px solid '+new_Style_color+'; border-right: 1px solid '+new_Style_color+';"';
			output = output + "<td "+n_style2+" class='" + obj + "_cal_empty'>&nbsp;</td>\n";	
		}
		
		// Print out footer
		output = output + "</tr><tr class=\"cal_footer_tr\">\n";	
		output = output + "<td style=\"height: 29px; font-size: 6px;\" width=\"100%\" colspan=\"7\">&nbsp;</td></tr>";
				
		output = output + "</td>\n</tr>\n</table>";
		
		output = output + "</td>\n</tr>\n</table>";
		
		calOBJ.innerHTML = output;
		
		if (document.getElementById('selected_id') != null) {
			sel_id = document.getElementById('selected_id');
			current_Sel(sel_id, loadclass, loadday, loadmonth);
		}
		//alert(output);
		
	}
	// next month
	function calendar_next(obj){
		year	= (cal_month[obj]+1)>11 ? cal_year[obj]+1 : cal_year[obj];
		month	= (cal_month[obj]+1) %12;
		future	= cal_future[obj]-1;
		past	= cal_past[obj]+1;
		calendar_create(obj, month, year, future, past)
	}
	// past month
	function calendar_past(obj){
		year	= (cal_month[obj]-1)<0 ? cal_year[obj]-1 : cal_year[obj];
		month	= (cal_month[obj]-1)<0 ? 11 : (cal_month[obj]-1);
		future	= cal_future[obj]+1;
		past	= cal_past[obj]-1;
		calendar_create(obj, month, year, future, past)
	}
	
	// add note to a date
	function calendar_dateNote(obj, note, day, month, year){
			if(!isArray(cal_DateNote[obj])){
				cal_DateNote[obj] = new Array();
			}
			if(!isArray(cal_DateNote[obj][year])){
				cal_DateNote[obj][year] = new Array();
			}
			if(!isArray(cal_DateNote[obj][year][month])){
				cal_DateNote[obj][year][month] = new Array();
			}
			if(cal_DateNote[obj][year][month][day] == undefined){
				cal_DateNote[obj][year][month][day] = '';	
			}
			cal_DateNote[obj][year][month][day] = cal_DateNote[obj][year][month][day] + note + "<br/>";
	}
	function isArray(a) {
    	return isObject(a) && a.constructor == Array;
	}
	function isObject(a) {
    	return (a && typeof a == 'object') || isFunction(a);
	}
	function isFunction(a) {
   		return typeof a == 'function';
	}
