// --------------------------------------------------------------------------------
// Date Parser/Generator for Tigra Calendar PRO script
// Format: yyyy/mm/dd
// If you can't find desired format here - mail us and we'll create one

// string to date object converter. input format is yyyy/mm/dd hh:mm:ss
// this method may be customized - string date format
function cal_parse_date (str_date) {
	var re_date = /^(\d+)-(\d+)-(\d+)$/;
	if (!re_date.exec(str_date))
		return alert("Parsing error: unsupported date format '" + str_date + "'");
	return (new Date (RegExp.$1,RegExp.$2-1,RegExp.$3));
}

// date object to string converter, output format is yyyy-mm-dd
// this method may be customized - string date format
function cal_generate_date (dt_date) {
	return (
		new String (
			dt_date.getFullYear() + 
			'-' + 
			(dt_date.getMonth() < 9 ? '0' : '') + (dt_date.getMonth() + 1) + 
			'-'	+ 
			(dt_date.getDate() < 10 ? '0' : '') + dt_date.getDate() 
		)
	);
}

// --------------------------------------------------------------------------------



