<!--
function checkWhitespace(f, clientID, name, text){
    var t = getElement(f, clientID, name);
    if (isWhitespace(t.value)){
        alert("Please complete the " + text + " field.");
        t.focus();
        return true;
    }    
    return false;
}

function checkWeekDays(f,clientID)
{
	var checked=false;
	for(x=0;x<f.length;x++)
	{
		var elem=f[x];
		if (elem.name.indexOf("Weekdays") > -1)
		{
			if (elem.type=="checkbox")
			{
				if (elem.checked)
				{
				
					checked=true;
					break;
				}
			}
		}
	}
	return checked;
}

function checkTimes(f,clientID)
{
	var checked=false;
	for(x=0;x<f.length;x++)
	{
		var elem=f[x];
		if (elem.name.indexOf("Times") > -1)
		{
			if (elem.type=="checkbox")
			{
				if (elem.checked)
				{
				
					checked=true;
					break;
				}
			}
		}
	}
	return checked;
}

function validatePortfolioType(f,clientID)
{
	var selectionMade=false;
	var t = getElement(f, clientID, "MultiFamily");
	if (t.checked)
	{
		return true;
	}
	var t = getElement(f, clientID, "CommercialIndustrial");
	if (t.checked)
	{
		return true;
	}
	var t = getElement(f, clientID, "Retail");
	if (t.checked)
	{
		return true;
	}
	var t = getElement(f, clientID, "SchoolGovernment");
	if (t.checked)
	{
		return true;
	}
	var t = getElement(f, clientID, "Other");
	if (t.checked)
	{
		return true;
	}
	return false;
	
}

function validateDropDownList(f,fld)
{
	var selectionMade=true;
	var fname;
	for (x=0;x<f.length;x++)
	{
		fname=f[x].name;
		if (f[x].type=="select-one")
		{
			if (fname.indexOf(fld)>0)
			{
				if (f[x].options[f[x].selectedIndex].value=="")
				{
					selectionMade=false;
					break;
				}
			}
		}
	}
	return selectionMade;
}
function checkContactUs(f, clientID){
	var formType=f.formType.value;
	switch(formType)
		{
		case "HotSauce":
			return checkHotSauce(f,clientID);
		case "LunchLearn":
			return checkLunchLearn(f,clientID);

		default: return true;
		
		}
	}
	
function checkLunchLearn(f,clientID)
{
    if (checkWhitespace(f, clientID, "FirstNameTextBox", "First Name")){
        return false;
    }
    if (checkWhitespace(f, clientID, "LastNameTextBox", "Last Name")){
        return false;
    }
    if (checkWhitespace(f, clientID, "CompanyTextBox", "Company")){
        return false;
    }
    if (checkWhitespace(f, clientID, "Address1TextBox", "Address")){
        return false;
    }
    if (checkWhitespace(f, clientID, "CityTextBox", "City")){
        return false;
    }
    if (checkWhitespace(f, clientID, "ZipCodeTextBox", "ZIP Code")){
        return false;
    }
    if (checkWhitespace(f, clientID, "PhoneNumberTextBox", "Phone Number")){
        return false;
    }
    
    if(!validatePortfolioType(f,clientID))
    {
		alert("Please indicate the type of portfolio you manage.");
		return false;
    }
    if (checkWhitespace(f, clientID, "AttendeeNumber", "Number of attendees")){
        return false;
    }

    if (checkWhitespace(f, clientID, "HowHeardTextBox", "'\"How did you hear about Black Diamond Paving\"")){
        return false;
    }
    if (!checkWeekDays(f,clientID))
    {
		alert("Please indicate preferred day(s) of the week.");
		return false;
    }
    if (!checkTimes(f,clientID))
    {
		alert("Please indicate available hours/schedule.");
		return false;
    }
    
    return true;
}


function checkHotSauce(f, clientID){    
	if (!validateDropDownList(f,"SauceType"))
	{
		alert("Please select your sauce!");
		return false;
	}
    if (checkWhitespace(f, clientID, "FirstNameTextBox", "First Name")){
        return false;
    }
    if (checkWhitespace(f, clientID, "LastNameTextBox", "Last Name")){
        return false;
    }
    if (checkWhitespace(f, clientID, "CompanyTextBox", "Company")){
        return false;
    }
    if (checkWhitespace(f, clientID, "Address1TextBox", "Address")){
        return false;
    }
    if (checkWhitespace(f, clientID, "CityTextBox", "City")){
        return false;
    }
    if (checkWhitespace(f, clientID, "ZipCodeTextBox", "Zip Code")){
        return false;
    }
    if (checkWhitespace(f, clientID, "PhoneNumberTextBox", "Phone Number")){
        return false;
    }
    
    if(!validatePortfolioType(f,clientID))
    {
		alert("Please indicate the type of portfolio you manage.");
		return false;
    }

    if (checkWhitespace(f, clientID, "HowHeardTextBox", "'\"How did you hear about Black Diamond Paving\"")){
        return false;
    }
    return true;
}
//-->

