var _initSelectionSilent = 0; // Set to not issue alerts for errors
var _RunningOffLine = 0; // Set to indicate form started from OML
function sniffer () {
agent = navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion, 10);
this.minor = parseFloat(navigator.appVersion);
this.ie = (agent.indexOf("msie") != -1);
this.mozilla = (agent.indexOf("mozilla") != -1);
this.firefox = (agent.indexOf("firefox") != -1);
this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
this.ie6 = (this.ie && (agent.indexOf("msie 6.0") != -1));
this.ie7 = (this.ie && (agent.indexOf("msie 7.0") != -1));
this.mac = (agent.indexOf("mac") != -1);
}
function CopyArrayValues (ArrayFrom, ArrayTo) {
for (fld in ArrayFrom) {
ArrayTo[fld] = ArrayFrom[fld];
}
}
function _CInt(V) {
return (parseInt(V, 10));
}
function validateNumeric (n) {
if (n.value.indexOf("$") == 0) { n.value = n.value.substring(1); } // remove leading dollar
var num = "0123456789.,$";
var retValue = true;
if (n.value.charAt(0) == '-' || n.value.charAt(0) == '+' || (num.indexOf(n.value.charAt(0)) > -1))
retValue = true;
else
retValue = false;
for (var I = 1; I < n.value.length; I++)
if (num.indexOf(n.value.charAt(I)) == -1)
retValue = false;
return retValue;
}
function getNumericPart (n) {
var num = "0123456789.,";
var retValue = 0;
var sindex = 0;
if (typeof n == "string") {
if (n.charAt(0) == '-' || n.charAt(0) == '+') {
sindex = 1;
}
for (var I = sindex; I < n.length; I++) {
if (num.indexOf(n.charAt(I)) == -1)
break;
}
retValue = n.substring (0, I);
}
else
retValue = n;
return retValue;
}
function RmNonNum (M, NuNum) {
// remove non-numeric chars with two different modes of usage
if (M == 0) {
if (NuNum.value.length > 0) {
// remove "," for conversion
if (NuNum.value.indexOf(",") != -1)
NuNum.value = NuNum.value.replace(/,/g, "");
// remove "$" for conversion
if (NuNum.value.indexOf("$") != -1)
NuNum.value = NuNum.value.replace(/\$/g, "");
// remove multiple "." for conversion
var P = NuNum.value.indexOf(".");
if (P != -1) {
if (NuNum.value.indexOf(".", P + 1) != -1) {
alert ("More than decimal place was entered, removing extra periods!");
NuNum.value = NuNum.value.replace(/\./g, "");
NuNum.value = NuNum.value.substring(0, P) + "." + NuNum.value.substring(P);
}
}
}
return NuNum.value;
}
else {
if (NuNum.length > 0) {
// remove "," for conversion
if (NuNum.indexOf(",") != -1)
NuNum = NuNum.replace(/,/g, "");
// remove "$" for conversion
if (NuNum.indexOf("$") != -1)
NuNum = NuNum.replace(/\$/g, "");
// remove multiple "." for conversion
var P = NuNum.indexOf(".");
if (P != -1) {
if (NuNum.indexOf(".", P + 1) != -1) {
alert ("More than decimal place was entered, removing extra periods!");
NuNum = NuNum.replace(/\./g, "");
NuNum = NuNum.substring(0, P) + "." + NuNum.substring(P);
}
}
}
return NuNum;
}
}
function FPNFormat (FPNum) {
NuNum = FPNum;
// remove non-numeric chars
NuNum.value = RmNonNum(0, FPNum);
// Number format the Total
var dotindex = NuNum.value.indexOf(".");
var dotsize = NuNum.value.length;
if (dotindex < 0) {
NuNum.value += ".00";
}
else {
NuNum.value = (Math.round (NuNum.value * 100)) + .49;
NuNum.value = parseFloat(NuNum.value / 100);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".00";
else
if ((NuNum.value.length - dotindex) == 2)
NuNum.value += "0";
else
NuNum.value = NuNum.value.substr (0, dotindex + 3);
}
return NuNum.value;
}
function FPNFormatZS (FPNum, Fmt) {
NuNum = FPNum;
if (FPNum.value == "0" || FPNum.value == "") {
NuNum.value = "";
}
else {
if (NuNum.value.indexOf("$") == 0) { NuNum.value = FPNum.value.substring(1); } // remove leading dollar
var T = "";
for (I = 0; I < FPNum.value.length; I++) {
C = FPNum.value.substring (I, I+1);
if ((C.charCodeAt(0) >= 48 && C.charCodeAt(0) <= 57) || C.charCodeAt(0) == 46 || (I == 0 && C.charCodeAt(0) == 45))
T += C;
}
FPNum.value = T;
// check if negative and reformat w/o "-"
var NegNum = 0;
if (parseFloat(FPNum.value) < 0) {
NegNum = 1;
FPNum.value = 0 - T;
}
// Number format the Total
var Fmtdotindex = Fmt.length - Fmt.indexOf(".") - 1;
var dotindex = FPNum.value.indexOf(".");
var dotsize = FPNum.value.length;
if (dotindex < 0) {
switch (Fmtdotindex) {
case 0:
NuNum.value += ".";
break;
case 1:
NuNum.value += ".0";
break;
case 2:
NuNum.value += ".00";
break;
case 3:
NuNum.value += ".000";
break;
case 4:
NuNum.value += ".0000";
break;
}
}
else {
switch (Fmtdotindex) {
case 0:
NuNum.value = (Math.round (FPNum.value * 10)) + .49;
NuNum.value = parseFloat(NuNum.value / 10);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".";
else
NuNum.value = NuNum.value.substr (0, dotindex + 1);
break;
case 1:
NuNum.value = (Math.round (FPNum.value * 10)) + .49;
NuNum.value = parseFloat(NuNum.value / 10);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".0";
else
NuNum.value = NuNum.value.substr (0, dotindex + 2);
break;
case 2:
NuNum.value = (Math.round (FPNum.value * 100)) + .49;
NuNum.value = parseFloat(NuNum.value / 100);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".00";
else
if ((NuNum.value.length - dotindex) == 2)
NuNum.value += "0";
else
NuNum.value = NuNum.value.substr (0, dotindex + 3);
break;
case 3:
NuNum.value = (Math.round (FPNum.value * 1000)) + .49;
NuNum.value = parseFloat(NuNum.value / 1000);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".000";
else {
switch (NuNum.value.length - dotindex) {
case 3:
NuNum.value += "00";
break;
case 2:
NuNum.value += "0";
break;
default:
NuNum.value = NuNum.value.substr (0, dotindex + 4);
break;
}
}
break;
case 4:
NuNum.value = (Math.round (FPNum.value * 10000)) + .49;
NuNum.value = parseFloat(NuNum.value / 10000);
dotindex = NuNum.value.indexOf(".");
if (dotindex < 0)
NuNum.value += ".0000";
else {
switch (NuNum.value.length - dotindex) {
case 4:
NuNum.value += "000";
break;
case 3:
NuNum.value += "00";
break;
case 2:
NuNum.value += "0";
break;
default:
NuNum.value = NuNum.value.substr (0, dotindex + 5);
break;
}
}
break;
}
}
if ((typeof Fmt) != "undefined" && Fmt.length) {
if (Fmt == "#,###.0000" || Fmt == "$#,###.0000") {
var pindex = NuNum.value.indexOf(".");
var wnum = NuNum.value.substring (0, pindex);
var n3 = wnum.substring (wnum.length - 3);
wnum = wnum.substring (0, wnum.length - 3);
while (wnum.length > 3) {
n3 = wnum.substring (wnum.length - 3) + "," + n3;
wnum = wnum.substring (0, wnum.length - 3);
}
if (wnum.length) {
n3 = wnum + "," + n3;
}
var dnum = NuNum.value.substring (NuNum.value.length - 5);
NuNum.value = n3 + dnum;
if (Fmt.indexOf("$") == 0)
NuNum.value = "$" + NuNum.value;
}
else
if (Fmt == "#,##0.00" || Fmt == "$#,##0.00") {
var pindex = NuNum.value.indexOf(".");
var wnum = NuNum.value.substring (0, pindex);
var n3 = wnum.substring (wnum.length - 3);
wnum = wnum.substring (0, wnum.length - 3);
while (wnum.length > 3) {
n3 = wnum.substring (wnum.length - 3) + "," + n3;
wnum = wnum.substring (0, wnum.length - 3);
}
if (wnum.length) {
n3 = wnum + "," + n3;
}
var dnum = NuNum.value.substring (NuNum.value.length - 3);
NuNum.value = n3 + dnum;
if (Fmt.indexOf("$") == 0)
NuNum.value = "$" + NuNum.value;
}
else
if (Fmt == "$#,###." || Fmt == "#,###.") {
var pindex = NuNum.value.indexOf(".");
var wnum;
if (pindex > -1)
wnum = NuNum.value.substring (0, pindex);
else
wnum = NuNum.value;
var n3 = wnum.substring (wnum.length - 3);
wnum = wnum.substring (0, wnum.length - 3);
while (wnum.length > 3) {
n3 = wnum.substring (wnum.length - 3) + "," + n3;
wnum = wnum.substring (0, wnum.length - 3);
}
if (wnum.length) {
n3 = wnum + "," + n3;
}
var dnum = NuNum.value.substring (NuNum.value.length - 1);
NuNum.value = n3 + dnum;
if (Fmt.indexOf("$") == 0)
NuNum.value = "$" + NuNum.value;
}
else
if (Fmt == "$#,###" || Fmt == "#,###") {
var pindex = NuNum.value.indexOf(".");
var wnum = NuNum.value.substring (0, pindex);
var n3 = wnum.substring (wnum.length - 3);
wnum = wnum.substring (0, wnum.length - 3);
while (wnum.length > 3) {
n3 = wnum.substring (wnum.length - 3) + "," + n3;
wnum = wnum.substring (0, wnum.length - 3);
}
if (wnum.length) {
n3 = wnum + "," + n3;
}
NuNum.value = n3;
if (Fmt.indexOf("$") == 0)
NuNum.value = "$" + NuNum.value;
}
}
if (NegNum) { NuNum.value = "-" + NuNum.value; } // reformat with "-"
}
return NuNum.value;
}
function TparseFloat (FPNumStr) {
// remove non-numeric chars
FPNumStr = RmNonNum(1, FPNumStr);
if (isNaN(parseFloat(FPNumStr)))
return 0;
else
return (parseFloat(FPNumStr));
}
function isEmpty (str) {
for (var I = 0; I < str.length; I++) {
if (str.charAt(I) != " ")
return false;
}
return true;
}
function CountTextLines (TLine) {
var LCount = 1;
for (var I = 0; I < TLine.length; I++) {
if (TLine.charAt(I) == "\n")
++LCount;
}
return LCount;
}
function CountBRLines (TLine) {
var LCount = 1;
var tlen = TLine.length;
var i = 0;
while (i < (tlen - 4)) {
var j = i + 4;
if (TLine.substring (i, j) == "
" || TLine.substring (i, j) == "
")
++LCount;
++i;
}
return LCount;
}
function FindTextLineEnd (TLine, MaxLines) {
var LCount = 1;
var CCount = 0;
for (var I = 0; I < TLine.length; I++) {
if (TLine.charAt(I) == "\n")
++LCount;
++CCount;
if (LCount > MaxLines)
break;
}
return CCount;
}
function CountTextChars (TLine) {
var CCount = 0;
for (var I = 0; I < TLine.length; I++) {
if (TLine.charAt(I) != "\n" && TLine.charAt(I) != "\r")
++CCount;
}
return CCount;
}
function CnvToBRs (TLine) {
var RLine = "";
for (var I = 0; I < TLine.length; I++) {
if (TLine.charAt(I) != "\n" && TLine.charAt(I) != "\r") {
RLine += TLine.charAt(I);
}
else {
RLine += "
";
I += 1;
}
}
return RLine;
}
function LimitInputArea (OrigString, MAXL, MAXC) {
var TargetString = OrigString;
var lcnt = CountTextLines (TargetString);
var ccnt = CountTextChars (TargetString);
if (lcnt > MAXL || ccnt > MAXC) {
var msg = "Imprint Area has more than " + MAXL + " lines or more than " + MAXC + " chars";
alert (msg);
if (ccnt > MAXC) {
var s = TargetString;
TargetString = s.substring (0, MAXC - 1);
lcnt = CountTextLines (TargetString);
}
if (lcnt > MAXL) {
ccnt = FindTextLineEnd (TargetString, MAXL);
var s = TargetString;
TargetString = s.substring (0, ccnt-2);
}
}
return TargetString;
}
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
function ASpecC (SpecStr, SpecFont) {
if (LastImprintArea != "undef") {
if (SpecFont.length > 0 && SpecFont != "Basefont") {
LastImprintArea.value = LastImprintArea.value + "" + SpecStr + "";
}
else {
LastImprintArea.value = LastImprintArea.value + SpecStr;
}
LastImprintArea.focus();
}
}
function CloseSpecChar () {
SpecCharLegend.style.visibility = "hidden";
if (LastSpecList != "undef") {
LastSpecList.style.visibility = "hidden";
}
if (LastImprintArea != "undef") {
LastImprintArea.focus();
}
}
function MakeSubmitID () {
TDate = new Date();
var SubmitID = "";
var YRM = TDate.getFullYear() % 100;
if (YRM < 10)
SubmitID += "0";
SubmitID += YRM;
if (TDate.getMonth() < 10)
SubmitID += "0";
SubmitID += ("" + TDate.getMonth());
if (TDate.getDate() < 10)
SubmitID += "0";
SubmitID += ("" + TDate.getDate());
if (TDate.getHours() < 10)
SubmitID += "0";
SubmitID += ("" + TDate.getHours());
if (TDate.getMinutes() < 10)
SubmitID += "0";
SubmitID += ("" + TDate.getMinutes());
if (TDate.getSeconds() < 10)
SubmitID += "0";
SubmitID += ("" + TDate.getSeconds());
return SubmitID;
}
function _TodaysDate () {
TDate = new Date();
var cDate = "";
if (parseInt(TDate.getMonth(), 10) + 1 < 10)
cDate += "0";
cDate += ("" + parseInt(TDate.getMonth() + 1, 10));
cDate += "/";
if (TDate.getDate() < 10)
cDate += "0";
cDate += ("" + TDate.getDate());
cDate += "/";
cDate += ("" + TDate.getFullYear());
return cDate;
}
function GetDateValue (S) {
return (Date.UTC(S.substr(6, 4), S.substr(0, 2) - 1, S.substr(3, 2)));
}
function _ModalDlg (U, H, W, T, L) {
// example of full screen, centered dialog:
// _ModalDlg (YourURL, -1, -1, -1, -1);
// if height or width is -1, use the full screen values
var ih = H;
var iw = W;
if (H == -1) { ih = window.window.screen.availHeight; }
if (W == -1) { iw = window.window.screen.availWidth; }
var features = "dialogHeight: " + ih + "px; dialogWidth: " + iw + "px; ";
// if top and left is -1, center on the screen
if (T == -1 && L == -1) {
features += "center: Yes; ";
}
else {
// use specific top and left position values
features += "dialogTop: " + T + "px; dialogLeft: " + L + "px; ";
features += "center: No; ";
}
// misc features as desired
features += "edge: Raised; help: No; ";
features += "resizable: No; status: No; unadorned: No;";
// display a modal dialog with specified URL and features
window.showModalDialog(U,window, features);
}
function _initSelection (qURL, rStr, bLine, comboObj, callback) {
// usage: var reqstr = "CompID=" + document.forms[0].CompanyName0.value;
// usage: _initSelection ("../query/CompanyLocList-pl.cgi", reqstr, 1, document.forms[0].LocationID0);
// usage: NOTE: callback is only used in MacCompat Mode
var _TList = new Array;
var _VList = new Array;
var cline = 1;
var cindex = 0;
var eindex = 0;
var rtext = "";
var comboline = "";
var ctext = "";
var rtext = "";
var http;
var Activex;
// Do not try if we did not come from server
if (window.location.protocol.indexOf ("http") < 0) {
return (0);
}
if (window.XMLHttpRequest && !window.ActiveXObject){
// If IE7, IE8, Mozilla, Safari, etc: Use native object
http = new XMLHttpRequest();
Activex = false;
}
else if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
http = new ActiveXObject("Microsoft.XMLHTTP");
Activex = true;
}
if (http != null || (bsniff.ie55 || bsniff.ie6 || bsniff.ie7 || bsniff.ie8) && !bsniff.mac) {
if (Activex) {
// var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", qURL, false);
http.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
http.send (rStr);
if (http.status == 200) {
ctext = http.responseText;
}
else {
rtext = http.statusText;
ctext = http.responseText;
var NFIndex = rtext.indexOf ("Not Found");
if (!_initSelectionSilent) {
if (ctext.indexOf ("= 0)
return (-2);
else
return (-1);
}
}
else {
http.open ("POST", qURL, false);
http.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
http.send (rStr);
if (http.status == 200) {
ctext = http.responseText;
// alert ("No Applet: _initSelection:" + rStr + "\r\n" + rtext);
}
else {
rtext = http.statusText;
ctext = http.responseText;
if (ctext.indexOf (" 0) {
cindex = ctext.indexOf ("\n");
if (cindex > 0) {
++cline;
_VList.length = _TList.length = cline;
comboline = ctext.substring (0, cindex);
eindex = comboline.indexOf ("=");
if (eindex > 0) {
_VList[cline-1] = comboline.substring (0, eindex);
_TList[cline-1] = comboline.substring (eindex+1);
}
ctext = ctext.substring (cindex+1);
}
else {
++cline;
_VList.length = _TList.length = cline;
_VList[cline-1] = _TList[cline-1] = ctext;
ctext = "";
}
}
if (bLine == 0) {
// ignore 1st blank line entry
var tlen = comboObj.options.length = _TList.length-1;
for (i = 0; i < tlen; i++) {
comboObj.options[i].text = _TList[i+1];
comboObj.options[i].value = _VList[i+1];
}
}
else {
var boffset = 0;
// all entries w/blank line
var tlen = comboObj.options.length = _TList.length;
if (bLine == -1) {
if (tlen == 2) {
boffset = 1;
--tlen;
}
}
for (i = 0; i < tlen; i++) {
comboObj.options[i].text = _TList[i+boffset];
comboObj.options[i].value = _VList[i+boffset];
}
}
return (tlen);
}
function _saveSelectLists (ListArray) {
var _slDiags = 0;
for (fld in ListArray) {
if (_slDiags) { alert (fld); }
var slObj = document.getElementById (ListArray[fld]);
if (slObj != null) {
hidObj = document.getElementById (fld);
if (hidObj != null) {
hidObj.value = "";
if (_slDiags) { alert ("SelectList: " + fld + ", length= " + slObj.options.length + " Sel=" + slObj.options.selectedIndex); }
// First line of returned select list is the "count, curIndex"
hidObj.value = slObj.options.length + "," + slObj.options.selectedIndex + "\n";
for (var sndx = 0; sndx < slObj.options.length; sndx++) {
if (_slDiags) { alert (slObj.options[sndx].value + " -- " + slObj.options[sndx].text); }
hidObj.value += escape(slObj.options[sndx].value) + "=" + escape(slObj.options[sndx].text) + "\n";
}
}
}
}
}
function _initSelectionStep (qURL, rStr, bLine, comboObj, comboCnt) {
// usage: var reqstr = "CompID=" + document.forms[0].CompanyName0.value;
// usage: _initSelectionStep ("../query/CompanyLocList-pl.cgi", reqstr, 1, document.forms[0].LocationID0);
var _TList = new Array;
var _VList = new Array;
var cline = 1;
var cindex = 0;
var eindex = 0;
var rtext = "";
var comboline = "";
var ctext = "";
var cCnt = 0;
var ctext = "";
var rtext = "";
var http;
var Activex;
// Do not try if we did not come from server
if (window.location.protocol.indexOf ("http") < 0) {
return (0);
}
if (window.XMLHttpRequest && !window.ActiveXObject){
// If IE7, IE8, Mozilla, Safari, etc: Use native object
http = new XMLHttpRequest();
Activex = false;
}
else if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
http = new ActiveXObject("Microsoft.XMLHTTP");
Activex = true;
}
if (http != null || (bsniff.ie55 || bsniff.ie6 || bsniff.ie7 || bsniff.ie8) && !bsniff.mac) {
if (Activex) {
// var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", qURL, false);
http.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
http.send (rStr);
if (http.status == 200) {
ctext = http.responseText;
}
else {
rtext = http.statusText;
ctext = http.responseText;
if (ctext.indexOf (" 0) {
cindex = ctext.indexOf ("\n");
if (cindex > 0) {
++cline;
_VList.length = _TList.length = cline;
comboline = ctext.substring (0, cindex);
eindex = comboline.indexOf ("=");
if (eindex > 0) {
_VList[cline-1] = comboline.substring (0, eindex);
_TList[cline-1] = comboline.substring (eindex+1);
}
ctext = ctext.substring (cindex+1);
}
else {
++cline;
_VList.length = _TList.length = cline;
_VList[cline-1] = _TList[cline-1] = ctext;
ctext = "";
}
}
if (bLine == 0) {
// ignore 1st blank line entry
for (cCnt = 0; cCnt < comboCnt; cCnt++) {
var tlen = comboObj[cCnt].options.length = _TList.length-1;
for (i = 0; i < tlen; i++) {
comboObj[cCnt].options[i].text = _TList[i+1];
comboObj[cCnt].options[i].value = _VList[i+1];
}
}
}
else {
for (cCnt = 0; cCnt < comboCnt; cCnt++) {
var boffset = 0;
// all entries w/blank line
var tlen = comboObj[cCnt].options.length = _TList.length;
if (bLine == -1) {
if (tlen == 2) {
boffset = 1;
--tlen;
}
}
for (i = 0; i < tlen; i++) {
comboObj[cCnt].options[i].text = _TList[i+boffset];
comboObj[cCnt].options[i].value = _VList[i+boffset];
}
}
}
return (comboCnt);
}
function _InitDependentFields (qURL, rStr, ObjList, KeyList, len, pfdata, callback) {
// usage: var reqstr = "CompID=" + form.CompanyName0.value;
// usage: NOTE: callback is only used in MacCompat Mode
// var OList = new Array ();
// OList[0] = form.Field0; // Repeat for all dependent fields
// var KList = new Array ();
// KList[0] = "KeyName"; // Repeat for all dependent fields
// pfdata ; // Pre-filled in data (server is not contacted, just parse string passed)
// _InitDependentFields ("../query/CompanyLocData-pl.cgi", reqstr, OList, KList, KList.length);
var cindex = 0;
var eindex = 0;
var ctext = "";
if (pfdata == void 0 || pfdata == null || pfdata.length == 0) {
var http;
var Activex;
// Do not try if we did not come from server
if (window.location.protocol.indexOf ("http") < 0) {
return (0);
}
if (window.XMLHttpRequest && !window.ActiveXObject){
// If IE7, IE8, Mozilla, Safari, etc: Use native object
http = new XMLHttpRequest();
Activex = false;
}
else if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
http = new ActiveXObject("Microsoft.XMLHTTP");
Activex = true;
}
if (http != null || (bsniff.ie55 || bsniff.ie6 || bsniff.ie7 || bsniff.ie8) && !bsniff.mac) {
if (Activex) {
// var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", qURL, false);
http.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
http.send (rStr);
if (http.status == 200) {
ctext = http.responseText;
}
else {
rtext = http.statusText;
ctext = http.responseText;
if (ctext.indexOf (" 0) {
cindex = ctext.indexOf ("\n");
if (cindex > 0) {
var comboline = ctext.substring (0, cindex);
eindex = comboline.indexOf ("=");
if (eindex > 0) {
key = comboline.substring (0, eindex);
val = comboline.substring (eindex+1);
for (J = 0; J < len; J++) {
if (KeyList[J].toLowerCase() == key.toLowerCase()) {
if (ObjList[J] != null && (typeof ObjList[J]) == "object") {
if (ObjList[J].type == "checkbox") {
if (val == "1" || val.toLowerCase() == "true" || val.toLowerCase() == "y") {
ObjList[J].value = "1";
ObjList[J].checked = true;
}
else {
ObjList[J].value = "0";
ObjList[J].checked = false;
}
}
else {
val = val.replace (/\\r/g, "\r");
val = val.replace (/\\n/g, "\n");
if (ObjList[J].tagName == "P")
ObjList[J].innerText = val;
ObjList[J].value = val;
}
}
break;
}
}
}
ctext = ctext.substring (cindex+1);
}
}
return (1);
}
function _submitData (qURL, rStr) {
// _submitData ("../scripts/CompanySaveData-pl.cgi", reqstr);
var rtext = "";
var http;
var Activex;
// Do not try if we did not come from server
if (window.location.protocol.indexOf ("http") < 0) {
return (false);
}
if (window.XMLHttpRequest && !window.ActiveXObject){
// If IE7, IE8, Mozilla, Safari, etc: Use native object
http = new XMLHttpRequest();
Activex = false;
}
else if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
http = new ActiveXObject("Microsoft.XMLHTTP");
Activex = true;
}
if (http != null || (bsniff.ie55 || bsniff.ie6 || bsniff.ie7 || bsniff.ie8) && !bsniff.mac) {
if (Activex) {
// var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open ("POST", qURL, false);
http.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
http.send (rStr);
if (http.status == 200) {
ctext = http.responseText;
}
else {
rtext = http.statusText;
ctext = http.responseText;
if (ctext.indexOf (" txt.substr(0, _typeAheadInfo.accumString.length)) ? i : nearest;
if (txt.indexOf(_typeAheadInfo.accumString) == 0) {
clearTimeout(_typeAheadInfo.timeout);
_typeAheadInfo.last = now;
_typeAheadInfo.timeout = setTimeout("_typeAheadInfo.reset()", _typeAheadInfo.delay);
selectElem.selectedIndex = i;
evt.cancelBubble = true;
evt.returnValue = false;
return false;
}
}
if (nearest != null) {
selectElem.selectedIndex = nearest;
}
} else {
clearTimeout(_typeAheadInfo.timeout);
}
_typeAheadInfo.reset();
}
return true;
}