function dateSquare(dateIn,monthIn,weekIn) {
	this.selected = false;
	this.myDate = dateIn;
	this.myMonth = monthIn;
	this.week = weekIn;
}
dateSquare.prototype.draw = function(classIn,idIn) {
	this.id = idIn;
	this.myDiv = document.createElement("div");
	this.myDiv.myParent = this;
	this.myText = document.createTextNode(this.myDate.getDate());
	this.myDiv.appendChild(this.myText);
	this.myDiv.myParent = this;
	this.myDiv.onmousedown = function(e) {
		// ebug(this.myParent);
		this.myParent.onmousedown(e);
	}
	this.myDiv.onmouseover = function(e) {
		this.myParent.onmouseover(e);
	}
	this.myDiv.onmouseout = function(e) {
		this.myParent.onmouseout(e);
	}

	disableSelection(this.myDiv);
	// this.myDate.getMonth();
	// ebug(this.myMonth+" "+this.myDate.getMonth());
	var curDate = new Date();
	var curMonth = curDate.getMonth();
	var curDate2 = curDate.getDate();
	var curYear = curDate.getYear();
	if ((curDate2 == this.myDate.getDate()) &&(curMonth == this.myDate.getMonth()) &&(curYear == this.myDate.getYear())) {
		var startClass = classIn+"Today";
	}
	else if (this.myMonth != this.myDate.getMonth()) {
		var startClass = classIn+"Other";
	}
	else {
		var startClass = classIn+"Normal";
	}
	this.setClass(startClass,"");
	return this.myDiv;
}
dateSquare.prototype.setPosition = function(x,y) {
	this.myDiv.style.top = y+"px";
	this.myDiv.style.left = x+"px";
}
dateSquare.prototype.onmouseover = function(e) {
	this.setClass(this.myClass,"Selected");
	if (this.myParent.dragging) {
		var cal = this.myParent;
		cal.addSelected(this);
	}
}
dateSquare.prototype.onmouseout = function(e) {
	this.setClass(this.myClass,"");
	if (this.myParent.dragging) {
		var cal = this.myParent;
		cal.addSelected(this);
	}
}
dateSquare.prototype.onmousedown = function(e) {
	evt = (e) ? e : ((window.event) ? window.event : "");
	shiftPressed=evt.shiftKey;
	if (shiftPressed) {
		var cal = this.myParent;
		cal.addSelected(this);
	}
	else {
		var cal = this.myParent;
		cal.dragging = true;
		cal.startID = this.id;
		cal.clearSelected();
		this.setSelected(true);
		cal.addSelected(this);
		cal.close();
	}
       // var ss = document.getElementById("specialSelect");
//	ss.selectedIndex = 0;        
}
dateSquare.prototype.setSelected = function(selected) {
	this.selected = selected;
	if (selected) {
		this.setClass(this.myClass,"Selected");
	}
	else {
		this.setClass(this.myClass,"");
	}
}
dateSquare.prototype.setClass = function(classIn,Type) {
// this.myDate.getMonth()
	this.myClass = classIn;
	var className = this.myClass+Type;
	// ebug(classIn+" "+className+" "+Type);
	this.myDiv.setAttribute("class",className);
	this.myDiv.setAttribute("className",className);
}
