var webPageHigh = 16; var flexiblePage = 10; var footerAtBottom = 5; var discount = 0.5; var customPage = 13; var orderFormServerError = ""; var alreadyUploadedServerError = ""; function init() { if (trim(orderFormServerError) !== '') { getID('orderFormErrorDiv').style.display = 'block'; getID('orderFormErrorDiv').innerHTML = orderFormServerError; } if (trim(alreadyUploadedServerError) !== '') { getID('alreadyUploadedText').style.display = 'block'; getID('alreadyUploadedText').innerHTML = alreadyUploadedServerError; } if (trim(getID('pagescount').value) == '') { getID('pagescount').value = '1'; } calculatePrice(); } var pagePrev = 1; function calculatePrice() { var pricePerPage = 59; var workingHours = 8; var noOfDays = 1; var dayOrDays = 'Day'; var estDate = new Date(); estDate.setDate(07); estDate.setMonth(8); estDate.setFullYear(2010); var priceShow = getID('priceDigits'); var pagesCount = parseInt(getID('pagescount').value); if (getID('webpageoption1').checked) { pricePerPage += webPageHigh; } if (getID('flexiblePage').checked) { pricePerPage += flexiblePage; } if (getID('footerBottom').checked) { pricePerPage += footerAtBottom; } var totalPrice = pricePerPage; //if (!checkIfNumber('pagescount') || trim(getID('pagescount').value) == "") if (!checkIfNumber('pagescount')) { getID('pagescount').value = '1'; } if (trim(getID('pagescount').value) !== '') { pagePrev = pagesCount; } if (pagesCount < customPage) { switch(pagesCount) { case 1: noOfDays = 1; workingHours = 8; dayOrDays = 'Day'; break;case 2: noOfDays = 2; workingHours = 16; dayOrDays = 'Days'; break;case 3: noOfDays = 3; workingHours = 20; dayOrDays = 'Days'; break;case 4: noOfDays = 3; workingHours = 24; dayOrDays = 'Days'; break;case 5: noOfDays = 4; workingHours = 32; dayOrDays = 'Days'; break;case 6: noOfDays = 5; workingHours = 36; dayOrDays = 'Days'; break;case 7: noOfDays = 5; workingHours = 40; dayOrDays = 'Days'; break;case 8: noOfDays = 6; workingHours = 48; dayOrDays = 'Days'; break;case 9: noOfDays = 7; workingHours = 54; dayOrDays = 'Days'; break;case 10: noOfDays = 7; workingHours = 56; dayOrDays = 'Days'; break;case 11: noOfDays = 8; workingHours = 64; dayOrDays = 'Days'; break;case 12: noOfDays = 9; workingHours = 68; dayOrDays = 'Days'; break;default: noOfDays = 1; workingHours = 8; dayOrDays = 'Day'; break; } if (pagesCount == 1) { totalPrice = pricePerPage; } else if (pagesCount > 1) { totalPrice = pricePerPage + (pricePerPage * discount * (pagesCount - 1)); } var months = new Array(12); months[0] = "January"; months[1] = "February"; months[2] = "March"; months[3] = "April"; months[4] = "May"; months[5] = "June"; months[6] = "July"; months[7] = "August"; months[8] = "September"; months[9] = "October"; months[10] = "November"; months[11] = "December"; estDate.setDate(estDate.getDate() + noOfDays); expectedDateFormat = estDate.getFullYear() + '-' + (estDate.getMonth() + 1) + '-' + estDate.getDate(); estDate = months[estDate.getMonth()] + " " + estDate.getDate() + ", " + estDate.getFullYear(); totalPrice = roundNumber(totalPrice, 0); priceShow.innerHTML = '$' + totalPrice; getID('workinghrs').innerHTML = workingHours; getID('days').innerHTML = noOfDays; getID('day').innerHTML = dayOrDays; getID('date').innerHTML = estDate; } else if (pagesCount >= customPage) { priceShow.innerHTML = 'Custom'; getID('workinghrs').innerHTML = 'Custom'; getID('days').innerHTML = 'Custom'; getID('day').innerHTML = 'Custom'; getID('date').innerHTML = 'Custom'; } getID('priceInput').value = totalPrice; //alert(pagesPrev); getID('daysInput').value = noOfDays; getID('hoursCount').value = workingHours; getID('expectedDate').value = expectedDateFormat; setTimeout("calculatePrice()", 100); } function resetPageCount() { getID('pagescount').value = pagePrev; return true; }