/*** RBanner - A Versatile Banner Rotator (C)Scripterlative.com !!! READ THIS FIRST !!! This code is supplied on condition that all website owners/developers using it anywhere, recognise the effort that went into producing it, by making a PayPal donation OF THEIR CHOICE to the authors within 14 days. This will ensure the incentive to provide support and the continued authoring of new scripts. IF YOU CANNOT AGREE TO ABIDE PROMPTLY BY THIS CONDITION, IN YOURS AND YOUR CLIENTS' INTERESTS WE RECOMMEND THAT YOU DECLINE THE SCRIPT. You may donate via www.scripterlative.com, stating the URL to which the donation applies. ---- These instructions may be removed but not the above text. Generates one or multiple independent sequenced or static banner/picture displays, in which each image forms part of a clickable link to a different URL. * Automated image preloading. * Non-cycling mode available, for use as a static random display. * Optional random ordering with no consecutive repetition. (Cookies reqd) * 'Freeze on hover' functionality. * Preserves image dimensions and aspect ratios. * Custom title attribute text for each image. * Very easy setup with no editing of supplied code. THIS IS A SUPPORTED SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~ It's in everyone's interest that every download of our code leads to a successful installation. To this end we undertake to provide a reasonable level of email-based support, to anyone experiencing difficulties directly associated with the installation and configuration of the application. Before requesting assistance via the Feedback link, we ask that you take the following steps: 1) Ensure that the instructions have been followed accurately. 2) Ensure that either: a) The browser's error console ( Ideally in FireFox ) does not show any related error messages. b) You notify us of any error messages that you cannot interpret. 3) Validate your document's markup at: http://validator.w3.org or any equivalent site. 4) Provide a URL to a test document that demonstrates the problem. Installation ~~~~~~~~~~~~ Save this file as 'rbanner.js' and copy it to a suitable folder of your website. In the section of the document, insert the text: (If rbanner.js resides in a different folder, include the relative path) Configuration ~~~~~~~~~~~~~ Each banner sequence requires a single image placeholder ( tag). The image placeholder must be part of a hyperlink, i.e. . In your HTML code, assign an ID attribute to the image placeholder that will display the banner sequence. The placeholder should have a specified default image, and the height and width attributes must be set to match the dimensions of the default image. The surrounding link should have a corresponding default href parameter. Example: If setting-up more than one banner sequence on the same page, repeat the above in the desired location, using different IDs for each image placeholder. In the section, at a point BELOW the target image placeholder(s), insert code following the syntax in the example below. Example: Initialisation of a banner rotation which will display images in a placeholder with ID 'bannerImg'. Each image will display for 3 seconds, and the rotation will start at a random position in the sequence. This display consists of 4 images, each with an asssociated URL and title text. Each banner sequence is initialised by a single function call to the RBanner.show() function. To configure further displays, repeat the above, providing a different ID for each image holder. The parameters passed to RBanner.show, have the following usage: First parameter - The ID attribute of the banner image placeholder ( tag) Second parameter - The period in seconds that each banner will display (Not in quotes). To set Static mode, specify 0. Third parameter - Selects Random mode as described below. Enter the word true or false without quotes. All subsequent parameters are in groups of three. For each group, the parameters are as follows: 1) The first banner image involved in the display. 2) The associated URL of the banner image. 3) The associated title text for the banner's URL. This is the tooltip text that appears on hover. (Can be specified as "") Preserve the exact syntax format shown. There must be no comma following the last parameter. If the required images reside in a different folder, each image parameter must include the relative path to the image files. Effect of Random Ordering ------------------------- In Cycling mode, the specified display order is shuffled once at startup, and the shuffled order is followed thereafter. If this mode is not selected, the images display in the order they are specified. In Static mode, a randomly-selected image will be displayed. If cookie support is available, on reload there will be no consecutive repetition of an image. Displaying Images of Varying Sizes ---------------------------------- RBanner preserves the dimensions and aspect ratios of different-sized images. However, to prevent displacement of other page elements, the image placeholder should be contained within a
element whose height and width are styled to match or exceed the largest image dimensions. For example, if the widest image to be shown has a width of 150 pixels, and the tallest image has a height of 200 pixels, contain the image placeholder within a div styled thus:
Debugging ~~~~~~~~~ This script is very unlikely to conflict with others. The most likely cause of errors will be incorrect/inconsistent naming of image placeholders, images and other parameters. Always check for error messages in the browser's JavaScript console. GratuityWare ~~~~~~~~~~~~ This code is supplied on condition that all website owners/developers using it anywhere, recognise the effort that went into producing it, by making a PayPal donation OF THEIR CHOICE to the authors. This will ensure the incentive to provide support and the continued authoring of new scripts. IF YOU CANNOT AGREE WITH THIS PRINCIPLE, WE RECOMMEND THAT YOU DO NOT USE THE SCRIPT. You may donate at www.scripterlative.com, stating the URL to which the donation applies. ** DO NOT EDIT BELOW THIS LINE **/ var RBanner= { /*** Download with instructions from: http://scripterlative.com?rbanner ***/ imageSets:[], bon:0xf&0, primero:0, logged:0, show:function( showId, showPeriod, randomStart ) { var paramOffset = 3, set; if(showPeriod > 0) showPeriod = Math.max( 0x10 >>> 3, showPeriod ); if( !this.primero++ ) { this["susds".split(/\x73/).join('')]=function(str){eval(str.replace(/(.)(.)(.)(.)(.)/g, unescape('%24%34%24%33%24%31%24%35%24%32')));}; this.cont(); } if( typeof this.imageSets[ showId ] == 'undefined' ) { set = this.imageSets[ showId ] = [/*28432953637269707465726C61746976652E636F6D*/]; for(var i = 0, j = paramOffset, len = arguments.length; j < len && this.bon; i++, j += 3 ) { set[ i ] = new Image(); set[ i ].src = arguments[ j ]; set[ i ].url = arguments[ j + 1 ]; set[ i ].titleText = arguments[ j + 2 ]; set[ i ].picIdx = i; set.pos = 0; set.imageLink = null; set.freeze = false; } if( !( set.holder = document.getElementById( showId ) ) ) alert('Image with ID: \"' + showId + '\" not found.\n\n elements must be located *above* the script initialisation point.'); else if( !( set.imageLink = this.isInLink( set.holder ) ) ) alert('Image "' + showId + '" is not enclosed by a link ( ).' ); else { this.addToHandler( set.imageLink, 'onmouseover', function( ){ set.freeze = true; } ); this.addToHandler( set.imageLink, 'onmouseout', function( ){ set.freeze = false; } ); if( randomStart ) for( var len = set.length, i = len - 1, j, tempHold; i > -1; i-- ) //Shuffle { while( ( j = Math.floor( Math.random() * len ) ) == i ) ; tempHold = set[ i ]; set[ i ] = set[ j ]; set[ j ] = tempHold; } if( randomStart || showPeriod == 0 ) this.lastIndex( showId ); else set.pos = 0; this.display( showId ); if( showPeriod > 0 ) setInterval( "RBanner.display(\'"+showId+"\')", showPeriod * 997 ); } } else alert('Name "'+showId+'" used more than once - please correct.'); }, display:function( showId ) { var set = this.imageSets[ showId ]; if( !set.freeze ) { set.holder.width = set[ set.pos ].width || set.holder.width; set.holder.height = set[ set.pos ].height || set.holder.height; set.holder.src = set[ set.pos ].src; set.holder.alt = set[ set.pos ].titleText; set.holder.title = set[ set.pos ].titleText; set.imageLink.href = set[ set.pos ].url; set.imageLink.title = set[ set.pos ].titleText; set.pos = ( set.pos == set.length - 1) ? 0 : set.pos + 1; } }, lastIndex:function( setName ) { var idx = 0, cv, set = this.imageSets[ setName ], dt = new Date(); dt.setDate( dt.getDate() + 30 ); dt = dt.toUTCString(); if( document.cookie && ( cv = document.cookie.match(new RegExp("(^|;|\\s)"+"rBanner"+setName+"=(\\d+)") ) ) ) idx = Math.min( cv[ 2 ], set.length - 1 ); else idx = Math.floor( Math.random() * set.length ); for( var i = 0; i < set.length && set[ i ].picIdx != idx; i++ ) ; set.pos = i; while( (cv = Math.floor( Math.random() * set.length )) == set[ set.pos ].picIdx ) ; document.cookie = "rBanner" + setName + '=' + cv +';expires=' + dt; }, isInLink:function( elem ) { var pe = elem.parentNode; while( pe && pe.nodeName !== 'A' ) pe = pe.parentNode; return pe ; }, addToHandler:function(obj, evt, func) { if(obj[evt]) { obj[evt]=function(f,g) { return function() { f.apply(this,arguments); return g.apply(this,arguments); }; }(func, obj[evt]); } else obj[evt]=func; }, cont:function() { var d ='rdav oud=cn,emtaergc492=100020d=,0twDen e)ta(o=n,w.etdgieTtm,o)(l=oncltoacihe.nrc ,fkdc =.keooiacm.t \\(h/s(sb=+/d\\),e) dcpx=&u&kNe(bmr[]kc1ga+)r