﻿// JScript File

function textLimit(field, maxlen) {
 if (field.value.length > maxlen) {
 field.value = field.value.substring(0, maxlen);
} }

function chck_flds(frm) {
  var msg = "";
  var noblanks = true;
  for(var i = 0;i < frm.length; i++) {
    if(frm[i].name != "submit" && !frm[i].value.match(/\w+/)) {
     noblanks = false;
     msg += "Please complete field: " + frm[i].id + "  " + frm[i].value + "\n";
    }  
  }
  if(noblanks == false) alert(msg);
  return noblanks;
}


function calc(id) {
 var people = document.getElementById("people" + id).value;
 var price = document.getElementById("price" + id).value;
 var tot = people * price;

 //document.getElementById("tot" + id).innerHTML = "$" + tot;
 document.getElementById("total" + id).value = tot;
 var tot1 = parseInt(document.getElementById("total1").value);
 var tot2 = parseInt(document.getElementById("total2").value);
 var tot4 = parseInt(document.getElementById("total4").value);
if (isNaN(tot1)) { tot1 = 0;}
if (isNaN(tot2)) { tot2 = 0;}
if (isNaN(tot4)) { tot4 = 0;}
 document.getElementById("grandtotal").value = tot1 + tot2 + tot4;
}


function CheckContactInfoForm(frm)
{
	msg = '';
	if (frm.cmp_First_Name.value == '')
		msg += "Please enter your First name.\n";
	if (frm.cmp_Last_Name.value == '')
		msg += "Please enter your Last name.\n";
	if (frm.cmp_Birthday.value == '')
		msg += "Please enter your Birthday.\n";
	if (frm.cmp_Class_Year.value == '')
		msg += "Please enter your Class year.\n";
	if (msg == '')
	{
		return true;
	}
	else
	{
		alert(msg);
		return false;
	}
}