Create Event)
newDiv.style.left = shim.style.left;
var secondDiv = document.createElement("DIV");
secondDiv.style.visibility = "hidden";
secondDiv.style.position = "absolute";
secondDiv.style.left="-10000";
secondDiv.style.top="-10000";
secondDiv.style.width="0";
secondDiv.style.height="0";
var iFrame = document.createElement("IFRAME");
iFrame.completeDiv = newDiv;
iFrame.shim = shim;
iFrame.name = "completionFrame_" + displayFld.id;
iFrame.id = "completionFrame_" + displayFld.id;
iFrame.src = "javascript:false;";
secondDiv.appendChild(iFrame);
document.body.appendChild(secondDiv);
acResultDivs__Text__[displayFld.id] = iFrame;
}
function getXMLHTTP__Text__(){
var A=null;
try {
A=new ActiveXObject("Msxml2.XMLHTTP")
}catch(e){
try{
A=new ActiveXObject("Microsoft.XMLHTTP")
} catch(oc){
A=null
}
}
if(!A && typeof XMLHttpRequest != "undefined") {
A=new XMLHttpRequest()
}
return A
}
var acSuggestionMouseOver__Text__ = function() {
//if(_highlightedSuggestionDiv) {
//setStyleForElement__Text__(_highlightedSuggestionDiv,"aAutoComplete");
//}
setStyleForElement__Text__(this,"bAutoComplete")
};
var acSuggestionMouseOut__Text__ = function() {
setStyleForElement__Text__(this,"aAutoComplete");
return false;
};
// Called by parseAjaxResponse__Text__ to display the suggestions
function displaySuggestedList__Text__(acDiv, listResults, listIDs){
while(acDiv.childNodes.length > 0) {
acDiv.removeChild(acDiv.childNodes[0]);
}
acNumResults__Text__[acCurDisplayField__Text__.id] = listResults.length;
// For each element in our list, we create:
//
//
//
// M. KREULEN Brian
//
// // This span is hidden
// 0000d50000001fdb
//
//
//
for(var f = 0; f < listResults.length; ++f) {
var u=document.createElement("DIV");
setStyleForElement__Text__(u,"aAutoComplete");
u.onmousedown = acOnMouseDown__Text__;
u.onmouseover = acSuggestionMouseOver__Text__;
u.onmouseout = acSuggestionMouseOut__Text__;
var ka=document.createElement("SPAN");
setStyleForElement__Text__(ka,"lAutoComplete");
var ua=document.createElement("SPAN");
ua.innerHTML=listResults[f]; // the text for the suggested result...
var ea=document.createElement("SPAN");
setStyleForElement__Text__(ea,'dAutoComplete');
setStyleForElement__Text__(ua,"cAutoComplete");
u.displaySpan=ea;
ea.innerHTML=listIDs[f]; // The ID of the suggested result
ka.appendChild(ua);
ka.appendChild(ea);
u.appendChild(ka);
acDiv.appendChild(u);
}
}
function hideFieldDiv__Text__(){
if (!acCurDisplayField__Text__) {
return;
}
if (!acResultDivs__Text__[acCurDisplayField__Text__.id]) {
return;
}
acResultDivs__Text__[acCurDisplayField__Text__.id].completeDiv.style.visibility = "hidden";
acResultDivs__Text__[acCurDisplayField__Text__.id].shim.style.visibility = "hidden";
acResultDivs__Text__[acCurDisplayField__Text__.id].shim.style.display = "none";
acCurHighlightedDiv__Text__ = null;
}
function showFieldDiv__Text__(){
if (!acCurDisplayField__Text__) {
return;
}
if (!acResultDivs__Text__[acCurDisplayField__Text__.id]) {
return;
}
acResultDivs__Text__[acCurDisplayField__Text__.id].completeDiv.style.visibility = "visible";
acResultDivs__Text__[acCurDisplayField__Text__.id].shim.style.visibility = "visible";
acResultDivs__Text__[acCurDisplayField__Text__.id].shim.style.display = "block";
}
function setCompleteDivSize__Text__(divToSet, sourceField){
if(divToSet){
divToSet.style.left = acCalcDisplayOffset(sourceField, "offsetLeft") + "px";
divToSet.style.top = acCalcDisplayOffset(sourceField, "offsetTop") + sourceField.offsetHeight - 1 + "px";
divToSet.style.width = calculateDisplayWidth__Text__(sourceField) + "px";
}
}
// Called in resposne to a successfull ajax phone home
parseAjaxResponse__Text__ = function(iFrame, searchTerm, query, listResults, listIDs) {
if(acTimeoutAdjustment__Text__ > 0) {
acTimeoutAdjustment__Text__--;
}
acCacheResults__Text__(acCurDisplayField__Text__.id, searchTerm, query, listResults, listIDs);
var b = iFrame.completeDiv;
var s = iFrame.shim;
b.completeStrings = listResults;
b.displayStrings = listIDs;
//b.prefixStrings=pr;
displaySuggestedList__Text__(b,b.completeStrings,b.displayStrings);
checkKeypress__Text__(b);
if(acCurrentDisplayValues__Text__[acCurDisplayField__Text__.id] == "" || 0 == listResults.length) {
hideFieldDiv__Text__()
}else{
showFieldDiv__Text__()
}
if(listResults.length > 0) {
s.style.width = b.offsetWidth;
b.height = 16 * listResults.length + 4;
s.style.height = b.height;
} else {
//hideCompleteDiv();
}
}
// Function that calls home and gets the data.
function callEDeal__Text__(escapedSearchTerm) {
if(xmlHTTP__Text__ && xmlHTTP__Text__.readyState!=0){
xmlHTTP__Text__.abort()
}
if (!acCurDisplayField__Text__) {
return;
}
var fldName = acCurDisplayField__Text__.id;
var acField = fldName;
if (acField.indexOf('_')>0) {
acFieldName=acField.substring(0,acField.indexOf('_'));
} else {
acFieldName=acField;
}
var maxLimit_ = document.getElementById(acField+'MaxLimit__').value;
var caseSensitive_ = document.getElementById(acField+'CaseSensitive__').value;
var fieldTable_ = document.getElementById(acField+'Table__').value;
var triggerSize_ = document.getElementById(acField+'Trigger__').value;
var distinct_ = document.getElementById(acField+'Distinct__').value;
var fieldTable_ = document.getElementById(acField+'Table__').value;
var url = acAjaxURL__Text__ + '?field=' + acFieldName + '&search=' + escapedSearchTerm + '&maxlimit=' + maxLimit_ + '&casesensitive=' + caseSensitive_ + '&table=' + fieldTable_ +'&trigger=' + triggerSize_ + '&distinct=' + distinct_;
var querField = document.getElementById(acField+'Query__').value;
try {
//eval('url');
eval('url += \'&query=\' + querField');
//eval('url += \'&query=\' + escape(' + querField + ');');
} catch (error) {
}
xmlHTTP__Text__=getXMLHTTP__Text__();
if(xmlHTTP__Text__){
// We end up calling:
// /complete/search?hl=en&js=true&qu= ...
xmlHTTP__Text__.open("GET", url, true);
// Note that this function will ONLY be called when we get a complete
// response back from google!!
xmlHTTP__Text__.onreadystatechange=function() {
if(xmlHTTP__Text__.readyState == 4 && xmlHTTP__Text__.responseText) {
var frameElement = acResultDivs__Text__[acCurDisplayField__Text__.id];
if(xmlHTTP__Text__.responseText.charAt(0) == "<") {
acTimeoutAdjustment__Text__--;
} else {
// The response text gets executed as javascript...
eval(xmlHTTP__Text__.responseText);
}
}
};
// DON'T TRY TO TALK WHEN WE'RE LOCAL...
// Comment out when running from a local file...
xmlHTTP__Text__.send(null);
}
}
function recalculateTimeout__Text__(Mb){
var H=100;
for(var o=1; o<=(Mb-2)/2; o++){
H=H*2
}
H=H+50;
return H
}
// Main timeout based loop
var mainLoop__Text__ = function() {
if (!acCurDisplayField__Text__) {
setTimeout("mainLoop__Text__()",recalculateTimeout__Text__(acTimeoutAdjustment__Text__));
return true;
}
var lastValue;
try {
lastValue = acLastDisplayValues__Text__[acCurDisplayField__Text__.id];
} catch (err) {
lastValue = "";
}
var newValue;
try {
newValue = acCurrentDisplayValues__Text__[acCurDisplayField__Text__.id];
} catch (err) {
newValue = "";
}
if (newValue != '' && lastValue != newValue) {
var escapedValue = escapeURI(newValue);
var ourCache = acResultCache__Text__[acCurDisplayField__Text__.id];
var ma = null;
if (ourCache) {
ma = ourCache[newValue];
}
if (ma) {
parseAjaxResponse__Text__(acResultDivs__Text__[acCurDisplayField__Text__.id], newValue, ma[0], ma[1], acResultDivs__Text__[acCurDisplayField__Text__.id].completeDiv.prefixStrings);
} else {
acTimeoutAdjustment__Text__++;
callEDeal__Text__(escapedValue);
}
acCurDisplayField__Text__.focus();
}
acLastDisplayValues__Text__[acCurDisplayField__Text__.id] = acCurrentDisplayValues__Text__[acCurDisplayField__Text__.id];
setTimeout("mainLoop__Text__()",recalculateTimeout__Text__(acTimeoutAdjustment__Text__));
return true;
};
setTimeout("mainLoop__Text__()", 10);
function escapeURI(toEncode) {
if (escape) {
return escape(toEncode);
}
if(encodeURIComponent) {
return encodeURIComponent(toEncode);
}
return toEncode;
}
function isMSIE() {
return (navigator && navigator.userAgent.toLowerCase().indexOf("msie") >= 0);
}
function displayTextOnFocus__(dispField) {
//var f = document.forms[0];
//var nameID = dispField.name.substring(3, dispField.name.length);
//var nameID = dispField.name + "Hidden__";
var nameID = dispField.id + "Hidden__";
acCurDisplayField__Text__ = dispField;
//acCurIDField__Text__ = f[nameID];
//if (acCurIDField__Text__==null) {
acCurIDField__Text__=document.getElementById(nameID);
//}
//alert("acCurIDField__Text__ : "+acCurIDField__Text__);
//acLastCompleteValues__Text__[acCurDisplayField__Text__.name] = acCurDisplayField__Text__.value;
//acLastCompleteValues__Text__[acCurIDField__Text__.name] = acCurIDField__Text__.value;
acLastCompleteValues__Text__[acCurDisplayField__Text__.id] = acCurDisplayField__Text__.value;
acLastCompleteValues__Text__[acCurIDField__Text__.id] = acCurIDField__Text__.value;
//acCurDisplayField__Text__.value = '';
//acCurIDField__Text__.value = '';
//acLastDisplayValues__Text__[acCurDisplayField__Text__.name] = '';
//acCurrentDisplayValues__Text__[acCurDisplayField__Text__.name] = '';
}
function displayOnFocusTwo__Text__(dispField,formIndex) {
//var f = document.forms[formIndex];
//var nameID = dispField.name.substring(3, dispField.name.length);
var nameID = dispField.id + "Hidden__";
acCurDisplayField__Text__ = dispField;
//acCurIDField__Text__ = f[nameID];
//if (acCurIDField__Text__==null) {
acCurIDField__Text__=document.getElementById(nameID);
//}
//acCurDisplayField__Text__.value = '';
//acCurIDField__Text__.value = '';
//acLastDisplayValues__Text__[acCurDisplayField__Text__.name] = '';
//acCurrentDisplayValues__Text__[acCurDisplayField__Text__.name] = '';
}
function stripCRFromString__Text__(strToStrip){
var rtrn = '';
var crVal = "\n\r";
for(var cnt = 0; cnt < strToStrip.length; cnt++) {
if (crVal.indexOf(strToStrip.charAt(cnt)) == -1) {
rtrn += strToStrip.charAt(cnt);
} else {
rtrn += " ";
}
}
return rtrn;
}
acOnMouseDown__Text__ = function(e) {
$(this).change();
selectEntry__Text__(valueOfCAutoComplete__Text__(this), valueOfDAutoComplete(this));
hideFieldDiv__Text__();
//JSA prevent event to bubble
if (e!=null) {
//alert(e);
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
}
return false;
};
function highlightNewValue__Text__(newValueIndex) {
var resultDiv = acResultDivs__Text__[acCurDisplayField__Text__.id];
var numResults = acNumResults__Text__[acCurDisplayField__Text__.id];
if (!resultDiv || !numResults || !acCurSuggestionList__Text__) {
return;
}
if(newValueIndex >= numResults){
newValueIndex = numResults - 1;
}
if(acCurHighlightedIndex__Text__ != -1 && newValueIndex != acCurHighlightedIndex__Text__){
setStyleForElement__Text__(acCurHighlightedDiv__Text__,"aAutoComplete");
acCurHighlightedIndex__Text__ = -1;
}
if(newValueIndex < 0){
acCurHighlightedIndex__Text__ = -1;
acCurDisplayField__Text__.focus();
return;
}
acCurHighlightedIndex__Text__ = newValueIndex;
acCurHighlightedDiv__Text__ = acCurSuggestionList__Text__.item(newValueIndex);
setStyleForElement__Text__(acCurHighlightedDiv__Text__,"bAutoComplete");
}