tionId);
$('upload_target').remove();
if (data.error) {
} else {
$('option_'+data.optionId+'_uploaded_file').value = data.fileName;
$('option_'+data.optionId+'_file').value = '';
$('option_'+data.optionId+'_file').hide();
$('option_'+data.optionId+'').hide();
template = '
<\/a>Remove file<\/a>';
Element.insert($('option_'+data.optionId+'_uploaded_file'), {after: template});
}
},
removeFile : function(optionId)
{
$('option_'+optionId+'_uploaded_file').value= '';
$('option_'+optionId+'_file').show();
$('option_'+optionId+'').show();
$('option_'+optionId+'_file_box').remove();
}
}
var optionTextCounter = {
count : function(field,cntfield,maxlimit){
if (field.value.length > maxlimit){
field.value = field.value.substring(0, maxlimit);
} else {
cntfield.innerHTML = maxlimit - field.value.length;
}
}
}
Product.Options = Class.create();
Product.Options.prototype = {
initialize : function(config) {
this.config = config;
this.reloadPrice();
document.observe("dom:loaded", this.reloadPrice.bind(this));
},
reloadPrice : function() {
var config = this.config;
var skipIds = [];
$$('body .product-custom-option').each(function(element){
var optionId = 0;
element.name.sub(/[0-9]+/, function(match){
optionId = parseInt(match[0], 10);
});
if (config[optionId]) {
var configOptions = config[optionId];
var curConfig = {price: 0};
if (element.type == 'checkbox' || element.type == 'radio') {
if (element.checked) {
if (typeof configOptions[element.getValue()] != 'undefined') {
curConfig = configOptions[element.getValue()];
}
}
} else if(element.hasClassName('datetime-picker') && !skipIds.include(optionId)) {
dateSelected = true;
$$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){
if (dt.getValue() == '') {
dateSelected = false;
}
});
if (dateSelected) {
curConfig = configOptions;
skipIds[optionId] = optionId;
}
} else if(element.type == 'select-one' || element.type == 'select-multiple') {
if ('options' in element) {
$A(element.options).each(function(selectOption){
if ('selected' in selectOption && selectOption.selected) {
if (typeof(configOptions[selectOption.value]) != 'undefined') {
curConfig = configOptions[selectOption.value];
}
}
});
}
} else {
if (element.getValue().strip() != '') {
curConfig = configOptions;
}
}
if(element.type == 'select-multiple' && ('options' in element)) {
$A(element.options).each(function(selectOption) {
if (('selected' in selectOption) && typeof(configOptions[selectOption.value]) != 'undefined') {
if (selectOption.selected) {
curConfig = configOptions[selectOption.value];
} else {
curConfig = {price: 0};
}
optionsPrice.addCustomPrices(optionId + '-' + selectOption.value, curConfig);
optionsPrice.reload();
}
});
} else {
optionsPrice.addCustomPrices(element.id || optionId, curConfig);
optionsPrice.reload();
}
}
});
}
}
function validateOptionsCallback(elmId, result) {
var container = $(elmId).up('ul.options-list');
if (result == 'failed') {
container.removeClassName('validation-passed');
container.addClassName('validation-failed');
} else {
container.removeClassName('validation-failed');
container.addClassName('validation-passed');
}
}
var opConfig = new Product.Options({"106":{"2387":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2388":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2389":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2390":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2391":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2392":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2393":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2394":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2395":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2396":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"2397":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0}}});
//]]>
-