ce24db15dcda4afdf55bce12f376edb4b8bed3e2
[plewww.git] / plekit / niftycorner / nifty_init.js
1 /* 
2   $Id$
3
4  instead of explicitly calling 
5  Nifty ('div#$id','medium');
6  on every single element as the original niftycube.js recommends, 
7  we just do that on every element that has one of the
8  the nifty-{small,medium,big} class set
9 */
10
11 var nifty_inited = false;
12
13 function nifty_init () {
14   if ( nifty_inited ) return;
15   var sizes= { 0: 'small', 1: 'medium', 2: 'big', length: 3};
16   $A(sizes).each (function (size) {
17     
18     var elements=document.getElementsByClassName('nifty-'+size);
19     for (var i=0; i<elements.length; i++) {
20       // use Rounded rather than Nifty
21       // the latter needs an id that some elements don't have
22       // plus, it's more efficient anyway
23       pleRounded(elements[i],size);
24     }
25     });
26   nifty_inited = true;
27 }
28