

	function validateApplyForm(frm)	{

		if (frm.companyName.value.length < 1) {
			alert("The  value of company name field is empty.  \rPlease type in a valid  company name value.");
			giveFocus(frm.companyName);
			return false;
		}

		if (frm.registrarOfCompany.value.length < 1) {
			alert("The  value of registration no. field is empty.  \rPlease type in a valid  registration no. value.");
			giveFocus(frm.registrarOfCompany);
			return false;
		}

		if (frm.registerAddress1.value.length < 1 &&
			frm.registerAddress2.value.length < 1 &&
			frm.registerAddress3.value.length < 1 ) {
			alert("The  value of register address field is empty.  \rPlease type in a valid register address.");
			giveFocus(frm.registerAddress1);
			return false;
		}

		if (frm.regPostalCode.value.length < 1) {
			alert("The  value of register address postal code field is empty.  \rPlease type in a valid  register address postal code value.");
			giveFocus(frm.regPostalCode);
			return false;
		}

		if (frm.regTelephone.value.length < 1) {
			alert("The  value of register address telephone field is empty.  \rPlease type in a valid  register address telephone value.");
			giveFocus(frm.regTelephone);
			return false;
		}

		if (frm.sharedCapitalAmount.value.length < 1) {
			alert("The  value of shared capital amount field is empty.  \rPlease type in a valid  shared capital amount value.");
			giveFocus(frm.sharedCapitalAmount);
			return false;
		}

		if (isNaN(frm.sharedCapitalAmount.value)) {
			alert("The value of shared capital amount field is invalid. \rPlease type in a valid numeric shared capital amount value.");
			giveFocus(frm.sharedCapitalAmount);
			return false;
		}


		if (frm.annualTurnover.value.length < 1) {
			alert("The  value of annual turnover field is empty.  \rPlease type in a valid  annual turnover value.");
			giveFocus(frm.annualTurnover);
			return false;
		}

		if (isNaN(frm.annualTurnover.value)) {
			alert("The value of annual turnover field is invalid. \rPlease type in a valid numeric annual turnover value.");
			giveFocus(frm.annualTurnover);
			return false;
		}

		if (isNaN(frm.fixedAssetsInvestment.value)) {
			alert("The value of fixed assets investment field is invalid. \rPlease type in a valid numeric fixed assets investment value.");
			giveFocus(frm.fixedAssetsInvestment);
			return false;
		}

		if (frm.employmentSize.value.length < 1) {
			alert("The  value of employment size field is empty.  \rPlease type in a valid employment size value.");
			giveFocus(frm.employmentSize);
			return false;
		}

		if (isNaN(frm.employmentSize.value)) {
			alert("The value of employment size field is invalid. \rPlease type in a valid numeric employment size value.");
			giveFocus(frm.employmentSize);
			return false;
		}

		if (isNaN(frm.unionizedSizeA.value)) {
			alert("The value of unionized size field is invalid. \rPlease type in a valid numeric unionized size value.");
			giveFocus(frm.unionizedSizeA);
			return false;
		}

		if (frm.reasonForJoining.value.length < 1) {
			alert("The  value of reason for joining field is empty.  \rPlease type in a valid reason for joining value.");
			giveFocus(frm.reasonForJoining);
			return false;
		}

	
		if(frm.fullName1.value.length>0 && getCheckedCount(frm,'maillingFlag1')<1) {
			alert("The choice of preferred communication mode of CEO is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName1);
			return false;
		}
		if(frm.fullName3.value.length>0 && getCheckedCount(frm,'maillingFlag3')<1) {
			alert("The choice of preferred communication mode of general is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName3);
			return false;
		}
		if(frm.fullName4.value.length>0 && getCheckedCount(frm,'maillingFlag4')<1) {
			alert("The choice of preferred communication mode of industry related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName4);
			return false;
		}
		if(frm.fullName5.value.length>0 && getCheckedCount(frm,'maillingFlag5')<1) {
			alert("The choice of preferred communication mode of feedback is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName5);
			return false;
		}
		if(frm.fullName6.value.length>0 && getCheckedCount(frm,'maillingFlag6')<1) {
			alert("The choice of preferred communication mode HR/IR related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName6);
			return false;
		}
		if(frm.fullName7.value.length>0 && getCheckedCount(frm,'maillingFlag7')<1) {
			alert("The choice of preferred communication mode of market related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName7);
			return false;
		}

		if (frm.fullName0.value.length < 1) {
			alert("The  name of the person who sumitting form is empty.  \rPlease type in a valid  name of the person who sumitting form value.");
			giveFocus(frm.fullName0);
			return false;
		}

		if (frm.jobTitle0.value.length < 1) {
			alert("The  designation of the person who sumitting form is empty.  \rPlease type in a valid  designation of the person who sumitting form value.");
			giveFocus(frm.jobTitle0);
			return false;
		}

		if (frm.email0.value.length < 1) {
			alert("The  email of the person who sumitting form is empty.  \rPlease type in a valid  email of the person who sumitting form value.");
			giveFocus(frm.email0);
			return false;
		}

		if (frm.email0.value.length!=0 && ((frm.email0.value.indexOf("@")==-1||frm.email0.value.indexOf(".")==-1) || (frm.email0.value.indexOf("@.")!=-1))) {
			alert("The value of email field is invalid. \rPlease type in a valid email value.");
			giveFocus(frm.email0);
			return false;
		}

		if (frm.telephone0.value.length < 1) {
			alert("The  telephone of the person who sumitting form is empty.  \rPlease type in a valid  telephone of the person who sumitting form value.");
			giveFocus(frm.telephone0);
			return false;
		}
		

		frm.submit();
		
		return true;
	}


	function validateUpdateForm(frm)	{

		if (frm.companyName.value.length < 1) {
			alert("The  value of company name field is empty.  \rPlease type in a valid  company name value.");
			giveFocus(frm.companyName);
			return false;
		}

		if (frm.registrarOfCompany.value.length < 1) {
			alert("The  value of registration no. field is empty.  \rPlease type in a valid  registration no. value.");
			giveFocus(frm.registrarOfCompany);
			return false;
		}

		if (frm.registerAddress1.value.length < 1 &&
			frm.registerAddress2.value.length < 1 &&
			frm.registerAddress3.value.length < 1 ) {
			alert("The  value of register address field is empty.  \rPlease type in a valid register address.");
			giveFocus(frm.registerAddress1);
			return false;
		}

		if (frm.regPostalCode.value.length < 1) {
			alert("The  value of register address postal code field is empty.  \rPlease type in a valid  register address postal code value.");
			giveFocus(frm.regPostalCode);
			return false;
		}

		if (frm.regTelephone.value.length < 1) {
			alert("The  value of register address telephone field is empty.  \rPlease type in a valid  register address telephone value.");
			giveFocus(frm.regTelephone);
			return false;
		}

		if (frm.sharedCapitalAmount.value.length < 1) {
			alert("The value of shared capital amount field is empty. \rPlease type in a shared capital amount value.");
			giveFocus(frm.sharedCapitalAmount);
			return false;
		}

		if (isNaN(frm.sharedCapitalAmount.value)) {
			alert("The value of shared capital amount field is invalid. \rPlease type in a valid numeric shared capital amount value.");
			giveFocus(frm.sharedCapitalAmount);
			return false;
		}


		if (isNaN(frm.annualTurnover.value)) {
			alert("The value of annual turnover field is invalid. \rPlease type in a valid numeric annual turnover value.");
			giveFocus(frm.annualTurnover);
			return false;
		}

		if (isNaN(frm.fixedAssetsInvestment.value)) {
			alert("The value of fixed assets investment field is invalid. \rPlease type in a valid numeric fixed assets investment value.");
			giveFocus(frm.fixedAssetsInvestment);
			return false;
		}

		if (isNaN(frm.employmentSize.value)) {
			alert("The value of employment size field is invalid. \rPlease type in a valid numeric employment size value.");
			giveFocus(frm.employmentSize);
			return false;
		}

		if (isNaN(frm.unionizedSizeA.value)) {
			alert("The value of unionized size field is invalid. \rPlease type in a valid numeric unionized size value.");
			giveFocus(frm.unionizedSizeA);
			return false;
		}

	
		if(frm.fullName1.value.length>0 && getCheckedCount(frm,'maillingFlag1')<1) {
			alert("The choice of preferred communication mode of CEO is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName1);
			return false;
		}
		if(frm.fullName2.value.length>0 && getCheckedCount(frm,'maillingFlag2')<1) {
			alert("The choice of preferred communication mode of REP is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName2);
			return false;
		}
		if(frm.fullName3.value.length>0 && getCheckedCount(frm,'maillingFlag3')<1) {
			alert("The choice of preferred communication mode of general is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName3);
			return false;
		}
		if(frm.fullName4.value.length>0 && getCheckedCount(frm,'maillingFlag4')<1) {
			alert("The choice of preferred communication mode of industry related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName4);
			return false;
		}
		if(frm.fullName5.value.length>0 && getCheckedCount(frm,'maillingFlag5')<1) {
			alert("The choice of preferred communication mode of feedback is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName5);
			return false;
		}
		if(frm.fullName6.value.length>0 && getCheckedCount(frm,'maillingFlag6')<1) {
			alert("The choice of preferred communication mode HR/IR related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName6);
			return false;
		}
		if(frm.fullName7.value.length>0 && getCheckedCount(frm,'maillingFlag7')<1) {
			alert("The choice of preferred communication mode of market related activities is invalid. \rPlease choose at least one mode.");
			giveFocus(frm.fullName7);
			return false;
		}

		if (frm.fullName0.value.length < 1) {
			alert("The  name of the person who sumitting form is empty.  \rPlease type in a valid  name of the person who sumitting form value.");
			giveFocus(frm.fullName0);
			return false;
		}

		if (frm.jobTitle0.value.length < 1) {
			alert("The  designation of the person who sumitting form is empty.  \rPlease type in a valid  designation of the person who sumitting form value.");
			giveFocus(frm.jobTitle0);
			return false;
		}

		if (frm.email0.value.length < 1) {
			alert("The  email of the person who sumitting form is empty.  \rPlease type in a valid  email of the person who sumitting form value.");
			giveFocus(frm.email0);
			return false;
		}

		if (frm.email0.value.length!=0 && ((frm.email0.value.indexOf("@")==-1||frm.email0.value.indexOf(".")==-1) || (frm.email0.value.indexOf("@.")!=-1))) {
			alert("The value of email field is invalid. \rPlease type in a valid email value.");
			giveFocus(frm.email0);
			return false;
		}

		if (frm.telephone0.value.length < 1) {
			alert("The  telephone of the person who sumitting form is empty.  \rPlease type in a valid  telephone of the person who sumitting form value.");
			giveFocus(frm.telephone0);
			return false;
		}

		frm.submit();
		
		return true;
	}
	
	//from,to : the designation code
	function copyContactDetails(frm,from, to) {

		var toSolutObj = document.getElementById("salutation"+to);
		var toNameObj = document.getElementById("fullName"+to);
		var toDesnObj = document.getElementById("jobTitle"+to);
		var toTelObj = document.getElementById("telephone"+to);
		var toFaxObj = document.getElementById("fax"+to);
		var toEmailObj = document.getElementById("email"+to);
		var toMailFlagObj0 = getElementInFormByNameSeq(frm,"maillingFlag"+to,0);
		var toMailFlagObj1 = getElementInFormByNameSeq(frm,"maillingFlag"+to,1);
		var toMailFlagObj2 = getElementInFormByNameSeq(frm,"maillingFlag"+to,2);

		if(from.length==0) {
			toSolutObj.selectedIndex=0;
			toNameObj.value="";
			toDesnObj.value="";
			toTelObj.value="";
			toFaxObj.value="";
			toEmailObj.value="";
			toMailFlagObj0.checked=false;
			toMailFlagObj1.checked=false;
			toMailFlagObj2.checked=false;
		} else {
		
			var fromSolutObj = document.getElementById("salutation"+from);
			var fromNameObj = document.getElementById("fullName"+from);
			var fromDesnObj = document.getElementById("jobTitle"+from);
			var fromTelObj = document.getElementById("telephone"+from);
			var fromFaxObj = document.getElementById("fax"+from);
			var fromEmailObj = document.getElementById("email"+from);
			var fromMailFlagObj0 = getElementInFormByNameSeq(frm,"maillingFlag"+from,0);
			var fromMailFlagObj1 = getElementInFormByNameSeq(frm,"maillingFlag"+from,1);
			var fromMailFlagObj2 = getElementInFormByNameSeq(frm,"maillingFlag"+from,2);
	
			toSolutObj.selectedIndex = fromSolutObj.selectedIndex;
			toNameObj.value = fromNameObj.value;
			toDesnObj.value = fromDesnObj.value;
			toTelObj.value = fromTelObj.value;
			toFaxObj.value = fromFaxObj.value;
			toEmailObj.value = fromEmailObj.value;
			toMailFlagObj0.checked=fromMailFlagObj0.checked;
			toMailFlagObj1.checked=fromMailFlagObj1.checked;
			toMailFlagObj2.checked=fromMailFlagObj2.checked;
		}
	
	}
	
	
	function toggleOwnership(frm) {
	
	  if (frm.capitalOwnership[0].checked || frm.capitalOwnership[1].checked) {
	    disableCapitalCountryField(frm);
	  }
	  
	  if (frm.capitalOwnership[2].checked) {
	    enableCapitalCountryField(frm);
	  }
	
	  if (frm.capitalOwnership[3].checked) {
	    disableCapitalCountryField(frm);
	  }
	}


	function disableCapitalCountryField(frm) {
	  frm.capitalCountry.disabled = true;
	  frm.capitalCountry.value = frm.capitalCountry.defaultValue;
	}
	
	function enableCapitalCountryField(frm) {
	  frm.capitalCountry.disabled = false;
	  frm.capitalCountry.value = frm.capitalCountry.defaultValue;
	}
	
	



	
	function validateSearchForm(frm)	{

		if (frm.searchText.value.length < 1) {
			alert("The  value of company name or member Id field is empty.  \rPlease type in a valid  company name or member Id value.");
			giveFocus(frm.searchText);
			return false;
		}
		if (frm.searchText.value.length < 2) {
			alert("Minimum 2 characters is required to be provided as company name or member Id.  \rPlease type in a valid  company name or member Id value.");
			giveFocus(frm.searchText);
			return false;
		}
		
		if (frm.searchText.value.indexOf("'")!=-1||frm.searchText.value.indexOf("\"")!=-1) {
			alert("Special characters are not allowed to be provided as company name or member Id.  \rPlease type in a valid  company name or member Id value.");
			giveFocus(frm.searchText);
			return false;
		}
		
		frm.submit();
	
	}
	
	function checkSearchFormKeyPress(frm)	{
		if(window.event.keyCode == 13)
			return validateSearchForm(frm);
		else
			return true;
	}
		
	
