/******************************************************************************* FILE: mud_Scripts.js REQUIRES: prototype.js AUTHOR: Takashi Okamoto mud(tm) - http://www.mudcorp.com/ VERSION: 2.1 - update to make it work more like MudFadeGallery DATE: 04/07/2006 -------------------------------------------------------------------------------- This file is part of MudShiftContent. MudShiftContent is free for anyone to use, but this header MUST be included, and may not be modified. *******************************************************************************/ //////////////////////////////////////////////////////////////////////////////// // GLOBAL VARS var imgs; var imgsGallery = new Array(); //////////////////////////////////////////////////////////////////////////////// // MOUSE EVENTS function setOnMouseClick() { var elements = document.getElementsByTagName("a"); for (var i = 0; i < elements.length; i++) { switch(elements[i].className) { case "next": elements[i].onclick = function() { imgs.move('next'); return false; } break; case "prev": elements[i].onclick = function() { imgs.move('prev'); return false; } break; } } } //////////////////////////////////////////////////////////////////////////////// // INIT function init() { setOnMouseClick(); // images gallery imgsGallery[0] = new Object(); imgsGallery[0].image = new Image(); imgsGallery[0].image.src = "images/irate1.jpg"; imgsGallery[0].title = "IRATE Sound & Space (1 of 2)"; imgsGallery[0].caption = "CD packaging for noise rock group"; imgsGallery[0].url = ""; imgsGallery[1] = new Object(); imgsGallery[1].image = new Image(); imgsGallery[1].image.src = "images/irate2.jpg"; imgsGallery[1].title = "IRATE Sound & Space (2 of 2)"; imgsGallery[1].caption = "CD packaging for noise rock group"; imgsGallery[1].url = ""; // MudShiftContent(id, unitX, unitTotal) imgs = new MudShiftContent('imgs', imgsGallery); // set init if ($('imgs_title')) $('imgs_title').innerHTML = imgsGallery[0].title; if ($('imgs_caption')) $('imgs_caption').innerHTML = imgsGallery[0].caption; if ($('imgs_url')) $('imgs_url').innerHTML = imgsGallery[0].url; tooltip = new MudToolTip('tooltip', 'tooltipbox'); } //////////////////////////////////////////////////////////////////////////////// // EVENTS Event.observe(window, 'load', init, false); if (!/MSIE/.test(navigator.userAgent)) { Event.observe(window, 'mouseover', onMouseOver, false); Event.observe(window, 'mouseout', onMouseOut, false); Event.observe(window, 'mousemove', onMouseMove, false); } else { Event.observe(document, 'mouseover', onMouseOver, false); Event.observe(document, 'mouseout', onMouseOut, false); Event.observe(document, 'mousemove', onMouseMove, false); } //////////////////////////////////////////////////////////////////////////////// // GLOBAL VARS var tooltip; /////////////////////////////////////////////////////////////////////////////// // MOUSE EVENTS function onMouseOver(evt) { evt = (evt) ? evt : event; var target = (evt.target) ? evt.target : evt.srcElement; if (target.className == "tooltip") { tooltip.showTip(evt); } return false; } function onMouseOut(evt) { tooltip.hideTip(evt); } function onMouseMove(evt) { tooltip.setPos(evt); }