/* actually not the sale rep script any more, it's now the secret pal page's script */
function checkSalesRepForm()	{
	var pattern1 = /[\w\-]+\@[\w\-]+\.\w{2,3}/;
	var pattern2 = /\d{3}\-\d{3}\-\d{4}/;

	if (document.getElementById('conName').value.length < 3)	{
		alert("Please enter your name");
		document.getElementById('conName').focus();
		document.getElementById('conName').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('conName').style.backgroundColor = '#FFFFFF';
		}
	if (document.getElementById('addy1').value.length < 5)	{
		alert("Please enter your address");
		document.getElementById('addy1').focus();
		document.getElementById('addy1').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('addy1').style.backgroundColor = '#FFFFFF';
		}
	if (document.getElementById('city').value.length < 5)	{
		alert("Please enter your city");
		document.getElementById('city').focus();
		document.getElementById('city').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('city').style.backgroundColor = '#FFFFFF';
		}
	if (document.getElementById('country').selectedIndex == 0)	{
		alert("Please select your country");
		document.getElementById('country').focus();
		document.getElementById('country').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('country').style.backgroundColor = '#FFFFFF';
		}
	if ((document.getElementById('country').selectedIndex == 1 || document.getElementById('country').selectedIndex == 15) && document.getElementById('state').selectedIndex == 0)	{
		alert("Please select your state / province");
		document.getElementById('state').focus();
		document.getElementById('state').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('state').style.backgroundColor = '#FFFFFF';
		}
	if ((document.getElementById('country').selectedIndex == 1 || document.getElementById('country').selectedIndex == 15) && document.getElementById('zipcode').value.length != 5)	{
		alert("Please enter your zipcode");
		document.getElementById('zipcode').focus();
		document.getElementById('zipcode').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('zipcode').style.backgroundColor = '#FFFFFF';
		}
	if (!pattern2.test(document.getElementById('bizPhone').value))	{
		alert("Please enter your  phone number in xxx-xxx-xxxx format");
		document.getElementById('bizPhone').focus();
		document.getElementById('bizPhone').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('bizPhone').style.backgroundColor = '#FFFFFF';
		}
	if (!pattern1.test(document.getElementById('conEmail').value))	{
		alert("The email address you have enter appears to be incorrect, please check it and resubmit the form");
		document.getElementById('conEmail').focus();
		document.getElementById('conEmail').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('conEmail').style.backgroundColor = '#FFFFFF';
		}
	/* secret pal shipping info */
	if (document.getElementById('palOrder').checked)	{
		if (document.getElementById('palName').value.length < 3)	{
			alert("Please enter your secret pals name");
			document.getElementById('palName').focus();
			document.getElementById('palName').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palName').style.backgroundColor = '#FFFFFF';
			}
		if (document.getElementById('palAddy1').value.length < 5)	{
			alert("Please enter your secret pals address");
			document.getElementById('palAddy1').focus();
			document.getElementById('palAddy1').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palAddy1').style.backgroundColor = '#FFFFFF';
			}
		if (document.getElementById('palCity').value.length < 5)	{
			alert("Please enter your secret pals city");
			document.getElementById('palCity').focus();
			document.getElementById('palCity').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palCity').style.backgroundColor = '#FFFFFF';
			}
		if (document.getElementById('palCountry').selectedIndex == 0)	{
			alert("Please select your secret pals country");
			document.getElementById('palCountry').focus();
			document.getElementById('palCountry').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palCountry').style.backgroundColor = '#FFFFFF';
			}
		if ((document.getElementById('palCountry').selectedIndex == 1 || document.getElementById('palCountry').selectedIndex == 15) && document.getElementById('palState').selectedIndex == 0)	{
			alert("Please select your secret pals state / province");
			document.getElementById('palState').focus();
			document.getElementById('palState').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palState').style.backgroundColor = '#FFFFFF';
			}
		if ((document.getElementById('palCountry').selectedIndex == 1 || document.getElementById('palCountry').selectedIndex == 15) && document.getElementById('palZipcode').value.length != 5)	{
			alert("Please enter your secret pals zipcode");
			document.getElementById('palZipcode').focus();
			document.getElementById('palZipcode').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('palZipcode').style.backgroundColor = '#FFFFFF';
			}
		if (document.getElementById('bizTell').value == 'List of products to be added to Secret Pal (Gift Recipient) Order or your discount code *')	{
			alert("Please enter a list of the products to be shipped your secret pal in the text area provided");
			document.getElementById('bizTell').focus();
			document.getElementById('bizTell').style.backgroundColor = '#FBF780';
			return false;
			}
		else	{
			document.getElementById('bizTell').style.backgroundColor = '#FFFFFF';
			}
		}
		/* end secret pal logic */
	if (document.getElementById('bizTell').value.length == 0 || document.getElementById('bizTell').value == 'List of products to be added to Secret Pal (Gift Recipient) Order or your discount code *')	{
		alert("Please enter your discount code in the text area provided");
		document.getElementById('bizTell').focus();
		document.getElementById('bizTell').style.backgroundColor = '#FBF780';
		return false;
		}
	else	{
		document.getElementById('bizTell').style.backgroundColor = '#FFFFFF';
		}
	}

function openPalInfo()	 {
	var fields = new Array("palName", "palAddy1", "palAddy2", "palCity", "palState", "palCountry", "palZipcode");
	if (document.getElementById('palOrder').checked)	{
		for (var x = 0 ; x < fields.length ; x++)	{
			document.getElementById(fields[x]).disabled = false;
			}
		}
	else	{
		for (var x = 0 ; x < fields.length ; x++)	{
			document.getElementById(fields[x]).disabled = true;
			}
		}
	}