var currCal;
var mozilla=document.getElementById && !document.all;
var ie=document.all;

function bodyClick(){
	var calButton=/^calDrop_[1-9]/;
	if (window.event.srcElement.name){
		if (window.event.srcElement.name.match(calButton) == -1){
			document.all.cal.style.visibility="hidden";
			}
		}
	else{
		document.all.cal.style.visibility="hidden";
		}
	}


function showCal(elementID){
	var x=0;
	var y=0;
	if (ie){
		var c=window.event.srcElement;
		while (c){
			x+=c.offsetLeft;
			y+=c.offsetTop;
			c=c.offsetParent;
			}
		if (window.event){
			currCal="date"+elementID.getAttribute("name");;
			document.all.cal.style.left=x+2;
			document.all.cal.style.top=y+2;
			document.all.cal.style.visibility="visible";
			}
		}
	else{
		x=elementID.x;
		y=elementID.y;
		document.all.cal.style.left=x+2;
		document.all.cal.style.top=y+2;
		document.all.cal.style.visibility="visible";
		currCal="date"+elementID.getAttribute("name");;
		}
	}

function calClick(y, m, d){
	//alert(currCal+" "+y+" "+m+" "+d);
	document.all.cal.style.visibility="hidden";
	nodeList=document.getElementsByName(currCal);
	if (m){
		nodeList[0].value=m+"/"+d+"/"+y;
		}
	}

