/*
	The following need to be in the <head> tag
	
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/calendar/assets/skins/sam/calendar.css"> 
	<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
	<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/calendar/calendar-min.js"></script>
	
	Add a div with an id of calender to your body
	<div class="yui-skin-sam">
		<style>
			.calheader{color:#000000;}
		</style>
		<div id="calendar" style="position:absolute;"></div>
	</div>
	
	Call the showCalendar and pass it the id of the input that will get the date picked
	<input type="text" id="startdate" value="" />
	<img src="calendar.gif" onmousemove="showCalendar('startdate');" />
*/
<!--
// 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
}

//-->		
var calendarSetId="";
var cal1;
function selectCalendar(type,args,obj)
{
	//find calendar id
	// var temp=obj.id;
	// temp=temp.replace("_t","");
	
	// var temp2=temp.substring(0,temp.length-3);
	
	var year=args[0][0][0];
	var month=args[0][0][1];
	var day=args[0][0][2];
	document.getElementById(calendarSetId).value=month+"/"+day+"/"+year;
	document.getElementById(calendarSetId).focus();
	hideCalendar();
}
function createCalendar()
{

}
function showCalendar(id)
{
	cal1 = new YAHOO.widget.Calendar('calendar');
	cal1.selectEvent.subscribe(selectCalendar, cal1, true);
	cal1.render();
	cal1.createTitleBar("Select A Date");
	cal1.createCloseButton();
	calendarSetId=id;
	document.getElementById('calendar').style.display="block";
	document.getElementById('calendar').style.left=(mouseX+5)+"px";
	document.getElementById('calendar').style.top=(mouseY+5)+"px";

}
function hideCalendar()
{
	document.getElementById('calendar').style.display="none";
}
