function changeQuotationTheme() {
  var themeSelect = document.getElementById('quotationInformerTheme');
  var theme       = informerTheme[themeSelect.options[themeSelect.selectedIndex].value];
  for (i=1; i<=4; i++) {
    color = document.getElementById('quotationInformerColor'+i);
    color.value = theme[i-1];
  }
}
function changeQuotationValue() {
  for (i=1; i<=5; i++) {
    quotation = document.getElementById('quotationInformerValue'+i);
    if (i<quotation.length) {
      quotation.selectedIndex = i;
    } else {
      break;
    }
  }
}
function copyQuotationInformer() {
  var source = document.getElementById('quotationInformerSource');
  source.focus();
  document.execCommand('SelectAll');
  document.execCommand('Copy');
}
function createQuotationInformer() {
  var source       = document.getElementById('quotationInformerSource');
  var view         = document.getElementById('quotationInformerView');
  var location     = document.getElementById('quotationInformerLocation');
  var name         = document.getElementById('quotationInformerName').value;
  var quotations   = '';
  var colors       = new Array();
  var height       = 20;
  for (i=1; i<=5; i++) {
    quotation = document.getElementById('quotationInformerValue'+i);
    if (quotation.value != 0) {
      quotations += quotation.value + '-';
      height += 20;
    }
  }
  if (quotations == '') {
    source.value   = 'Выберите котировки и нажмите кнопку "Обновить"!';
    view.innerHTML = '';
    alert('Не выбрана ни одна котировка!');
    quotation.focus();
    return
  }
  for (i=1; i<=4; i++) {
    color = document.getElementById('quotationInformerColor'+i);
    if (color.value == '') {
      alert('Не задан цвет!');
      color.focus();
      return
    } else {
      colors[i] = color.value;
    }
  }
  source.value   = '<table width="120" cellspacing="0" cellpadding="0" border="0">' +
                   '<tr><td align="center" style="font-family:tahoma;font-size:10px;padding:4px;color:#' + colors[4] + '" bgcolor="#' + colors[2] + '">' + name + '</td></tr>' +
                   '<tr><td>' +
                     '<iframe width="100%" height="' + height + '" scrolling="no" frameborder="0" src="' + quotationInformer +
                       '&a[1]=' + location.options[location.selectedIndex].value +
                       '&a[2]=' + quotations.substring(0, quotations.length-1) +
                       '&a[3]=nominal' +
                       '&a[4]=' + colors[1] + '-' + colors[2] + '-' + colors[3] + '-' + colors[4] +
                     '"> ' + quotationBackLink + ' </iframe>' +
                   '</td></tr>' +
                   '</table>';
  view.innerHTML = source.value;
}

