/////////////////////////////////////////////////////////////////////////////////////Written to validate warranty form fields 							             ////Each function handles specific validation relevant to the corresponding field  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// This general function checks the input fields on the form to verify that they  //// are not empty. Additional validation can be added if necessary.                //////////////////////////////////////////////////////////////////////////////////////function isEmpty(inputStr) {	var n= inputStr	if (n == "" || n == null) {		return true		}	return false}////////////////////////////////////////////////////////////////////////////////////// This function is used to handle the addition and subtraction of the checkbox's //// on the Allison form.  It also sets the txtTotal value on that form.            //////////////////////////////////////////////////////////////////////////////////////function chkTotal(chkNum)	{		document.forms[0].txtTotal.value = "0"		for (i = 0; i<document.forms[0].checkbox.length; i++)			if(document.forms[0].checkbox[i].checked) 			{			  var e = new Number(parseFloat(document.forms[0].txtTotal.value)+parseFloat(document.forms[0].checkbox[i].value));			  x = e.toFixed(1);			  document.forms[0].txtTotal.value = x	   		}    }/////////////////////////////////////////////////////////////////////////////////////// The is the Master validation routine that is invoked once the Submit button is  //// clicked on the warranty form.  It checks the company name, contact person and   //// contact phone for user input. If no data is typed in these fields then it       //// prompts the user to select one. Else, it submits the form.                      ///////////////////////////////////////////////////////////////////////////////////////function isValid(choice) {	if (isEmpty(document.forms[0].txtCompanyName.value)) {		alert("The Company Name is required.")		document.forms[0].txtCompanyName.focus()		return false	} else {		if (isEmpty(document.forms[0].txtContactPerson.value)) {			alert("A Contact Name is required.")			document.forms[0].txtContactPerson.focus()			return false		} else {			if (isEmpty(document.forms[0].txtContactPhone.value)) {			alert("The Contact Phone is required.")			document.forms[0].txtContactPhone.focus()			return false			}		}	}	p = choice	switch (p)  	 {		case "Mitchell":			var x=document.forms[0]			x.method="post"			x.action="../_vti_bin/shtml.dll/waterloo/warrantyclaim.htm"//			alert(x.action);			x.submit()		break		case "Allison":			document.forms[0].txtTotal.disabled = false			document.forms[0].txtTotal.focus()			var x=document.forms[0]			x.method="post"			x.action="../_vti_bin/shtml.dll/waterloo/warrantyclaimallison.htm"//			alert(x.action);		    x.submit()		break  	 }	    return true}//////////////////////////////////////////////////////////////////////// This code was added on 9/22/04 to allow for coupon functionality //// 	EC	coupon.htm													//// 	PC	performancecoupon.htm										//	// 	TC	couponfreetow.htm											//// 	MC	couponpreventative.htm										//// 	DC	dealercoupon.htm											//// 																	//	//////////////////////////////////////////////////////////////////////function ShowCoupon(coupon) {	if (window.event.keyCode == 13) {				x = coupon.toUpperCase();				switch (x)			{			case "CV":				window.open ("coupons/coupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			case "MV":				window.open ("coupons/performancecoupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			case "TV":				window.open ("coupons/couponfreetow.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';			break			case "MC":				window.open ("coupons/couponpreventative.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';								break			case "DV":				window.open ("coupons/dealercoupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			default:				document.getElementById('Layer1').style.visibility='visible';				document.getElementById('couponcode').focus();			break		}	}}function ShowCoupon2(coupon) {		if (document.getElementById('btnSubmit').value='Submit') {				x = coupon.toUpperCase();				switch (x)			{			case "CV":				window.open ("coupons/coupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			case "MV":				window.open ("coupons/performancecoupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			case "TV":				window.open ("coupons/couponfreetow.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';			break			case "MC":				window.open ("coupons/couponpreventative.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';								break			case "DV":				window.open ("coupons/dealercoupon.htm",'cPop','left=25,top=25,width=600,height=435,resizable=yes')					document.getElementById('Layer1').style.visibility='hidden';				break			default:				document.getElementById('Layer1').style.visibility='visible';				document.getElementById('couponcode').focus();			break		}	}}
