var Variations = { changeList: function(t, value1, value2, value3, value4, value5, avail_message) { anchor = $$('#variations .selectableList li a'); anchor.forEach(function(tag) { $(tag).getParent().removeClass('selected');}); $(t).getParent().addClass('selected'); Variations.loadData( 'link', '', '', value1, value2, value3, value4, value5, avail_message );}, loadData: function( genre, nome_valore, valore, value1, value2, value3, value4, value5, avail_message ) { if (genre == 'link')
{ var new_url = my_url; new_url += '&id_valore1='+value1; new_url += '&id_valore2='+value2; new_url += '&id_valore3='+value3; new_url += '&id_valore4='+value4; new_url += '&id_valore5='+value5;}
else
{ var new_url = my_url + '&' + nome_valore + '=' + valore;}
var request = new Request.JSON({ url: new_url, method: 'get', onComplete: function(jsonObj) { $('large_image').setProperty('src', jsonObj.image_file); $('price').set('html', jsonObj.list_price); if (jsonObj.sale_price != 0) { $('sale_price').set('html', jsonObj.sale_price); $('price').removeClass('price'); $('price').addClass('barrato');}
else{ $('sale_price').set('text', ''); $('price').removeClass('barrato'); $('price').addClass('price');}
Variations.setDefaultData(jsonObj); var myNewColor = ""; if ($$('#variations select')) { $$('#variations select option').forEach(function(o) { o.selected = false; if (o.value == parseInt(jsonObj.id_valore)) { o.selected = true; myNewColor = o.text + ":";}
});}
if (jsonObj.fzFlagDispIllimitata != '1') { if (parseInt(jsonObj.local_inventory) < 1) { if (myNewColor == "")
$('id_your_selection').setStyle('display', 'block'); $('in_stock').set('text', ''); $('disp_color').set('text', myNewColor + avail_message);}
else
{ $('id_your_selection').setStyle('display', 'none'); $('disp_color').set('text', myNewColor);}
}
else
{ $('id_your_selection').setStyle('display', 'none'); $('disp_color').set('text', myNewColor);}
if (jsonObj.manufacturer_id != '') { $('manufacturer_id').set('text', jsonObj.manufacturer_id);}
$('content_1').empty(); $('content_1').addClass('empty'); $('techSheetLink').setProperty('href', jsonObj.dest_url); my_url_check_availability = jsonObj.avail_url; my_url_send_email = jsonObj.sendemail_url; $('availabilityContainer').addClass('empty'); $('ca_btn_tab').setProperty('href', my_url_check_availability); $('id_valore').value = jsonObj.id_valore;}
}).send();}, setDefaultData: function(jsonObj) { $('availability').set('text', jsonObj.availability); if (jsonObj.fzFlagDispIllimitata != '1')
{ if (parseInt(jsonObj.local_inventory) < 1)
{ if (jsonObj.flagSoldOut == '1')
{ $('btn_Add').setStyle('display', 'none'); $('availability').setStyle('display', 'none'); $('btn_Wish').setStyle('display', 'none'); $('ca_btn_tab').setStyle('display', 'none'); $('btn_soldout').setStyle('display', 'block');}
else
{ $('in_stock').setStyle('display', 'none'); $('btn_Add').setStyle('display', 'none'); $('btn_Wish').setStyle('display', 'block'); $('availability').setStyle('display', 'none'); $('ca_btn_tab').setStyle('display', 'block'); $('btn_soldout').setStyle('display', 'none');}
}
else
{ $('btn_Wish').setStyle('display', 'block'); $('in_stock').setStyle('display', 'inline'); $('btn_Add').setStyle('display', 'block'); $('availability').setStyle('display', 'block'); $('ca_btn_tab').setStyle('display', 'none'); $('btn_soldout').setStyle('display', 'none');}
}
else
{ $('in_stock').setStyle('display', 'inline'); $('btn_Add').setStyle('display', 'block'); $('btn_Wish').setStyle('display', 'block'); $('availability').setStyle('display', 'block'); $('ca_btn_tab').setStyle('display', 'none'); $('btn_soldout').setStyle('display', 'none');}
$('in_stock').set('text', jsonObj.msg_in_stock);}
}; 