var giPosx = 0; var giPosy = 0; var bShowToolTip = false; var giClienty = 0; var giClientx = 0; var gbMouseIn; var oTimer; var oXmlHttp = NewXMLHttp(); var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i\n' + '\n' + ' \n' + ' \n' + ' ' + iVehicleId + '\n' + ' ' + '2' + '\n' + ' \n' + ' \n' + '\n'); } function OnReadyStateChange() { if (oXmlHttp != null) { if (oXmlHttp.readyState == 4) { // Try-catch block for FireFox, FireFox throws an exception if you access // oXmlHttp.Status after an abort has been called. try { if (oXmlHttp.status == 200) { var oXml; var sPrefix; var oToolTip, oTable, oRow, oCell; var sId, sConstruction, sType, sMake, sYear, sPrice, sCompanyName, sCountry; //if (document.all) { sPrefix = "m:"; } // For Microsoft. Microsoft expects namespace //else { sPrefix = ""; } if (BrowserDetect.browser == "Chrome" || BrowserDetect.browser == "Opera" || BrowserDetect.browser == "Safari") {sPrefix = "";} else sPrefix = "m:"; oXml = oXmlHttp.responseXML; try { sId = oXml.getElementsByTagName(sPrefix + "Id")[0].firstChild.nodeValue; } catch (err) {sId = "";} try { sConstruction = oXml.getElementsByTagName(sPrefix + "Construction")[0].firstChild.nodeValue; } catch (err) { sConstruction = "";} try { sType = oXml.getElementsByTagName(sPrefix + "Type")[0].firstChild.nodeValue; } catch (err) { sType = "";} try { sMake = oXml.getElementsByTagName(sPrefix + "Make")[0].firstChild.nodeValue; } catch (err) {sMake = "";} try { sYear = oXml.getElementsByTagName(sPrefix + "Year")[0].firstChild.nodeValue; } catch (err) { sYear = "";} try { sPrice = oXml.getElementsByTagName(sPrefix + "Price")[0].firstChild.nodeValue; } catch (err) {sPrice = "";} try { sCompanyName = oXml.getElementsByTagName(sPrefix + "CompanyName")[0].firstChild.nodeValue; } catch (err) { sCompanyName = ""; } try { sCountry = oXml.getElementsByTagName(sPrefix + "Country")[0].firstChild.nodeValue; } catch (err) { sCountry = ""; } oToolTip = document.getElementById("ToolTip"); if ( oToolTip.firstChild != null) oToolTip.removeChild(oToolTip.firstChild); oTable = document.createElement("table"); //Make oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.innerHTML = gsMakeLabel + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sMake; //Construction oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.innerHTML = gsConstructionLabel + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sConstruction; //Type oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.style.verticalAlign = "top"; oCell.innerHTML = gsTypeLabel + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sType; //Year if (sYear!='') { oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.innerHTML = gsYearLabel + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sYear; } //ID if (sId!='') { oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.innerHTML = gsId + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sId; } //Price if (sPrice!='') { oRow = oTable.insertRow(-1); oCell = oRow.insertCell(-1); oCell.innerHTML = gsPrice + ": "; oCell = oRow.insertCell(-1); oCell.innerHTML = sPrice; } //Add the table to the tooltip oToolTip.appendChild(oTable); bShowToolTip = true; positionToolTip(); } } catch (error) { } } } } function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft; curtop = obj.offsetTop; while (obj = obj.offsetParent) { curleft += obj.offsetLeft; curtop += obj.offsetTop; } } return [curleft,curtop]; } function hideToolTip() { document.getElementById("ToolTip").style.visibility = "hidden"; //Reset global vars bShowToolTip = false; gbMouseIn = false; //Cancel possible current request clearTimeout(oTimer); oXmlHttp.abort(); } function positionToolTip(e) { var ToolTip = document.getElementById("ToolTip"); if(window.event) { e = window.event; if (e.pageX || e.pageY) { giPosx = e.pageX; giPosy = e.pageY; } else if (e.clientX || e.clientY) { giPosx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; giPosy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; giClienty = e.clientY; giClientx = e.clientX; } // posx and posy contain the mouse position relative to the document // Do something with this information } else if(e) { if (e.pageX || e.pageY) { giPosx = e.pageX; giPosy = e.pageY; giClienty = e.pageY; giClientx = e.pageX; } else if (e.clientX || e.clientY) { giPosx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; giPosy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; giClienty = e.clientY; giClientx = e.clientX; } // posx and posy contain the mouse position relative to the document // Do something with this information } if(bShowToolTip && gbMouseIn) { if(giClienty > (document.documentElement.clientHeight - ToolTip.clientHeight)) { ToolTip.style.top = giPosy - 5 - ToolTip.clientHeight + "px"; } else { ToolTip.style.top = giPosy + 5 + "px"; } // - 6 added for small descrepancy where the actual width of the site is a few pixels outside of the browser. if(giClientx > (document.documentElement.clientWidth - ToolTip.clientWidth) - 6) { ToolTip.style.left = giPosx - 5 - ToolTip.clientWidth + "px"; } else { ToolTip.style.left = giPosx + 5 + "px"; } ToolTip.style.visibility = "visible"; } else { ToolTip.style.visibility = "hidden"; } } function showToolTip(e, sender, iVehicleId) { bShowToolTip = false; gbMouseIn = true; if(!e) var e = window.event; if (e.pageX || e.pageY) { giPosx = e.pageX; giPosy = e.pageY; giClienty = e.pageY; giClientx = e.pageX; } else if (e.clientX || e.clientY) { giPosx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; giPosy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; giClienty = e.clientY; giClientx = e.clientX; } // posx and posy contain the mouse position relative to the document // Do something with this information oTimer = setTimeout("LoadInfo("+iVehicleId+")", 1000); }