// function getfile will perform our request using our created xmlhttp object //
function doAction(div,action,urlvars,wait) {
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
// Display the please-wait, processing div if requested //
if (wait == 'yes') {
document.getElementById('processing').style.display = "block";
document.getElementById('processing').innerHTML = processingMsg;
document.getElementById(div).innerHTML = ' ';
}
var Current = action+"?RandomKey=" + Math.random() * Date.parse(new Date());
if (urlvars.charAt(1) != " ") {
var Current = Current+urlvars;
}
xmlhttp.open("GET", Current, true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.getElementById(div).innerHTML = xmlhttp.responseText;
document.getElementById('processing').style.display = "none";
// If we find a meta refresh in the result, take the user back to the login page
refresh = /meta http-equiv=Refresh/;
if (xmlhttp.responseText.search(refresh)!=-1) {
window.location="http://gedidev.gaineycorp.com/?message=You have been inactive too long, and automatically logged out";
}
// Init sortable tables //
sortables_init();
switch (action) {
// If we are opening the image viewer, then set focus to the first field
case "/imaging/viewer.cfm":
document.imageform.elements[0].focus();
break;
// If we are displaying indexing form set focus
case "/indexing/viewer.cfm":
if (document.getElementById('formData')) {
document.getElementById('formData').elements[2].focus();
document.getElementById('formData').elements[2].select();
}
break
// If we are performing print fax email actions, refresh divs
case "/sysTools/qAction.cfm":
refresh('qList','/sysTools/qList.cfm','');
break
// If we are displaying our fullimage page, init the accordian
case "/imaging/fullimage.cfm":
break
// If we are displaying the notes page, do stuff
case "/imaging/notes.cfm":
document.noteform.elements[0].focus();
break
}
// Check contents of responseText for special notification message, if found, alert to user //
rExp = /{n}/;
if (xmlhttp.responseText.search(rExp)!=-1) {
var tmpArr = xmlhttp.responseText.split("{n}");
inform(tmpArr[1].toString());
}
}
}
xmlhttp.send(null);
refresh = null;
tmpArr = null;
}