
var _panelMainID="CalendarMainPanel";
var _panelTimeID="CalendarTimePanel";
var _panelID="CalendarPanel";
var _currentYear=0;
var _currentMonth=-1;

var _monthNames=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var _rightToLeft=true;

var _MainBackground="#B5C3C3";
var _MainBorderSize=1;
var _MainBorderColor="blue";

var _TimeBackground="#B5C3C3";
var _TimeBorderSize=1;
var _TimeBorderColor="blue";
var _TimeCellColor="#F6B853";
var _TimeCellFontName="Tahoma";
var _TimeCellFontSize="10px";

var _calendarBackground="#B5C3C3";
var _calenderBorderSize=1;
var _calenderBorderColor="blue";

var _calendarToDayBackground="#B5C3C3";
var _calenderCellColor="#F6B853";
var _calendarToDayCellColor="#FF0000";
var _calenderCellFontName="Tahoma";
var _calenderCellFontSize="10px";
var _calenderTextFontName="Tahoma";
var _calenderTextFontSize="10px";
var _calenderTextColor="white";
var _calendarAddLight=30;
var _calendarCallbackFunction="CalendarCallback";
var _calenderDayCellColor = "FFFFFF";

function BrowseDate(cname) {
	
	var strDate = document.getElementById(cname).value;
	
	var today = new Date();
	var tyear = today.getFullYear() - 1 + 1;
	var tmonth = today.getMonth() + 1;
	var tday = today.getDate() - 1 + 1;
	if (strDate == "" ){
		strDate = tday + "/" + tmonth + "/" + tyear;
	}else if (strDate.length < 10 ){
		strDate = tday + "/" + tmonth + "/" + tyear;
	}
	
	var arrParts=strDate.split("/");
	if (arrParts[0].substr(0,1) == 0){arrParts[0] = arrParts[0].substr(1,1);}
	if (arrParts[1].substr(0,1) == 0){arrParts[1] = arrParts[1].substr(1,1);}
	
	OpenCalendar("N",parseInt(arrParts[2]), parseInt(arrParts[1]), parseInt(arrParts[0]),"","",cname);
	
}

function BrowseDateTime(cname) {
	
	var strDate = document.getElementById(cname).value;
	
	var today = new Date();
	var tyear = today.getFullYear() - 1 + 1;
	var tmonth = today.getMonth() + 1;
	var tday = today.getDate() - 1 + 1;
	if (strDate == "" ){
		strDate = tday + "/" + tmonth + "/" + tyear;
	}else if (strDate.length < 10 ){
		strDate = tday + "/" + tmonth + "/" + tyear;
	}
	
	var arrParts=strDate.split("/");
	if (arrParts[0].substr(0,1) == 0){arrParts[0] = arrParts[0].substr(1,1);}
	if (arrParts[1].substr(0,1) == 0){arrParts[1] = arrParts[1].substr(1,1);}
	
	OpenCalendar("Y",parseInt(arrParts[2]), parseInt(arrParts[1]), parseInt(arrParts[0]),"","",cname);
	
}

function BrowseDate2(c1, c2, c3) {
	var today = new Date();
	var tyear = today.getFullYear() - 1 + 1;
	var valDay = document.getElementById(c1).value - 1 + 1;
	var calday = new Date(tyear, 0, valDay);
	var tmonth = calday.getMonth() + 1;
	var tday = calday.getDate() - 1 + 1;
	OpenCalendar("N",tyear, tmonth, tday, c1, c2, c3);
}

function CalendarCallback(distime,strSelectedDate, c1, c2, c3) {
	
	var ONE_DAY = 1000 * 60 * 60 * 24;
	var today = new Date();
	var tyear = today.getFullYear() - 1 + 1;
	var fdate = new Date(tyear,0,1);
	var fms = fdate.getTime();
	var tdate=new Date(strSelectedDate);
	var tms = tdate.getTime();
	var difference_ms = Math.abs(tms - fms);

	if(c1 != ""){document.getElementById(c1).value = Math.round(difference_ms/ONE_DAY) + 1;}
	if(c2 != ""){document.getElementById(c2).value = tdate.format('jS F');}
	
	if(distime == "Y"){
		if(c3 != ""){document.getElementById(c3).value = formatnumber(tdate.getDate())+"/"+formatnumber((tdate.getMonth()+1))+"/"+tdate.getFullYear()+" " + document.getElementById("hrs").value + ":" + document.getElementById("mins").value + ":" +document.getElementById("secs").value ;
		}
	}else{
		if(c3 != ""){document.getElementById(c3).value = formatnumber(tdate.getDate())+"/"+formatnumber((tdate.getMonth()+1))+"/"+tdate.getFullYear();}
	}

}

function formatnumber(nu){
	if (nu < 10){
		return "0" + nu;
	}else{
		return nu;
	}
}

function OpenCalendar(distime, defYear, defMonth, defDay, c1, c2, c3) {
	var now=new Date();
	if ((typeof defYear == "undefined")||(isNaN(defYear)))
		defYear = now.getFullYear();
	if ((typeof defMonth == "undefined")||(isNaN(defMonth)))
		defMonth = now.getMonth();
	else
		defMonth--;
	if ((typeof defDay == "undefined")||(isNaN(defDay)))
		defDay = now.getDate();
;
	FillCalendar(distime, defYear, defMonth+1, defDay, c1, c2, c3);
	
	var objPanel = document.getElementById(_panelMainID);
	objPanel.style.display = "block";
	var panelWidth = GetElementWidth(objPanel);
	var panelHeight = GetElementHeight(objPanel);
	var bodyWidth = document.body.clientWidth;
	var bodyHeight = document.body.clientHeight;
	var panelLeft = parseInt((bodyWidth/2)-(panelWidth/2));
	var panelTop = parseInt((bodyHeight/2)-(panelHeight/2));
	objPanel.style.left = panelLeft+"px";
	objPanel.style.top = panelTop+"px";
}

function FillCalendar(distime, year, month, day, c1, c2, c3) {
	//var date=new Date();
	//date.setFullYear(year+1, month, day);
	//alert(day);
	
	_currentYear = year;
	_currentMonth = month-1;
	//alert('"'+month+'/1'+"/"+year+'"');
	var daysCount=DaysInMonth(year, month);
	var myDate = new Date(eval('"'+month+'/1'+"/"+year+'"'));
	var daystart = myDate.getDay();
	var c_daystart = daystart;
	//alert(myDate);
	
	var objMainPanel = document.getElementById(_panelMainID);
	if (!objMainPanel) {
		objMainPanel = document.createElement("div");
		objMainPanel.id = _panelMainID;
		objMainPanel.style.position = "absolute";
		objMainPanel.style.display = "none";
		//objMainPanel.style.float = "left";
		objMainPanel.style.height = "auto";
		objMainPanel.style.width = "auto";
		objMainPanel.style.border = _MainBorderSize+"px solid "+_MainBorderColor;
		objMainPanel.style.backgroundColor = _MainBackground;
		document.body.appendChild(objMainPanel);
	}
	
	var objPanel = document.getElementById(_panelID);
	if (!objPanel) {
		objPanel = document.createElement("div");
		objPanel.id = _panelID;
		//objPanel.style.display = "inline-block";
		objPanel.style.border = _calenderBorderSize+"px solid "+_calenderBorderColor;
		objPanel.style.backgroundColor = _calendarBackground;
		objMainPanel.appendChild(objPanel);
	}
	
	if(distime == "Y"){
		var objTimePanel = document.getElementById(_panelTimeID);
		if (!objTimePanel) {
			objTimePanel = document.createElement("div");
			objTimePanel.id = _panelTimeID;
			//objTimePanel.style.display = "inline-block";
			objTimePanel.style.border = _TimeBorderSize+"px solid "+_TimeBorderColor;
			objTimePanel.style.backgroundColor = _TimeBackground;
			objMainPanel.appendChild(objTimePanel);
		}
		
		while (objTimePanel.childNodes.length > 0)
			objTimePanel.removeChild(objTimePanel.childNodes[0]);
	}
	
	while (objPanel.childNodes.length > 0)
		objPanel.removeChild(objPanel.childNodes[0]);

	BuildCalendarDetails(distime, objPanel, _currentMonth, _currentYear, c1, c2, c3);

	tday=new Date()
	today = new Date(tday.getFullYear(),tday.getMonth(),tday.getDate())

	var cellWidth=30;
	var cellHeight=25;
	var currentDay=1;
	var objTable=document.createElement("table");
	objTable.setAttribute("border", "0");
	objTable.setAttribute("cellpadding", "0");
	objTable.setAttribute("cellspacing", "0");
	var objRow=0;
	
	myDays=["Sun","Mon","Tue","Wed","Thr","Fri","Sat","Sun"];
	objRow=objTable.insertRow(objTable.rows.length);
	for (var i=0; i<7; i++) {
		
		var objCell=objRow.insertCell(objRow.cells.length);
		objCell.setAttribute("width", cellWidth+"");
		objCell.setAttribute("height", cellHeight+"");
		objCell.style.border = "1px solid black";
		objCell.style.textAlign = "center";
		objCell.style.fontFamily = _calenderCellFontName;
		objCell.style.fontSize = _calenderCellFontSize;
			
		var this_day = currentDay - daystart;
		objCell.style.backgroundColor = _calenderDayCellColor;
		objCell.innerHTML = myDays[i]+"";
		
	}
	
	var totaldays = daysCount + daystart;
	while (currentDay <= totaldays ) {
		if (((currentDay-1)%7) == 0) {
			objRow=objTable.insertRow(objTable.rows.length);
		}
		for (var i=1; i<=7; i++) {
			if (currentDay > totaldays)
				break;
			var objCell=objRow.insertCell(objRow.cells.length);
			objCell.setAttribute("width", cellWidth+"");
			objCell.setAttribute("height", cellHeight+"");
			objCell.style.border = "1px solid black";
			objCell.style.textAlign = "center";
			objCell.style.fontFamily = _calenderCellFontName;
			objCell.style.fontSize = _calenderCellFontSize;
			
			if (c_daystart > 0){
				c_daystart = c_daystart - 1;
			}else{
				
				var this_day = currentDay - daystart;
				checkday = new Date(_currentYear,_currentMonth,this_day)
				if ((Math.abs(checkday.getTime()-today.getTime())) == 0){
					objCell.style.backgroundColor = _calendarToDayCellColor;
				}else{
					objCell.style.backgroundColor = _calenderCellColor;
				}
				objCell.style.cursor = "pointer";
				objCell.onmouseover = new Function("PutMoreLight(this)");
				objCell.onmouseout = new Function("RestoreColor(this)");
				tccc = "CalenderCellClick(this,'" + distime + "','" + c1 + "','" + c2 + "','" + c3 + "');";
				objCell.onclick = new Function(tccc);
				objCell.innerHTML = this_day+"";
				
			}
			currentDay++;
		}
	}
	objPanel.appendChild(objTable);
	
	if(distime == "Y"){
		
		var cellTimeWidth=30;
		var cellTimeWidth2=60;
		var cellTimeHeight=25;
	
		var objTimeTable=document.createElement("table");
		objTimeTable.setAttribute("border", "0");
		objTimeTable.setAttribute("cellpadding", "0");
		objTimeTable.setAttribute("cellspacing", "0");
		var objTimeRow=0;
	
		objTimeRow=objTimeTable.insertRow(objTimeTable.rows.length);
		
		var objCell=objTimeRow.insertCell(objTimeRow.cells.length);
		objCell.setAttribute("width", cellTimeWidth2+"");
		objCell.setAttribute("height", cellTimeHeight+"");
		objCell.style.border = "1px solid black";
		objCell.style.textAlign = "center";
		objCell.style.fontFamily = _TimeCellFontName;
		objCell.style.fontSize = _TimeCellFontSize;
		objCell.style.backgroundColor = _TimeCellColor;
		objCell.innerHTML = "Time";
		
		var objCell=objTimeRow.insertCell(objTimeRow.cells.length);
		objCell.setAttribute("width", cellTimeWidth2+"");
		objCell.setAttribute("height", cellTimeHeight+"");
		objCell.style.border = "1px solid black";
		objCell.style.textAlign = "center";
		objCell.style.fontFamily = _TimeCellFontName;
		objCell.style.fontSize = _TimeCellFontSize;
		objCell.style.backgroundColor = _TimeCellColor;
		
		var t_combo = '<select id="hrs">';
		for (var i=0; i<24; i++) {
			if(i < 10){
				t_combo = t_combo + '<option value="0' + i + '">0' + i + '</option>';
			}else{
				t_combo = t_combo + '<option value="' + i + '">' + i + '</option>';
			}
		}
		objCell.innerHTML = t_combo;
		
		var objCell=objTimeRow.insertCell(objTimeRow.cells.length);
		objCell.setAttribute("width", cellTimeWidth2+"");
		objCell.setAttribute("height", cellTimeHeight+"");
		objCell.style.border = "1px solid black";
		objCell.style.textAlign = "center";
		objCell.style.fontFamily = _TimeCellFontName;
		objCell.style.fontSize = _TimeCellFontSize;
		objCell.style.backgroundColor = _TimeCellColor;
		
		var t_combo = '<select id="mins">';
		for (var i=0; i<60; i++) {
			if(i < 10){
				t_combo = t_combo + '<option value="0' + i + '">0' + i + '</option>';
			}else{
				t_combo = t_combo + '<option value="' + i + '">' + i + '</option>';
			}
		}
		objCell.innerHTML = t_combo;
		
		var objCell=objTimeRow.insertCell(objTimeRow.cells.length);
		objCell.setAttribute("width", cellTimeWidth2+"");
		objCell.setAttribute("height", cellTimeHeight+"");
		objCell.style.border = "1px solid black";
		objCell.style.textAlign = "center";
		objCell.style.fontFamily = _TimeCellFontName;
		objCell.style.fontSize = _TimeCellFontSize;
		objCell.style.backgroundColor = _TimeCellColor;
		
		var t_combo = '<select id="secs">';
		for (var i=0; i<60; i++) {
			if(i < 10){
				t_combo = t_combo + '<option value="0' + i + '">0' + i + '</option>';
			}else{
				t_combo = t_combo + '<option value="' + i + '">' + i + '</option>';
			}
		}
		objCell.innerHTML = t_combo;
		
		objTimePanel.appendChild(objTimeTable);
	}
	
	//window.resizeTo(objTable.clientWidth, objPanel.offsetHeight);
}

function BuildCalendarDetails(distime, objContainer, month, year, c1, c2, c3) {
	
	var btnCloseCal=BuildCalendarButton((_rightToLeft)?"Close":"&lt;&lt;",10);
	tccc = "HideCalendar();";
	btnCloseCal.onclick = new Function(tccc);
	
	var btnPreviousMonth=BuildCalendarButton((_rightToLeft)?">>":"&lt;&lt;",18);
	tccc = "NextMonthClick('" + distime + "','" + c1 + "','" + c2 + "','" + c3 + "');";
	btnPreviousMonth.onclick = new Function(tccc);
	
	var btnNextMonth=BuildCalendarButton((_rightToLeft)?"&lt;&lt;":">>",18);
	tccc = "PreviousMonthClick('" + distime + "','" + c1 + "','" + c2 + "','" + c3 + "');";
	btnNextMonth.onclick = new Function(tccc);
	
	var objMonthSpan=BuildCalendarSpan(_monthNames[month]);
	tccc = "HideCalendar();";
	objMonthSpan.onclick = new Function(tccc);
	var objYearSpan=BuildCalendarSpan(year+"");
	tccc = "HideCalendar();";
	objYearSpan.onclick = new Function(tccc);
	
	var objSpan=document.createElement("div");
	objSpan.id = _panelID+"_details";
	objSpan.style.textAlign = "center";
	objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
	if (_rightToLeft) {
		objSpan.appendChild(btnCloseCal);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnNextMonth);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(objMonthSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;&nbsp;&nbsp;"));
		objSpan.appendChild(objYearSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnPreviousMonth);
	}
	else {
		objSpan.appendChild(btnCloseCal);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnPreviousMonth);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(objYearSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;&nbsp;&nbsp;"));
		objSpan.appendChild(objMonthSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnNextMonth);
	}
	objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
	//objSpan.appendChild(BuildCalendarSpan("<br />"));
	objContainer.appendChild(objSpan);
}

function BuildCalendarButton(strText,chrsize) {
	var result=document.createElement("button");
	result.setAttribute("type", "button");
	result.style.fontSize = chrsize + "px";
	result.innerHTML = strText;
	return result;
}

function BuildCalendarSpan(strText) {
	var result=document.createElement("span");
	result.style.fontFamily = _calenderTextFontName;
	result.style.fontSize = _calenderTextFontSize;
	result.style.color = _calenderTextColor;
	result.innerHTML = strText;
	return result;
}

function CalenderCellClick(objCell,distime, c1, c2, c3) {
	
	//hide:
	HideCalendar();
	
	//set date:
	var date=new Date();
	date.setFullYear(_currentYear, _currentMonth, parseInt(objCell.innerHTML));
	
	//activate callback function:
	eval(_calendarCallbackFunction+"('" + distime + "','" + date + "','" + c1 + "','" + c2 + "','" + c3 + "')");
}

function HideCalendar() {
	var objPanel = document.getElementById(_panelMainID);
	objPanel.style.display = "none";
}

function PreviousMonthClick(distime,c1, c2, c3) {
	_currentMonth--;
	if (_currentMonth < 0) {
		_currentMonth = 11;
		_currentYear--;
	}
	FillCalendar(distime,_currentYear, _currentMonth+1, 1,c1, c2, c3);
	
}

function NextMonthClick(distime,c1, c2, c3) {
	_currentMonth++;
	if (_currentMonth > 11) {
		_currentMonth = 0;
		_currentYear++;
	}
	FillCalendar(distime,_currentYear, _currentMonth+1, 1,c1, c2, c3);
}

function DaysInMonth(year, month) {
	var date=new Date();
	var result=0;
	date.setFullYear(year, month-1, 1);
	while ((date.getFullYear() <= year)&&(date.getMonth() <= (month-1))) {
		result++;
		if (result > 31) {
			alert("error getting days in month!\nyear: "+year+", month: "+month);
			return 0;
		}
		date.setFullYear(year, month-1, date.getDate()+1);
	}
	return result;
}

function GetElementWidth(element) {
	return element.clientWidth;
}

function GetElementHeight(element) {
	return element.clientHeight;
}

var arrColoredControls=new Array();
function PutMoreLight(objControl, color, lightAmount) {
	var cancelAddLight=objControl.getAttribute("cancel_add_light");
	if (cancelAddLight == "1")
		return true;
	
	if (typeof color == "undefined")
		color = _calenderCellColor;
	
	if (typeof lightAmount == "undefined")
		lightAmount = _calendarAddLight;
	
	arrColoredControls[objControl] = color;
	
	var R=HexToInt(color.substring(1, 3));
	var G=HexToInt(color.substring(3, 5));
	var B=HexToInt(color.substring(5, 7));
	
	R = SafeAdd(R, lightAmount, 0, 255);
	G = SafeAdd(G, lightAmount, 0, 255);
	B = SafeAdd(B, lightAmount, 0, 255);
	
	var lightedColor=BuildColor(R, G, B);
	objControl.style.backgroundColor = lightedColor;
}

function RestoreColor(objControl) {
	var cancelAddLight=objControl.getAttribute("cancel_add_light");
	if (cancelAddLight == "1")
		return true;
	objControl.style.backgroundColor = arrColoredControls[objControl];
}

function IntToHex(num) {
	if (num < 10)
		return (num+"");
	
	switch (num) {
		case 10: return "a";
		case 11: return "b";
		case 12: return "c";
		case 13: return "d";
		case 14: return "e";
		case 15: return "f";
	}
	
	return IntToHex(parseInt(num/16))+IntToHex(parseInt(num%16));
}

function HexToInt(strHex) {
	return parseInt(strHex, 16);
}

function SafeAdd(num, addition, min, max) {
	num += addition;
	if (num > max)
		num = max;
	if (num < min)
		num = min;
	return num;
}

function BuildColor(r, g, b) {
	var R=IntToHex(r);
	var G=IntToHex(g);
	var B=IntToHex(b);
	R=(R.length == 1)?("0"+R):R;
	G=(G.length == 1)?("0"+G):G;
	B=(B.length == 1)?("0"+B):B;
	return "#"+R+G+B;
}

Date.prototype.format = function(format) {
	var returnStr = '';
	var replace = Date.replaceChars;

	for (var i = 0; i < format.length; i++) {
		var curChar = format.charAt(i);

		if (replace[curChar]){
			returnStr += replace[curChar].call(this);
		}else{
			returnStr += curChar;
		}
	}

	return returnStr;
};
Date.replaceChars = {
	shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
	
	// Day
	d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	j: function() { return this.getDate(); },
	l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	N: function() { return this.getDay() + 1; },
	S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	w: function() { return this.getDay(); },
	z: function() { return "Not Yet Supported"; },
	// Week
	W: function() { return "Not Yet Supported"; },
	// Month
	F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	m: function() { return (this.getMonth() < 11 ? '0' : '') + (this.getMonth() + 1); },
	M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	n: function() { return this.getMonth() + 1; },
	t: function() { return "Not Yet Supported"; },
	// Year
	L: function() { return "Not Yet Supported"; },
	o: function() { return "Not Supported"; },
	Y: function() { return this.getFullYear(); },
	y: function() { return ('' + this.getFullYear()).substr(2); },
	// Time
	a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	B: function() { return "Not Yet Supported"; },
	g: function() { return this.getHours() == 0 ? 12 : (this.getHours() > 12 ? this.getHours() - 12 : this.getHours()); },
	G: function() { return this.getHours(); },
	h: function() { return (this.getHours() < 10 || (12 < this.getHours() < 22) ? '0' : '') + (this.getHours() < 10 ? this.getHours() + 1 : this.getHours() - 12); },
	H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	// Timezone
	e: function() { return "Not Yet Supported"; },
	I: function() { return "Not Supported"; },
	O: function() { return (this.getTimezoneOffset() < 0 ? '-' : '+') + (this.getTimezoneOffset() / 60 < 10 ? '0' : '') + (this.getTimezoneOffset() / 60) + '00'; },
	T: function() { return "Not Yet Supported"; },
	Z: function() { return this.getTimezoneOffset() * 60; },
	// Full Date/Time
	c: function() { return "Not Yet Supported"; },
	r: function() { return this.toString(); },
	U: function() { return this.getTime() / 1000; }
}


