if(document.images)
{
		pic1on= new Image(20,20); 
		pic1on.src="gif/menuOn1.png";
		pic1off= new Image(20,20); 
		pic1off.src="gif/menuOff1.png";
		
		pic2on= new Image(20,20); 
		pic2on.src="gif/menuOn2.png"; 
		pic2off= new Image(20,20); 
		pic2off.src="gif/menuOff2.png"; 
		
		pic3on= new Image(20,20); 
		pic3on.src="gif/menuOn3.png"; 
		pic3off= new Image(20,20); 
		pic3off.src="gif/menuOff3.png";
		
		pic4on= new Image(20,20); 
		pic4on.src="gif/menuOn4.png"; 
		pic4off= new Image(20,20); 
		pic4off.src="gif/menuOff4.png";
		
		pic5on= new Image(20,20); 
		pic5on.src="gif/menuOn5.png"; 
		pic5off= new Image(20,20);
		pic5off.src="gif/menuOff5.png";
		
		pic6on= new Image(20,20); 
		pic6on.src="gif/menuOn6.png"; 
		pic6off= new Image(20,20); 
		pic6off.src="gif/menuOff6.png";
		
}

function chkEmail()
{
	if(document.frmLoan.txtPrfCntMthd[1].checked==true)
	{
		document.getElementById("spEmail").className="orange";
		document.getElementById("txtEmail").style.backgroundColor="#F9F9C7"		
	}
	else
	{
		document.getElementById("spEmail").className="off";
		document.getElementById("txtEmail").style.backgroundColor=""		
	
	}			
}

function chkBkRel(index)
{
	var flag = eval("document.frmLoan.rdotest" + index + "1[0].checked");
	if(flag)
	{
		document.getElementById("sp" + index + "1").className="orange";
		document.getElementById("test" + index + "1").style.backgroundColor="#F9F9C7"
		document.getElementById("sp" + index + "2").className="orange";
		document.getElementById("test" + index + "2").style.backgroundColor="#F9F9C7"
		document.getElementById("sp" + index + "3").className="orange";
		document.getElementById("test" + index + "3").style.backgroundColor="#F9F9C7"
		//document.getElementById("sp" + index + "4").className="orange";
		//document.getElementById("test" + index + "4").style.backgroundColor="#F9F9C7"	
			
	}
	else
	{
		
		document.getElementById("sp" + index + "1").className="off";
		document.getElementById("test" + index + "1").style.backgroundColor=""
		document.getElementById("sp" + index + "2").className="off";
		document.getElementById("test" + index + "2").style.backgroundColor=""
		document.getElementById("sp" + index + "3").className="off";
		document.getElementById("test" + index + "3").style.backgroundColor=""
		//document.getElementById("sp" + index + "4").className="off";
		//document.getElementById("test" + index + "4").style.backgroundColor=""		
	
	}			
}

function chkPrevEmp()
{
//alert("test");
	if(document.frmLoan.rdoPrevEmp[0].checked==true)
		{
		//alert("yes");
		//alert(document.getElementById("spPrevBus").className="orange")
		document.getElementById("spPrevBus").className="orange";
		//document.getElementById("spPrevBusNature").className="orange";
		document.getElementById("spPrevPos").className="orange";
		document.getElementById("spPrevPrd").className="orange";
		document.getElementById("spESDate").className="orange";
		document.getElementById("txtPreviousBusName").style.backgroundColor="#F9F9C7";
		//document.getElementById("txtPreviousBusNature").style.backgroundColor="#F9F9C7";
		document.getElementById("txtPreviousPosition").style.backgroundColor="#F9F9C7";
		document.getElementById("txtServiceDt").style.backgroundColor="#F9F9C7";
		document.getElementById("txtEndServiceDt").style.backgroundColor="#F9F9C7";
		
		}
	else
		{
		//alert("no");
		document.getElementById("spPrevBus").className="off";
		//document.getElementById("spPrevBusNature").className="off";
		document.getElementById("spPrevPos").className="off";
		document.getElementById("spPrevPrd").className="off";
		document.getElementById("spESDate").className="off";
		document.getElementById("txtPreviousBusName").style.backgroundColor="";
		//document.getElementById("txtPreviousBusNature").style.backgroundColor="";
		document.getElementById("txtPreviousPosition").style.backgroundColor="";
		document.getElementById("txtServiceDt").style.backgroundColor="";
		document.getElementById("txtEndServiceDt").style.backgroundColor="";
		}
}

	
	function chkExp(thisone)
	{
		var d = new Date();
		var dstr =thisone.value;
		//alert(dstr);
		d.setDate(dstr.substring(0,2));
		d.setMonth(dstr.substring(3,5)-1);
		d.setFullYear(dstr.substring(6,10));
		
		var tmp1 = d.getTime();
		var tmp2 = thisday.getTime();
		
		if (trimString(dstr) != "")
		{
			if ( tmp1 < tmp2 )
			{
			alert("Passport Date has expired");
			}
			
		}
					
					
		}
			


var win;
function OpenWindow(url,x,y,z,winname)
{
if(winname = "")
{
winname = "BBK";
}
var prop;
prop="width=" + x + ",height=" + y + ",scrollbars=" + z
window.open(url,winname,prop);
}
		
var prevtab = -1
function showtab(tabid)
{

if (tabid==1)
{document.getElementById("Header1_maintitle").innerHTML="Loan Information"}
else if (tabid==2)
{document.getElementById("Header1_maintitle").innerHTML="Customer Information"}
else if (tabid==3)
{document.getElementById("Header1_maintitle").innerHTML="Employment/Business Details"}
else if (tabid==4)
{document.getElementById("Header1_maintitle").innerHTML="Existing Banking Relationship"}
else if (tabid==5)
{document.getElementById("Header1_maintitle").innerHTML="Monthly Income/Expenditure"}
else if (tabid==6)
{document.getElementById("Header1_maintitle").innerHTML="Preview & Process"}
else
{document.getElementById("Header1_maintitle").innerHTML="Loan Information"}

	var flag = true
	
	for(k=1; k < tabid; k++)
	{
		var funname = "checkForm" + k + "()";
		var resname = "result" + k;
		//alert(funname);
		var result = eval(funname);
		if(result != "")
		{
			//validation failed
			flag = false;
			break;
		}
	}
	// 
	//alert(flag);
	if(flag)
	{
		// page is valid
		var varname = "page" + parseInt(tabid) + "passed = true";
		eval(varname);
	
		var valfunname = "validate";
		var result = eval(valfunname + tabid + "()");
		if(result == true)
		{
			if(prevtab != tabid)
			{
				var thisimg = "img" + tabid;
				if(prevtab != -1)
				{
					var previmg = "img" + prevtab;
				}
				// make previous tab offline
				img = new Image()
				if(prevtab != -1)
				{
					img.src =  "/gif/menus/menuOff" + prevtab + ".jpg";
					
					//document.getElementById(previmg).src = "/gif/menus/menuOff" + prevtab + ".jpg";
					document.getElementById(previmg).src = eval("pic" + prevtab + "off.src");
				}
				
				
				
				// make new tab online
				//document.getElementById(thisimg).src = "/gif/menus/menuOn" + tabid + ".jpg";
				document.getElementById(thisimg).src = eval("pic" + tabid + "on.src");
				var selectedpage = "page" + tabid;
				if(prevtab != -1)
				{
					var unselectedpage = "page" + prevtab;
					document.getElementById(unselectedpage).className = "hiddenPage";
				}
				document.getElementById(selectedpage).className = "visiblePage";						
				
				// at the end keep track of the current tab
				prevtab = tabid;
				// keep track of the hidden form field to remember currently open the page
				document.getElementById("hCurPage").value = tabid;
			}
		}		
	}
	else
	{
		//return true;
		var varname = "page" + parseInt(tabid) + "passed";
		//alert(eval(varname));
		//if(prevtab != -1)
		//{
			funname = "checkForm" + prevtab + "()";
			result = eval(funname);
			if(result != "")
			{
				alert(result);
			}
		
		//}
		//else
		//{
		//	return true;
		//}		
			
	}
}
			
			
			
			function validate1()
			{			
				return page1passed;		
			}
			
			function validate2()
			{
				return page2passed;
			}
			
			function validate3()
			{
				return page3passed;
			}
			function validate4()
			{
				return page4passed;
			}
			function validate5()
			{
				return page5passed;
			}
			function validate6()
			{
				return page6passed;
			}
			
function Form1Validation()
{	
	var errString,bValid, sError,loanType,loanAmt,loanPrp;
			errString="";
			
			msg = "\n"
			var loanType_choice = false;
			var counter=0;
			
			//loanType=document.frmLoan.rdoLoanType.value;
			loanAmt=document.frmLoan.txtLoanAmt.value;
			loanTenor=document.frmLoan.txtLoanTenor.value;
			//loanPrp=document.frmLoan.drpPurpose.value;
			
			for (counter = 0;  counter < frmLoan.rdoLoanType.length; counter++)
				{
				if (frmLoan.rdoLoanType[counter].checked)
				loanType_choice = true; 
				}
				

				if (!loanType_choice)
				{
				errString +="Please select Loan type  \n";
				document.frmLoan.rdoLoanType[0].focus();
				document.frmLoan.rdoLoanType[0].select();
				//return (false);
				}
					
			

			if(trimString(loanAmt)=="" )
			errString +="Please enter Loan amount \n";
			
			if(trimString(loanAmt)!="" )
			{
				if (CurrencyVal(loanAmt)==false)	
				{
				errString +="Invalid Loan amount \n";
				document.frmLoan.txtLoanAmt.focus();
				document.frmLoan.txtLoanAmt.select();			
				}	
						
				
				if((loanAmt.replace(',',''))<1000 || (loanAmt.replace(',',''))>125000)
				{
				errString +="Loan amount must be between BD1000 and BD125000 \n";
				document.frmLoan.txtLoanAmt.focus();
				document.frmLoan.txtLoanAmt.select();
				//return false;
				}

			}
			
			if(trimString(loanTenor)=="" )
			errString +="Please enter Tenor \n";
			
			
			if(trimString(loanTenor)!="" )
			{
			if(!isInteger(loanTenor))
				{
					errString +="Invalide Tenor, only numbers allowed \n";
					document.frmLoan.txtLoanTenor.focus();
					document.frmLoan.txtLoanTenor.select();
				}
			if(loanTenor<6 || loanTenor>84)
				{
					errString +="Invalide Tenor, Number of months must be between 6 and 84 \n";
					document.frmLoan.txtLoanTenor.focus();
					document.frmLoan.txtLoanTenor.select();
				}
			}
			
				
			if(trimString(document.frmLoan.drpPurpose.options[document.frmLoan.drpPurpose.selectedIndex].value) == "" )
			errString +="Please enter Loan purpose \n";	
	
			
			if (errString != ""){
			errString += alert(msg + errString + "\n");
			return false;
			}
			
			else
			{
			page2passed = true;
			//now set the hidden field value to true
			document.getElementById("hTabValidated2").value = "True";
			showtab(2);
			}
			
}
			
function checkForm1()
{	
	var errString,bValid, sError,loanType,loanAmt,loanPrp;
	errString="";
			
	msg = "\n"
	var loanType_choice = false;
	var counter=0;

	//loanType=document.frmLoan.rdoLoanType.value;
	loanAmt=document.frmLoan.txtLoanAmt.value;
	loanTenor=document.frmLoan.txtLoanTenor.value;
	//loanPrp=document.frmLoan.drpPurpose.value;

	for (counter = 0;  counter < frmLoan.rdoLoanType.length; counter++)
	{
		if (frmLoan.rdoLoanType[counter].checked)
			loanType_choice = true; 
	}
	if (!loanType_choice)
	{
		errString +="Please select Loan type  \n";
		//document.frmLoan.rdoLoanType[0].focus();
		//document.frmLoan.rdoLoanType[0].select();
	}
	if(trimString(loanAmt)=="" )
		errString +="Please enter Loan amount \n";

	if(trimString(loanAmt)!="" )
	{
		if (CurrencyVal(loanAmt)==false)	
		{
			errString +="Invalid Loan amount \n";
			//document.frmLoan.txtLoanAmt.focus();
			//document.frmLoan.txtLoanAmt.select();			
		}	
		if((loanAmt.replace(',',''))<1000 || (loanAmt.replace(',',''))>125000)
		{
			errString +="Loan amount must be between BD1000 and BD125000 \n";
			//document.frmLoan.txtLoanAmt.focus();
			//document.frmLoan.txtLoanAmt.select();
			//return false;
		}
	}

	if(trimString(loanTenor)=="" )
		errString +="Please enter Tenor \n";
	if(trimString(loanTenor)!="" )
	{
		if(!isInteger(loanTenor))
		{
			errString +="Invalide Tenor, only numbers allowed \n";
			//document.frmLoan.txtLoanTenor.focus();
			//document.frmLoan.txtLoanTenor.select();
		}
		if(loanTenor<6 || loanTenor>84)
		{
			errString +="Invalide Tenor, Number of months must be between 6 and 84 \n";
			//document.frmLoan.txtLoanTenor.focus();
			//document.frmLoan.txtLoanTenor.select();
		}
	}
	
	if(trimString(document.frmLoan.drpPurpose.options[document.frmLoan.drpPurpose.selectedIndex].value) == "" )
		errString +="Please enter Loan purpose \n";	
			
	return errString;
			
}
			
function Form2Validation()
{
	var errString,bValid, sError,fullName,depNo,passNo,issueDate,expDate,cpr,nationality,tel,mob,fax,email;
	var	issuePlace,expDt,issueDt,houseno,country,pobox,res,roadno,edu,blockno,yrs;
	var method_choice = false;
		var counter=0;
		
		errString="";
				
		msg = "\n"
		fullname=document.frmLoan.txtFullName.value;
		depNo=document.frmLoan.txtDepNo.value;
		fullname=document.frmLoan.txtFullName.value;
		cpr=document.frmLoan.txtCPR.value;
		nationality=document.frmLoan.txtNationality.value;
		passNo=document.frmLoan.txtPassportNo.value;
		expDate=document.frmLoan.txtExpDate.value;
		issueDate=document.frmLoan.txtIssueDate.value;
		issuePlace=document.frmLoan.txtIssuePlace.value;
		houseno=document.frmLoan.txtHouseNo.value;
		blockno=document.frmLoan.txtBlockNo.value;
		roadno=document.frmLoan.txtRoadNo.value;
		country=document.frmLoan.txtCountry.value;
		pobox=document.frmLoan.txtPOBox.value;
		tel=document.frmLoan.txtTel.value;
		mob=document.frmLoan.txtMob.value;
		fax=document.frmLoan.txtFax.value;
		email=document.frmLoan.txtEmail.value;
		yrs=document.frmLoan.txtYrs.value;
		
		
		if(trimString(document.frmLoan.drpStatus.options[document.frmLoan.drpStatus.selectedIndex].value) == "" )
		errString +="Please select Maritus Status \n";	
		
		if(trimString(fullname)=="" )
		errString +="Please enter Full Name as in CPR \n";
		
		if(trimString(depNo)=="" )
		errString +="Please enter No. of Dependents \n";
		
		if (trimString(depNo)!="")
		{
			if(!isInteger(depNo))
				{
				errString +="Please enter valid No. of Dependents \n";
				document.frmLoan.txtDepNo.focus();
				document.frmLoan.txtDepNo.select();
				//return false;
				}
		}
		
		if(trimString(cpr)=="" )
		errString +="Please enter CPR No \n";
		
		if(trimString(cpr) != "")
		{
		
			if (cpr.length<9 || cpr.length>9)
			{
				errString += "You have entered an Invalid CPR Number \n";
				document.frmLoan.txtCPR.focus();
				document.frmLoan.txtCPR.select();
				//return false;
			}
			if(!isInteger(cpr))
			{
			errString +="please enter a valid CPR Number \n";
			document.frmLoan.txtCPR.focus();
			document.frmLoan.txtCPR.select();
			//return false;
			}
		}
		
		if(trimString(nationality)=="" )
		errString +="Please enter Nationality \n";
		
		if(trimString(passNo)=="" )
		errString +="Please enter Passport No. \n";
							
		if(trimString(expDate)=="" )
		errString +="Please enter Expiry Date \n";
		
		//if(trimString(issueDate)=="" )
		//errString +="Please enter Issue Date \n";
		
		if(trimString(issuePlace)=="" )
		errString +="Please enter Issue Place \n";
		
		if(trimString(tel)=="" )
		errString +="Please enter Home telephone No \n";
		
		
		if (tel != "")
		{
			if (checkInternationalPhone(tel)==false)
			{
			errString +="Please Enter a Valid Telephone Number \n";
			document.frmLoan.txtTel.focus();
			document.frmLoan.txtTel.select();
			//return false;
			}
		}
		
		if (mob != "")
		{
			if (checkInternationalPhone(mob)==false)
			{
			errString += "Please Enter a Valid Mobile Number \n";
			document.frmLoan.txtMob.focus();
			document.frmLoan.txtMob.select();
			//return false;
			}
		}
		
			if (fax != "")
		{
			if (checkInternationalPhone(fax)==false)
			{
			errString +=errString + "Please Enter a Valid Fax Number \n";
			document.frmLoan.txtFax.focus();
			document.frmLoan.txtFax.select();
			//return false;
			}
		}
		
		if(document.frmLoan.txtEmail.value != "")
		{
			if (email.indexOf ('@',0) == -1 || email.indexOf ('.',0) == -1) {
			errString += "The E-Mail field requires a \"@\" and a \".\"be used. Please re-enter your E-Mail address. \n";
			document.frmLoan.txtEmail.focus();
			document.frmLoan.txtEmail.select();
			//return false;
			}
		}
		
		
			
		if(trimString(houseno)=="" )
		errString +="Please enter Building/House No \n";
		
		if(trimString(blockno)=="" )
		errString +="Please enter Block No \n";

		if(trimString(roadno)=="" )
		errString +="Please enter Road No \n";
		
		if(trimString(country)=="" )
		errString +="Please enter City & Country \n";
		
		if(trimString(yrs)=="" )
		errString +="Please enter no of years at present address \n";
					
		if(trimString(document.frmLoan.drpRes.options[document.frmLoan.drpRes.selectedIndex].value) == "" )
		errString +="Please select Residence \n";	
		
		if(trimString(document.frmLoan.drpEdu.options[document.frmLoan.drpEdu.selectedIndex].value) == "" )
		errString +="Please select Educational Qualification \n";
		
		//if(trimString(document.frmLoan.PrfCntBranch.options[document.frmLoan.PrfCntBranch.selectedIndex].value) == "" )
		//errString +="Please select Preferred Contact Branch \n";
		
		for (counter = 0;  counter < frmLoan.txtPrfCntMthd.length; counter++)
			{
			if (frmLoan.txtPrfCntMthd[counter].checked)
			method_choice = true; 
			}
			

			if (!method_choice)
			{
			errString +="Please select Preferred Contact Method  \n";
			document.frmLoan.txtPrfCntMthd[0].focus();
			document.frmLoan.txtPrfCntMthd[0].select();
			//return (false);
			}
			
		if (document.frmLoan.txtPrfCntMthd[1].checked)
		{
			if(trimString(email)=="" )
			{
				errString +="Please enter Email  \n";
				document.frmLoan.txtEmail.focus();
				document.frmLoan.txtEmail.select();
			}
				
		}
		
		if (errString != ""){
		errString += alert(msg + errString + "\n");
		return false;
		}
		
		else
		{
			page3passed = true;
			document.getElementById("hTabValidated3").value = "True";
			showtab(3);
		}
}


function checkForm2()
{
	var errString,bValid, sError,fullName,depNo,passNo,issueDate,expDate,cpr,nationality,tel,mob,fax,email;
	var	issuePlace,expDt,issueDt,houseno,country,pobox,res,roadno,edu,blockno,yrs;
	var method_choice = false;
	var counter=0;
	errString="";
	msg = "\n"
	fullname=document.frmLoan.txtFullName.value;
	depNo=document.frmLoan.txtDepNo.value;
	fullname=document.frmLoan.txtFullName.value;
	cpr=document.frmLoan.txtCPR.value;
	nationality=document.frmLoan.txtNationality.value;
	passNo=document.frmLoan.txtPassportNo.value;
	expDate=document.frmLoan.txtExpDate.value;
	issueDate=document.frmLoan.txtIssueDate.value;
	issuePlace=document.frmLoan.txtIssuePlace.value;
	houseno=document.frmLoan.txtHouseNo.value;
	blockno=document.frmLoan.txtBlockNo.value;
	roadno=document.frmLoan.txtRoadNo.value;
	country=document.frmLoan.txtCountry.value;
	pobox=document.frmLoan.txtPOBox.value;
	tel=document.frmLoan.txtTel.value;
	mob=document.frmLoan.txtMob.value;
	fax=document.frmLoan.txtFax.value;
	email=document.frmLoan.txtEmail.value;
	yrs=document.frmLoan.txtYrs.value;
	
		/*var d=new Date();
		var td=new Date();
		var dstr=expDate;
		//alert(dstr);
		d.setDate(dstr.substring(0,2));
		d.setMonth(parseInt(dstr.substring(3,5))-1);
		d.setFullYear(dstr.substring(6,10));
		
		var tmp1 = d.getTime();
		var tmp2 = td.getTime();
		
		if (trimString(dstr) != "")
		{
			if ( tmp1 < tmp2 )
			{
			alert("Your passport has expired");
			}
			
		}
		*/
			
	
	if(trimString(document.frmLoan.drpStatus.options[document.frmLoan.drpStatus.selectedIndex].value) == "" )
	errString +="Please select Maritus Status \n";	

	if(trimString(fullname)=="" )
	errString +="Please enter Full Name as in CPR \n";

	if(trimString(depNo)=="" )
	errString +="Please enter No. of Dependents \n";

	if (trimString(depNo)!="")
	{
		if(!isInteger(depNo))
		{
		errString +="Please enter valid No. of Dependents \n";
		//document.frmLoan.txtDepNo.focus();
		//document.frmLoan.txtDepNo.select();
		//return false;
		}
	}

	if(trimString(cpr)=="" )
		errString +="Please enter CPR No \n";
	if(trimString(cpr) != "")
	{
		if (cpr.length<9 || cpr.length>9)
		{
			errString += "You have entered an Invalid CPR Number \n";
			//document.frmLoan.txtCPR.focus();
			//document.frmLoan.txtCPR.select();
			//return false;
		}
		if(!isInteger(cpr))
		{
			errString +="please enter a valid CPR Number \n";
			//document.frmLoan.txtCPR.focus();
			//document.frmLoan.txtCPR.select();
			//return false;
		}
	}

	if(trimString(nationality)=="" )
		errString +="Please enter Nationality \n";

	if(trimString(passNo)=="" )
		errString +="Please enter Passport No. \n";
						
	if(trimString(expDate)=="" )
		errString +="Please enter Expiry Date \n";

	//if(trimString(issueDate)=="" )
		//errString +="Please enter Issue Date \n";

	if(trimString(issuePlace)=="" )
		errString +="Please enter Issue Place \n";

	if(trimString(tel)=="" )
		errString +="Please enter Home telephone No \n";

	if (tel != "")
	{
		if (checkInternationalPhone(tel)==false)
		{
			errString +="Please Enter a Valid Telephone Number \n";
			//document.frmLoan.txtTel.focus();
			//document.frmLoan.txtTel.select();
			//return false;
		}
	}
	if (mob != "")
	{
		if (checkInternationalPhone(mob)==false)
		{
			errString += "Please Enter a Valid Mobile Number \n";
			//document.frmLoan.txtMob.focus();
			//document.frmLoan.txtMob.select();
			//return false;
		}
	}

	if (fax != "")
	{
		if (checkInternationalPhone(fax)==false)
		{
			errString +=errString + "Please Enter a Valid Fax Number \n";
			//document.frmLoan.txtFax.focus();
			//document.frmLoan.txtFax.select();
			//return false;
		}
	}

	if(document.frmLoan.txtEmail.value != "")
	{
		if (email.indexOf ('@',0) == -1 || email.indexOf ('.',0) == -1) 
		{
			errString += "The E-Mail field requires a \"@\" and a \".\"be used. Please re-enter your E-Mail address. \n";
			//document.frmLoan.txtEmail.focus();
			//document.frmLoan.txtEmail.select();
			//return false;
		}
	}

	if(trimString(houseno)=="" )
	errString +="Please enter Building/House No \n";
	
	if(trimString(blockno)=="" )
	errString +="Please enter Block No \n";

	if(trimString(roadno)=="" )
	errString +="Please enter Road No \n";

	if(trimString(country)=="" )
	errString +="Please enter City & Country \n";
	
	if(trimString(yrs)=="" )
	errString +="Please enter No of years at present address \n";
				
	if(trimString(document.frmLoan.drpRes.options[document.frmLoan.drpRes.selectedIndex].value) == "" )
	errString +="Please select Residence \n";	

	if(trimString(document.frmLoan.drpEdu.options[document.frmLoan.drpEdu.selectedIndex].value) == "" )
	errString +="Please select Educational Qualification \n";
	
	//if(trimString(document.frmLoan.PrfCntBranch.options[document.frmLoan.PrfCntBranch.selectedIndex].value) == "" )
	//errString +="Please select Preferred Contact Branch \n";

	for (counter = 0;  counter < frmLoan.txtPrfCntMthd.length; counter++)
	{
		if (frmLoan.txtPrfCntMthd[counter].checked)
			method_choice = true; 
	}
	if (!method_choice)
	{
		errString +="Please select Preferred Contact Method  \n";
		//document.frmLoan.txtPrfCntMthd[0].focus();
		//document.frmLoan.txtPrfCntMthd[0].select();
		//return (false);
	}
		
	if (document.frmLoan.txtPrfCntMthd[1].checked)
	{
		if(trimString(email)=="" )
		{
			errString +="Please enter Email  \n";
			//document.frmLoan.txtEmail.focus();
			//document.frmLoan.txtEmail.select();
		}
	}
	return errString;
}
			
			
function Form3Validation()
{
var errString,bValid, sError,gPeriod,pstEmpName,pstEmpNature,pstEmpPosition,prevEmpNature,pstJoiningDate,prevEmpName,prevEmpPosition,prevPeriod,salTransfer,instDate;
errString="";
var method_choice = false;
var counter=0;
		
msg = "\n"
pstEmpName=document.frmLoan.txtPresentBusName.value;
pstEmpNature=document.frmLoan.txtPresentBusNature.value;
pstEmpPosition=document.frmLoan.txtPresentPosition.value;
pstJoiningDate=document.frmLoan.txtJoiningDt.value;
prevEmpName=document.frmLoan.txtPreviousBusName.value;
prevEmpNature=document.frmLoan.txtPreviousBusNature.value;
prevEmpPosition=document.frmLoan.txtPreviousPosition.value;
prevPeriod=document.frmLoan.txtServiceDt.value;
salTransfer=document.frmLoan.txtSalDt.value;
instDate=document.frmLoan.txtInstDt.value;
gPeriod=document.frmLoan.txtGPeriod.value;
	

if(trimString(pstEmpName)=="" )
errString +="Please enter Present Employer/ Name of Business  \n";

//if(trimString(pstEmpNature)=="" )
//errString +="Please enter Present Business Nature \n";

if(trimString(pstEmpPosition)=="" )
errString +="Please enter Position \n";

if(trimString(pstJoiningDate)=="" )
errString +="Please enter Commencing/ Joining Date \n";


	for (counter = 0;  counter < frmLoan.rdoPrevEmp.length; counter++)
	{
		if (frmLoan.rdoPrevEmp[counter].checked)
			method_choice = true; 
	}
	if (!method_choice)
	{
		errString +="Have you been previously employed?  \n";
		
	}
	
	if(document.frmLoan.rdoPrevEmp[0].checked==true)
	{
			if(trimString(prevEmpName)=="" )
			errString +="Please enter Previous Employer/ Name of Business  \n";
			
			//if(trimString(prevEmpNature)=="" )
			//errString +="Please enter Previous Business Nature  \n";
			
			if(trimString(prevEmpPosition)=="" )
			errString +="Please enter Previous Position\n";
			
			if(trimString(prevPeriod)=="" )
			errString +="Please enter Service period  \n";

			if (trimString(prevPeriod)!="")
			{
				if(!isInteger(prevPeriod))
					{
					errString +="Please enter valid Service Period \n";
					document.frmLoan.txtServiceDt.focus();
					document.frmLoan.txtServiceDt.select();
					//return false;
					}
			}
	}



if(trimString(salTransfer)=="" )
errString +="Please enter Date of salary transfer  \n";

if(trimString(instDate)=="" )
errString +="Please enter Date of first payment/installment  \n";

if (trimString(gPeriod)!="")
{
	if(!isInteger(gPeriod))
		{
		errString +="Please enter valid Grace Period \n";
		document.frmLoan.txtGPeriod.focus();
		document.frmLoan.txtGPeriod.select();
		//return false;
		}
}

if (errString != ""){
errString += alert(msg + errString + "\n");
return false;
}

else
{
	page4passed = true;
	document.getElementById("hTabValidated4").value = "True";
	showtab(4);
	
	
	
}
}

function checkForm3()
{
	var errString,bValid, sError,gPeriod,pstEmpName,pstEmpNature,prevEmpNature,pstEmpPosition,pstJoiningDate,prevEmpName,prevEmpPosition,prevPeriod,salTransfer,instDate;
	errString="";	
	var method_choice = false;
	var counter=0;
	msg = "\n"
	pstEmpName=document.frmLoan.txtPresentBusName.value;
	pstEmpNature=document.frmLoan.txtPresentBusNature.value;
	pstEmpPosition=document.frmLoan.txtPresentPosition.value;
	pstJoiningDate=document.frmLoan.txtJoiningDt.value;
	prevEmpName=document.frmLoan.txtPreviousBusName.value;
	prevEmpNature=document.frmLoan.txtPreviousBusNature.value;
	prevEmpPosition=document.frmLoan.txtPreviousPosition.value;
	prevPeriod=document.frmLoan.txtServiceDt.value;
	salTransfer=document.frmLoan.txtSalDt.value;
	instDate=document.frmLoan.txtInstDt.value;
	gPeriod=document.frmLoan.txtGPeriod.value;
		
	if(trimString(pstEmpName)=="" )
		errString +="Please enter Present Employer/ Name of Business  \n";
	
	//if(trimString(pstEmpNature)=="" )
	 //  errString +="Please enter Present Business Nature \n";

	if(trimString(pstEmpPosition)=="" )
		errString +="Please enter Position \n";

	if(trimString(pstJoiningDate)=="" )
		errString +="Please enter Commencing/ Joining Date \n";
	
	for (counter = 0;  counter < frmLoan.rdoPrevEmp.length; counter++)
	{
		if (frmLoan.rdoPrevEmp[counter].checked)
			method_choice = true; 
	}
	if (!method_choice)
	{
		errString +="Have you been previously employed?  \n";
		
	}
	
	if(document.frmLoan.rdoPrevEmp[0].checked==true)
	{
			if(trimString(prevEmpName)=="" )
			errString +="Please enter Previous Employer/ Name of Business  \n";
			
			//if(trimString(prevEmpNature)=="" )
			//errString +="Please enter Previous Business Nature  \n";
			
			if(trimString(prevEmpPosition)=="" )
			errString +="Please enter Previous Position\n";
			
			if(trimString(prevPeriod)=="" )
			errString +="Please enter Service period  \n";
			
			if (trimString(prevPeriod)!="")
			{
				if(!isInteger(prevPeriod))
					{
					errString +="Please enter valid Service Period \n";
					document.frmLoan.txtServiceDt.focus();
					document.frmLoan.txtServiceDt.select();
					//return false;
					}
			}
	}


	if(trimString(salTransfer)=="" )
		errString +="Please enter Date of salary transfer  \n";

	if(trimString(instDate)=="" )
		errString +="Please enter Date of first payment/installment  \n";

	if (trimString(gPeriod)!="")
	{
		if(!isInteger(gPeriod))
			{
			errString +="Please enter valid Grace Period \n";
			//document.frmLoan.txtGPeriod.focus();
			//document.frmLoan.txtGPeriod.select();
			//return false;
			}
	}
	return errString;
}
			
function showbg()
{
	//document.getElementById("dyntxtDeposit01").style.backgroundColor="#F9F9C7"
	//document.getElementById("dyntxtDeposit02").style.backgroundColor="#F9F9C7"
	//document.getElementById("dyntxtLoan01").style.backgroundColor="#F9F9C7"
	//document.getElementById("dyntxtLoan02").style.backgroundColor="#F9F9C7"
	//document.getElementById("dyntxtCards01").style.backgroundColor="#F9F9C7"
	//document.getElementById("dyntxtCards02").style.backgroundColor="#F9F9C7"							
}
		
function Form4Validation()
{
	var errString,bValid, sError,depAc,loanAc,cardAc,bankDet1,bankDet2,bankDet3,bankDet4;
	errString="";
	var method_choice = false;
	var counter=0;
			
	msg = "\n"
	
	errString += validate_dynDeposit();
	errString += validate_dynloan();
	errString += validate_dynCards();
	errString += validate_bankDet();
	
	if (errString != ""){
	errString += alert(msg + errString + "\n");
	return false;
	}

	else
	{
	page5passed = true;
	document.getElementById("hTabValidated5").value = "True";
	showtab(5);
		
		
	}
}
		
function checkForm4()
{

	var errString,bValid, sError,depAc,loanAc,cardAc,bankDet1,bankDet2,bankDet3,bankDet4;
	errString="";
	var method_choice = false;
	var counter=0;
			
	msg = "\n"
	
	errString += validate_dynDeposit();
	errString += validate_dynloan();
	errString += validate_dynCards();
	errString += validate_bankDet();
	return errString;
}		
									
			function calTotal()
			{
			
			var errString,bValid, sError,basicSal,payAllowance,otherInc;
				var deduc,totMonthlyIncome,rentInst,livingExp,otherExp,totMonthlyExp;
				var totCredLimit,totCLimit,totIncome;
				var mTotal,exTotal,netTotal,netSal;
				mTotal=0;
				exTotal=0;
				netTotal=0;
				netSal=0;
				
				
						basicSal=document.frmLoan.txtBasicSal.value;
						payAllowance=document.frmLoan.txtPAllowances.value;
						otherInc=document.frmLoan.txtOtherIncome.value;
						deduc=document.frmLoan.txtLessDeduc.value;
						totMonthlyIncome=document.frmLoan.txtTotMonthlyInc.value;
						rentInst=document.frmLoan.txtInst.value;
						livingExp=document.frmLoan.txtLivingExp.value;
						totCredLimit=document.frmLoan.txtCredLimit.value;
						otherExp=document.frmLoan.txtOtherExp.value;
						totMonthlyExp=document.frmLoan.txtMonthlyExp.value;
						totIncome=document.frmLoan.txtTotalIncome.value;
						netSal=document.frmLoan.txtNetSal.value;
							
						//1
						if(trimString(basicSal)=="" )
							{
							basicSal=0.000;
							}
							else
							{
							basicSal=basicSal.replace(',','')
							}
						if (CurrencyVal(basicSal)==false)
							{
							basicSal=0.000;
							}
														
						//2
						if(trimString(payAllowance)=="" )
							{
							payAllowance=0.000;
							}
							else
							{
							payAllowance=payAllowance.replace(',','')
							}
						if (CurrencyVal(payAllowance)==false)
							{
							payAllowance=0.000;
							}
							
						//3
						if(trimString(otherInc)=="" )
							{
							otherInc=0.000;
							}
							else
							{
							otherInc=otherInc.replace(',','')
							}
						if (CurrencyVal(otherInc)==false)
							{
							otherInc=0.000;
							}
							
						//4
						if(trimString(deduc)=="" )
							{
							deduc=0.000;
							}
							else
							{
							deduc=deduc.replace(',','')
							}
						if (CurrencyVal(deduc)==false)
							{
							deduc=0.000;
							}
							
							
						//5	
						if(trimString(rentInst)=="" )
							{
							rentInst=0.000;
							}
							else
							{
							rentInst=rentInst.replace(',','')
							}
						if (CurrencyVal(rentInst)==false)
							{
							rentInst=0.000;
							}
							
						//6
						if(trimString(livingExp)=="" )
							{
							livingExp=0.000;
							}
							else
							{
							livingExp=livingExp.replace(',','')
							}
							
						if (CurrencyVal(livingExp)==false)
							{
							livingExp=0.000;
							}
							
						//7	
						if(trimString(totCredLimit)=="" )
							{
							totCredLimit=0.000;
							}
							else
							{
							totCredLimit=totCredLimit.replace(',','')
							}
							
						if (CurrencyVal(totCredLimit)==false)
							{
							totCredLimit=0.000;
							}
							
							
						//8
						if(trimString(otherExp)=="" )
							{
							otherExp=0.000;
							}
							else
							{
							otherExp=otherExp.replace(',','')
							}
						if (CurrencyVal(otherExp)==false)
							{
							otherExp=0.000;
							}
							
						//9
						if(trimString(totMonthlyExp)=="" )
							{
							totMonthlyExp=0.000;
							}
							else
							{
							totMonthlyExp=totMonthlyExp.replace(',','')
							}
						if (CurrencyVal(totMonthlyExp)==false)
							{
							totMonthlyExp=0.000;
							}							
							
						mTotal=eval(basicSal)+eval(payAllowance)+eval(otherInc)-eval(deduc);
						totCLimit=eval(totCredLimit*0.05)
						document.frmLoan.txtTotCredLimit.value= totCLimit
						exTotal=eval(rentInst)+eval(livingExp)+totCLimit+eval(otherExp);
						document.frmLoan.txtTotMonthlyInc.value= mTotal;
						document.frmLoan.txtMonthlyExp.value=exTotal;
						netTotal=eval(mTotal)-eval(exTotal);		
						document.frmLoan.txtTotalIncome.value=netTotal;
						//netSal=eval(mTotal)-eval(totCLimit);
						document.frmLoan.txtNetSal.value=mTotal;
						//alert(mTotal);
					
													
						
			}
			
			
function Form5Validation()
{
	var errString,bValid, sError,basicSal,payAllowance,otherInc;
	var deduc,totMonthlyIncome,rentInst,livingExp,otherExp,totMonthlyExp;
	var totCredLimit,totIncome,netSal
			errString="";
					
			msg = "\n"
			basicSal=document.frmLoan.txtBasicSal.value;
			payAllowance=document.frmLoan.txtPAllowances.value;
			otherInc=document.frmLoan.txtOtherIncome.value;
			deduc=document.frmLoan.txtLessDeduc.value;
			totMonthlyIncome=document.frmLoan.txtTotMonthlyInc.value;
			rentInst=document.frmLoan.txtInst.value;
			livingExp=document.frmLoan.txtLivingExp.value;
			totCredLimit=document.frmLoan.txtCredLimit.value;
			otherExp=document.frmLoan.txtOtherExp.value;
			totMonthlyExp=document.frmLoan.txtMonthlyExp.value;
			totIncome=document.frmLoan.txtTotalIncome.value;
			netSal=document.frmLoan.txtNetSal.value;
				
			
			if(trimString(basicSal)=="" )
			errString +="Please enter Basic Salary  \n";
			
			//1
			if(trimString(basicSal)!="" )
			{
				if (CurrencyVal(basicSal)==false)	
				{
				errString +="Invalid Basic Salary/Monthly Turnover \n";
				document.frmLoan.txtBasicSal.focus();
				document.frmLoan.txtBasicSal.select();			
				}
				
			}	
			//2
				if(trimString(payAllowance)!="" )
			{
				if (CurrencyVal(payAllowance)==false)	
				{
				errString +="Invalid Payment allowances \n";
				document.frmLoan.txtPAllowances.focus();
				document.frmLoan.txtPAllowances.select();			
				}
				
			}
			//3
			
			if(trimString(otherInc)!="" )
			{
				if (CurrencyVal(otherInc)==false)	
				{
				errString +="Invalid Other Income \n";
				document.frmLoan.txtOtherIncome.focus();
				document.frmLoan.txtOtherIncome.select();			
				}
				
			}
			
			//4
			if(trimString(deduc)!="" )
			{
			if (CurrencyVal(deduc)==false)	
				{
				errString +="Invalid less Deduction \n";
				document.frmLoan.txtLessDeduc.focus();
				document.frmLoan.txtLessDeduc.select();			
				}
				
			}
		
			
			//5
			if(trimString(totMonthlyIncome)!="" )
			{
				if (CurrencyVal(totMonthlyIncome)==false)	
				{
				errString +="Invalid Total Monthly Income \n";
				document.frmLoan.txtTotMonthlyInc.focus();
				document.frmLoan.txtTotMonthlyInc.select();			
				}
				
			}
			//6
			if(trimString(rentInst)!="" )
			{
				if (CurrencyVal(rentInst)==false)	
				{
				errString +="Invalid Rent/Housing Installment \n";
				document.frmLoan.txtInst.focus();
				document.frmLoan.txtInst.select();			
				}
				
			}
			//7
			if(trimString(livingExp)!="" )
			{
				if (CurrencyVal(livingExp)==false)	
				{
				errString +="Invalid Living Expenses \n";
				document.frmLoan.txtLivingExp.focus();
				document.frmLoan.txtLivingExp.select();			
				}
				
			}
			//8
			if(trimString(totCredLimit)!="" )
			{
				if (CurrencyVal(totCredLimit)==false)	
				{
				errString +="Invalid Total Credit Card Limit \n";
				document.frmLoan.txtCredLimit.focus();
				document.frmLoan.txtCredLimit.select();			
				}
				
			}
			//9
			if(trimString(otherExp)!="" )
			{
				if (CurrencyVal(otherExp)==false)	
				{
				errString +="Invalid Other Expenses \n";
				document.frmLoan.txtOtherExp.focus();
				document.frmLoan.txtTotMonthlyInc.select();			
				}
				
			}
			
			//10
			if(trimString(totMonthlyExp)!="" )
			{
				if (CurrencyVal(totMonthlyExp)==false)	
				{
				errString +="Invalid Total Monthly Expenses \n";
				document.frmLoan.txtMonthlyExp.focus();
				document.frmLoan.txtMonthlyExp.select();			
				}
				
			}
			
			//11
			if(trimString(totIncome)!="" )
			{
				if (CurrencyVal(totIncome)==false)	
				{
				errString +="Invalid Total Income \n";
				document.frmLoan.txtTotalIncome.focus();
				document.frmLoan.txtTotalIncome.select();			
				}
				
				else if (totIncome<200)
				{
				errString +="Total Income must be greater than 200BD\n";
				document.frmLoan.txtTotalIncome.focus();
				document.frmLoan.txtTotalIncome.select();	
				
				}
				
			}									
				/*
				else if(loanAmt<1000)
				{
				errString +="Loan amount should not less than 1000 BD\n";
				document.frmLoan.txtLoanAmt.focus();
				document.frmLoan.txtLoanAmt.select();
				return false;
				}
				*/

			
			
			
			if (errString != ""){
			errString += alert(msg + errString + "\n");
			return false;
			}
			else
			{
				page6passed = true;
				document.getElementById("hTabValidated6").value = "True";																	
				showtab(6);
				dispVal();	
			}
			
}

function checkForm5()
{
	var errString,bValid, sError,basicSal,payAllowance,otherInc;
	var deduc,totMonthlyIncome,rentInst,livingExp,otherExp,totMonthlyExp;
	var totCredLimit,totIncome,netSal
	errString="";
	msg = "\n"
	basicSal=document.frmLoan.txtBasicSal.value;
	payAllowance=document.frmLoan.txtPAllowances.value;
	otherInc=document.frmLoan.txtOtherIncome.value;
	deduc=document.frmLoan.txtLessDeduc.value;
	totMonthlyIncome=document.frmLoan.txtTotMonthlyInc.value;
	rentInst=document.frmLoan.txtInst.value;
	livingExp=document.frmLoan.txtLivingExp.value;
	totCredLimit=document.frmLoan.txtCredLimit.value;
	otherExp=document.frmLoan.txtOtherExp.value;
	totMonthlyExp=document.frmLoan.txtMonthlyExp.value;
	totIncome=document.frmLoan.txtTotalIncome.value;
	netSal=document.frmLoan.txtNetSal.value;
		
	
	if(trimString(basicSal)=="" )
	errString +="Please enter Basic Salary  \n";
	
	if(trimString(basicSal)!="" )
	{
		if (CurrencyVal(basicSal)==false)	
		{
			errString +="Invalid Basic Salary/Monthly Turnover \n";
			//document.frmLoan.txtBasicSal.focus();
			//document.frmLoan.txtBasicSal.select();			
		}		
	}	
	//2
	if(trimString(payAllowance)!="" )
	{
		if (CurrencyVal(payAllowance)==false)	
		{
			errString +="Invalid Payment allowances \n";
			//document.frmLoan.txtPAllowances.focus();
			//document.frmLoan.txtPAllowances.select();			
		}
		
	}
	//3
	
	if(trimString(otherInc)!="" )
	{
		if (CurrencyVal(otherInc)==false)	
		{
			errString +="Invalid Other Income \n";
			//document.frmLoan.txtOtherIncome.focus();
			//document.frmLoan.txtOtherIncome.select();			
		}
		
	}
	
	//4
	if(trimString(deduc)!="" )
	{
		if (CurrencyVal(deduc)==false)	
		{
			errString +="Invalid less Deduction \n";
			//document.frmLoan.txtLessDeduc.focus();
			//document.frmLoan.txtLessDeduc.select();			
		}		
	}

	
	//5
	if(trimString(totMonthlyIncome)!="" )
	{
		if (CurrencyVal(totMonthlyIncome)==false)	
		{
			errString +="Invalid Total Monthly Income \n";
			//document.frmLoan.txtTotMonthlyInc.focus();
			//document.frmLoan.txtTotMonthlyInc.select();			
		}
	}
	//6
	if(trimString(rentInst)!="" )
	{
		if (CurrencyVal(rentInst)==false)	
		{
		errString +="Invalid Rent/Housing Installment \n";
		//document.frmLoan.txtInst.focus();
		//document.frmLoan.txtInst.select();			
		}
		
	}
	//7
	if(trimString(livingExp)!="" )
	{
		if (CurrencyVal(livingExp)==false)	
		{
		errString +="Invalid Living Expenses \n";
		//document.frmLoan.txtLivingExp.focus();
		//document.frmLoan.txtLivingExp.select();			
		}
		
	}
	//8
	if(trimString(totCredLimit)!="" )
	{
		if (CurrencyVal(totCredLimit)==false)	
		{
		errString +="Invalid Total Credit Card Limit \n";
		//document.frmLoan.txtCredLimit.focus();
		///document.frmLoan.txtCredLimit.select();			
		}
		
	}
	//9
	if(trimString(otherExp)!="" )
	{
		if (CurrencyVal(otherExp)==false)	
		{
		errString +="Invalid Other Expenses \n";
		//document.frmLoan.txtOtherExp.focus();
		//document.frmLoan.txtTotMonthlyInc.select();			
		}
		
	}
	
	//10
	if(trimString(totMonthlyExp)!="" )
	{
		if (CurrencyVal(totMonthlyExp)==false)	
		{
		errString +="Invalid Total Monthly Expenses \n";
		//document.frmLoan.txtMonthlyExp.focus();
		//document.frmLoan.txtMonthlyExp.select();			
		}
		
	}
	
	//11
	if(trimString(totIncome)!="" )
	{
		if (CurrencyVal(totIncome)==false)	
		{
		errString +="Invalid Total Income \n";
		//document.frmLoan.txtTotalIncome.focus();
		//document.frmLoan.txtTotalIncome.select();			
		}
		
		else if (totIncome<200)
		{
		errString +="Total Income must be greater than 200BD\n";
		//document.frmLoan.txtTotalIncome.focus();
		//document.frmLoan.txtTotalIncome.select();	
		
		}
		
	}									
		/*
		else if(loanAmt<1000)
		{
		errString +="Loan amount should not less than 1000 BD\n";
		document.frmLoan.txtLoanAmt.focus();
		document.frmLoan.txtLoanAmt.select();
		return false;
		}
		*/
		return errString;			
}

				
/*function Form6Validation()
{
	//page6passed = true;
	//document.getElementById("hTabValidated6").value = "True";
	//showtab(6);
}

function checkForm6()
{

//page6passed = true;
	//document.getElementById("hTabValidated6").value = "True";
	//showtab(6);
	return true;
}*/

function Form6Validation()
{
	page6passed = true;
	document.getElementById("hTabValidated6").value = "True";
	showtab(6);
}

function checkForm6()
{

	
}
	

function dispVal()
{

if (frmLoan.rdoLoanType[0].checked)
	{
		document.getElementById("divLoanType").innerHTML="New Consumer Loan";			 
	}
	else
	{
		document.getElementById("divLoanType").innerHTML="Renewal of Existing BBK Consumer Loan";

	}
document.getElementById("divLoanAmt").innerHTML=document.frmLoan.txtLoanAmt.value;
document.getElementById("divLoanTenor").innerHTML=document.frmLoan.txtLoanTenor.value;
document.getElementById("divFullName").innerHTML=document.frmLoan.txtFullName.value;
document.getElementById("divCpr").innerHTML=document.frmLoan.txtCPR.value;
document.getElementById("divNationality").innerHTML=document.frmLoan.txtNationality.value;
document.getElementById("divTel").innerHTML=document.frmLoan.txtTel.value;
document.getElementById("divHouseNo").innerHTML=document.frmLoan.txtHouseNo.value;
document.getElementById("divBlockNo").innerHTML=document.frmLoan.txtBlockNo.value;
document.getElementById("divRoadNo").innerHTML=document.frmLoan.txtRoadNo.value;
document.getElementById("divCityCountry").innerHTML=document.frmLoan.txtCountry.value;
document.getElementById("divPrstEmpName").innerHTML=document.frmLoan.txtPresentBusName.value;
//document.getElementById("divPrstEmpNature").innerHTML=document.frmLoan.txtPresentBusNature.value;
document.getElementById("divPrstPosition").innerHTML=document.frmLoan.txtPresentPosition.value;
document.getElementById("divPrstDate").innerHTML=document.frmLoan.txtJoiningDt.value;
document.getElementById("divSalDate").innerHTML=document.frmLoan.txtSalDt.value;
document.getElementById("divSalDate").innerHTML=document.frmLoan.txtInstDt.value;
document.getElementById("divBasicSal").innerHTML=document.frmLoan.txtBasicSal.value;
document.getElementById("divTotIncome").innerHTML=document.frmLoan.txtTotalIncome.value;

}

function trimString (str)
{
str = this != window? this : str;
return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function isInteger(s)
{   var i;
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	return true;
}
// For Contact Number
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";

var NumberDelimiters = "-";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validChars = NumberDelimiters;
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 6;

function stripCharsInBag(s, bag)
{   var i;
	var returnString = "";
	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++)
	{   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}
function checkInternationalPhone(strPhone)
{
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

//For Currency
var AmtDelimiters = ".,";
var validChars = AmtDelimiters;

function stripCharsInBag1(s, bag)
{   var i;
	var returnString = "";
	// Search through string's characters one by one.
	// If character is not in bag, append to returnString.
	for (i = 0; i < s.length; i++)
	{   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}
function CurrencyVal(strCur)
{
s=stripCharsInBag1(strCur,AmtDelimiters);
return (isInteger(s));
}

function chkLght(thisone)
{
var tmp;
tmp=thisone.value.length;
if (trimString(thisone.value) !="")
	{
		if(tmp>12 || tmp<12)
		{
		alert("Invalid Deposits Account number");
		}
	}
}
function CalculateFirstPay()
{

	var p = document.getElementById("txtGPeriod").value;
	var dstr = document.getElementById("txtSalDt").value;
	if(!isNaN(p))
	{
		p = parseInt(p)
		if(p > 90)
		{
			alert("Grace Period should not be more than 90 days");
			document.getElementById("txtGPeriod").value = "0";
			document.getElementById("txtGPeriod").focus();
			document.getElementById("txtGPeriod").select();
		}
	}
	var p = document.getElementById("txtGPeriod").value;
	if(!isNaN(p) && p != "" && dstr !="")
	{
		
		var d = new Date();
		d.setDate(dstr.substring(0,2));
		d.setMonth(dstr.substring(3,5)-1);
		d.setFullYear(dstr.substring(6,10));
		
		
	
		//document.getElementById("txtInstDt").value = "sreeju";
		
		var tmp = d.getTime();
		
			tmp = tmp + 24* 60 * 60 * 1000 * parseInt(p);			
			d.setTime(tmp);
			document.getElementById("txtInstDt").value = padZero(d.getDate()) + "/" + padZero(parseInt(d.getMonth()+1)) + "/" + d.getFullYear();
	}
	else
	{
		document.getElementById("txtInstDt").value = document.getElementById("txtSalDt").value;
	}
}

function padZero(str)
{
	
	if(parseInt(str) < 10)
	{
		str = "0" + str;
	}
	return str;
}
