// JavaScript Document

function count(calc){
var item1_0price = 170;
var item1_1price = 277.5;
var item1_2price = 195;
var item1_3price = 315;
var item1_4price = 607.5;
var item1_511price = 210;
var item1_512price = 200;
var item1_513price = 75;
//matching text for prices above
var item1_0text_out = "General Household Pests\n";
var item1_1text_out = "Pests in Kitchen & Pantry\n";
var item1_2text_out = "Rodents\n";
var item1_3text_out = "Bloodsucking insects\n";
var item1_4text_out = "Parasites\n";
var item1_511text_out = "Stinging Insects\n";
var item1_512text_out = "Nest inside drywall - Removal and repair\n";
var item1_513text_out = "Working on nests - ladder work higher than 8 feet\n";
//next three are text vars
var item1_formdata = "No items selected";
var item1_5112price = "Termites - please call for free inspection and estimate\n";
var item1_5122price = "Carpenter Bees - please call for free inspection and estimate\n";
var item1_5132price = "Carpenter Ants - please call for free inspection and estimate\n";

//Quarterley services
var item1_6price = 340;
var item1_6text_out = "Quarterly treatments - 4 visits at $85 each\n";


var item2price = 0;
var item2text_out = "Animal trapping/removal - please call for free inspection and estimate\n";

var item3price = 0;//3 and 4 are placeholders for additional orders
var item4price = 0;

var header_msg ="Thank you! Here are the services you've requested.\n\n";
var footer_msg ="\nA representative of Century Termite and Pest will follow up to confirm your order and schedule a vist.\n";
var followup_alert = "Followup visits are necessary because of the egg life-cycle for these insects. (includes 2 week followup at half price )\n";
 
 // price tree - no branching to subs
 if (calc.General_Pest.checked){
	 calc.General_Pest.value = item1_0price;
   witem1_0 = item1_0price;
   witem1_0text_out = item1_0text_out;
 } else {
   witem1_0 = calc.General_Pest.value = 0;
   witem1_0text_out =  "";
 }
 if (calc.Kitchen_and_Pantry.checked){
	 calc.Kitchen_and_Pantry.value = item1_1price;
   witem1_1 =  item1_1price;
   witem1_1text_out  = item1_1text_out;
 } else {
   witem1_1 =calc.Kitchen_and_Pantry.value = 0;
   witem1_1text_out = "";
 }
  if (calc.Mice_and_Rats.checked){
	  calc.Mice_and_Rats.value = item1_2price;
   witem1_2 = item1_2price;
   witem1_2text_out = item1_2text_out;
 } else {
   witem1_2 =calc.Mice_and_Rats.value = 0;
   witem1_2text_out = "";
 }
  if (calc.Fleas_and_ticks.checked){
   calc.Fleas_and_ticks.value = item1_3price;
   witem1_3 = item1_3price;
   witem1_3text_out  = item1_3text_out;
 } else {
   witem1_3 = 0;
   witem1_3text_out  = "";
 }
  if (calc.lice_and_bedbugs.checked){
	  calc.lice_and_bedbugs.value = item1_4price;
  witem1_4 = item1_4price;
  witem1_4text_out  = item1_4text_out;
 } else {
   witem1_4  = 0;
   witem1_4text_out = "";
 }
 
  if (calc.stinging_insects.checked){
	  calc.stinging_insects.value = item1_511price;
   witem1_511 = item1_511price;
   witem1_511text_out = item1_511text_out;
 } else {
   witem1_511 = 0;
   witem1_511text_out = "";
 }
  if (calc.stingers_in_wall.checked){
	  calc.stingers_in_wall.value = item1_512price;
   witem1_512 = item1_512price;
   witem1_512text_out = item1_512text_out;
 } else {
   witem1_512  = 0;
   witem1_512text_out = "";
 }
  if (calc.stingers_uphigh.checked){
	  calc.stingers_uphigh.value = item1_513price;
   witem1_513text_out =  item1_513text_out;
   witem1_513 =  item1_513price;
 } else {
   witem1_513  = 0;
   witem1_513text_out = "";
 }
//from here the vars are all text and are assigned to the textarea
  if (calc.Termite_Inspection.checked){
	  calc.Termite_Inspection.value = item1_5112price;
   witem1_5112 =  item1_5112price;
 } else {
   witem1_5112 = "";calc.Termite_Inspection.value = "";
 }
  if (calc.Carpenter_Bees.checked){
	  calc.Carpenter_Bees.value = item1_5122price;
   witem1_5122 = item1_5122price;
 } else {
   witem1_5122 = "";calc.Carpenter_Bees.value = "";
 }
  if (calc.Carpenter_Ants.checked){
   witem1_5132 = item1_5132price;calc.Carpenter_Ants.value = item1_5132price;
 } else {
   witem1_5132 = "";calc.Carpenter_Ants.value = "";
 }

//item1_6price
 if (calc.quarterly_followups.checked){
   calc.quarterly_followups.value = item1_6price;
   witem1_6 = item1_6price;
   witem1_6text_out = item1_6text_out;
 } else {
   witem1_6  = 0;calc.quarterly_followups.value = 0;
   witem1_6text_out = "";
 }
 
 if (calc.animal_trap.checked){
   calc.animal_trap.value = item2price;
   witem2 = item2price;
   witem2text_out = item2text_out;
 } else {
   witem2 = 0;calc.animal_trap.value = "";
   witem2text_out = "";
 }

 // item3 and item4 not in use  yet
 //var witem3 = 0;
 //var witem4 = 0;
 //var item3text_out = "\n";
 //var item4text_out = "\n";

// if (calc.item3.checked) {
//   var witem3 =calc.item3.value = item3price;
// } else {
//   var witem3 =calc.item3.value = 0;
// }
// if (calc.item4.checked) {
//   var witem4 =calc.item4.value = item4price;
// } else {
//   var witem4 =calc.item4.value = 0;
// }

calc.pay.value = (witem1_0 + witem1_1 + witem1_2 + witem1_3  + witem1_4  + witem1_511 + witem1_512 + witem1_513 + witem1_6 + witem2);
// + witem3 + witem4);
calc.body.value = (header_msg + witem1_0text_out + witem1_1text_out + witem1_3text_out + witem1_4text_out + witem1_2text_out+ witem1_511text_out + witem1_512text_out + witem1_513text_out + witem1_5112 + witem1_5122 + witem1_5132 + witem1_6text_out + witem2text_out + footer_msg);
// + item3text_out + item4text_out);
}

function HideContent(d) {
document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
document.getElementById(d).style.display = "block";
}

function ReverseDisplay(d) {
if(document.getElementById(d).style.display == "none") { 
document.getElementById(d).style.display = "block"; 
} else { 
document.getElementById(d).style.display = "none"; 
}
return d;
}

	function checkboxenable(calc)	{
		if ((calc.General_Pest.checked) || (calc.Kitchen_and_Pantry.checked ) || (calc.Mice_and_Rats.checked ) || (calc.Fleas_and_ticks.checked ) || (calc.lice_and_bedbugs.checked) || (calc.stinging_insects.checked) || (calc.stingers_in_wall.checked) || (calc.stingers_uphigh.checked)){ 
		return true;
		}else{
		return false;}
	}
	
function IfNotCheckedSendAlert(calc,node,cboxstate,htmlFile){
{
PopCustomerAlertMssg((checkboxenable(calc)),node,htmlFile);
}
}

function processform(calc){
checkboxenable(calc);
count(calc);
} 
