
var Hotel = stack.length; stack.push({}); stack[Hotel].name = "Hotel"; var CustomGetTileUrl = function(a, b) { var bW = 8; var ci = ""; if (b > 12) { return ""; } if (b < bW) { ci = b + "/"; } else { var xPower = Math.pow(2, (b - bW)); var xTrunk = Math.floor(a.x / xPower); var dw = Math.pow(2, (b - bW)); var dx = Math.floor(a.y / dw); ci = bW + "_" + dx + "_" + xTrunk + "/"; } var dC = b + "_" + a.y + "_" + a.x + ".png"; var w = ((a.x + a.y) % 4); var baseU = "http://m" + w + ".hotelmapsearch.com/"; return baseU + ci + dC; }; stack[Hotel].layer = new GTileLayer(copyCollection, 0, 25); stack[Hotel].layer.getTileUrl = CustomGetTileUrl; stack[Hotel].layer.isPng = function() { return true; }; stack[Hotel].layer.getOpacity = function() { return 1; }; stack[Hotel].Overlay = new GTileLayerOverlay(stack[Hotel].layer); stack[Hotel].TilesVisible = false; stack[Hotel].dX = true; stack[Hotel].m = function() { stack[Hotel].HoverDiv.style.display = 'none'; stack[Hotel].CurrentZoom = map.getZoom(); if (stack[Hotel].dX == true) { if (map.getZoom() > 12 && stack[Hotel].TilesVisible == true) { map.removeOverlay(stack[Hotel].Overlay); stack[Hotel].TilesVisible = false; } if (map.getZoom() <= 12 && stack[Hotel].TilesVisible == false) { map.addOverlay(stack[Hotel].Overlay); stack[Hotel].TilesVisible = true; } } if (stack[Hotel].filterEnabled == false && map.getZoom() >= stack[Hotel].filterMinZoom) { document.getElementById('filtersDisabled').style.display = 'none'; document.getElementById('searchFilters').style.display = 'block'; stack[Hotel].filterEnabled = true; stack[Hotel].queFilter(); } if (stack[Hotel].filterEnabled == true && map.getZoom() < stack[Hotel].filterMinZoom) { document.getElementById('filtersDisabled').style.display = 'block'; document.getElementById('searchFilters').style.display = 'none'; setOpacity('filtersDisabled', 100); stack[Hotel].filterEnabled = false; stack[Hotel].queFilter(); } if (map.getZoom() < 10) { stack[Hotel].HoverDiv.style.display = 'none'; } }; stack[Hotel].am = 10; stack[Hotel].D = []; stack[Hotel].F = 1; stack[Hotel].GettingINFO = []; stack[Hotel].aT = function() { var Zoom = map.getZoom(); if (Zoom < stack[Hotel].am) { stack[Hotel].QUEGetDataInView(); return; } var bounds = map.getBounds(); var K = bounds.getSouthWest(); var L = bounds.getNorthEast(); var bh = Math.floor(K.lat()); var be = Math.ceil(L.lat()); var bc = Math.floor(K.lng()); var bd = Math.ceil(L.lng()); var loadedFiles = stack[Hotel].D; var ab = []; stack[Hotel].F = 1; var F = stack[Hotel].F; for (var TT = bh; TT < be; TT += F) { for (var WW = bc; WW < bd; WW += F) { var ad = TT; var ac = WW; var ag = Math.floor(ad / F); var ah = Math.floor(ac / F); var w = ((Math.abs(ag + ah)) % 4); var baseU = "http://m" + w + ".hotelmapsearch.com/H/"; var bC = baseU + ag + "_" + ah + ".txt"; var H = false; for (var f = stack[Hotel].D.length - 1; f >= 0; --f) { if (bC == loadedFiles[f]) { H = true; break; } } if (H == false) { ab.push(bC); } } } for (var f = ab.length - 1; f >= 0; --f) { var filelocation = ab[f]; stack[Hotel].GettingINFO.push(filelocation); j(filelocation); stack[Hotel].D.push(filelocation); } if (ab.length == 0) { stack[Hotel].QUEGetDataInView(); } }; stack[Hotel].filterPriceMin = ""; stack[Hotel].filterPriceMax = ""; stack[Hotel].filterStarsMin = ""; stack[Hotel].filterStarsMax = ""; stack[Hotel].filterName = ""; stack[Hotel].filterChain = ""; stack[Hotel].filterPetFriendly = ""; stack[Hotel].filterWaiting = false; stack[Hotel].filterID = ""; stack[Hotel].filterMinZoom = 13; stack[Hotel].filterEnabled = true; if (map.getZoom() < stack[Hotel].filterMinZoom) { stack[Hotel].filterEnabled = false; } stack[Hotel].clearAllFilters = function() { stack[Hotel].filterPriceMin = ""; stack[Hotel].filterPriceMax = ""; stack[Hotel].filterStarsMin = ""; stack[Hotel].filterStarsMax = ""; stack[Hotel].filterName = ""; stack[Hotel].filterChain = ""; stack[Hotel].filterPetFriendly = ""; document.getElementById('filterPriceMin').value = ""; document.getElementById('filterPriceMax').value = ""; document.getElementById('filterName').value = ""; document.getElementById('filterBrand').value = ""; document.getElementById('filterPetFriendly').checked = false; document.getElementById('filterStarsMin').value = ""; document.getElementById('filterStarsMax').value = ""; stack[Hotel].queFilter(); }; stack[Hotel].queFilter = function() { if (stack[Hotel].filterWaiting) { clearInterval(stack[Hotel].filterID); } stack[Hotel].filterID = setInterval('stack[Hotel].addFilter()', 1000); stack[Hotel].filterWaiting = true; }; stack[Hotel].addFilter = function() { if (stack[Hotel].filterWaiting) { clearInterval(stack[Hotel].filterID); } stack[Hotel].filterWaiting = false; stack[Hotel].mm.clearMarkers(); stack[Hotel].dm = []; stack[Hotel].shortHtml = []; stack[Hotel].M = []; stack[Hotel].D = []; stack[Hotel].listData = []; stack[Hotel].aT(); document.getElementById('filterApplied').style.display = 'block'; setOpacity('filterApplied', 100); fadeOut('filterApplied', 10, 2000); }; stack[Hotel].purgeFilter = function() { if (stack[Hotel].filterWaiting) { clearInterval(stack[Hotel].filterID); } stack[Hotel].filterWaiting = false; stack[Hotel].mm.clearMarkers(); stack[Hotel].dm = []; stack[Hotel].shortHtml = []; stack[Hotel].M = []; stack[Hotel].D = []; stack[Hotel].listData = []; stack[Hotel].aT(); document.getElementById('filterApplied').style.display = 'block'; setOpacity('filterApplied', 100); fadeOut('filterApplied', 10, 2000); }; stack[Hotel].dm = []; stack[Hotel].shortHtml = []; stack[Hotel].M = []; stack[Hotel].mm = new MarkerManager(map, { maxZoom: 24 }); stack[Hotel].IconMinZoom = 13; stack[Hotel].IconMaxZoom = 18; stack[Hotel].P = false; stack[Hotel].listData = []; stack[Hotel].processingDownload = false;stack[Hotel].process_it = function(row) {
    stack[Hotel].processingDownload = true; var h1 = []; h1.push('<div><div class="HotelInfo"><table width="380" cellspacing="4" cellpadding="0" border="0"><tbody><tr><td width="180" valign="top"><a class="mouse_on" '); var BookHotelIndexH1 = h1.length; h1.push('BookHotel'); h1.push('" rel="nofollow"><img width="64" vspace="0" hspace="0" height="64" style="border: 1px solid rgb(51, 102, 153);"src="'); var imageURLIndexH1 = h1.length; h1.push('imageURL'); h1.push('"/></a><br/><a class="mouse_on"'); var photosIndexH1 = h1.length; h1.push(Photos); h1.push('" rel="nofollow"> <span style="text-decoration:underline; cursor: pointer; color:Blue;">More Photos</span></a>'); var chainIndexH1 = h1.length; h1.push('Chain'); var totalRoomsIndexH1 = h1.length; h1.push('TotalRooms'); var openedIndexH1 = h1.length; h1.push('Opened'); var lastRenovatedIndexH1 = h1.length; h1.push('LastRenovated'); h1.push('<br/><a class="mouse_on" '); var moreInfoIndexH1 = h1.length; h1.push('MoreInfo'); h1.push('" rel="nofollow"><span style="text-decoration:underline; cursor: pointer; color:Blue;">More Information</span></a><br/></td><td width="200" valign="top"><strong >'); var nameIndexH1 = h1.length; h1.push('Name'); h1.push('</strong><br/>'); var addressIndexH1 = h1.length; h1.push('Address'); h1.push(Address); h1.push('<br/>'); var cityIndexH1 = h1.length; h1.push('City'); h1.push(bg); h1.push('<br/>Avg. Rate: <strong >$'); var avgRateIndexH1 = h1.length; h1.push('avgRate'); h1.push('</strong><br/>'); var ratingIndexH1 = h1.length; h1.push('Rating'); var petFriendlyIndexH1 = h1.length; h1.push('PetFriendly'); h1.push('<br/><a class="mouse_on"'); var bookHotelIndexH1b = h1.length; h1.push('BookHotel'); h1.push('" rel="nofollow"><img width="80" height="17" border="0" align="absmiddle" alt="Check Rates" src="/Icons/checkrates.jpg"/ style="cursor: pointer; PADDING-TOP: 5px;"></a></span><br/><img onClick="javascript:stack[Hotel].AddFavorite(\''); var indexIndexH1 = h1.length; h1.push('myindex'); h1.push('\');" width="130" height="24" border="0" align="absmiddle" alt="Add to My Hotels list" src="http://code.hotelmapsearch.com/Main21/MyImages/FavoriteStar.gif"/ style="PADDING-TOP: 10px; -moz-user-select: none; cursor: pointer; z-index: 10000;"></span></table></div>');
    h1 = [];


    h1.push('<iframe width="550" height="440" frameborder="0" src="/Hotel"  name="myIframe" class="tabContent" />');
    var h2 = []; h2.push('<div id="'); var h2HotelID = h2.length; h2.push('HotelID'); h2.push('" style="border: solid 3px #99CCFF; font-size: 12px; PADDING-BOTTOM: 5px;"><img onClick="javascript:stack[Hotel].RemoveFavorite(\''); var h2HotelIDb = h2.length; h2.push('HotelIDb'); h2.push('\');" style="border: 0px none ; margin: 0px; padding: 0px; float: right; width: 12px; height: 12px; -moz-user-select: none; cursor: pointer; z-index: 10000;" src="'); var h2StyleFolder = h2.length; h2.push('StyleFolder'); h2.push('small_close.gif"/><a '); var h2BookHotel = h2.length; h2.push('BookHotel'); h2.push('" rel="nofollow" /><img width="50" height="50" src="'); var h2imageURL = h2.length; h2.push('imageURL'); h2.push('" alt = "Hotel Picture" style="border: solid 1px black; float: left;" /> </a><a '); var h2BookHotelb = h2.length; h2.push('BookHotelb'); h2.push('">'); var h2Name = h2.length; h2.push('Name'); h2.push('</a> <br />'); var h2Rating = h2.length; h2.push('Rating'); h2.push('<div style="text-align: right;">Avg Rate: <b>$'); var h2avgRate = h2.length; h2.push('avgRate'); h2.push('</b></div><img onClick="javascript:stack[Hotel].findFavorite(\''); var h2HotelIDc = h2.length; h2.push('HotelIDc'); h2.push('\','); var h2lat = h2.length; h2.push('lat'); h2.push(','); var h2lng = h2.length; h2.push('lng'); h2.push(');" align = "right" style="border: 0px none ; margin: 0px;  padding: 0px; width: 53px; height: 15px; -moz-user-select: none; cursor: pointer; z-index: 10000;" src="'); var h2StyleFolderb = h2.length; h2.push('StyleFolder'); h2.push('MapIt.gif" alt = "Map It"/><br /></div>'); var h3 = []; h3.push('<div style="border-top: solid 1px gray; font-size: 12px; height: 50px; padding-bottom: 2px;" id="'); var h3HotelID = h3.length; h3.push('HotelID'); h3.push('"><div style="float: left; height: 50px;"><a '); var h3BookHotel = h3.length; h3.push('BookHotel'); h3.push('"><img width="50" height="50" style="border: 1px solid black; float: left;" src="'); var h3imageURL = h3.length; h3.push('imageURL'); h3.push('" alt="Hotel Picture"/></a></div><div><div><span style="text-decoration: underline; cursor: pointer; color: Blue;"><a '); var h3BookHotelb = h3.length; h3.push('BookHotel'); h3.push('>'); var h3Name = h3.length; h3.push('Name'); h3.push('</a></span></div></div><div style="float: right; border: 0px none ;">'); var h3Rating = h3.length; h3.push('Rating'); h3.push('</div><br /><div class="price" style="float:right;" onmouseover="showDiv(\'clickToMapIt\',tempX + 20,tempY);"  onmouseout="hideDiv(\'clickToMapIt\');"><img src="'); var h3priceIconURL = h3.length; h3.push('priceIconURL'); h3.push('" onClick="javascript:stack[Hotel].freezeList();stack[Hotel].ShowFavoriteBalloon(\''); var h3myindex = h3.length; h3.push('myindex'); h3.push('\');" alt="Price: '); var h3avgRate = h3.length; h3.push('avgRate'); h3.push(' Map It"/></div><div style="float: left; font-size:10px; ">'); var h3locationtext = h3.length; h3.push(locationtext); h3.push('</div></div>'); var usingFilters = false; var filterPriceMin = stack[Hotel].filterPriceMin; if (filterPriceMin != "") { usingFilters = true; } var filterPriceMax = stack[Hotel].filterPriceMax; if (filterPriceMax != "") { usingFilters = true; } var filterStarsMin = stack[Hotel].filterStarsMin; if (filterStarsMin != "") { usingFilters = true; } var filterStarsMax = stack[Hotel].filterStarsMax; if (filterStarsMax != "") { usingFilters = true; } var filterName = stack[Hotel].filterName; if (filterName != "") { usingFilters = true; } var filterChain = stack[Hotel].filterChain; if (filterChain != "") { usingFilters = true; } var filterPetFriendly = stack[Hotel].filterPetFriendly; if (filterPetFriendly != "") { usingFilters = true; } var Zoom = map.getZoom(); var ay = []; var minZoom = stack[Hotel].filterMinZoom; var filterEnabled = stack[Hotel].filterEnabled; if (stack[Hotel].filterEnabled == false) { usingFilters = false; } if (Zoom < minZoom) { usingFilters = false; } var rowLength = row.length; for (var i = 0; i < rowLength; i++) {
        if (row[i]) {
            var parts = row[i].split("|"); var bK = (parts[0]); var lat = parseFloat(parts[1]); var lng = parseFloat(parts[2]); var df = parseFloat(parts[6]); var dS = parseFloat(parts[7]); var cu = Math.floor((df + df + dS) / 3); var Name = (parts[3]) + " "; var bf = (parts[8]) + " "; var bG = (parts[13]); var starNumber = parseFloat(parts[14]); if (isNaN(starNumber)) { starNumber = 0; } var allowRow = true; if (usingFilters) { if (filterPriceMin != "") { if (cu < filterPriceMin) { allowRow = false; } } if (filterPriceMax != "") { if (cu > filterPriceMax) { allowRow = false; } } if (filterStarsMin != "") { if (starNumber < filterStarsMin) { allowRow = false; } } if (filterStarsMax != "") { if (starNumber > filterStarsMax) { allowRow = false; } } if (filterName != "") { if (Name != "undefined" && Name.length > 3) { var Namelower = Name.toLowerCase(); if (Namelower.indexOf(filterName, 0) == -1) { allowRow = false; } } else { Name = ""; allowRow = false; } } if (filterChain != "") { var Chainlower = ""; if (bf != "undefined" && bf.length > 0) { Chainlower = bf.toLowerCase(); } var Namelower = ""; if (Name != "undefined" && Name.length > 0) { Namelower = Name.toLowerCase(); } if (Chainlower.indexOf(filterChain, 0) == -1 && Namelower.indexOf(filterChain, 0) == -1) { allowRow = false; } } if (filterPetFriendly != "") { if (bG == "undefined" || bG != "Y") { allowRow = false; } } if (aE(bK, stack[Hotel].favoriteIDList) > -1) { allowRow = true } } if (allowRow == true) {
                if (bf) { bf = aR(bf); bf = '<br/><strong>Brand: </strong>' + bf; } else { bf = ""; } stack[Hotel].dm.push(bK); var Address = (parts[4]); var bg = (parts[5]); if (bg) { bg = aR(bg); } var LastRenovated = (parts[9]); if (LastRenovated) { LastRenovated = '<br/><strong>Last Renovated: </strong>' + LastRenovated + '</a>'; } else { LastRenovated = ""; } var bO = parseFloat(parts[10]); if (bO > 1) { bO = '<br/><strong>Total Rooms: </strong> ' + bO; } else { bO = ""; } var Opened = (parts[11]); if (Opened) { Opened = '<br/><strong>Operating Since: </strong>' + Opened; } else { Opened = ""; } var aS = (parts[12]) + " "; if (aS.length < 4) { aS = '/Icons/ComingSoon.jpg'; } var Rating = parseFloat(parts[14]); if ((isNaN(Rating)) || (Rating == 0)) { Rating = ''; } else { Rating = '<img width="70" height="14" border="0" align="absmiddle" alt="' + Rating + ' Star" src="/Icons/Stars/' + Rating + '.gif"/>' } var NewWindow = 'onClick="' + "window.open('" + "http://book.charlestonhotelsmap.com/index.jsp?pageName=hotInfo&cid=296760&hotelID=" + bK + "','mywindow','width=850,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')" + '"'; var bV = NewWindow; var Photos = NewWindow; var cy = NewWindow; bG = (parts[13]); if (bG && bG == "Y") { bG = '<br/><a class="mouse_on" target="_blank" ' + cy + '" rel="nofollow"> <span style="text-decoration:underline; cursor: pointer; color:Blue;">Pet Friendly* </span></a><img width="30" height="30" border="0" align="absmiddle" alt="Check Rates" src="/Icons/pet.gif"/>'; } else { bG = ""; } var ai = stack[Hotel].shortHtml.length;

                //                var h11 = h1.slice();
                //                h11[BookHotelIndexH1] = bV;
                //                h11[imageURLIndexH1] = aS;
                //                h11[photosIndexH1] = Photos;
                //                h11[chainIndexH1] = bf;
                //                h11[totalRoomsIndexH1] = bO;
                //                h11[openedIndexH1] = Opened;
                //                h11[lastRenovatedIndexH1] = LastRenovated;
                //                h11[moreInfoIndexH1] = cy;
                //                h11[nameIndexH1] = Name;
                //                h11[addressIndexH1] = Address;
                //                h11[cityIndexH1] = bg;
                //                h11[avgRateIndexH1] = cu;
                //                h11[ratingIndexH1] = Rating;
                //                h11[petFriendlyIndexH1] = bG;
                //                h11[bookHotelIndexH1b] = bV;
                //                h11[indexIndexH1] = ai;
                //                 var html1 = h11;
                //var html1 = '<iframe width="550" height="440" frameborder="0" src="/Hotel/'+ bK + '"  name="myIframe" class="tabContent" />';
                var html1 = [];
                html1.push('<iframe width="550" height="440" frameborder="0" src="/Hotel/' + bK + '"  name="myIframe" class="tabContent" />');

                var point = new GLatLng(lat, lng);
                var h22 = h2.slice(); h22[h2HotelID] = bK; h22[h2HotelIDb] = bK; h22[h2StyleFolder] = StyleFolder; h22[h2BookHotel] = bV; h22[h2imageURL] = aS; h22[h2BookHotelb] = bV; h22[h2Name] = Name; h22[h2Rating] = Rating; h22[h2avgRate] = cu; h22[h2HotelIDc] = bK; h22[h2lat] = lat; h22[h2lng] = lng; h22[h2StyleFolderb] = StyleFolder; var html2 = h22; stack[Hotel].shortHtml.push(html2); stack[Hotel].M.push(html1); var aV = icons[stack[Hotel].l(cu)]; var priceIconURL = aV.image; var locationtext = Address + ', ' + bg; var h33 = h3.slice(); h33[h3HotelID] = bK; h33[h3BookHotel] = bV; h33[h3imageURL] = aS; h33[h3BookHotelb] = bV; h33[h3Name] = Name; h33[h3Rating] = Rating; h33[h3priceIconURL] = priceIconURL; h33[h3myindex] = ai; h33[h3avgRate] = cu; h33[h3locationtext] = locationtext; var dataRowHML = h33; var dataRow = {}; dataRow.html = dataRowHML; dataRow.lat = lat; dataRow.lon = lng; dataRow.id = bK; dataRow.index = stack[Hotel].listData.length; dataRow.cu = cu; dataRow.aS = aS; dataRow.name = name; dataRow.street = Address; dataRow.city = bg; dataRow.stars = starNumber; dataRow.showScrpit = 'javascript:stack[Hotel].ShowFavoriteBalloon(' + "'" + ai + "'" + ');'; stack[Hotel].listData.push(dataRow); var marker = new GMarker(point, { icon: aV, clickable: false }); ay.push(marker);
            }
        }
    } if (Zoom < stack[Hotel].am || stack[Hotel].P) { var C = stack[Hotel].al(stack[Hotel].aI, stack[Hotel].aJ, stack[Hotel].upCurrentZoom); var dT = new GLatLng(stack[Hotel].aI, stack[Hotel].aJ); if (C) { map.openInfoWindowHtml(dT, C); af = Hotel; } stack[Hotel].P = false; stack[Hotel].T = ""; } var bD = stack[Hotel].bE.length; if (bD > 0) { var cp = []; for (var i = 0; i < bD; i++) { var bu = stack[Hotel].bE[i].split("|"); var cl = bu[0] + ""; var ad = parseFloat(bu[1]); var ac = parseFloat(bu[2]); var fIndex = aE(cl, stack[Hotel].dm); if (fIndex > -1) { stack[Hotel].AddFavorite(fIndex); cp.push(cl); } } var cg = stack[Hotel].cs; var tempArray = stack[Hotel].bE; var cZ = cp.length; if (cZ > 0) { for (var i = 0; i < cZ; i++) { var removeID = cp[i] + ""; var removeIndex = aE(removeID, cg); if (removeIndex > -1) { tempArray.splice(removeIndex, 1); cg.splice(removeIndex, 1); } } stack[Hotel].bE = tempArray; stack[Hotel].cs = cg; } } stack[Hotel].mm.addMarkers(ay, stack[Hotel].IconMinZoom, stack[Hotel].IconMaxZoom); stack[Hotel].mm.refresh(); if (true) { stack[Hotel].QUEGetDataInView(); } stack[Hotel].processingDownload = false;
};      stack[Hotel].l = function l(DataValue) { if (typeof DataValue == "undefined") { DataValue = 0; } var aA = g.length - 1; for (var i = 0; i < aA; i++) { if (DataValue < g[i]) { return i; } } return aA; }; stack[Hotel].aI = 0; stack[Hotel].aJ = 0; stack[Hotel].upCurrentZoom = 0; stack[Hotel].ae = function(overlay, point) { if (typeof point == "undefined") { return false; } var Q = parseFloat(point.lat()); var R = parseFloat(point.lng()); var CurrentZoom = map.getZoom(); if (CurrentZoom < stack[Hotel].am) { stack[Hotel].aI = Q; stack[Hotel].aJ = R; stack[Hotel].upCurrentZoom = CurrentZoom; stack[Hotel].aL(Q, R); } var C = stack[Hotel].al(Q, R, CurrentZoom); if (C) { map.openInfoWindowHtml(point, C); af = Hotel; stack[Hotel].P = false; return true; } }; stack[Hotel].aL = function(ad, ac) { stack[Hotel].P = true; stack[Hotel].F = 1; var ag = Math.floor(ad / stack[Hotel].F); var ah = Math.floor(ac / stack[Hotel].F); var fudgeLeft = 1; var DividedLat1 = Math.floor((ad + .5) / stack[Hotel].F); var DividedLon1 = Math.ceil((ac + .5 - fudgeLeft) / stack[Hotel].F); var DividedLat2 = Math.floor((ad - .5) / stack[Hotel].F); var DividedLon2 = Math.ceil((ac - .5 - fudgeLeft) / stack[Hotel].F); var pathList = []; var w = ((Math.abs(ag + ah)) % 4); var baseU = "http://m" + w + ".hotelmapsearch.com/H/"; pathList.push(baseU + ag + "_" + ah + ".txt"); var myCount = pathList.length; var ab = []; for (var z = 0; z < myCount; z++) { var bC = pathList[z]; var H = false; for (var f = stack[Hotel].D.length - 1; f >= 0; --f) { if (bC == stack[Hotel].D[f]) { H = true; break; } } if (H == true) { bC = ""; } if (bC != "") { ab.push(bC); stack[Hotel].GettingINFO.push(bC); j(bC); stack[Hotel].D.push(bC); } } if (ab.length == 0) { stack[Hotel].QUEGetDataInView(); } }; stack[Hotel].bI = 1; stack[Hotel].bL = 20; stack[Hotel].T = ""; stack[Hotel].al = function(aq, as, CurrentZoom, returnIndex) { var iconH = 20; var aU = 35; var downFudge = 0; var rightFudge = 0; if (CurrentZoom < 7) { downFudge = .2; rightFudge = .2; if (CurrentZoom < 4) { rightFudge = 4; } } var currentPPlon = ppLon[CurrentZoom]; var lonBuffer = 1 / currentPPlon * aU; var currentPPlat = ppLon[CurrentZoom]; var latBuffer = 1 / currentPPlat * iconH; if (stack[Hotel].T != "") { latBuffer += .0001; downFudge += .0001; lonBuffer += .0001; rightFudge += .0001; } var maxLength = stack[Hotel].listData.length; for (var i = 0; i < maxLength; i++) { var dataRow = stack[Hotel].listData[i]; var aB = dataRow.id; var A = dataRow.lat; var B = dataRow.lon; if (aq < (A + latBuffer) && aq > (A - downFudge) && as < (B + lonBuffer) && as > (B - rightFudge)) { ba = dataRow.id + "|" + dataRow.lat + "|" + dataRow.lon; if (stack[Hotel].T == "") { if (returnIndex) { return i; } return stack[Hotel].M[i].join(""); } else { if (stack[Hotel].T == aB) { stack[Hotel].T = ""; stack[Hotel].AddFavorite(i); if (returnIndex) { return i; } else { return stack[Hotel].M[i].join(""); } } } } } return false; }; stack[Hotel].favoriteFlyingList = new aa(200, 200, null, null, true, null); stack[Hotel].favoriteFlyingList.SetMainWidth(200); stack[Hotel].favoriteFlyingList.SetHandleWidth(190); stack[Hotel].favoriteFlyingList.bM(true); stack[Hotel].favoriteFlyingList.bv(300); stack[Hotel].favoriteFlyingList.bo("MyHotel List:    <a href='javascript:ShowCopyLinkForm();' style='color:white;'> Save</a>"); stack[Hotel].favoriteFlyingList.bp("<div id='MyHotelList' style='background:white;'></div>"); stack[Hotel].favoriteIDList = []; stack[Hotel].I = []; stack[Hotel].cr = []; stack[Hotel].V = []; stack[Hotel].J = new MarkerManager(map, { maxZoom: 24 }); stack[Hotel].U = new GIcon(); stack[Hotel].U.image = StyleFolder + "favorite.png"; stack[Hotel].U.iconSize = new GSize(32, 32); stack[Hotel].U.iconAnchor = new GPoint(20, 40); stack[Hotel].AddFavorite = function(O) { var dataRow = stack[Hotel].listData[O]; if (aE(dataRow.id, stack[Hotel].favoriteIDList) == -1) { stack[Hotel].I.push(stack[Hotel].shortHtml[O].join("")); document.getElementById('MyHotelsCount').innerHTML = stack[Hotel].I.length; document.getElementById('MyHotelList').innerHTML = stack[Hotel].I.join(" "); document.getElementById('MyHotelsWrapper').style.backgroundColor = 'rgb(255,223,37)'; stack[Hotel].favoriteIDList.push(dataRow.id); stack[Hotel].cr.push(dataRow.id + "|" + dataRow.lat + "|" + dataRow.lon); var A = dataRow.lat; var B = dataRow.lon; var testpoint = new GLatLng(A, B); var marker = new GMarker(testpoint, { icon: stack[Hotel].U, clickable: false }); stack[Hotel].V.push(marker); stack[Hotel].J.clearMarkers(); var tempArray = stack[Hotel].V; stack[Hotel].J.addMarkers(tempArray, 2, 20); stack[Hotel].J.refresh(); } }; stack[Hotel].RemoveFavorite = function(ID) { var listLength = stack[Hotel].I.length; for (var i = 0; i < listLength; i++) { var txt = stack[Hotel].I[i]; if (txt.indexOf(ID, 0) > 0) { stack[Hotel].I.splice(i, 1); stack[Hotel].V.splice(i, 1); stack[Hotel].cr.splice(i, 1); stack[Hotel].favoriteIDList.splice(i, 1); break; } } stack[Hotel].J.clearMarkers(); stack[Hotel].J.addMarkers(stack[Hotel].V, 1, 20); stack[Hotel].J.refresh(); document.getElementById('MyHotelsCount').innerHTML = stack[Hotel].I.length; document.getElementById('MyHotelList').innerHTML = stack[Hotel].I.join(" "); if (stack[Hotel].I.length == 0) { document.getElementById('MyHotelsWrapper').style.backgroundColor = 'White'; } }; stack[Hotel].ShowFavoriteBalloon = function(O) { var C = stack[Hotel].M[O].join(""); var dataRow = stack[Hotel].listData[O]; var A = dataRow.lat; var B = dataRow.lon; var testpoint = new GLatLng(A, B); if (C.length > 1) { map.openInfoWindowHtml(testpoint, C); af = Hotel; ba = (dataRow.id + "|" + dataRow.lat + "|" + dataRow.lon); } }; stack[Hotel].listSegment = 0; stack[Hotel].listSize = 7; stack[Hotel].unsortedList = []; stack[Hotel].listFrozen = false; stack[Hotel].freezeList = function() { stack[Hotel].listFrozen = true; setTimeout('stack[Hotel].listFrozen = false;', 1000) }; stack[Hotel].ListDataInView = function(optMove) { if (stack[Hotel].listFrozen) { return; } var ar = stack[Hotel].unsortedList; ar = ar.sort(stack[Hotel].sort); var segmentCount = Math.ceil(ar.length / stack[Hotel].listSize); if (optMove) { if (optMove == "forward") { stack[Hotel].listSegment += 1; if (stack[Hotel].listSegment > (segmentCount - 1)) { stack[Hotel].listSegment = (segmentCount - 1); } } if (optMove == "backward") { stack[Hotel].listSegment -= 1; if (stack[Hotel].listSegment < 0) { stack[Hotel].listSegment = 0; } } } var HTMLstring = ""; var listLength = ar.length; var maxItems = ((stack[Hotel].listSegment + 1) * stack[Hotel].listSize); if (maxItems > listLength) { maxItems = listLength; } var textText = " " + ((stack[Hotel].listSegment * stack[Hotel].listSize) + 1) + " - " + maxItems + " of " + listLength; document.getElementById("dynamicHotelCount").innerHTML = textText; var startAt = stack[Hotel].listSegment * stack[Hotel].listSize; if (startAt >= listLength) { document.getElementById("dynamicHotelList").innerHTML = ""; return; } var endAt = startAt + stack[Hotel].listSize; if (endAt >= listLength) { endAt = listLength; } for (i = startAt; i < endAt; i++) { HTMLstring += ar[i].html.join("") + "<br />"; } document.getElementById("dynamicHotelList").innerHTML = HTMLstring; }; stack[Hotel].sortPrimaryName = "sd"; stack[Hotel].sortSecondaryName = "pa"; stack[Hotel].sortChangePrimary = function(sortType) { if (sortType == "pa") { stack[Hotel].sortPrimary = stack[Hotel].sortPriceAsc; } if (sortType == "pd") { stack[Hotel].sortPrimary = stack[Hotel].sortPriceDec; } if (sortType == "n") { stack[Hotel].sortPrimary = stack[Hotel].sortName; } if (sortType == "b") { stack[Hotel].sortPrimary = stack[Hotel].sortBrand; } if (sortType == "sd") { stack[Hotel].sortPrimary = stack[Hotel].sortStarsDec; } if (sortType == "sa") { stack[Hotel].sortPrimary = stack[Hotel].sortStarsAsc; } stack[Hotel].sortPrimaryName = sortType; stack[Hotel].listSegment = 0; stack[Hotel].ListDataInView(); }; stack[Hotel].sortChangeSecondary = function(sortType) { if (sortType == "pa") { stack[Hotel].sortSecondary = stack[Hotel].sortPriceAsc; } if (sortType == "pd") { stack[Hotel].sortSecondary = stack[Hotel].sortPriceDec; } if (sortType == "n") { stack[Hotel].sortSecondary = stack[Hotel].sortName; } if (sortType == "b") { stack[Hotel].sortSecondary = stack[Hotel].sortBrand; } if (sortType == "sd") { stack[Hotel].sortSecondary = stack[Hotel].sortStarsDec; } if (sortType == "sa") { stack[Hotel].sortSecondary = stack[Hotel].sortStarsAsc; } stack[Hotel].sortSecondaryName = sortType; stack[Hotel].listSegment = 0; stack[Hotel].ListDataInView(); }; stack[Hotel].sort = function(rowA, rowB) { var primarySort = stack[Hotel].sortPrimary(rowA, rowB); if (primarySort != 0 || stack[Hotel].sortSecondary == "") { return primarySort; } var secondarySort = stack[Hotel].sortSecondary(rowA, rowB); return secondarySort; }; stack[Hotel].sortPriceDec = function sortfunction(rowA, rowB) { var a = rowA.cu; var b = rowB.cu; if (a > b) return -1; if (a < b) return 1; return 0 }; stack[Hotel].sortPriceAsc = function sortfunction(rowA, rowB) { var a = rowA.cu; var b = rowB.cu; if (a < b) return -1; if (a > b) return 1; return 0 }; stack[Hotel].sortStarsAsc = function sortfunction(rowA, rowB) { var a = rowA.stars; var b = rowB.stars; if (a < b) return -1; if (a > b) return 1; return 0 }; stack[Hotel].sortStarsDec = function sortfunction(rowA, rowB) { var a = rowA.stars; var b = rowB.stars; if (a > b) return -1; if (a < b) return 1; return 0 }; stack[Hotel].sortName = function sortfunction(rowA, rowB) { var a = rowA.name; var b = rowB.name; if (a < b) return -1; if (a > b) return 1; return 0 }; stack[Hotel].sortBrand = function sortfunction(rowA, rowB) { var a = rowA.chain; var b = rowB.chain; if (a < b) return -1; if (a > b) return 1; return 0 }; stack[Hotel].sortPrimary = stack[Hotel].sortStarsDec; stack[Hotel].sortSecondary = stack[Hotel].sortPriceAsc; stack[Hotel].QUEGetDataInViewTimeOutID = ""; stack[Hotel].QUEGetDataInViewDelay = 2000; stack[Hotel].QUEGetDataInView = function() { if (stack[Hotel].QUEGetDataInViewTimeOutID == "") { stack[Hotel].GetDataInViewTimeOutID = window.setTimeout(stack[Hotel].GetDataInView, stack[Hotel].QUEGetDataInViewDelay); } else { window.clearTimeout(stack[Hotel].GetDataInViewTimeOutID); stack[Hotel].GetDataInViewTimeOutID = window.setTimeout(stack[Hotel].GetDataInView, stack[Hotel].QUEGetDataInViewDelay); } }; stack[Hotel].GetDataInView = function() { var myPoints = stack[Hotel].listData; var bounds = map.getBounds(); var K = bounds.getSouthWest(); var bottomClon = K.lng(); var bottomClat = K.lat(); var L = bounds.getNorthEast(); var topClon = L.lng(); var topClat = L.lat(); var listLength = stack[Hotel].listData.length; var ar = []; for (var i = 0; i < listLength; i++) { var dataRow = myPoints[i]; var aB = dataRow.id; var A = dataRow.lat; var B = dataRow.lon; if (A > bottomClat && A < topClat && B > bottomClon && B < topClon) { ar.push(stack[Hotel].listData[i]); } } stack[Hotel].listSegment = 0; stack[Hotel].unsortedList = []; stack[Hotel].unsortedList = ar; stack[Hotel].ListDataInView(); }; stack[Hotel].bz = function(aP, ao, an) { stack[Hotel].P = true; stack[Hotel].T = aP; var Q = parseFloat(ao); var R = parseFloat(an); var CurrentZoom = map.getZoom(); stack[Hotel].aI = Q; stack[Hotel].aJ = R; stack[Hotel].upCurrentZoom = CurrentZoom; var aw = new GLatLng(Q, R); stack[Hotel].aL(Q, R); var C = stack[Hotel].al(Q, R, CurrentZoom); if (C.length > 2) { map.openInfoWindowHtml(aw, C); stack[Hotel].P = false; af = Hotel; ba = aP + "|" + ao + "|" + an; } }; stack[Hotel].findFavorite = function(id, lat, lon) { var fIndex = aE(id, stack[Hotel].dm); if (fIndex > -1) { stack[Hotel].ShowFavoriteBalloon(fIndex); } else { stack[Hotel].RemoveFavorite(id); stack[Hotel].bz(id, lat, lon); } }; stack[Hotel].bE = []; stack[Hotel].cs = []; stack[Hotel].dP = function(bS) { stack[Hotel].bE = bS; var bD = bS.length; for (var i = 0; i < bD; i++) { var dz = bS[i].split("|"); stack[Hotel].cs.push(dz[0]); } for (var i = 0; i < bD; i++) { var bu = bS[i].split("|"); var cl = bu[0] + ""; var ad = parseFloat(bu[1]); var ac = parseFloat(bu[2]); var ag = Math.floor(ad / stack[Hotel].F); var ah = Math.floor(ac / stack[Hotel].F); var w = ((Math.abs(ag + ah)) % 4); var baseU = "http://m" + w + ".hotelmapsearch.com/H/"; var bC = baseU + ag + "_" + ah + ".txt"; var H = false; for (var f = stack[Hotel].D.length - 1; f >= 0; --f) { if (bC == stack[Hotel].D[f]) { H = true; break; } } if (H == true) { bC = ""; } if (bC != "") { stack[Hotel].GettingINFO.push(bC); j(bC); stack[Hotel].D.push(bC); } } }; document.onmousemove = getMouseXY; stack[Hotel].lastIndex = ""; stack[Hotel].CurrentZoom = map.getZoom(); stack[Hotel].HoverDiv = document.getElementById('floatingHotelInfo'); stack[Hotel].HoverCheck = false; stack[Hotel].HoverInterval = setInterval('stack[Hotel].HoverCheck = true;', 500); stack[Hotel].Hover = function(point) { if (stack[Hotel].HoverCheck) { stack[Hotel].HoverCheck = false; if (stack[Hotel].CurrentZoom < stack[Hotel].am) { return; } else { var hotelIndex = stack[Hotel].al(point.lat(), point.lng(), map.getZoom(), true); if (hotelIndex) { stack[Hotel].lastIndex = hotelIndex; stack[Hotel].HoverDiv.style.display = 'block'; var rightX = tempX + 20; stack[Hotel].HoverDiv.style.left = rightX + "px"; var bh = tempY; stack[Hotel].HoverDiv.style.top = bh + "px"; stack[Hotel].HoverDiv.innerHTML = "<span style='font-family:arial; font-size: 9px; color:#474747;'>Left Click for more info. Right Click to add to MyHotels List. </span><br/>" + stack[Hotel].listData[hotelIndex].html.join(""); } else { stack[Hotel].lastIndex = ""; stack[Hotel].HoverDiv.style.display = 'none'; } } } }; stack[Hotel].rightClick = function(point) { var latlon = map.fromContainerPixelToLatLng(point); var hotelIndex = stack[Hotel].al(latlon.lat(), latlon.lng(), map.getZoom(), true); if (hotelIndex) { stack[Hotel].AddFavorite(hotelIndex); } }; GEvent.addListener(map, 'mousemove', function(latlng) { if (!stack[Hotel].processingDownload) { stack[Hotel].Hover(latlng); } }); GEvent.addListener(map, 'singlerightclick', function(point) { stack[Hotel].rightClick(point) }); increaseWidth('startupProgress', 20);
