nswImage = new Image(); nswImage. src ="/images/map/nsw.png"; function adjustAddressContainer() { //Adjust height of address containers $$("#stockists_info_container .row .cell").each(function(element,index){ theParent = element.getParent(); size = theParent.getSize(); theHeight = size.y; if(index % 3 == 0){ theParent.set("style", "height: " + theHeight + "px;"); } element.set("style","height: 100%;"); //console.log(size.y); }); var myFx = new Fx.Scroll('stockists_info_container').toTop(); } var position = { "nsw":{ x: 179, y: 139 }, "qld":{ x: 165, y: 4 }, "vic":{ x: 178, y: 181 }, "tas":{ x: 190, y: 225 }, "nt":{ x: 102, y: 3 }, "sa":{ x: 104, y: 118 }, "wa":{ x: 0, y: 25 } } states = Array("nsw","qld","vic","tas","nt","sa","wa"); nodes = Array(); window.addEvent("domready",function(){ adjustAddressContainer(); //Fix for IE 7 positioning bug theUserAgent = navigator.userAgent if(theUserAgent.indexOf("MSIE 7.0") != -1) { position.nsw.y = 124; position.nsw.x = 180; } for(i = 0; i < states.length; i++){ state = states[i]; theNode = new Element("img"); theNode.setProperty('src',"/images/map/"+ states[i] +".png"); theNode.setProperty('title', state.toUpperCase()); theNode.setProperty('alt', state.toUpperCase()); theNode.setProperty('id', "map" + state.toUpperCase()); theNode.setStyles({ position: "absolute", top: position[state].y + $("canvas").offsetHeight, left: position[state].x + $("canvas").offsetWidth }); //load hove images hoverImage = new Image(); hoverImage.src = "/images/map/" + state + "-hover.png"; theNode.inject('canvas'); nodes[states[i]] = theNode; } //Set NSW as default //$("mapNSW").setProperty("src", "/images/map/nsw-hover.png"); $$("#canvas img").addEvent("click",function(){ $$("#stockists_info_container div.info").addClass("hide"); state = this.getProperty("title"); state = state.toLowerCase(); $(state + "Info").removeClass("hide"); $$("#stockists_info_container .row").set("style",""); adjustAddressContainer(); }); $$("#canvas img").addEvent("mouseover",function(){ src = this.get("src"); state = this.get("title"); state = state.toLowerCase(); regex = "/" + state + "/"; src.replace(regex, "aaa") this.set("src","/images/map/" + state + "-hover.png"); }); $$("#canvas img").addEvent("mouseout",function(){ src = this.get("src"); state = this.get("title"); state = state.toLowerCase(); regex = "/" + state + "/"; src.replace(regex, "aaa") this.set("src","/images/map/" + state + ".png"); }); });