function ValidPhone(sTmp) { var s ; s = sTmp.value ; if ( s == "") { return ; } var charArray = [ '.', '\\', '/', '(', ')', '-', '_', '?', '*' ]; var i = 0 ; for (i=0;i 90 ) { iYear = "19" + iYear } else { iYear = "20" + iYear } } sTmp = iMonth + "/" + iDay + "/" + iYear if ( iMonth < 1 || iMonth > 12 ) { alert( "Invalid Month: " + iMonth ) ; dTmp.focus() ; return ; } if ( iDay < 1 || iDay > 31 ) { alert("Invalid Day: " + iDay ) ; dTmp.focus() ; return ; } if ( (iMonth == 4 || iMonth == 6 || iMonth == 9 || iMonth == 11) && iDay > 30 ) { alert("Invalid Day For This Month: " + iDay ) ; dTmp.focus() ; return ; } if ( iMonth == 2 && iDay > 28 ) { if ( iYear % 4 != 0 || iDay > 29 ) { alert("Invalid Day For Feb in this Year: " + iYear) ; dTmp.focus() ; return ; } } // validate year if ( iYear > 99 && iYear < 1900 ) { alert("There appears to be a problem with the year - it's over 100 years ago.\nPlease enter the date again.") ; dTmp.focus() ; dTmp.select() ; return ; } dTmp.value = sTmp ; // added a return true to allow for true/false validation checking 12/5/2007 - ALS return true ; } /* End of ValidDate() Function */ function FormatToday() { Today = new Date(); return( (Today.getMonth()+1) + "/" + Today.getDate() + "/" + Today.getFullYear() ); } function DateLimit( EnterDate, Days ) { DPToday = Date.parse(Date()); DPEnterDate = Date.parse(EnterDate); OneDay = 86400000 ; diff = Math.abs( DPToday - DPEnterDate ); if ( diff >= ( Math.abs(Days) * OneDay ) ) { if ( Days < 0 && DPEnterDate < DPToday ) return true; if ( Days >= 0 && DPEnterDate > DPToday ) return true; } return false; } function DateLimitTwoDates( StartDate, EndDate, Days ) { DPStartDate = Date.parse(StartDate); DPEndDate = Date.parse(EndDate); OneDay = 86400000 ; diff = Math.abs( DPStartDate - DPEndDate ); if ( diff == 0 ) { diff = OneDay } ; if ( diff >= ( Math.abs(Days) * OneDay ) ) { if ( Days < 0 && DPEndDate < DPStartDate ) return true; if ( Days >= 0 && DPEndDate >= DPStartDate ) return true; } return false; } // Next two functions added 7/15/2009 - ALS - to allow date calculations // NOTE: the DateAdd function requires additional stuff for HTML pages; try using CalcDate or // CalcDateMD below if you are just adding months and/or days, and pass 0 if needed function DateAdd(valType, cDate, valAdd) { switch (valType) { // Date arithmetic case 'd': // Days cDate.setDate(cDate.getDate() + valAdd) break; case 'm': // Months cDate.setMonth(cDate.getMonth() + valAdd) break; case 'y': // Years cDate.setYear(cDate.getYear() + valAdd) break; // Time arithmetic case 'h': // Hours cDate.setHours(cDate.getHours() + valAdd) break; case 'n': // Minutes cDate.setMinutes(cDate.getMinutes() + valAdd) break; case 's': // Seconds cDate.setSeconds(cDate.getSeconds() + valAdd) break; } return cDate; } function CalcDate(cDate,Days,Dir) { var addDays = Days * Dir ; // Dir is whether you're adding (1) or subtracting (-1) days var stDate = new Date(cDate) ; var newDate1 = DateAdd('d', stDate, addDays) ; var newDate = new Date(newDate1) ; var strMonth = newDate.getMonth() + 1 ; var strDate = newDate.getDate() ; var strYear = newDate.getFullYear() ; var strNewDate = strMonth + "/" + strDate + "/" + strYear ; return(strNewDate) ; } function CalcDays(Start,End) { var present, presenttime, future, futuretime present = new Date(Start); presenttime = present.getTime(); future = new Date(End); futuretime = future.getTime(); duration = Math.floor((futuretime - presenttime) / 86400000.); if (duration < 0) { // you may need to provide for this in your calling code } return(duration) ; } function CalcDateMD(cDate,Months,Days,Dir) { var addMonths = Months * Dir ; // Dir is whether you're adding (1) or subtracting (-1) days var addDays = Days * Dir ; var stDate = new Date(cDate) ; var newDatem = DateAdd('m', stDate, addMonths) ; var newDate1 = new Date(newDatem) ; var newDated = DateAdd('d', stDate, addDays) ; var newDate = new Date(newDated) ; var strMonth = newDate.getMonth() + 1 ; var strDate = newDate.getDate() ; var strYear = newDate.getFullYear() ; var strNewDate = strMonth + "/" + strDate + "/" + strYear ; return(strNewDate) ; } // end Date functions function isInteger(s){ if( s.length > 1 ) { if ( s.substring(0,1) == '-' || s.substring(0,1) == '+' ){ if( s.slice(1).search(/\D/) < 0 && s.slice(1).length > 0 ) return true; } } if( s.search(/\D/) < 0 && s.length > 0 ) return true; return false; } function checkCapsLock( e ) { var myKeyCode=0; var myShiftKey=false; var myMsg='Caps Lock is On.\n\nPlease press Caps Lock to turn it off.'; //Check first if Firefox or Safari which don't detect Caps Lock if ( document.getElementById && !document.all && !document.layers ) { // don't do anything since the keycode detection doesn't work } else { // Internet Explorer 4+ if ( document.all ) { myKeyCode=e.keyCode; myShiftKey=e.shiftKey; } // Netscape 4 else if ( document.layers ) { myKeyCode=e.which; myShiftKey=( myKeyCode == 16 ) ? true : false; } // Netscape 6 else if ( document.getElementById ) { myKeyCode=e.which; myShiftKey=( myKeyCode == 16 ) ? true : false; } } // Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) { alert( myMsg ); } // Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) { alert( myMsg ); } } function Mid(str, start, len) { // Make sure start and len are within proper bounds if ( start < 0 || len < 0 ) return "" ; var iEnd, iLen = String(str).length ; if (start + len > iLen) { iEnd = iLen ; } else { iEnd = start + len ; } return String(str).substring(start,iEnd) ; } function InStr(strSearch, charSearchFor) { for (i=0; i < strSearch.length; i++) { if (charSearchFor == Mid(strSearch, i, 1)){ return i; } } return -1; } // trim added 2/16/09 Tom function trim(str) { var whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000'; for (var i = 0; i < str.length; i++) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(i); break; } } for (i = str.length - 1; i >= 0; i--) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(0, i + 1); break; } } return whitespace.indexOf(str.charAt(0)) === -1 ? str : ''; } function FixQuotes(sQuotes) { while ( sQuotes.indexOf("chr(34)") != -1 ){ var iQuote = sQuotes.indexOf("chr(34)") ; var lenQuote = sQuotes.length ; sQuotes = sQuotes.substring(0,iQuote) + "\"" + sQuotes.substring(iQuote+7,lenQuote) ; } return sQuotes ; } // Array function added 6/16/09 ALS -- allows use of array instead of multiple OR statements function inArray(arr,value) { var i; for (i=0; i < arr.length; i++) { if (arr[i] == value) { return true; } } return false; } // Left and Right functions added 8/26/09 Tom Carr function Left(str, n){ if (n <= 0) { return "" ; } else if (n > String(str).length) { return str ; } else { return String(str).substring(0,n) ; } } function Right(str, n){ var iLen = String(str).length; if (n <= 0) { return "" ; } else if (n > iLen) { return str ; } else { return String(str).substring(iLen - n, iLen) ; } } // function added to do browser check for AJAX calls - ALS - 10/15/2009 // modified to handle multiple versions of MSIE XMLHTTP objects function GetXmlHTTPObject() { var xmlHttpObj = null; if (navigator.userAgent.indexOf('MSIE') >= 0) { // var strName ; // strName = 'Microsoft.XMLHTTP'; var xhrList = new Array('Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.3.0', 'Microsoft.XMLHTTP'); for (var i = 0; i < xhrList.length; ++i) { try { xmlHttpObj = new ActiveXObject(xhrList[i]); // xmlHttpObj = new ActiveXObject(strName); // xmlHttpObj.onreadystatechange = handler; return xmlHttpObj; } catch(e) { alert('Error. Scripting for ActiveX might be disabled'); return; } } } if (navigator.userAgent.indexOf('Mozilla') >= 0) { xmlHttpObj = new XMLHttpRequest(); // xmlHttpObj.onload = handler; // xmlHttpObj.onerror = handler; return xmlHttpObj; } } // function added for testing of multiple windows open and disabling right-click on links -- ALS - 1/28/2009 function CheckWindowName(thisWindow) { if( window.name != thisWindow ) { window.name = "invalidAccess"; //window.open("Error.asp", "_self"); } } // function for refreshing Appointment Queue-- TRM - 9/2/2010 function OpenCheckIn() { var $http, $self = arguments.callee; if (window.XMLHttpRequest) { $http = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { $http = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { $http = new ActiveXObject('Microsoft.XMLHTTP'); } } if ($http) { $http.onreadystatechange = function() { if (/4|^complete$/.test($http.readyState)) { document.getElementById('subcontent3').innerHTML = $http.responseText; setTimeout(function(){$self();}, 180000); } }; $http.open('GET', 'Ajax/CheckIn_Svr.asp' + '?' + new Date().getTime(), true); $http.send(null); } } function GetAppointmentsWaiting() { var $http, $self = arguments.callee; if (window.XMLHttpRequest) { $http = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { $http = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { $http = new ActiveXObject('Microsoft.XMLHTTP'); } } if ($http) { $http.onreadystatechange = function() { if (/4|^complete$/.test($http.readyState)) { document.getElementById('contentlink').innerHTML = $http.responseText; setTimeout(function(){$self();}, 180000); } }; $http.open('GET', 'GetAppointmentsWaiting.asp' + '?' + new Date().getTime(), true); $http.send(null); } }