function LayerFrame(id, strImage)
{
	if (document.all) 
	{
		this.baseobj = document.all[id];
	}
	else
	{
		this.baseobj = document.getElementById(id);
	}
	this.style = this.baseobj.style;
	this.hidden = true;
	this.show=function(){this.style.left=getIMGxpos(strImage); this.style.top=getIMGypos(strImage); this.hidden = false;}
	this.hide=function(){this.style.top=-2000; this.hidden = true;}
	this.changestate = function(){if (this.hidden) this.show(); else this.hide()}
	this.load = function(strURL) {this.baseobj.src = strURL}
}

function OpenCalendar(objCalendar, strCalendar, strImage, strInput)
{
	if (!objCalendar) objCalendar = new LayerFrame('CLframe', strImage);
	objCalendar.changestate();
	datNow = new Date();
	objCalendar.load('calendar.asp?calendar=' + strCalendar + '&input=' + strInput + '&month=' + datNow.getMonth() + '&year=' + datNow.getFullYear());
}

// -----------------------------------------------------------------------------
// utility functions for image localisation (position)
// locate a NAMED images' position explicitly as an absolute measurement
// -----------------------------------------------------------------------------

function getIMGypos(imgnamestr)
{
	var imgTMP;
	var y = 0;

	if (document.all) 
	{
		imgTMP = document.all[imgnamestr];
	    obj = imgTMP;
	    while (obj.offsetParent != null) {
	      y += obj.offsetTop;
	      obj = obj.offsetParent;

	    }
	    y += obj.offsetTop;
	}
	else
	{
		imgTMP = document.getElementById(imgnamestr);
	    obj = imgTMP;
	    while (obj.offsetParent != null) {
	      y += obj.offsetTop;
	      obj = obj.offsetParent;

	    }
	    y += obj.offsetTop;
	}
	return y;
}

function getIMGxpos(imgnamestr)
{
	var imgTMP;
	var x = 0;

	if (document.all) 
	{
		imgTMP = document.all[imgnamestr];
	    obj = imgTMP;
	    while (obj.offsetParent != null) {
	      x += obj.offsetLeft;
	      obj = obj.offsetParent;

	    }
	    x += obj.offsetLeft;
	}
	else
	{
		imgTMP = document.getElementById(imgnamestr);
	    obj = imgTMP;
	    while (obj.offsetParent != null) {
	      x += obj.offsetLeft;
	      obj = obj.offsetParent;

	    }
	    x += obj.offsetLeft;
	}
	return x;
}

//PAGE SPECIFIC CODE STARTS HERE
var calStart;
var calStart2;
var calEnd;
function BodyClick()
{
	if (!calStart) calStart = new LayerFrame('CLframe', 'imgCalendarStart');
	if (!calStart2) calStart2 = new LayerFrame('CLframe', 'imgCalendarStart2');
	if (!calEnd) calEnd = new LayerFrame('CLframe', 'imgCalendarEnd');
	calStart.hide();
	calStart2.hide();
	calEnd.hide();
}