// JavaScript Document

function ValidateForm()
{
    var companyname = document.sparesform.txtcompanyname;
    var name = document.sparesform.txtname;
	var email = document.sparesform.txtemail;
	var machname = document.sparesform.txtmachname;

	//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 txtmachname
    if (machname.value == "")
    {
        window.alert("Machine Name can not be blank!");
       	machname.focus();
        return false;
    }
	

	var total=""
	for(var i=0; i < document.sparesform.txtfirmservices.length; i++)
	{
	if(document.sparesform.txtfirmservices[i].checked)
	total +=document.sparesform.txtfirmservices[i].value + " , " 
	}
	document.sparesform.txtservices.value = total;

}

