function checkOut() {
	document.getElementById('order').style.display='block'
	document.getElementById('p_case').innerHTML=document.getElementById('t_case').value;
	document.getElementById('p_printer').innerHTML=document.getElementById('t_printer').value;
	document.getElementById('p_validator').innerHTML=document.getElementById('t_validator').value;
	document.getElementById('p_quantity').innerHTML=document.getElementById('quantity').value;
	document.getElementById('p_summ').innerHTML=document.getElementById('total_price').value;
}

 function calculate() {
	 showCaseImage()
	 showPrinterImage()
	 showValidatorImage()
  var pc = eval(29000);
  var casePrice = eval(document.calc.casexxx.value);
  var printerPrice = eval(document.calc.printer.value);
  var validatorPrice = eval(document.calc.validator.value);
  var discout = eval(1);
  var quantity = eval(document.calc.quantity.value);
  var totalPrice = (casePrice + printerPrice + validatorPrice + pc) * quantity * discout;
  if (quantity<='0') {
   alert('Не указано количество')
  }
  else
  if (casePrice==0 | printerPrice==0 | validatorPrice==0) {
   alert('Выбраны не все компоненты')
  }
  else {
   document.getElementById('thisPlace').innerHTML= "<input type=\"button\" value=\"Купить\" onClick=\"checkOut();window.location='#orderPlace'; document.getElementById('name').focus();\"> <span style=\"font-size:38px; font-family: Georgia, Serif; text-shadow: 1px 1px 1px #ccc;\">" + totalPrice + "&nbsp;руб.</span> "
  document.getElementById('discountPlace').innerHTML= "<p>При заказе <span class=\"nobr\">3 и более</span> терминалов предоставляется скидка. Размер скидки расчитывается индивидуально.</p>"
  document.calc.total_price.value=totalPrice
  document.getElementById('t_price').value = document.getElementById('total_price').value;
  document.getElementById('t_quantity').value = document.getElementById('quantity').value;
  for (var i = 0; i < document.calc.casexxx.length; i++) {
   if (document.calc.casexxx.options[i].selected == true) {
   document.getElementById('t_case').value = document.calc.casexxx.options[i].text
   }
  }
  for (var i = 0; i < document.calc.printer.length; i++) {
   if (document.calc.printer.options[i].selected == true) {
   document.getElementById('t_printer').value = document.calc.printer.options[i].text
   }
  }
  for (var i = 0; i < document.calc.validator.length; i++) {
   if (document.calc.validator.options[i].selected == true) {
   document.getElementById('t_validator').value = document.calc.validator.options[i].text
   }
  }
    }
 }
function clearAll() {
 document.getElementById('thisPlace').innerHTML= ''
 document.getElementById('discountPlace').innerHTML= ''
 document.printerimg.src='/img/printer/empty_img.png'
 document.caseimg.src='/img/case/empty_img.png'
 document.validatorimg.src='/img/validator/empty_img.png'
 document.getElementById('thisColorPlace').style.display='none'
 document.getElementById('order').style.display='none'
 document.getElementById('result').style.display='none'
}
function showCaseImage() {
  document.getElementById('thisPlace').innerHTML = ''
  if(document.forms.calc.casexxx.selectedIndex==0)
   {document.caseimg.src='/img/case/empty_img.png'
   document.getElementById('thisColorPlace').style.display='none'}
  if(document.forms.calc.casexxx.selectedIndex==1)
   {document.caseimg.src='/img/case/proline_smart_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'}
  if(document.forms.calc.casexxx.selectedIndex==2)
   {document.caseimg.src='/img/case/exact_city_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'}
  if(document.forms.calc.casexxx.selectedIndex==3)
   {document.caseimg.src='/img/case/profast_standart_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'} 
  if(document.forms.calc.casexxx.selectedIndex==4)
   {document.caseimg.src='/img/case/exact_wall_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'} 
  if(document.forms.calc.casexxx.selectedIndex==5)
   {document.caseimg.src='/img/case/profit_v.2_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'}
  if(document.forms.calc.casexxx.selectedIndex==6)
   {document.caseimg.src='/img/case/prostyle_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'}
  if(document.forms.calc.casexxx.selectedIndex==7)
   {document.caseimg.src='/img/case/prostyle_ultra_full.jpg'
   document.getElementById('thisColorPlace').style.display='block'}
  else
  return false;
 }
 function showPrinterImage() {
  document.getElementById('thisPlace').innerHTML = ''
  if(document.forms.calc.printer.selectedIndex==0)
   {document.printerimg.src='/img/printer/empty_img.png'}
  if(document.forms.calc.printer.selectedIndex==1)
   {document.printerimg.src='/img/printer/citizen-ct-s2000.jpg'}
  if(document.forms.calc.printer.selectedIndex==2)
   {document.printerimg.src='/img/printer/custom-vkp-80.jpg'}
  else
  return false;
 }
function showValidatorImage() {
  document.getElementById('thisPlace').innerHTML = ''
  if(document.forms.calc.validator.selectedIndex==0)
   {document.validatorimg.src='/img/validator/empty_img.png'}
  if(document.forms.calc.validator.selectedIndex==1)
   {document.validatorimg.src='/img/validator/cashcode_mvu.jpg'}
  if(document.forms.calc.validator.selectedIndex==2)
   {document.validatorimg.src='/img/validator/cashcode-sm.gif'}
  if(document.forms.calc.validator.selectedIndex==3)
   {document.validatorimg.src='/img/validator/jcm-dbv-300.jpg'}
  else
  return false;
}

