/*************************************************************************
This code is from Dynamic Web Coding at dyn-web.com
Copyright 2008 by Sharon Paine
See Terms of Use at www.dyn-web.com/business/terms.php
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
for use with dw_rotator.js
version date: oct 1, 2008 (loadNewWin prop added for random)
*************************************************************************/
// display image at random
// rObj: object literal holding data
function dw_getRandomImage(rObj) {
var imgAr = rObj.images; if (!imgAr ) return;
var num = Math.floor( Math.random() * imgAr.length );
var imgStr = ''; var imgFile = imgAr[ num ];
rObj.num = num; // hold which img selected
var path = rObj.path || ''; var id = rObj.id || '';
var title, alt = '', url;
// If there are *any* entries for actions, alt or title include them here
if (rObj.alt) {
alt = rObj.alt[num]? rObj.alt[num]: rObj.alt[0]? rObj.alt[0]: '';
}
if (rObj.title) {
title = rObj.title[num]? rObj.title[num]: rObj.title[0]? rObj.title[0]: '';
}
if (rObj.actions) {
url = rObj.actions[num]? rObj.actions[num]: rObj.actions[0]? rObj.actions[0]: null;
}
if (url) {
imgStr += '': '">';
}
imgStr += '
';
if (url) {
imgStr += '';
}
document.write(imgStr); document.close();
}
/////////////////////////////////////////////////////////////////////
// code to add stop/restart links
dw_Rotator.addControls = function() {
var els = dw_getElementsByClassName('rotator_controls');
for (var i=0; els[i]; i++) {
var links = els[i].getElementsByTagName('a');
for (var j=0; links[j]; j++) {
if ( dw_hasClass( links[j], 'stop') ) {
links[j].onclick = function () { dw_Rotator.stop(); return false }
} else if ( dw_hasClass( links[j], 'start') ) {
links[j].onclick = function () { dw_Rotator.restart(); return false }
}
}
els[i].style.display = 'block';
}
}
// restart rotation for all instances
dw_Rotator.restart = function() {
var len = dw_Rotator.col.length, obj;
for (var i=0; i