    <!--
/*==================================================================================== */
/*  Function Name: checkForNums
       Parameters: textbox event
          Returns: Boolean
          Purpose: This function receives the event from the keyPress on the current
		  	       textbox. This will ensure that only numbers are input into the text
				   box. If it is not a number, then it will not be allowed to show up
				   on the form.
/*==================================================================================== */
function checkForNums(evt) 
{
	// Variables
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode

    if ((charCode >= 48 && charCode <= 57) ||
	(charCode == 32 || charCode == 8 || charCode == 9) ||
	(charCode == 46 || charCode == 35 || charCode == 36)) {
		return true;	
	}else{
		return false;
	}
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: checkForLetters
       Parameters: textbox event
          Returns: Boolean
          Purpose: This function receives the event from the keyPress on the current
		  	       textbox. This will ensure that only letters are input into the text
				   box. If it is not a letter, then it will not be allowed to show up
				   on the form.
/*==================================================================================== */
function checkForLetters(evt) 
{
	// Variables
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
		
    if (( charCode >= 65 && charCode <= 92 ) || 
		( charCode >= 97 && charCode <= 122 ) || 
		( charCode == 32 || charCode == 8 || charCode == 9 )||
		(charCode == 46 || charCode == 35 || charCode == 36 ))
	{
		return true;
    }
    	return false;
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: displayShipping
       Parameters: 
          Returns: Boolean
          Purpose: This function displays the shipping data entry fields
/*==================================================================================== */
function displayShipping()
{
    document.getElementById("tblShipping").style.display = "";
	
    calcTotal();
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: removeShipping
       Parameters: 
          Returns: Boolean
          Purpose: This function removes the shipping data entry fields
/*==================================================================================== */
function removeShipping()
{
    document.getElementById("tblShipping").style.display = "none";
	
    document.getElementById("txtStreetAddress").clear;
    document.getElementById("txtCity").clear;
    document.getElementById("txtZip").clear;
    document.getElementById("txtState").clear;
    document.getElementById("txtCountry").clear;    
    document.getElementById("chkInternational").clear;

    calcTotal();
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: calcTotal
       Parameters: 
          Returns: Boolean
          Purpose: This function calculates and displays the total
/*==================================================================================== */
function calcTotal()
{
    var qty = 0;
    var sub = 0;
    var tot = 0;
    
    qty = document.getElementById("txtQty").value;
    sub = qty * 19.99;    
    
	if (document.getElementById("rdoShipShip").checked) {
		if (document.getElementById("chkInternational").checked) {
			tot = sub + 19.99;
			document.getElementById("txtShipCost").value = "19.99";
		}else{
	        tot = sub + 4.99;
	   	    document.getElementById("txtShipCost").value = "4.99";
		}	
	}else{
	    document.getElementById("txtShipCost").value = "N/A";
    	tot = sub;		
	}
	    
    sub = formatCurrency(sub);
    tot = formatCurrency(tot);
    document.getElementById("txtSubTotal").value = sub; 
    document.getElementById("txtTotal").value = tot;
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: formatCurrency
       Parameters: 
          Returns: integer formatted for currenct
          Purpose: This function formats an integer for currency
/*==================================================================================== */
function formatCurrency(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: checkForm
       Parameters: None
          Returns: None
          Purpose: This function checks for any blanks that are in the text boxes. 
                   It is done in sequential order. The first instance of a blank text 
                   box will throw an error, display an error message below the textbox 
                   in violation, and put the focus on the violating textbox.           */
/*==================================================================================== */
function checkForm(){

    if (document.getElementById("txtName").value == ""){
        alert("Please enter your name");
		document.getElementById("txtName").focus();
		return false;
	    }
    else if (document.getElementById("txtPhone").value == ""){
        alert("Please enter a valid telephone number");
		document.getElementById("txtPhone").focus();
		return false;
	    }
    else if (!document.getElementById("rdoTime10").checked && !document.getElementById("rdoTime14").checked){
        alert("You must specify a time");
		document.getElementById("rdoTime").focus();
		return false;
	    }
    else if (!document.getElementById("rdoDateMay").checked && !document.getElementById("rdoDateDec").checked){
        alert("Please select a month");
		document.getElementById("rdoDate").focus();
		return false;
	    }
    else if (document.getElementById("txtQty").value == ""){
        alert("Please enter a quantity for the number of DVD's");
		document.getElementById("txtQty").focus();
		return false;
	    }
	    
    else if (document.getElementById("rdoShipShip").checked){
    
        if (document.getElementById("txtStreetAddress").value == ""){
            alert("Please enter the shipping address for the DVD(s)");
		    document.getElementById("txtStreetAddress").focus();
		    return false;
	        }
        else if (document.getElementById("txtZip").value == ""){
            alert("Please enter a valid zip code");
		    document.getElementById("txtZip").focus();
		    return false;
	        }
        else if (document.getElementById("txtCity").value == ""){
            alert("Please enter a valid city name");
		    document.getElementById("txtCity").focus();
		    return false;
	        }
	}

	calcTotal();
	
	return true;
}
/*==================================================================================== */

/*==================================================================================== */
/*  Function Name: printForm
       Parameters: None
          Returns: None
          Purpose: validates form data, calculates the total and prints the form
          
/*==================================================================================== */
function printForm(){
    if (checkForm() == true){
        window.print();
    }
}
/*==================================================================================== */
    -->
