/**
* Form Validate - K Hackenberg (Gould) - 12-28-2006
**/

var ie4 = document.all;

function checkIT() {

	if (document.cv.ws_email.value == "") {
		alert("Your Email Address is required !!!");
		document.cv.ws_email.focus();
		if (ie4) {			
			document.cv.ws_email.style.backgroundColor='00ffff'
		}
		return false;
	}
	    var inputVal = document.cv.ws_email.value
		var inputStr = inputVal.toString();
		var i = 1;
	    var sLength = inputStr.length;
	
	    // look for @
	    while ((i < sLength) && (inputStr.charAt(i) != "@"))
	    { i++
	    }
	    if ((i >= sLength) || (inputStr.charAt(i) != "@")) {
		alert("Enter a valid email address please !");
		return false;
		}	
		    else  i += 2;	
	    // look for .
	    while ((i < sLength) && (inputStr.charAt(i) != "."))
	    { i++
	    }
	    if ((i >= sLength - 1) || (inputStr.charAt(i) != ".")) {
		alert("Enter a valid email address please !");
		return false;
		}

		{
  		document.cv.submit();
		return true;	
	}
}

function checkIT2() {
	
	if (document.cv.vio_city.options[0].selected) {
		alert("Please select the city of the violation !!!");
		document.cv.vio_city.focus();
		if (ie4) {			
			document.cv.vio_city.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.ws_comments.value == "") {
		alert("Violation Description required !!!");
		document.cv.ws_comments.focus();
		if (ie4) {			
			document.cv.ws_comments.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_first_name.value == "") {
		alert("Your First Name is required !!!");
		document.cv.comp_first_name.focus();
		if (ie4) {			
			document.cv.comp_first_name.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_last_name.value == "") {
		alert("Your Last Name is required !!!");
		document.cv.comp_last_name.focus();
		if (ie4) {			
			document.cv.comp_last_name.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_address.value == "") {
		alert("Your Street Address is required !!!");
		document.cv.comp_address.focus();
		if (ie4) {			
			document.cv.comp_address.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_city.value == "") {
		alert("Your City is required !!!");
		document.cv.comp_city.focus();
		if (ie4) {			
			document.cv.comp_city.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_state.value == "" || document.cv.comp_state.value.length != 2) {
		alert("Your State is required !!!");
		document.cv.comp_state.focus();
		if (ie4) {			
			document.cv.comp_state.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_zip.value == "") {
		alert("Your Zip Code is required !!!");
		document.cv.comp_zip.focus();
		if (ie4) {			
			document.cv.comp_zip.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_zip.value.length <= 4) {
		alert("Enter a valid Zip Code please !!!");
		document.cv.comp_zip.focus();
		if (ie4) {			
			document.cv.comp_zip.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_email.value == "") {
		alert("Your Email Address is required !!!");
		document.cv.comp_email.focus();
		if (ie4) {			
			document.cv.comp_email.style.backgroundColor='00ffff'
		}
		return false;
	}
	    var inputVal = document.cv.comp_email.value
		var inputStr = inputVal.toString();
		var i = 1;
	    var sLength = inputStr.length;
	
	    // look for @
	    while ((i < sLength) && (inputStr.charAt(i) != "@"))
	    { i++
	    }
	    if ((i >= sLength) || (inputStr.charAt(i) != "@")) {
		alert("Enter a valid email address please !");
		return false;
		}
	
		    else  i += 2;
	
	
	    // look for .
	    while ((i < sLength) && (inputStr.charAt(i) != "."))
	    { i++
	    }
	    if ((i >= sLength - 1) || (inputStr.charAt(i) != ".")) {
		alert("Enter a valid email address please !");
		return false;
		}
	if (document.cv.comp_area_code.value == "") {
		alert("Your Area Code is required !!!");
		document.cv.comp_area_code.focus();
		if (ie4) {			
			document.cv.comp_area_code.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_area_code.value.length != 3) {
		alert("Please enter a valid Area Code  !!!");
		document.cv.comp_area_code.focus();
		if (ie4) {			
			document.cv.comp_area_code.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_phone.value == "") {
		alert("Your Phone Number is required !!!");
		document.cv.comp_phone.focus();
		if (ie4) {			
			document.cv.comp_phone.style.backgroundColor='00ffff'
		}
		return false;
	}
	if (document.cv.comp_phone.value.length <= 6 ) {
		alert("Please enter a valid Phone Number !!!");
		document.cv.comp_phone.focus();
		if (ie4) {			
			document.cv.comp_phone.style.backgroundColor='00ffff'
		}
		return false;
	}	
			
		{
  		document.cv.submit();
		return true;	
	
	}
}

