var n=0;

window.addEvent('domready', function() {

    var el = $$('div.slider')[0]
    
    var slider = new Slider(el, el.getElement('.knob'), {
        range: [1, 30],
        wheel: true, 
        onChange: function(){
            n=this.step
            $('number').set('html',this.step)
        }
    })

    $('rigenera').addEvent('click',function(){
        var schedeRoot = $('schede')
        var mark = $('mark').getProperty('value')
        schedeRoot.empty()
        
        for(var i=0; i<n; i++){
            var scheda = new Scheda(mark+' - n.'+(i+1))
            scheda.render( schedeRoot )
//            if((i%4)==0){
//                var pageBreak = new Element('div',{style:'page-break-after:always',html:'<!-- -->'})
//                pageBreak.inject(schedeRoot)
//            }
        }
    })
   
})

