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:'29,97',2:'59,94',3:'83,62',4:'111,49',5:'139,37',6:'161,84',7:'188,82',8:'215,79',9:'242,77',10:'269,74',15:'382,13',20:'509,51',25:'636,88',30:'764,26'}},{gId:2,gName:"Económico",vId:4,vName:"Suzuki Swift DDIS",pic:"frotaEconomico01.png",prices:{1:'36,97',2:'73,94',3:'110,91',4:'147,88',5:'184,85',6:'221,82',7:'258,79',8:'295,76',9:'332,73',10:'369,70',15:'554,55',20:'739,40',25:'924,25',30:'1 109,10'}},{gId:3,gName:"Compacto",vId:7,vName:"Fiat 500",pic:"frotaCompacto01.png",prices:{1:'52,95',2:'105,90',3:'105,79',4:'211,80',5:'264,75',6:'317,70',7:'370,65',8:'423,60',9:'476,55',10:'529,50',15:'794,25',20:'1 059,00',25:'1 323,75',30:'1 588,50'}},{gId:4,gName:"Familiar Económico",vId:45,vName:"Volvo V50",pic:"volvo_vnc_uonsultarapidapng_otmgzzemgq.png",prices:{1:'75,89',2:'144,19',3:'182,14',4:'242,85',5:'303,56',6:'341,51',7:'398,42',8:'455,34',9:'512,26',10:'569,18',15:'796,85',20:'1 062,46',25:'1 138,35',30:'1 366,02'}},{gId:5,gName:"Executivo",vId:13,vName:"BMW Serie 3",pic:"frotaExecutivo01.png",prices:{1:'93,88',2:'187,76',3:'281,64',4:'375,52',5:'469,40',6:'563,28',7:'657,16',8:'751,04',9:'844,92',10:'938,80',15:'1 408,20',20:'1 877,60',25:'2 347,00',30:'2 816,40'}},{gId:6,gName:"Familiar Executivo",vId:49,vName:"Volkswagen Tiguan 4 Motion",pic:"consultarapida_120x71pxpng_ccgvnhsczm.png",prices:{1:'129,99',2:'259,98',3:'362,67',4:'483,56',5:'604,45',6:'662,95',7:'773,44',8:'883,93',9:'994,42',10:'1 104,92',15:'1 364,90',20:'1 819,86',25:'1 949,85',30:'2 339,82'}},{gId:7,gName:"Premium",vId:51,vName:"Audi Q5 TDI Quatro S Tronic ",pic:"consultarapida_120x71pxpng_7ib7kknzh0.png",prices:{1:'186,72',2:'373,44',3:'560,16',4:'746,88',5:'933,60',6:'1 120,32',7:'1 307,04',8:'1 493,76',9:'1 680,48',10:'1 867,20',15:'2 800,80',20:'3 734,40',25:'2 800,80',30:'3 360,96'}},{gId:8,gName:"4 x 4",vId:21,vName:"Isuzu 2500 4x4",pic:"frota4x401.png",prices:{1:'132,01',2:'264,02',3:'396,03',4:'528,04',5:'660,05',6:'792,06',7:'924,07',8:'1 056,08',9:'1 188,09',10:'1 320,10',15:'1 980,15',20:'2 640,20',25:'3 300,25',30:'3 960,30'}},{gId:9,gName:"Minivan",vId:24,vName:"Fiat Scudo Panorama",pic:"frotaMinivan01.png",prices:{1:'101,84',2:'189,42',3:'259,69',4:'346,26',5:'432,82',6:'458,28',7:'534,66',8:'611,04',9:'687,42',10:'763,80',15:'1 069,32',20:'1 425,76',25:'1 527,60',30:'1 833,12'}},{gId:10,gName:"Especial",vId:32,vName:"Audi Q7 3.0 TDI",pic:"1q7-consultarapida_120x71png_r9kohjpkcq.png",prices:{1:'354,00',2:'708,00',3:'1 062,00',4:'1 416,00',5:'1 770,00',6:'1 593,00',7:'1 858,50',8:'2 124,00',9:'2 389,50',10:'2 655,00',15:'3 717,00',20:'4 956,00',25:'5 310,00',30:'6 372,00'}}]; 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); });