function makeAjaxCall(pType, pUrl, pSuccess, pData, pComplete) {
	$.ajax({
		type: pType,
		url: pUrl,
		data: pData,
		success: pSuccess,
		error: showAjaxError,
		complete: pComplete
	});
}

function getDateTimeStringWithLeadingZeros(pDate) {
	var dateStr = getDateStringWithLeadingZeros(pDate);

	var hh = (pDate.getHours() < 10 ? "0" : "") + pDate.getHours();
	var m = (pDate.getMinutes() < 10 ? "0" : "") + pDate.getMinutes();
	var ss = (pDate.getSeconds() < 10 ? "0" : "") + pDate.getSeconds();

	return dateStr + " " + hh + ":" + m + ":" + ss;
}

function getDateStringWithLeadingZeros(pDate) {
	var dd = (pDate.getDate() < 10 ? "0" : "") + pDate.getDate();
	var mm = ((pDate.getMonth() + 1) < 10 ? "0" : "") + (pDate.getMonth() + 1);
	var yyyy = pDate.getFullYear();

	return dd + "." + mm + "." + yyyy;
}

function subtractDates(date1, date2) {
	var t1 = date1.getTime();
	var t2 = date2.getTime();
	var diff = (t2 - t1) / 60000;

	return Math.abs(diff);
}

function addMinutes(date, minutes) {
	return new Date(date.getTime() + minutes * 60000);
}

function stringToTime(str) {
    var defaultResult = [-1, -1];
    var minutes = 0;

	if (str.length > 2) {
	    minutes = str.slice(str.length - 2, str.length);
	}
	var hours = str.slice(0, 2);
    
	defaultResult[0] = parseInt(hours);
	defaultResult[1] = parseInt(minutes);

	return defaultResult;
}
