// JScript source code

function checkForm(Form){
	if (Form.bodyarea.value == ""){
		alert("You must provide a body area.")
		return false
	}	

	if (Form.previousmethod.value == ""){
		alert("You must provide how you removed the unwanted hair before.")
		return false
	}	

	if(!Form.Hair[0].checked){
	if(!Form.Hair[1].checked){
	if(!Form.Hair[2].checked){
	if(!Form.Hair[3].checked){
	if(!Form.Hair[4].checked){
	if(!Form.Hair[5].checked){
	if(!Form.Hair[6].checked){
	if(!Form.Hair[7].checked){
		alert("You must provide the hair color you want treated.")
		return false}}}}}}}
	}	

	if(!Form.Skin[0].checked){
	if(!Form.Skin[1].checked){
	if(!Form.Skin[2].checked){
	if(!Form.Skin[3].checked){
		alert("You must provide your skin color in the area you want treated.")
		return false}}}
	}	

	if(!Form.suntan[0].checked){
	if(!Form.suntan[1].checked){
	if(!Form.suntan[2].checked){
		alert("You must provide if you have a sun tan or not.")
		return false}}
	}	

	if(!Form.Type[0].checked){
	if(!Form.Type[1].checked){
	if(!Form.Type[2].checked){
	if(!Form.Type[3].checked){
	if(!Form.Type[4].checked){
	if(!Form.Type[5].checked){
		alert("You must provide your skin type.")
		return false}}}}}
	}	

	if(!Form.Accutane[0].checked){
	if(!Form.Accutane[1].checked){
		alert("You must provide if you have been on Accutane.")
		return false}
	}

	if(!Form.Medicine[0].checked){
	if(!Form.Medicine[1].checked){
		alert("You must provide if you are on any medicine.")
		return false}
	}

	if (Form.Name.value == ""){
		alert("You must provide your name.")
		return false
	}	
	
	if (Form.Address.value == ""){
		alert("You must provide your address.")
		return false
	}

	if (Form.city.value == ""){
		alert("You must provide a city.")
		return false
	}

	if (Form.state.value == ""){
		alert("You must provide a state.")
		return false
	}
	
	if (Form.zipcode.value == ""){
			alert("You must provide your zip code.")
			return false
	}else{
				if(Form.zipcode.value.length < 5 || Form.zipcode.value.length > 7){
					alert("Please provide a valid zip code.")
					return false
				}

				if(
					Form.country.options[Form.country.selectedIndex].value == '' || 
					Form.country.options[Form.country.selectedIndex].value == 'USA'
				){
					var valid = "0123456789";
					
					for (var i=0; i < Form.zipcode.value.length; i++){
						temp = "" + Form.zipcode.value.substring(i, i+1);

						if (valid.indexOf(temp) == "-1"){
							alert("Invalid characters in your zip code. Do not provide +4 or spaces.")
							return false;
						}
					}
				}
			}

	if (Form.country.value == ""){
			alert("You must provide your country.")
			return false
	}
	if(!ValidPhone(Form.phone.value)){
		return false
	}
	if (Form.Email.value == ""){
		alert("You must provide an Email address.")
		return false
	
	}
	if (!validateEmail(Form.Email.value)){
		alert("You must provide a valid Email address.")
		return false
	}
	
	return true
	
}

function validateEmail(emailAddress){
	atPos = emailAddress.indexOf("@",1)
	periodPos = emailAddress.indexOf(".",atPos)
	
	if (atPos == -1){
		return false
	}
	
	if (periodPos == -1){
		return false
	}
	
	if ((periodPos - atPos) < 3 ){
		return false
	}
	
	if ((emailAddress.length - periodPos) < 3){
		return false
	}
	
	return true

}

function ValidPhone(phone)
{
	var valid = "0123456789-";

		if(phone=="")
		{
		alert("You must provide your phone number.")
		return false
		}
		
		if(phone.length != 12)
		{
		alert("Invalid phone number! Format must be xxx-xxx-xxxx.")
		return false
		}
		
		
		for (var i=0; i < phone.length; i++)
		{
		temp = "" + phone.substring(i, i+1);
		
		
			if (valid.indexOf(temp) == "-1") 
			{
			alert("Invalid characters in your phone number.  Format must be xxx-xxx-xxxx.")
			return false;
			}
		}
		
	
		return true
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
