menucolor0="#FFFFFF";
menucolor1="#ECE0B0";
menucolor2="#D7E2EC";
menucolor3="#116FA2";
menucolor4="#C1B78E";
menucolor4bak="#766D4E";
szHomePage="index.php";
szInfoPage="info.php";
szCenterPage="center.php";
szCenterAcctPage="acct.php";
szCenterBooksPage="books.php";
szCenterLinksPage="links.php";
szPatientPage="patient.php";
szLocationPage="location.php";
currenttab="none";
defaultprompt="";
if (location.pathname == ("/" + szHomePage) || location.pathname == ("/"))
{
currenttab="hometab";
}
else if (location.pathname == ("/" + szInfoPage))
{
currenttab="infotab";
}
else if ((location.pathname == ("/" + szCenterPage)) || (location.pathname == ("/" + szCenterAcctPage)) || (location.pathname == ("/" + szCenterBooksPage)) || (location.pathname == ("/" + szCenterLinksPage)))
{
currenttab="centertab";
}
else if (location.pathname == ("/" + szPatientPage))
{
currenttab="patienttab";
}
else if (location.pathname == ("/" + szLocationPage))
{
currenttab="locationtab";
}
function setdefaultprompt()
{
if (defaultprompt != "")
{
document.getElementById(defaultprompt).focus();
}
}
function expandable(object, id, show, hide)
{
id = document.getElementById(id);
if (object.innerHTML == hide)
{
object.innerHTML = show;
id.style.display = 'none';
}
else
{
object.innerHTML = hide;
id.style.display = 'block';
}
}
function displayimage()
{
if (currenttab == "hometab")
{
document.write("
");
document.write("
");
}
else if (currenttab == "infotab")
{
document.write("
");
document.write("
");
}
else if (currenttab == "centertab")
{
document.write("
");
document.write("
");
}
else if (currenttab == "locationtab")
{
document.write("
");
document.write("
");
}
else if (currenttab == "patienttab")
{
document.write("
");
document.write("
");
}
else
{
document.write("
");
document.write("
");
}
}
function menuon(object)
{
if (object.id != currenttab && object.className != "currenttab")
{
object.style.cursor='hand';
object.bgColor=menucolor3;
object.style.color=menucolor0;
}
}
function menuoff(object)
{
if (object.id != currenttab && object.className != "currenttab")
{
object.style.cursor='auto';
object.bgColor=menucolor1;
object.style.color='black';
}
}
function menuclick(object)
{
if (object.id != currenttab)
{
if (object.id == "hometab")
{
top.location=szHomePage;
}
if (object.id == "infotab")
{
top.location=szInfoPage;
}
if (object.id == "patienttab")
{
top.location=szPatientPage;
}
if (object.id == "centertab")
{
top.location=szCenterPage;
}
if (object.id == "locationtab")
{
top.location=szLocationPage;
}
}
}
function menuinit()
{
if (currenttab == "hometab")
{
object=this.hometab;
}
else if (currenttab == "infotab")
{
object=this.infotab;
}
else if (currenttab == "patienttab")
{
object=this.patienttab;
}
else if (currenttab == "centertab")
{
object=this.centertab;
}
else if (currenttab == "locationtab")
{
object=this.locationtab;
}
else
{
return;
}
object.bgColor=menucolor0;
object.style.borderRightColor=menucolor4;
object.style.borderRightStyle='solid';
object.style.borderRightWidth='1px';
object.style.borderLeftColor=menucolor4;
object.style.borderLeftStyle='solid';
object.style.borderLeftWidth='1px';
object.style.borderBottomColor='white';
}
function timeout(seconds)
{
setTimeout("expired()", seconds*1000);
}
function expired()
{
top.location="/expired.php";
}
function maxlength(Object, max)
{
return (Object.value.length <= max);
}
function numonly(Object, evt)
{
// Max length is 12
if (Object.value.length >= 12) return false;
var C = String.fromCharCode(evt.keyCode);
return ("0123456789".indexOf(C) != -1) ? true : false;
}
function phoneformat(Object, evt)
{
var C = String.fromCharCode(evt.keyCode);
if (("0123456789".indexOf(C) != -1) && (Object.value.length < 12))
{
if ((Object.value.length == 3) || (Object.value.length == 7))
{
C = "-" + C;
}
Object.value = Object.value + C;
}
return false;
}
function backspace_dash(Object, evt, value)
{
var c = evt.keyCode;
if (c == 8)
{
// Object.value = Object.value.substring(0, Object.value.length - (1 + (Object.value.charAt(Object.value.length - 1) == '-')));
// var back = (Object.value.charAt(Object.value.length - 2) == '-') ? 2 : 1;
var back = (Object.value.substring(Object.value.length - 2, 1) == '-') ? 2 : 1;
Object.value = Object.value.substring(0, Object.value.length - back);
return false;
}
else if (Object.value.length == 3)
{
Object.value = Object.value + Object.value.charAt(Object.value.length - 2);
}
return true;
// var oldSelectionStart = textControl.selectionStart;
// var oldSelectionEnd = textControl.selectionEnd;
// var selectedText = textControl.value.substring(oldSelectionStart, oldSelectionEnd);
// var newText = typeof keyCheck.newKey != 'undefined' ? keyCheck.newKey : String.fromCharCode(keyCheck.newKeyCode);
// textControl.value =
// textControl.value.substring(0, oldSelectionStart) +
// newText +
// textControl.value.substring(oldSelectionEnd);
// textControl.setSelectionRange(oldSelectionStart + newText.length, oldSelectionStart + newText.length);
// var C = String.fromCharCode(evt.keyCode);
// return ("0123456789".indexOf(C) != -1) ? true : false;
}
function deletethisfunction(textControl, evt, keyChecker)
{
var keyCode = evt.keyCode ? evt.keyCode :
evt.charCode ? evt.charCode :
evt.which ? evt.which : void 0;
var key;
if (keyCode)
{
key = String.fromCharCode(keyCode);
}
var keyCheck = keyChecker(keyCode, key);
if (keyCode && window.event && !window.opera)
{
if (keyCheck.cancelKey)
{
return false;
}
else if (keyCheck.replaceKey)
{
window.event.keyCode = keyCheck.newKeyCode;
if (window.event.preventDefault)
{
window.event.preventDefault();
}
return true;
}
else
{
return true;
}
}
else if (typeof textControl.setSelectionRange != 'undefined')
{
if (keyCheck.cancelKey)
{
if (evt.preventDefault)
{
evt.preventDefault();
}
return false;
}
else if (keyCheck.replaceKey)
{
// cancel the key event and insert the newKey for the current
// selection
if (evt.preventDefault)
{
evt.preventDefault();
}
var oldSelectionStart = textControl.selectionStart;
var oldSelectionEnd = textControl.selectionEnd;
var selectedText = textControl.value.substring(oldSelectionStart, oldSelectionEnd);
var newText = typeof keyCheck.newKey != 'undefined' ? keyCheck.newKey : String.fromCharCode(keyCheck.newKeyCode);
textControl.value =
textControl.value.substring(0, oldSelectionStart) +
newText +
textControl.value.substring(oldSelectionEnd);
textControl.setSelectionRange(oldSelectionStart + newText.length, oldSelectionStart + newText.length);
return false;
}
else
{
return true;
}
}
else if (keyCheck.cancelKey)
{
if (evt.preventDefault)
{
evt.preventDefault();
}
return false;
}
else
{
return true;
}
}