/** * @author Rat */ /** * Image src URLs **/ var imageList = [ "../administrator/admin/Uploads/Gallery Calendar_Gallery1_waves_Thumb.jpg", "../administrator/admin/Uploads/Gallery Calendar_Gallery2_hughes_Thumb.jpg", "../administrator/admin/Uploads/Gallery Calendar_Gallery1_tamworth_Thumb.jpg", "../administrator/admin/Uploads/Gallery Calendar_Gallery2_hely_Thumb.jpg", "../administrator/admin/Uploads/Gallery Calendar_Gallery1_generate_Thumb.jpg", "../administrator/admin/Uploads/Gallery Calendar_Gallery2_ernabella_Thumb.jpg" ]; /** * Since carousel.addItem uses an HTML string to create the interface * for each carousel item, this method formats the HTML for an LI. **/ var fmtItem = function(imgUrl, url, title) { var innerHTML = '' + title; return innerHTML; }; /** * Custom inital load handler. Called when the carousel loads the initial * set of data items. Specified to the carousel as the configuration * parameter: loadInitHandler **/ var loadInitialItems = function(type, args) { var start = args[0]; var last = args[1]; load(this, start, last); }; /** * Custom load next handler. Called when the carousel loads the next * set of data items. Specified to the carousel as the configuration * parameter: loadNextHandler **/ var loadNextItems = function(type, args) { var start = args[0]; var last = args[1]; var alreadyCached = args[2]; if(!alreadyCached) { load(this, start, last); } }; /** * Custom load previous handler. Called when the carousel loads the previous * set of data items. Specified to the carousel as the configuration * parameter: loadPrevHandler **/ var loadPrevItems = function(type, args) { var start = args[0]; var last = args[1]; var alreadyCached = args[2]; if(!alreadyCached) { load(this, start, last); } }; var load = function(carousel, start, last) { carousel.addItem(1, fmtItem(imageList[0], "0", "Making Waves")); carousel.addItem(2, fmtItem(imageList[1], "1", "Metonymy - look both ways")); carousel.addItem(3, fmtItem(imageList[2], "2", "Momentum: 18th Tamworth Textile Biennial ")); carousel.addItem(4, fmtItem(imageList[3], "3", "To There & Back ")); carousel.addItem(5, fmtItem(imageList[4], "4", "Generate '10")); carousel.addItem(6, fmtItem(imageList[5], "5", "Ernabella Arts Inc. "));}; /** * Custom button state handler for enabling/disabling button state. * Called when the carousel has determined that the previous button * state should be changed. * Specified to the carousel as the configuration * parameter: prevButtonStateHandler **/ var handlePrevButtonState = function(type, args) { var enabling = args[0]; var leftImage = args[1]; if(enabling) { leftImage.src = "css/images/left-enabled.gif"; } else { leftImage.src = "css/images/left-disabled.gif"; } }; /** * Custom button state handler for enabling/disabling button state. * Called when the carousel has determined that the next button * state should be changed. * Specified to the carousel as the configuration * parameter: nextButtonStateHandler **/ var handleNextButtonState = function(type, args) { var enabling = args[0]; var rightImage = args[1]; if(enabling) { rightImage.src = "css/images/right-enabled.gif"; } else { rightImage.src = "css/images/right-disabled.gif"; } }; /** * You must create the carousel after the page is loaded since it is * dependent on an HTML element (in this case 'dhtml-carousel'.) See the * HTML code below. **/ var pageLoad = function() { var carousel = new YAHOO.extension.Carousel("dhtml-carousel", { numVisible: 5, animationSpeed: .4, animationMethod: YAHOO.util.Easing.easeBoth, scrollInc: 4, navMargin: 5, size: 6, loadInitHandler: loadInitialItems, prevElementID: "prev-arrow", nextElementID: "next-arrow", loadNextHandler: loadNextItems, loadPrevHandler: loadPrevItems, prevButtonStateHandler: handlePrevButtonState, nextButtonStateHandler: handleNextButtonState } ); }; YAHOO.util.Event.addListener(window, 'load', pageLoad); Behaviour.register(myrules);