hoverframe = "schedulerFrame";
parent.setOffsets();
// client hover function - display available times for a specific date
function showSchedulerMouseover(evt,thisdate) {
var html = '
';
var innrhtml = '';
var r = 0;
var rows = schedulerResults.getRowCount();
var r_date = '';
var r_title = 0;
var r_body = 0;
var r_time = '';
var r_times = new Array();
var t = 0;
var a = 9*100;
var a1 = '';
var a2 = '';
var timeAvail = false;
var ampm = '';
var r_start = '';
for(r; r < rows; r++) {
r_date = schedulerResults.getField(r, 'date_start').format('yyyy-mm-dd');
if (r_date == thisdate) {
if (r_title == 0) {
html += '| ' + parent.hoverTopImage + ' |
';
html += '| ' + schedulerResults.getField(r, 'date_start').format('ddd mmm dd') + ' |
';
r_title = 1;
}
if (r_body == 0) {
html += '';
r_body = 1;
}
innrhtml += "" + replaceNoCase(schedulerResults.getField(r, 'headline'),"case_name=","","all") + " " + schedulerResults.getField(r, 'time_start').format('h:nn') + "-" + schedulerResults.getField(r, 'time_stop').format('h:nn') + "
";
// array of times not available
r_start = schedulerResults.getField(r, 'time_start');
r_time = r_start.format('hhhnn');
ampm = r_start.format('a/p');
if (ampm != 'a') {
r_time = parseInt(r_time);
r_time = (r_time < 1200) ? r_time + 1200 : r_time;
}
if((r_time / 100) != Math.round((r_time / 100))) { r_time = parseInt(r_time) + 20; }
r_times[t] = parseInt(r_time);
t += 1;
r_times[t] = parseInt(r_time) + 50;
t += 1;
r_times[t] = parseInt(r_time) + 100;
t += 1;
}
}
innrhtml = 'Available Tour Times ';
for(a; a <= 16*100; a = a + 50) {
a1 = a;
a2 = a + 50;
timeAvail = true;
t = 0;
for(t in r_times) {
if (r_times[t] == a1 || r_times[t] == a2) {
timeAvail = false;
}
}
if(timeAvail == true) {
innrhtml += "" + translateTime(a1) + " - " + translateTime(a2 + 50) + " ";
}
}
if (r_body == 1) {
html += innrhtml + ' |
';
} else {
r_date = new Date(thisdate.split("-")[0], (thisdate.split("-")[1] - 1), thisdate.split("-")[2]);
html += '| ' + parent.hoverTopImage + ' |
| ' + r_date.format('ddd mmm dd') + ' |
';
html += '| ' + innrhtml + ' |
';
}
html += '| ' + parent.hoverEndImage + ' |
'
parent.showMouseover(evt,html);
}
// converts a number to a time formatted string, i.e. 900 becomes 9:00 AM
function translateTime(thistime) {
var timehour = (thistime / 100).toString();
var ishalfhour = timehour.indexOf('.5');
var timeminute = ':00';
var timeperiod = ' AM';
var timestring = '';
if (ishalfhour > 0) { timehour = timehour.replace('.5',''); timeminute = ':30'; }
if (timehour > 12) { timeperiod = ' PM'; timehour = timehour - 12; }
timestring = timehour + '' + timeminute + '' + timeperiod;
return timestring;
}
// change iframe src
function changeSchedulerSrc(date) {
// initialize variables
var schedulerFrame = parent.document.getElementById('schedulerFrame');
var newSrc = '/templates/scheduler/scheduler_panel.cfm';
var this_date = createDateObject(date).format('yyyy-mm-dd');
if (arguments.length >= 2) { newSrc = arguments[1]; }
// change the src attribute of the iframe
newSrc = newSrc + '/date/' + this_date;
schedulerFrame.src = newSrc;
}