// Page-1 checking start

function firm_name()
{
	if(document.supplier.firm_name.value == "")
	{
		alert("Please enter 'Vendor' or 'Supplier' or 'Firm' name.");
		document.supplier.firm_name.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function year_establishment()
{
	dt = new Date();
	yr = dt.getYear();
	if(document.supplier.year_establishment.value == "")
	{
		alert("Please enter year of establishment.");
		document.supplier.year_establishment.focus();
		return 0;
	}
	else
	{
		if(parseInt(document.supplier.year_establishment.value) <= 0)
		{
			alert("Year of establishment can not be Zero or Negative value.\nPlease enter valid year.");
			document.supplier.year_establishment.focus();
			return 0;
		}
		else if(parseInt(document.supplier.year_establishment.value) > yr)
		{
			alert("Year of establishment can not be more than current year.\nPlease enter valid year.");
			document.supplier.year_establishment.focus();
			return 0;
		}
		else if(document.supplier.year_establishment.value.length < 4)
		{
			alert("Invalid year.\nPlease enter valid year.");
			document.supplier.year_establishment.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}

}

function head_office_address()
{
	if(document.supplier.head_office_address.value == "")
	{
		alert("Please enter head office address.");
		document.supplier.head_office_address.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function head_office_city()
{
	if(document.supplier.head_office_city.value == "")
	{
		alert("Please enter the city of your head office.");
		document.supplier.head_office_city.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function head_office_pin()
{
	if(document.supplier.head_office_pin.value == "")
	{
		alert("Please enter the pin code of your head office.");
		document.supplier.head_office_pin.focus();
		return 0;
	}
	else
	{
		if(document.supplier.head_office_pin.value.length < 6)
		{
			alert("Pin code can not be less than 6 characters.\nPlease enter valid pin code of your head office.");
			document.supplier.head_office_pin.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
}

function head_office_phone()
{
	if(document.supplier.head_office_phone.value == "")
	{
		alert("Please enter head office telephone number.");
		document.supplier.head_office_phone.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function head_office_email()
{
	if(document.supplier.head_office_email.value == "")
	{
		alert("Please enter head office email address.");
		document.supplier.head_office_email.focus();
		return 0;
	}
	else
	{
		emailid = document.supplier.head_office_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing.");
			document.supplier.head_office_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing.");
			document.supplier.head_office_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
}

function branch1_name()
{
	if(document.supplier.branch1_name.value.length > 0)
	{
		if(document.supplier.branch1_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.branch1_name.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch1_email()
{
	if(document.supplier.branch1_email.value.length > 0)
	{
		emailid = document.supplier.branch1_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing in Branch1.");
			document.supplier.branch1_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing in Branch1.");
			document.supplier.branch1_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch2_name()
{
	if(document.supplier.branch2_name.value.length > 0)
	{
		if(document.supplier.branch2_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.branch2_name.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch2_email()
{
	if(document.supplier.branch2_email.value.length > 0)
	{
		emailid = document.supplier.branch2_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing in Branch2.");
			document.supplier.branch2_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing in Branch2.");
			document.supplier.branch2_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch3_name()
{
	if(document.supplier.branch3_name.value.length > 0)
	{
		if(document.supplier.branch3_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.branch3_name.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch3_email()
{
	if(document.supplier.branch3_email.value.length > 0)
	{
		emailid = document.supplier.branch3_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing in Branch3.");
			document.supplier.branch3_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing in Branch3.");
			document.supplier.branch3_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function branch4_name()
{
	if(document.supplier.branch4_name.value.length > 0)
	{
		if(document.supplier.branch4_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.branch4_name.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function ownership_information()
{
	var ownership = 0;
	var msg = "";
	if(document.supplier.govt_of_india_undertaking_yes_no.value == "Yes")
	{
		ownership++;
		msg = "\nGovt. of India Undertaking";
	}
	if(document.supplier.state_govt_undertaking_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nState Govt. Undertaking";
	}
	if(document.supplier.limited_company_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nLimited Company";
	}
	if(document.supplier.private_company_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nPrivate Company";
	}
	if(document.supplier.co_operative_society_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nCo-Operative Society";
	}
	if(document.supplier.partnership_firm_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nPartnership Firm";
	}
	if(document.supplier.proprietorship_firm_yes_no.value == "Yes")
	{
		ownership++;
		msg = msg + "\nProprietorship Firm";
	}
	if(document.supplier.other_ownership.value.length > 0)
	{
		ownership++;
		msg = msg + "\n" + document.supplier.other_ownership.value;
	}

	if(ownership > 1)
	{
		alert("Please specify proper ownership information.\nOwnership information can not be multiple.\n\nAt a time you have chosen:\n" + msg);
		document.supplier.govt_of_india_undertaking_yes_no.focus();
		return 0;
	}
	else
	{
		if(ownership == 0)
		{
			alert("Please specify you ownership information.");
			document.supplier.other_ownership.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
}


function branch4_email()
{
	if(document.supplier.branch4_email.value.length > 0)
	{
		emailid = document.supplier.branch4_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing in Branch4.");
			document.supplier.branch4_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing in Branch4.");
			document.supplier.branch4_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function official_name()
{
	if(document.supplier.official_name.value == "")
	{
		alert("Please enter official name.");
		document.supplier.official_name.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function official_designation()
{
	if(document.supplier.official_designation.value == "")
	{
		alert("Please enter official designation.");
		document.supplier.official_designation.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function official_address()
{
	if(document.supplier.official_address.value == "")
	{
		alert("Please enter official address.");
		document.supplier.official_address.focus();
		return 0;
	}
	else
	{
		if(document.supplier.official_address.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.official_address.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
}

function official_phone()
{
	if(document.supplier.official_phone.value == "")
	{
		alert("Please enter official telephone number.");
		document.supplier.official_phone.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function official_email()
{
	if(document.supplier.official_email.value == "")
	{
		alert("Please enter official email address.");
		document.supplier.official_email.focus();
		return 0;
	}
	else
	{
		emailid = document.supplier.official_email.value;
		if(emailid.indexOf("@") == -1)
		{
			alert("Please check the email id.\n'@' Symbol is missing.");
			document.supplier.official_email.focus();
			return 0;
		}
		else if(emailid.indexOf(".") == -1)
		{
			alert("Please check the email id.\n'.' Symbol is missing.");
			document.supplier.official_email.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
}

function total_organization_strength()
{
	// For members in administration dept.
	if(document.supplier.administration_graduates.value == "")
	{
		document.supplier.administration_graduates.value = "0";
	}
	if(document.supplier.administration_diploma.value == "")
	{
		document.supplier.administration_diploma.value = "0";
	}
	if(document.supplier.administration_skilled.value == "")
	{
		document.supplier.administration_skilled.value = "0";
	}
	if(document.supplier.administration_non_skilled.value == "")
	{
		document.supplier.administration_non_skilled.value = "0";
	}

	// For members in engineering dept.
	if(document.supplier.engineering_graduates.value == "")
	{
		document.supplier.engineering_graduates.value = "0";
	}
	if(document.supplier.engineering_diploma.value == "")
	{
		document.supplier.engineering_diploma.value = "0";
	}
	if(document.supplier.engineering_skilled.value == "")
	{
		document.supplier.engineering_skilled.value = "0";
	}
	if(document.supplier.engineering_non_skilled.value == "")
	{
		document.supplier.engineering_non_skilled.value = "0";
	}

	// For members in technology dept.
	if(document.supplier.technology_graduates.value == "")
	{
		document.supplier.technology_graduates.value = "0";
	}
	if(document.supplier.technology_diploma.value == "")
	{
		document.supplier.technology_diploma.value = "0";
	}
	if(document.supplier.technology_skilled.value == "")
	{
		document.supplier.technology_skilled.value = "0";
	}
	if(document.supplier.technology_non_skilled.value == "")
	{
		document.supplier.technology_non_skilled.value = "0";
	}

	// For members in technology dept.
	if(document.supplier.technology_graduates.value == "")
	{
		document.supplier.technology_graduates.value = "0";
	}
	if(document.supplier.technology_diploma.value == "")
	{
		document.supplier.technology_diploma.value = "0";
	}
	if(document.supplier.technology_skilled.value == "")
	{
		document.supplier.technology_skilled.value = "0";
	}
	if(document.supplier.technology_non_skilled.value == "")
	{
		document.supplier.technology_non_skilled.value = "0";
	}

	// For members in manufacturing dept.
	if(document.supplier.manufacturing_graduates.value == "")
	{
		document.supplier.manufacturing_graduates.value = "0";
	}
	if(document.supplier.manufacturing_diploma.value == "")
	{
		document.supplier.manufacturing_diploma.value = "0";
	}
	if(document.supplier.manufacturing_skilled.value == "")
	{
		document.supplier.manufacturing_skilled.value = "0";
	}
	if(document.supplier.manufacturing_non_skilled.value == "")
	{
		document.supplier.manufacturing_non_skilled.value = "0";
	}

	// For members in quality dept.
	if(document.supplier.quality_graduates.value == "")
	{
		document.supplier.quality_graduates.value = "0";
	}
	if(document.supplier.quality_diploma.value == "")
	{
		document.supplier.quality_diploma.value = "0";
	}
	if(document.supplier.quality_skilled.value == "")
	{
		document.supplier.quality_skilled.value = "0";
	}
	if(document.supplier.quality_non_skilled.value == "")
	{
		document.supplier.quality_non_skilled.value = "0";
	}

	// For members in maintenance dept.
	if(document.supplier.maintenance_graduates.value == "")
	{
		document.supplier.maintenance_graduates.value = "0";
	}
	if(document.supplier.maintenance_diploma.value == "")
	{
		document.supplier.maintenance_diploma.value = "0";
	}
	if(document.supplier.maintenance_skilled.value == "")
	{
		document.supplier.maintenance_skilled.value = "0";
	}
	if(document.supplier.maintenance_non_skilled.value == "")
	{
		document.supplier.maintenance_non_skilled.value = "0";
	}

	// For members in site_management dept.
	if(document.supplier.site_management_graduates.value == "")
	{
		document.supplier.site_management_graduates.value = "0";
	}
	if(document.supplier.site_management_diploma.value == "")
	{
		document.supplier.site_management_diploma.value = "0";
	}
	if(document.supplier.site_management_skilled.value == "")
	{
		document.supplier.site_management_skilled.value = "0";
	}
	if(document.supplier.site_management_non_skilled.value == "")
	{
		document.supplier.site_management_non_skilled.value = "0";
	}

	// For members in others dept.
	if(document.supplier.others_graduates.value == "")
	{
		document.supplier.others_graduates.value = "0";
	}
	if(document.supplier.others_diploma.value == "")
	{
		document.supplier.others_diploma.value = "0";
	}
	if(document.supplier.others_skilled.value == "")
	{
		document.supplier.others_skilled.value = "0";
	}
	if(document.supplier.others_non_skilled.value == "")
	{
		document.supplier.others_non_skilled.value = "0";
	}

	// For total.
	if(document.supplier.total_graduates.value == "" || document.supplier.total_diploma.value == "" || document.supplier.total_skilled.value == "" || document.supplier.total_non_skilled.value == "")
	{
		alert("Total organization strength can not be blank.\nPlease click 'Calculate' link to get the total.");
		document.supplier.total_graduates.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function check1()
{
	if (firm_name() == 0)
	{
		return false;
	}
	else if (year_establishment() == 0)
	{
		return false;
	}
	else if (head_office_address() == 0)
	{
		return false;
	}
	else if (head_office_city() == 0)
	{
		return false;
	}
	else if (head_office_pin() == 0)
	{
		return false;
	}
	else if (head_office_phone() == 0)
	{
		return false;
	}
	else if (head_office_email() == 0)
	{
		return false;
	}
	else if (branch1_name() == 0)
	{
		return false;
	}
	else if (branch1_email() == 0)
	{
		return false;
	}
	else if (branch2_name() == 0)
	{
		return false;
	}
	else if (branch2_email() == 0)
	{
		return false;
	}
	else if (branch3_name() == 0)
	{
		return false;
	}
	else if (branch3_email() == 0)
	{
		return false;
	}
	else if (branch4_name() == 0)
	{
		return false;
	}
	else if (branch4_email() == 0)
	{
		return false;
	}
	else if (ownership_information() == 0)
	{
		return false;
	}
	else if (official_name() == 0)
	{
		return false;
	}
	else if (official_designation() == 0)
	{
		return false;
	}
	else if (official_address() == 0)
	{
		return false;
	}
	else if (official_phone() == 0)
	{
		return false;
	}
	else if (official_email() == 0)
	{
		return false;
	}	
	else if (total_organization_strength() == 0)
	{
		return false;
	}
	else
	{
		return true;
	}
}

// Page-1 checking end

//******************************//

// Page-2 checking start

function enlistment_item_category()
{
	if(document.supplier.enlistment_item_category.value == "")
	{
		alert("Please select atleast one enlistment item category from the given list.");
		document.supplier.enlistment_item_category.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function enlistment_item_name()
{
	if(document.supplier.enlistment_item_name.value == "")
	{
		alert("Please specify the items seperating by coma ','.");
		document.supplier.enlistment_item_name.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function manufacturer_checking_yes_no()
{
	if(document.supplier.manufacturer_checking_yes_no.value == "Yes")
	{
		if(document.supplier.factory1_name.value == "")
		{
			alert("Please enter atleast one factory name & address.");
			document.supplier.factory1_name.focus();
			return 0;
		}
		else if(document.supplier.factory1_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.factory1_name.focus();
			return 0;
		}
		else if(document.supplier.factory1_phone.value == "")
		{
			alert("Please enter factory's telephone number.");
			document.supplier.factory1_phone.focus();
			return 0;
		}
		else if(document.supplier.factory1_email.value.length > 0)
		{
			emailid = document.supplier.factory1_email.value;
			if(emailid.indexOf("@") == -1)
			{
				alert("Please check the email id.\n'@' Symbol is missing in Branch2.");
				document.supplier.factory1_email.focus();
				return 0;
			}
			else if(emailid.indexOf(".") == -1)
			{
				alert("Please check the email id.\n'.' Symbol is missing in Branch2.");
				document.supplier.factory1_email.focus();
				return 0;
			}
			else
			{
				return 1;
			}
		}
		else if(document.supplier.factory2_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.factory2_name.focus();
			return 0;
		}
		else if(document.supplier.factory2_email.value.length > 0)
		{
			emailid = document.supplier.factory2_email.value;
			if(emailid.indexOf("@") == -1)
			{
				alert("Please check the email id.\n'@' Symbol is missing in Branch2.");
				document.supplier.factory2_email.focus();
				return 0;
			}
			else if(emailid.indexOf(".") == -1)
			{
				alert("Please check the email id.\n'.' Symbol is missing in Branch2.");
				document.supplier.factory2_email.focus();
				return 0;
			}
			else
			{
				return 1;
			}
		}
		else if(document.supplier.factory3_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.factory3_name.focus();
			return 0;
		}
		else if(document.supplier.factory3_email.value.length > 0)
		{
			emailid = document.supplier.factory3_email.value;
			if(emailid.indexOf("@") == -1)
			{
				alert("Please check the email id.\n'@' Symbol is missing in Branch2.");
				document.supplier.factory3_email.focus();
				return 0;
			}
			else if(emailid.indexOf(".") == -1)
			{
				alert("Please check the email id.\n'.' Symbol is missing in Branch2.");
				document.supplier.factory3_email.focus();
				return 0;
			}
			else
			{
				return 1;
			}
		}
		else if(document.supplier.factory4_name.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.factory4_name.focus();
			return 0;
		}
		else if(document.supplier.factory4_email.value.length > 0)
		{
			emailid = document.supplier.factory4_email.value;
			if(emailid.indexOf("@") == -1)
			{
				alert("Please check the email id.\n'@' Symbol is missing in Branch2.");
				document.supplier.factory4_email.focus();
				return 0;
			}
			else if(emailid.indexOf(".") == -1)
			{
				alert("Please check the email id.\n'.' Symbol is missing in Branch2.");
				document.supplier.factory4_email.focus();
				return 0;
			}
			else
			{
				return 1;
			}
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function agent_yes_no()
{
	if(document.supplier.agent_yes_no.value == "Yes")
	{
		if(document.supplier.agent_name_address1.value == "")
		{
			alert("Please enter atleast one name and address of manufacturer.");
			document.supplier.agent_name_address1.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address1.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address1.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address2.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address2.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address3.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address3.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address4.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address4.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address5.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address5.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address6.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address6.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address7.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address7.focus();
			return 0;
		}
		else if(document.supplier.agent_name_address8.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.agent_name_address8.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function stockiest_yes_no()
{
	if(document.supplier.stockiest_yes_no.value == "Yes")
	{
		if(document.supplier.stockiest_item1.value == "")
		{
			alert("Please enter atleast one item name in store.");
			document.supplier.stockiest_item1.focus();
			return 0;
		}
		else if(document.supplier.present_stock1.value == "")
		{
			alert("Please enter atlease one present stock value.");
			document.supplier.present_stock1.focus();
			return 0;
		}
		else if(document.supplier.present_stock_in_godown1.value == "")
		{
			alert("Please enter the corresponding godown name.");
			document.supplier.present_stock_in_godown1.focus();
			return 0;
		}
	}
	else
	{
		return 1;
	}
}

function importer_yes_no()
{
	if(document.supplier.importer_yes_no.value == "Yes")
	{
		if(document.supplier.imported_class_of_goods1.value == "")
		{
			alert("Please enter atleast one class of goods imported by you.");
			document.supplier.imported_class_of_goods1.focus();
			return 0;
		}
		else if(document.supplier.imported_class_of_goods_annual_value1.value == "")
		{
			alert("Please enter the corresponding annual value.");
			document.supplier.imported_class_of_goods_annual_value1.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function insurance_yes_no()
{
	if(document.supplier.insurance_yes_no.value == "Yes")
	{
		if(document.supplier.insurance_company.value == "")
		{
			alert("Please enter insurance company name.");
			document.supplier.insurance_company.focus();
			return 0;
		}
		else if(document.supplier.insurance_company.value.length > 70)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.insurance_company.focus();
			return 0;
		}
		else if(document.supplier.insurance_amount.value == "")
		{
			alert("Please enter insurance amount.");
			document.supplier.insurance_amount.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function who_are_you()
{
	if (document.supplier.manufacturer_checking_yes_no.value == "No" && document.supplier.agent_yes_no.value == "No" && document.supplier.stockiest_yes_no.value == "No" && document.supplier.importer_yes_no.value == "No")
	{
		alert("Please specify that, if you are a manufacturer or a manufacturer's agent/distributor or a stockist or an importer!");
		document.supplier.manufacturer_checking_yes_no.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function check2()
{
	if (enlistment_item_category() == 0)
	{
		return false;
	}
	else if (enlistment_item_name() == 0)
	{
		return false;
	}
	else if (manufacturer_checking_yes_no() == 0)
	{
		return false;
	}
	else if (agent_yes_no() == 0)
	{
		return false;
	}
	else if (stockiest_yes_no() == 0)
	{
		return false;
	}
	else if (importer_yes_no() == 0)
	{
		return false;
	}
	else if (who_are_you() == 0)
	{
		return false;
	}
	else if (insurance_yes_no() == 0)
	{
		return false;
	}
	else
	{
		return true;
	}
}

// Page-2 checking end

//******************************//

// Page-3 checking start

function banker_name_address1()
{
	if(document.supplier.banker_name_address1.value == "")
	{
		alert("Please enter atleast one banker's information.");
		document.supplier.banker_name_address1.focus();
		return 0;
	}
	else
	{
		if(document.supplier.banker_name_address1.value.length > 100)
		{
			alert("Address can not be more than 100 characters long.");
			document.supplier.banker_name_address1.focus();
			return 0;
		}
		else
		{
			return 1;
		}		
	}
}

function banker_name_address2()
{
	if(document.supplier.banker_name_address2.value.length > 100)
	{
		alert("Address can not be more than 100 characters long.");
		document.supplier.banker_name_address2.focus();
		return 0;
	}
	else
	{
		return 1;
	}		
}

function banker_name_address3()
{
	if(document.supplier.banker_name_address3.value.length > 100)
	{
		alert("Address can not be more than 100 characters long.");
		document.supplier.banker_name_address3.focus();
		return 0;
	}
	else
	{
		return 1;
	}		
}

function banker_name_address4()
{
	if(document.supplier.banker_name_address4.value.length > 100)
	{
		alert("Address can not be more than 100 characters long.");
		document.supplier.banker_name_address4.focus();
		return 0;
	}
	else
	{
		return 1;
	}		
}


function central_sales_tax_registration_no()
{
	if(document.supplier.central_sales_tax_registration_no.value == "" && document.supplier.state_sales_tax_registration_no.value == "")
	{
		alert("Please enter central sales tax registration number or state sales tax registration number.");
		document.supplier.central_sales_tax_registration_no.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function excise_duty_registration_no()
{
	if(document.supplier.manufacturer_checking_yes_no.value == "Yes" && document.supplier.excise_duty_registration_no.value == "")
	{
		alert("Please enter excise duty registration number as you are a manufacturer.");
		document.supplier.excise_duty_registration_no.focus();
		return 0;
	}
	else
	{
		return 1;
	}
}

function national_small_scale_industries_registration_no()
{
	if(document.supplier.national_small_scale_industries_registration_no.value.length > 0)
	{
		if(document.supplier.national_small_scale_industries_registration_valid_upto.value == "")
		{
			alert("Please enter the validity date of national small scale industries registration.");
			document.supplier.national_small_scale_industries_registration_valid_upto.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function small_scale_industries_registration_no()
{
	if(document.supplier.small_scale_industries_registration_no.value.length > 0)
	{
		if(document.supplier.small_scale_industries_registration_valid_upto.value == "")
		{
			alert("Please enter the validity date of small scale industries registration.");
			document.supplier.small_scale_industries_registration_valid_upto.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function company_is_already_in_business_yes_no()
{
	if(document.supplier.company_is_already_in_business_yes_no.value == "Yes")
	{
		if(document.supplier.dvc_unit_name.value == "")
		{
			alert("Please enter the name of DVC unit.");
			document.supplier.dvc_unit_name.focus();
			return 0;
		}
		else if(document.supplier.registered_item1.value == "")
		{
			alert("Please enter atlease one registered item name.");
			document.supplier.registered_item1.focus();
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{
		return 1;
	}
}

function financial_info()
{
	if(document.supplier.share_capital_year1.value == "")
	{
		document.supplier.share_capital_year1.value = "0";
	}
	if(document.supplier.share_capital_year2.value == "")
	{
		document.supplier.share_capital_year2.value = "0";
	}
	if(document.supplier.share_capital_year3.value == "")
	{
		document.supplier.share_capital_year3.value = "0";
	}
	if(document.supplier.long_term_debit_year1.value == "")
	{
		document.supplier.long_term_debit_year1.value = "0";
	}
	if(document.supplier.long_term_debit_year2.value == "")
	{
		document.supplier.long_term_debit_year2.value = "0";
	}
	if(document.supplier.long_term_debit_year3.value == "")
	{
		document.supplier.long_term_debit_year3.value = "0";
	}
	if(document.supplier.investment_in_land_year1.value == "")
	{
		document.supplier.investment_in_land_year1.value = "0";
	}
	if(document.supplier.investment_in_land_year2.value == "")
	{
		document.supplier.investment_in_land_year2.value = "0";
	}
	if(document.supplier.investment_in_land_year3.value == "")
	{
		document.supplier.investment_in_land_year3.value = "0";
	}
	if(document.supplier.investment_in_plant_year1.value == "")
	{
		document.supplier.investment_in_plant_year1.value = "0";
	}
	if(document.supplier.investment_in_plant_year2.value == "")
	{
		document.supplier.investment_in_plant_year2.value = "0";
	}
	if(document.supplier.investment_in_plant_year3.value == "")
	{
		document.supplier.investment_in_plant_year3.value = "0";
	}
	if(document.supplier.investment_in_fixed_assets_year1.value == "")
	{
		document.supplier.investment_in_fixed_assets_year1.value = "0";
	}
	if(document.supplier.investment_in_fixed_assets_year2.value == "")
	{
		document.supplier.investment_in_fixed_assets_year2.value = "0";
	}
	if(document.supplier.investment_in_fixed_assets_year3.value == "")
	{
		document.supplier.investment_in_fixed_assets_year3.value = "0";
	}
	if(document.supplier.net_current_assets_year1.value == "")
	{
		document.supplier.net_current_assets_year1.value = "0";
	}
	if(document.supplier.net_current_assets_year2.value == "")
	{
		document.supplier.net_current_assets_year2.value = "0";
	}
	if(document.supplier.net_current_assets_year3.value == "")
	{
		document.supplier.net_current_assets_year3.value = "0";
	}
	if(document.supplier.net_current_liabilities_year1.value == "")
	{
		document.supplier.net_current_liabilities_year1.value = "0";
	}
	if(document.supplier.net_current_liabilities_year2.value == "")
	{
		document.supplier.net_current_liabilities_year2.value = "0";
	}
	if(document.supplier.net_current_liabilities_year3.value == "")
	{
		document.supplier.net_current_liabilities_year3.value = "0";
	}
	if(document.supplier.sales_year1.value == "")
	{
		document.supplier.sales_year1.value = "0";
	}
	if(document.supplier.sales_year2.value == "")
	{
		document.supplier.sales_year2.value = "0";
	}
	if(document.supplier.sales_year3.value == "")
	{
		document.supplier.sales_year3.value = "0";
	}
	if(document.supplier.profit_before_tax_year1.value == "")
	{
		document.supplier.profit_before_tax_year1.value = "0";
	}
	if(document.supplier.profit_before_tax_year2.value == "")
	{
		document.supplier.profit_before_tax_year2.value = "0";
	}
	if(document.supplier.profit_before_tax_year3.value == "")
	{
		document.supplier.profit_before_tax_year3.value = "0";
	}
	if(document.supplier.profit_after_tax_year1.value == "")
	{
		document.supplier.profit_after_tax_year1.value = "0";
	}
	if(document.supplier.profit_after_tax_year2.value == "")
	{
		document.supplier.profit_after_tax_year2.value = "0";
	}
	if(document.supplier.profit_after_tax_year3.value == "")
	{
		document.supplier.profit_after_tax_year3.value = "0";
	}
}

function check3()
{
	if (banker_name_address1() == 0)
	{
		return false;
	}
	else if (banker_name_address2() == 0)
	{
		return false;
	}
	else if (banker_name_address3() == 0)
	{
		return false;
	}
	else if (banker_name_address3() == 0)
	{
		return false;
	}
	else if (central_sales_tax_registration_no() == 0)
	{
		return false;
	}
	else if (excise_duty_registration_no() == 0)
	{
		return false;
	}
	else if (national_small_scale_industries_registration_no() == 0)
	{
		return false;
	}
	else if (small_scale_industries_registration_no() == 0)
	{
		return false;
	}
	else if (company_is_already_in_business_yes_no() == 0)
	{
		return false;
	}
	else
	{
		financial_info();
		alert("Thank you for filling up the Online Application Form.\n\nClick on 'OK' button to get a complete look of your filled up application form.");
		return true;
	}
}

// Page-3 checking end

function checkingPrint()
{
	txt_before_print = "**************\n   NOTICE\n**************\n\nNow you have to take a print out (hard copy) of your filled in online application form.\n\nThe printed application form along with all the relevant documents need to be submitted to the 'Chief Purchase Officer' of Damodar Valley Corporation.";
	prn = confirm(txt_before_print);
	if (prn == true)
	{
		window.print();
		document.supplier.action = "vendor_details_preview.jsp?val=1";
		document.supplier.submit();
		return true;
	}
	else
	{
		return false;
	}
}

function edit_data()
{
	document.supplier.action = "vendor_details_edit.jsp";
	document.supplier.submit();
}

function doSubmit()
{
	prn = confirm("You have to take of this filled form to submit the data to the DVC Administrator.\n\nWould you like to take the print out now ?");
	if (prn == true)
	{
		window.print();
		document.supplier.action = "supplier_details_save.jsp";
		document.supplier.submit();
		return true;
	}
	else
	{
		return false;
	}
}

function nochar1()
{
	code = event.keyCode;
	if(code < 48 || code > 57)
	{
		event.keyCode = 0;
	}
}

function nochar2()
{
	code = event.keyCode;
	if((code < 48 || code > 57) && code != 46)
	{
		event.keyCode = 0;
	}
}

function nochar3()
{
	code = event.keyCode;
	if((code < 48 || code > 57) && code != 45)
	{
		event.keyCode = 0;
	}
}

function calculate_total_graduates()
{
	if (document.supplier.administration_graduates.value == "")
	{
		administration_graduates = 0;
	}
	else
	{
		administration_graduates	= parseInt(document.supplier.administration_graduates.value);
	}

	if (document.supplier.engineering_graduates.value == "")
	{
		engineering_graduates = 0;
	}
	else
	{
		engineering_graduates	= parseInt(document.supplier.engineering_graduates.value);
	}

	if (document.supplier.technology_graduates.value == "")
	{
		technology_graduates = 0;
	}
	else
	{
		technology_graduates	= parseInt(document.supplier.technology_graduates.value);
	}

	if (document.supplier.manufacturing_graduates.value == "")
	{
		manufacturing_graduates = 0;
	}
	else
	{
		manufacturing_graduates	= parseInt(document.supplier.manufacturing_graduates.value);
	}

	if (document.supplier.quality_graduates.value == "")
	{
		quality_graduates = 0;
	}
	else
	{
		quality_graduates	= parseInt(document.supplier.quality_graduates.value);
	}

	if (document.supplier.maintenance_graduates.value == "")
	{
		maintenance_graduates = 0;
	}
	else
	{
		maintenance_graduates	= parseInt(document.supplier.maintenance_graduates.value);
	}	
	
	if (document.supplier.site_management_graduates.value == "")
	{
		site_management_graduates = 0;
	}
	else
	{
		site_management_graduates	= parseInt(document.supplier.site_management_graduates.value);
	}

	if (document.supplier.others_graduates.value == "")
	{
		others_graduates = 0;
	}
	else
	{
		others_graduates	= parseInt(document.supplier.others_graduates.value);
	}


	document.supplier.total_graduates.value = (administration_graduates + engineering_graduates + technology_graduates + manufacturing_graduates + quality_graduates + maintenance_graduates + site_management_graduates + others_graduates);
}


function calculate_total_diploma()
{
	if (document.supplier.administration_diploma.value == "")
	{
		administration_diploma = 0;
	}
	else
	{
		administration_diploma	= parseInt(document.supplier.administration_diploma.value);
	}

	if (document.supplier.engineering_diploma.value == "")
	{
		engineering_diploma = 0;
	}
	else
	{
		engineering_diploma	= parseInt(document.supplier.engineering_diploma.value);
	}

	if (document.supplier.technology_diploma.value == "")
	{
		technology_diploma = 0;
	}
	else
	{
		technology_diploma	= parseInt(document.supplier.technology_diploma.value);
	}

	if (document.supplier.manufacturing_diploma.value == "")
	{
		manufacturing_diploma = 0;
	}
	else
	{
		manufacturing_diploma	= parseInt(document.supplier.manufacturing_diploma.value);
	}

	if (document.supplier.quality_diploma.value == "")
	{
		quality_diploma = 0;
	}
	else
	{
		quality_diploma	= parseInt(document.supplier.quality_diploma.value);
	}

	if (document.supplier.maintenance_diploma.value == "")
	{
		maintenance_diploma = 0;
	}
	else
	{
		maintenance_diploma	= parseInt(document.supplier.maintenance_diploma.value);
	}	
	
	if (document.supplier.site_management_diploma.value == "")
	{
		site_management_diploma = 0;
	}
	else
	{
		site_management_diploma	= parseInt(document.supplier.site_management_diploma.value);
	}

	if (document.supplier.others_diploma.value == "")
	{
		others_diploma = 0;
	}
	else
	{
		others_diploma	= parseInt(document.supplier.others_diploma.value);
	}


	document.supplier.total_diploma.value = (administration_diploma + engineering_diploma + technology_diploma + manufacturing_diploma + quality_diploma + maintenance_diploma + site_management_diploma + others_diploma);
}

function calculate_total_skilled()
{
	if (document.supplier.administration_skilled.value == "")
	{
		administration_skilled = 0;
	}
	else
	{
		administration_skilled	= parseInt(document.supplier.administration_skilled.value);
	}

	if (document.supplier.engineering_skilled.value == "")
	{
		engineering_skilled = 0;
	}
	else
	{
		engineering_skilled	= parseInt(document.supplier.engineering_skilled.value);
	}

	if (document.supplier.technology_skilled.value == "")
	{
		technology_skilled = 0;
	}
	else
	{
		technology_skilled	= parseInt(document.supplier.technology_skilled.value);
	}

	if (document.supplier.manufacturing_skilled.value == "")
	{
		manufacturing_skilled = 0;
	}
	else
	{
		manufacturing_skilled	= parseInt(document.supplier.manufacturing_skilled.value);
	}

	if (document.supplier.quality_skilled.value == "")
	{
		quality_skilled = 0;
	}
	else
	{
		quality_skilled	= parseInt(document.supplier.quality_skilled.value);
	}

	if (document.supplier.maintenance_skilled.value == "")
	{
		maintenance_skilled = 0;
	}
	else
	{
		maintenance_skilled	= parseInt(document.supplier.maintenance_skilled.value);
	}	
	
	if (document.supplier.site_management_skilled.value == "")
	{
		site_management_skilled = 0;
	}
	else
	{
		site_management_skilled	= parseInt(document.supplier.site_management_skilled.value);
	}

	if (document.supplier.others_skilled.value == "")
	{
		others_skilled = 0;
	}
	else
	{
		others_skilled	= parseInt(document.supplier.others_skilled.value);
	}


	document.supplier.total_skilled.value = (administration_skilled + engineering_skilled + technology_skilled + manufacturing_skilled + quality_skilled + maintenance_skilled + site_management_skilled + others_skilled);
}

function calculate_total_non_skilled()
{
	if (document.supplier.administration_non_skilled.value == "")
	{
		administration_non_skilled = 0;
	}
	else
	{
		administration_non_skilled	= parseInt(document.supplier.administration_non_skilled.value);
	}

	if (document.supplier.engineering_non_skilled.value == "")
	{
		engineering_non_skilled = 0;
	}
	else
	{
		engineering_non_skilled	= parseInt(document.supplier.engineering_non_skilled.value);
	}

	if (document.supplier.technology_non_skilled.value == "")
	{
		technology_non_skilled = 0;
	}
	else
	{
		technology_non_skilled	= parseInt(document.supplier.technology_non_skilled.value);
	}

	if (document.supplier.manufacturing_non_skilled.value == "")
	{
		manufacturing_non_skilled = 0;
	}
	else
	{
		manufacturing_non_skilled	= parseInt(document.supplier.manufacturing_non_skilled.value);
	}

	if (document.supplier.quality_non_skilled.value == "")
	{
		quality_non_skilled = 0;
	}
	else
	{
		quality_non_skilled	= parseInt(document.supplier.quality_non_skilled.value);
	}

	if (document.supplier.maintenance_non_skilled.value == "")
	{
		maintenance_non_skilled = 0;
	}
	else
	{
		maintenance_non_skilled	= parseInt(document.supplier.maintenance_non_skilled.value);
	}	
	
	if (document.supplier.site_management_non_skilled.value == "")
	{
		site_management_non_skilled = 0;
	}
	else
	{
		site_management_non_skilled	= parseInt(document.supplier.site_management_non_skilled.value);
	}

	if (document.supplier.others_non_skilled.value == "")
	{
		others_non_skilled = 0;
	}
	else
	{
		others_non_skilled	= parseInt(document.supplier.others_non_skilled.value);
	}


	document.supplier.total_non_skilled.value = (administration_non_skilled + engineering_non_skilled + technology_non_skilled + manufacturing_non_skilled + quality_non_skilled + maintenance_non_skilled + site_management_non_skilled + others_non_skilled);
}

function calculate_total()
{
	calculate_total_graduates();
	calculate_total_diploma();
	calculate_total_skilled();
	calculate_total_non_skilled();
}

function edit_check()
{
	if(check1())
	{
		if(check2())
		{
			if(check3())
			{
				document.supplier.action = "vendor_details_preview.jsp";
				document.supplier.submit();
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}
function NoChar2()//only for numericals
{
	code = event.keyCode;
	if(code < 48 || code > 57)
	{
		event.keyCode = 0;
	}
}

function checkCombo(opt,info)
{
	 var option=opt;
     var name=info;
	 if(option.value=="0")
	 {
	 alert("Please select"+" "+name+" "+"");
	 option.focus();
	 return false;
	 }
	 else
	 {
	 return true;
	 }
}
function checkVacant(data,info)//for resizing and vacant  fields 
{
                    var data1=data;
					var str=data.value;
                    var name=info;
					while (str.charAt(0) == ' ')
   					str = str.substring(1);
				    while (str.charAt(str.length - 1) == ' ')
				    str = str.substring(0, str.length - 1);
					data1.value=str;
					if(data1.value=="")
                    {
                    alert("Please enter"+" "+name+" ");
                    data1.focus();
                    return false;
                    }
					else
					{
					return true;
					}
					//return false;
					
}
