// JavaScript Document

function ValidateForm()
{
    var companyname = document.componentform.txtcompanyname;
    var name = document.componentform.txtname;
	var email = document.componentform.txtemail;
	var compadd = document.componentform.txtcompanyaddress;
	var city = document.componentform.txtcity;
	var state = document.componentform.txtstate;
	var zip = document.componentform.txtzip;
	var country = document.componentform.txtcountry;
	var phone = document.componentform.txtphone;
	var application = document.componentform.txtapplication;
	var modeldesc = document.componentform.txtmodeldesc;

	//validation of txtcompanyname
    if (companyname.value == "")
    {
        window.alert("Company Name can not be blank!");
        companyname.focus();
        return false;
    }
	
	//validation of txtname
    if (name.value == "")
    {
        window.alert("Name can not be blank!");
        name.focus();
        return false;
    }
	
	//validation of txtemail
	if (email.value == "")
    {
        window.alert("E-mail address can not be blank!");
        email.focus();
        return false;
    }
    if (email.value.indexOf("@", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
    if (email.value.indexOf(".", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        email.focus();
        return false;
    }
	
	//validation of txtcompanyaddress
    if (compadd.value == "")
    {
        window.alert("Company Address can not be blank!");
       	compadd.focus();
        return false;
    }
	
	//validation of txtcity
    if (city.value == "")
    {
        window.alert("City can not be blank!");
       	city.focus();
        return false;
    }
	
	//validation of txtstate
    if (state.value == "")
    {
        window.alert("State can not be blank!");
       	state.focus();
        return false;
    }

	//validation of txtzip
    if (zip.value == "")
    {
        window.alert("Zip code can not be blank!");
       	zip.focus();
        return false;
    }
	
	//validation of txtzip
    if (country.selectedIndex < 1)
    {
        alert("Country can not be blank!");
        country.focus();
        return false;
    }

	//validation of txtphone
	if (phone.value == "")
    {
        window.alert("Phone Number can not be blank!");
       	phone.focus();
        return false;
    }

	//validation of txtapplication
	if (application.value == "")
    {
        window.alert("Application can not be blank!");
       	application.focus();
        return false;
    }

	//validation of txtmodeldesc
	if (modeldesc.value == "")
    {
        window.alert("Model Description can not be blank!");
       	modeldesc.focus();
        return false;
    }


	var total=""
	for(var i=0; i < document.componentform.txtfirmservices.length; i++)
	{
	if(document.componentform.txtfirmservices[i].checked)
	total +=document.componentform.txtfirmservices[i].value + " , " 
	}
	document.componentform.txtservices.value = total;

}

