Форма срочного заказа

Калькулятор

{source}
<div id="calkulator" class="">
<div class="row">
<div class="col-md-10 center">
<form method="post" class="calc" name="myForm">
<div id="radio_button" class="col col1">
Тип работы:<br>
<input type="radio" id="r1" name="type_work" value="Thesis" onclick="getRadioValue('Thesis')"><label for="r1"><span></span>Диссертация</label><br>
<input type="radio" id="r2" name="type_work" value="Diploma" onclick="getRadioValue('Diploma')"><label for="r1"><span></span>Дипломная работа</label><br>
<input type="radio" id="r3" name="type_work" value="Course" checked onclick="getRadioValue('Course')"><label for="r2"><span></span>Курсовая работа</label><br>
<input type="radio" id="r4" name="type_work" value="Practice" onclick="getRadioValue('Practice')"><label for="r2"><span></span>Отчет по практике</label><br>
<input type="radio" id="r5" name="type_work" value="TestWork" onclick="getRadioValue('TestWork')"><label for="r3"><span></span>Контрольная/реферат</label>
</div>
<p></p>
<div id="radio_calc1" class="col col2">
<div id="science_block">
<div>Науки:</div>
<select name="science" id="science">
<option>Экономические</option>
<option>Гуманитарные</option>
<option>Технические</option>
<option>Правовые</option>
</select>
</div> <div>Количество страниц:</div>
<select name="pages" class="turnintodropdown" id="pages">
<!--<option value="25-30">25-30</option><option value="30-35">30-35</option><option value="35-40">35-40</option>-->
</select>
<div>Срок выполнения:</div>
<select name="days" id="days">
<!--<option value="3-4 дня">3-4 дня</option><option value="5-6 дней">5-6 дней</option><option value="14 дней">14 дней</option><option value="21 день">21 день</option>-->
</select>
</div>
</form>
<!--<a href="#calk"><button class="uk-button uk-button-success" onclick="calculatePrice()" style="margin: 10px;">Просчитать стоимость</button></a>-->
<div class="clear"></div>
<div class="r_button">
<button class="button yel" onclick="calculatePrice()" >Узнать стоимость работы</button>
</div> <div id="output" class="center"> </div>
</div>
</div> </div>
<div class="container"><a href="/zakazat" class="zakazat">Заказать работу</a></div> <script language="javascript" type="text/javascript">

var thesisEconomy =
[
["","21 день", "14 дней", "7 дней"],
["80-100", 30, 40, 50],
["100-130", 40, 50 ,60],
["130-180", 80, 90, 120] ];
var thesisHumanities =
[
["","21 день", "14 дней", "7 дней"],
["80-100", 23, 30, 36],
["100-130", 34, 40 ,48],
["130-180", 70, 80, 90]];
var thesisTechnical =
[
["","21 день", "14 дней", "7 дней"],
["80-100", 80, 95, 110],
["100-130", 100, 120 ,135],
["130-180", 200, 230, 250]];
var thesisLaw=
[
["","21 день", "14 дней", "7 дней"],
["80-100", 23, 28, 34],
["100-130", 32, 40 ,48],
["130-180", 70, 80, 90]];
var diplomEconomy =
[
["","21 день", "14 дней", "7 дней"],
["40-60", 19, 23, 27],
["60-70", 21, 25 ,28],
["70-90", 24, 28, 33]];
var diplomHumanities =
[
["","21 день", "14 дней", "7 дней"],
["40-60", 16, 24, 28],
["60-70", 20, 25 ,30],
["70-90", 22, 31, 38]];
var diplomTechnical =
[
["","21 день", "14 дней", "7 дней"],
["40-60", 20, 27, 35],
["60-70", 24, 31 ,40],
["70-90", 30, 35, 42]];
var diplomLaw =
[
["","21 день", "14 дней", "7 дней"],
["40-60", 17, 21, 27],
["60-70", 19, 23 ,29],
["70-90", 21, 24, 29]];
var courseEconomy =
[
["","5-6 дней", "3-4 дня", "до 3 дней"],
["25-30", 2800, 3000, 5600],
["30-35", 3200, 3500 ,6400],
["35-40", 3600, 4200, 7200]];
var courseHumanities =
[
["","5-6 дней", "3-4 дня", "до 3 дней"],
["25-30", 2600, 3000, 5000],
["30-35", 3000, 3400 ,5000],
["35-40", 3300, 3700, 5500]];
var courseTechnical =
[
["","5-6 дней", "3-4 дня", "до 3 дней"],
["25-30", 3800, 5000, 7000],
["30-35", 4300, 5200 ,8000],
["35-40", 5000, 6000, 8000]];
var courseLaw =
[
["","5-6 дней", "3-4 дня", "до 3 дней"],
["25-30", 2600, 3200, 5000],
["30-35", 3000, 3400, 5000],
["35-40", 3500, 3900, 5000]];
var Practice =
[
["","5-6 дней", "3-4 дня", "до 3 дней"],
["10-15", 2600, 3200, 4000],
["15-20", 3200, 3700, 4300],
["20-30", 3800, 4300, 5000]];
var testWork =
[
["","3-5 дней", "1-3 дня"],
["10-15", 1500, 1800],
["15-20", 2300, 2600],
["20-30", 3000, 3700]]; document.addEventListener("DOMContentLoaded", function(event) {
getRadioValue('Course');
}); function calculatePrice() {
var pages;
var days;
var wType;
var science;
var radios = document.getElementsByTagName('input');
for (var i = 0; i < radios.length; i++) {
if (radios[i].type === 'radio' && radios[i].checked && radios[i].name === 'type_work') {
//
wType = radios[i].value;
}
}
days = document.getElementById("days").value;
pages = document.getElementById("pages").value;
science = document.getElementById("science").value; console.log("R1 " + wType + " Days " + days + " Pages " + pages + " Science " + science); if (wType == 'Thesis'){
if (science == 'Экономические'){
searchIndex(days,pages,thesisEconomy);
}
if (science == 'Гуманитарные'){
searchIndex(days,pages,thesisHumanities);
}
if (science == 'Технические'){
searchIndex(days,pages,thesisTechnical);
}
if (science == 'Правовые'){
searchIndex(days,pages,thesisLaw);
}
} else if (wType == 'Diploma'){
if (science == 'Экономические'){
searchIndex(days,pages,diplomEconomy);
}
if (science == 'Гуманитарные'){
searchIndex(days,pages,diplomHumanities);
}
if (science == 'Технические'){
searchIndex(days,pages,diplomTechnical);
}
if (science == 'Правовые'){
searchIndex(days,pages,diplomLaw);
}
} else if (wType == 'Course'){
if (science == 'Экономические'){
searchIndex(days,pages,courseEconomy);
}
if (science == 'Гуманитарные'){
searchIndex(days,pages,courseHumanities);
}
if (science == 'Технические'){
searchIndex(days,pages,courseTechnical);
}
if (science == 'Правовые'){
searchIndex(days,pages,courseLaw);
}
} else if (wType == 'Practice'){
searchIndex(days,pages,Practice);
} else if (wType == 'TestWork'){
searchIndex(days,pages,testWork);
}
} function searchIndex(days, pages, searchArr){
var dayIndex = 0;
var pageIndex = 0;
for(var i=0;i<(searchArr.length)-1;i++){
if (days == searchArr[0][i+1])
dayIndex= i+1;
}
for(var i=0;i<(searchArr.length)-1;i++){
if (pages == searchArr[i+1][0])
pageIndex = i+1;
}
//console.log(dayIndex );
//console.log(pageIndex );
//console.log(searchArr[pageIndex][dayIndex]);
var output = searchArr[pageIndex][dayIndex];
var rur;
console.log(output.toString().length);
if (output.toString().length >= 4) rur = ' рублей ';
else rur = ' тыс. рублей ';
document.getElementById('output').innerHTML = '<b>'+ 'Приблизительная стоимость ' + output + rur + '</b>'; //return searchArr[pageIndex][dayIndex];
}
function getRadioValue(wType)
{
var el = document.getElementById("science_block");
if (wType == 'Thesis'){
el.style.display = "block";
var arr = thesisEconomy;
} else if (wType == 'Diploma'){
el.style.display = "block";
var arr = diplomEconomy;
} else if (wType == 'Course'){
el.style.display = "block";
var arr = courseEconomy;
} else if (wType == 'Practice'){
el.style.display = "none";
var arr = Practice;
} else if (wType == 'TestWork'){
el.style.display = "none";
var arr = testWork;
}
//console.log(thesisEconomy.length); // Высота
//console.log(thesisEconomy[0][i+1]); // Выводит первую строку
//console.log(thesisEconomy[i+1][0]); // Выводит первый столбец
var pages = document.myForm.pages;
pages.length=0;
for(var i=0;i<(arr.length)-1;i++){ pages.options[i]=new Option(arr[i+1][0]);
}
var days = document.myForm.days;
days.length=0;
for(var i=0;i<(arr[0].length)-1;i++){
console.log(arr[0][i+1]);
days.options[i]=new Option(arr[0][i+1]);
}
}

</script>
<?php
// You can place PHP like this

?>
{/source}