patrick@17: // $Id$ patrick@17: // balade_nature patrick@17: patrick@17: var text = null; patrick@17: var spot = null; patrick@17: var box = null; patrick@17: var boxProperty = ''; patrick@17: patrick@17: patrick@17: window.addEvent('domready', function(){ Patrick@74: // Hotspots patrick@17: (function initialize() { Patrick@74: $$(".pdocHotspot").each(function(hotspot) { patrick@94: var spot = $(hotspot.get('id') + "s") patrick@94: var scenario = hotspot.getElement("span"); patrick@94: if (spot && scenario) { Patrick@74: hotspot.addEvent("click", function() { patrick@94: var spot = $(this.get('id') + "s"); patrick@94: if (spot.getChildren("img")) { patrick@94: spot.setStyles({"opacity": 1, "display": "block"}); patrick@94: } else { patrick@94: spot.setStyles({"opacity": 0, "display": "block"}); patrick@94: spot.tween("opacity", 1); patrick@94: } Patrick@74: this.setStyle("display", "none"); Patrick@74: (function() { patrick@94: spot.setStyle("display", "none"); Patrick@74: hotspot.setStyle("display", "block"); Patrick@74: }).delay(12000); Patrick@74: }); patrick@17: patrick@94: spot.addEvent("click", function() { Patrick@74: this.setStyle("display", "none"); patrick@94: $(this.get('id').substring(0, this.get('id').length-1)) Patrick@74: .setStyle("display", "block"); Patrick@74: }); patrick@17: } patrick@17: }); Patrick@74: }).delay(100); patrick@17: patrick@17: // Effect: glow patrick@17: var effectGlow = $("effectGlow"); patrick@17: if (effectGlow) { patrick@17: text = $("effectGlowText"); patrick@17: spot = $("effectGlowSpot"); patrick@17: box = $("effectGlowBox") patrick@17: if (typeof box.style.webkitBoxShadow == 'string') { patrick@17: boxProperty = 'webkitBoxShadow'; patrick@17: } else if (typeof box.style.MozBoxShadow == 'string') { patrick@17: boxProperty = 'MozBoxShadow'; patrick@17: } else if (typeof box.style.boxShadow == 'string') { patrick@17: boxProperty = 'boxShadow'; patrick@17: } patrick@17: patrick@17: if (text && spot && box) { patrick@17: effectGlow.onmousemove = onMouseMove; patrick@17: effectGlow.ontouchmove = function (e) { patrick@17: e.preventDefault(); patrick@17: e.stopPropagation(); patrick@17: onMouseMove({clientX: e.touches[0].clientX, clientY: e.touches[0].clientY}); patrick@17: } patrick@17: } patrick@17: } patrick@17: }); patrick@17: patrick@17: patrick@17: function onMouseMove(e) { patrick@17: if (typeof e === 'undefined' || typeof e.clientX === 'undefined') { patrick@17: return; patrick@17: } patrick@17: patrick@17: var xm = (e.clientX - Math.floor(window.innerWidth / 2)) * 0.4; patrick@17: var ym = (e.clientY - Math.floor(window.innerHeight / 3)) * 0.4; patrick@17: var d = Math.round(Math.sqrt(xm*xm + ym*ym) / 5); patrick@17: text.style.textShadow = -xm + 'px ' + -ym + 'px ' + (d + 10) + 'px black'; patrick@17: patrick@17: if (boxProperty) { patrick@17: box.style[boxProperty] = '0 ' + -ym + 'px ' + (d + 30) + 'px black'; patrick@17: } patrick@17: patrick@17: xm = e.clientX - Math.floor(window.innerWidth / 2); patrick@17: ym = e.clientY - Math.floor(window.innerHeight / 2); patrick@17: spot.style.backgroundPosition = xm + 'px ' + ym + 'px'; patrick@17: } patrick@17: