function isEmailAddr(Email)
{
  var result = false;
  var theStr = new String(Email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
  result = true;
  }
  return result;
}

function validEmail(formField)
{
  var result = true;

  if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
  {
    result = false;
  }
   
  return result;

}

function checkContact() {
	if (document.contact.fname.value.length < 1) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('fname').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter a value in the First Name field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
			}
		document.contact.fname.value = 'Please enter your first name here';
		return false;
	}
	if (document.contact.lname.value.length < 1) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('lname').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter a value in the Last Name field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.lname.value = 'Please enter your last name here';
		return false;
	}
	if (document.contact.company.value.length < 1) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('company').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter a value in the Company field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.company.value = 'Please enter your company\'s name here';
		return false;
	}
//	/////////////////////country//////////////////
//	if (document.contact.country.options[0].selected) {
//		if (document.getElementById) {
//			document.getElementById('contact-error').style.display = 'block';
//			document.getElementById('contact-error-span').style.display = 'block';
//			document.getElementById('contact-error-span').innerHTML = ('* Please selct a country from the dropdown menu');
//			document.getElementById('imgButton').src = '../images/button-submit-error.gif';
//		}
//		document.contact.country.focus();
//		return false;
//	}
//	//////////////////////
	
	if (document.contact.phone.value.length < 1) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('phone').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter a value in the Phone field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.phone.value = 'Please enter your phone number here';
		return false;
	}
	if (!validEmail(document.contact.email)) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('email').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter a valid email address in the Email field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.email.value = 'Please enter your email address here';
		return false;
	}
	if (!validEmail(document.contact.email2)) {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('email2').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please confirm your email address in the Confirm Email field');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.email2.value = 'Please confirm your email address here';
		return false;
	}
	if (document.contact.txtEmpl.value == '') {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('txtEmpl').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please Enter No. of Employee');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.txtEmpl.value = 'Please Enter No. of Employee';
		return false;
	}
		if (document.contact.txtAnnRev.value == '') {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('txtAnnRev').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please Enter Annual Sales Revenue');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.txtAnnRev.value = 'Please Enter Annual Sales Revenue';
		return false;
	}
	if (document.contact.txtServ.value == '') {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('txtServ').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please Enter type of service you need');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.txtServ.value = 'Please Enter type of service you need';
		return false;
	}
	if (document.contact.txtdate.value == '') {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('txtdate').style.color = '#cc0000';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter Date');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.txtdate.value = '__/__/__';
		return false;
	}

	if (document.contact.comments.value == '') {
		if (document.getElementById) {
			document.getElementById('contact-error').style.display = 'block';
			document.getElementById('contact-error-span').style.display = 'block';
			document.getElementById('contact-error-span').innerHTML = ('* Please enter your comment(s) or question(s) in the box below');
			document.getElementById('Button1').src = '../images/button-submit-error.gif';
		}
		document.contact.comments.focus();
		return false;
	}
	return true;
}




