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