function Area(name) { this.div = document.createElement('div'); this.div.setAttribute('id',name); this.div.setAttribute('style','position:absolute;height:275px;'); this.div.appendChild(new Image(name)); document.body.appendChild(this.div); centerHeight(this.div); centerWidth(this.div); this.div.onmouseover = function() { this.timer = setTimeout(this.stopAndForward,200); }; this.div.onmouseout = function() { clearTimeout(this.timer); }; this.div.stopAndForward = function() { var time = stopTimer("TEST"); this.style.border = 'solid'; if (time==undefined) { this.style.border = ''; } else { url = "/logger?" + "width="+ this.id + "&time=" + time + "&distance=" + this.distance; new Ajax.Request(url, {method: 'post', asynchronous:true, evalScripts:true, onSuccess: function() { window.location = "http://localhost:5000"; } }); } }; return this.div; }