window.addEvent('domready', function(){ // First Example //var pArray = new Array(10, 20, 30, 40, 50, 60, 70, 80, 90, 100); var dArray = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30); var picCars = new Array(); var data = [{gId:1,gName:"Mini",vId:1,vName:"Opel Agila ",pic:"frotaMini01.png",prices:{1:'49,64',2:'99,29',3:'148,93',4:'198,57',5:'248,22',6:'297,86',7:'347,50',8:'397,14',9:'446,79',10:'496,43',15:'744,65',20:'992,86',25:'1 241,08',30:'1 489,29'}},{gId:2,gName:"Económico",vId:4,vName:"Suzuki Swift DDIS",pic:"frotaEconomico01.png",prices:{1:'53,38',2:'106,77',3:'160,15',4:'213,53',5:'266,92',6:'320,30',7:'373,68',8:'427,06',9:'480,45',10:'533,83',15:'800,75',20:'1 067,66',25:'1 334,58',30:'1 601,49'}},{gId:3,gName:"Compacto",vId:58,vName:"Seat Ibiza Tdi STW",pic:"seat_consultarapida_120x71ppng_qakju1gpq0.png",prices:{1:'49,64',2:'99,29',3:'148,93',4:'198,58',5:'248,22',6:'297,86',7:'347,51',8:'397,15',9:'446,80',10:'496,44',15:'744,66',20:'992,88',25:'1 054,94',30:'1 265,92'}},{gId:4,gName:"Familiar Económico",vId:45,vName:"Volvo V50",pic:"volvov50_consultarapida_120png_pnxqr2bjmp.png",prices:{1:'88,94',2:'177,89',3:'266,83',4:'355,78',5:'444,72',6:'533,66',7:'622,61',8:'711,55',9:'800,50',10:'889,44',15:'1 134,04',20:'1 512,05',25:'1 556,52',30:'1 600,99'}},{gId:26,gName:"Automático",vId:74,vName:"Renault Megane Stw Sport",pic:"megane_consulrapida_120x71png_e8u8tuvkr1.png",prices:{1:'88,94',2:'177,89',3:'266,83',4:'355,78',5:'444,72',6:'533,66',7:'622,61',8:'711,55',9:'800,50',10:'889,44',15:'1 334,16',20:'1 778,88',25:'1 556,52',30:'1 600,99'}},{gId:5,gName:"Executivo",vId:14,vName:"Alfa Romeo 159",pic:"alfa159_consultarapida_120xpng_wjd8tqf071.png",prices:{1:'115,47',2:'230,95',3:'346,42',4:'461,90',5:'577,37',6:'692,84',7:'808,32',8:'923,79',9:'1 039,27',10:'1 154,74',15:'1 732,11',20:'2 309,48',25:'2 886,85',30:'3 464,22'}},{gId:6,gName:"Familiar Executivo",vId:49,vName:"Volkswagen Tiguan 4 Motion",pic:"consultarapida_120x71pxpng_ccgvnhsczm.png",prices:{1:'146,56',2:'293,13',3:'439,69',4:'586,26',5:'732,82',6:'879,38',7:'1 025,95',8:'1 172,51',9:'1 319,08',10:'1 465,64',15:'1 538,92',20:'2 051,90',25:'2 198,46',30:'2 638,15'}},{gId:7,gName:"Premium",vId:51,vName:"Audi Q5 TDI Quatro S Tronic ",pic:"consultarapida_120x71pxpng_7ib7kknzh0.png",prices:{1:'210,52',2:'421,05',3:'631,57',4:'842,10',5:'1 052,62',6:'1 263,14',7:'1 473,67',8:'1 684,19',9:'1 894,72',10:'2 105,24',15:'3 157,86',20:'4 210,48',25:'3 157,86',30:'3 789,43'}},{gId:27,gName:"Suv",vId:72,vName:"Audi A4 Allroad",pic:"a4allroad_consulr_120x71_2png_aghj2vlpf1.png",prices:{1:'154,22',2:'308,45',3:'462,67',4:'616,90',5:'771,12',6:'925,34',7:'1 079,57',8:'1 233,79',9:'1 388,02',10:'1 542,24',15:'2 313,36',20:'3 084,48',25:'2 313,36',30:'2 776,03'}},{gId:8,gName:"4 x 4",vId:21,vName:"Isuzu 2500 4x4",pic:"frota4x401.png",prices:{1:'135,31',2:'270,62',3:'405,93',4:'541,24',5:'676,55',6:'811,86',7:'947,17',8:'1 082,48',9:'1 217,79',10:'1 353,10',15:'2 029,65',20:'2 706,20',25:'3 382,75',30:'4 059,30'}}]; var el_1 = $('priceSlide'), el_2 = $('daySlide'), total = $('total'), day = dArray[0], cGroup = 0 // Create the new slider instance new Slider(el_1, el_1.getElement('.knob'), { snap: true, wheel: true, steps: 9, // There are 9 steps range: [0], // Minimum value is 10 onChange: function(value){ // Everytime the value changes cGroup = value; updateTotal(); loadImage(value); } }) new Slider(el_2, el_2.getElement('.knob'), { wheel: true, steps: 13, // There are 35 steps range: [0], // Minimum value is 1 onChange: function(value){ // Everytime the value changes day = dArray[value]; updateTotal(); } }) var updateTotal= function(){ // Sets the color of the output text and its text to the current color var t = data[cGroup]['prices'][day]; total.set('text', t + " Euros"); $('bookIt').href = 'pages/reservaStep1.php?g=' + data[cGroup]['gId'] + '>=1'; } var preloadImages = function(){ var imgFolder = ( -1 != window.location.pathname.search('/en/') ) ? ( '../assets/images/vehicles/consulta_rap/' ) : ( 'assets/images/vehicles/consulta_rap/' ); for(var i in data) { picCars[i] = new Image(); picCars[i].src = imgFolder + data[i]['pic']; } } var loadImage = function(num){ $('labelPic').innerHTML = data[cGroup]['gName']//labelArray[num]; document['carPic'].src = picCars[num].src; document['carPic'].alt = data[cGroup]['vName']; } //Init updateTotal(); preloadImages(); loadImage(0); });