// JavaScript Document
// Form Submit Validation of Input on Quote form on Studio 119 Degrees Web Site

function validateForm(Studio119Quote)
{

if(""==document.forms.Studio119Quote.Name.value || "First and Last Name"==document.forms.Studio119Quote.Name.value)
{
alert("Please enter your full name.");
document.forms.Studio119Quote.Name.focus();
return false;
}

if(""==document.forms.Studio119Quote.Email.value || "e.g. myname@example.com"==document.forms.Studio119Quote.Email.value)
{
alert("Please enter your email address.");
document.forms.Studio119Quote.Email.focus();
return false;
}

if(""==document.forms.Studio119Quote.Phone.value || "e.g 555-555-5555"==document.forms.Studio119Quote.Phone.value)
{
alert("Please enter your phone number.");
document.forms.Studio119Quote.Phone.focus();
return false;
}

// Radio Button Validation
if ( ( document.forms.Studio119Quote.BestTimeToCall[0].checked == false )
  && ( document.forms.Studio119Quote.BestTimeToCall[1].checked == false )
  && ( document.forms.Studio119Quote.BestTimeToCall[2].checked == false ) )
    {
        alert ( "Please select a best time for us to call you." );
		document.forms.Studio119Quote.BestTimeToCall[0].focus();
		return false;
    }
	
if ( ( document.forms.Studio119Quote.TypeOfDesign[0].checked == false )
  && ( document.forms.Studio119Quote.TypeOfDesign[1].checked == false ) )
    {
        alert ( "Please select if this is a new design or re-design." );
		document.forms.Studio119Quote.TypeOfDesign[0].focus();
		return false;
    }	
	
// Select Box Validation
if( document.Studio119Quote.PagesNeeded.selectedIndex > 0) {
    // an option has been selected
	//return true;
  } else {
    // no option selected
	alert ( "Please select how many pages you need Designed or Developed." );
	document.forms.Studio119Quote.PagesNeeded.selectedIndex = 0; // The first index in the array
    document.forms.Studio119Quote.PagesNeeded.focus();
	return false;
  }
  
if( document.Studio119Quote.StartDate.selectedIndex > 0) {
    // an option has been selected
	//return true;
  } else {
    // no option selected
	alert ( "Please select a Desired Project Start Date." );
	document.forms.Studio119Quote.StartDate.selectedIndex = 0; // The first index in the array
    document.forms.Studio119Quote.StartDate.focus();
	return false;
  }
  
if( document.Studio119Quote.EndDate.selectedIndex > 0) {
    // an option has been selected
	//return true; has to be on last select box checked to exit out of the loop
	return true;
  } else {
    // no option selected
	alert ( "Please select a Desired Project End Date." );
	document.forms.Studio119Quote.EndDate.selectedIndex = 0; // The first index in the array
    document.forms.Studio119Quote.EndDate.focus();
	return false;
  }  

return false;
}

