var newTabName = ""; var newTabURL = ""; jQuery(document).ready(function() { setTimeout(function(){ var postID = 4940; var mainMapID = 4940; // jQuery(window).load(function() { var existingTab = jQuery('#mapTab-4940', window.parent.document); var customTab = jQuery('.customMap', window.parent.document); var exitButton = jQuery('.exitMapSpan', window.parent.document); var mainTab = jQuery('.mainMap', window.parent.document); jQuery('#mapTitle a', window.parent.document).removeClass("active"); if (existingTab.length > 0) { existingTab.addClass("active"); if(postID !=mainMapID){ mainTab.attr("href", "javascript:tabSvgMapLookUp(" + mainMapID + ", 'Keystone Centre Map')"); } } else { if(postID != mainMapID){ if (customTab.length > 0) { customTab.remove(); } // insert a custom tab var html = ''; html += 'Keystone Centre Map'; html += ''; jQuery(html).insertBefore(jQuery('.mainMapTab', window.parent.document)); jQuery('#mapTab-' + postID, window.parent.document).addClass("active"); mainTab.attr("href", "javascript:tabSvgMapLookUp(" + mainMapID + ", 'Keystone Centre Map')"); // fixes problem in Android Chrome where the dom isn't updated. var refresh = jQuery('#mapTab-' + postID, window.parent.document); refresh.hide().show(0).hide().show(0); } } setBoothColor(); },100); }); function setTabName() { var customTab = jQuery('.customMap', window.parent.document); customTab.html("Keystone Centre Map"); customTab.css("color","#000000"); } var boothColorAttempt = 0; var boothColorSet = 0; var blinkArea = 0; var blinkObj = null; var oldFill = null; var fill = null; function setBoothColor() { boothColorAttempt++; fill = "#FFF660"; if (boothColorSet == 1) { return; } if (booth == "noBooths") { return; } if (boothColorAttempt > 10) { return; } if(booth!==null && booth!==undefined){ booths = booth.split('~'); if(booths instanceof Array){ for (var i = booths.length - 1; i >= 0; i--) { // make sure the Farmers Market booths are not treated as "non-numbers" booths[i] = booths[i].replace(' (Tuesday)', ''); booths[i] = booths[i].replace(' (Wednesday)', ''); booths[i] = booths[i].replace(' (Thursday)', ''); if( isNaN(booths[i]) ){// if not a number it is likely for the main map which uses area names var Booth = booths[i]; Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); Booth = Booth.replace(' ', ''); if (Booth == "WestobaPlaceConcourse" || Booth == "WestobaPlace" || Booth == "WestobaAgCentreShowRoom" || Booth == "CanadaRoom" || Booth == "PioneerLounge" || Booth == "MainStreet" || Booth == "MainStreetSouth" ) { fill = '#FF6600'; } else { fill = '#FFF660'; } var boothObj = jQuery('[id='+Booth+']'); if (boothObj.length > 0) { console.log("boothObj", boothObj); oldFill = boothObj.css("fill"); boothObj.css('fill', fill); boothObj.css('stroke-width', '2'); boothObj.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; blinkArea = 1; blinkObj = boothObj; } if (boothColorSet == 1) { } else { var boothObj2 = jQuery('[id=Area_'+Booth+']'); if (boothObj2.length > 0) { oldFill = boothObj2.css("fill"); boothObj2.css('fill', fill); boothObj2.css('stroke-width', '2'); boothObj2.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; if (blinkArea == 0) { blinkArea = 1; blinkObj = boothObj2; } } } }else{ var boothObj = jQuery('[id=R'+booths[i]+']'); if (boothObj.length > 0) { boothObj.css('fill', fill); boothObj.css('stroke-width', '2'); boothObj.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; } var boothObj2 = jQuery('[id=Area_'+booths[i]+']'); if (boothObj2.length > 0) { boothObj2.css('fill', fill); boothObj2.css('stroke-width', '2'); boothObj2.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; } } }; if (boothColorSet == 1) { if (blinkArea) { setTimeout(function(){ blinkAreaOff() },500); } } else { setTimeout(function(){ setBoothColor() },250); } }else{ if (booth == "WestobaPlaceConcourse" || booth == "WestobaPlace" || booth == "WestobaAgCentreShowRoom" || booth == "CanadaRoom" || booth == "PioneerLounge" || booth == "MainStreet" || booth == "MainStreetSouth" ) { fill = '#FF6600'; } else { fill = '#FFF660'; } var boothObj = jQuery('[id=R'+booth+']'); if (boothObj.length > 0) { boothObj.css('fill', fill); boothObj.css('stroke-width', '2'); boothObj.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; } if( isNaN(booth)) { var boothObj2 = jQuery('[id=Area_'+booth+']'); if (boothObj2.length > 0) { boothObj2.css('fill', fill); boothObj2.css('stroke-width', '2'); boothObj2.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; } var boothObj2 = jQuery('[id='+booth+']'); if (boothObj2.length > 0) { boothObj2.css('fill', fill); boothObj2.css('stroke-width', '2'); boothObj2.css('stroke', 'rgb(0,0,0)'); boothColorSet = 1; } } if (boothColorSet == 1) { } else { setTimeout(function(){ setBoothColor() },250); } } } else { } if (boothColorSet == 1) { } } var timesBlinked = 0; function blinkAreaOn() { timesBlinked++; blinkObj.css('fill', fill); blinkObj.css('stroke-width', '2'); blinkObj.css('stroke', 'rgb(0,0,0)'); setTimeout(function(){ blinkAreaOff() },500); } function blinkAreaOff() { blinkObj.css('fill', oldFill); blinkObj.css('stroke-width', '0'); blinkObj.css('stroke', 'rgb(0,0,0)'); if (timesBlinked < 4) { setTimeout(function(){ blinkAreaOn() },500); } }