arrTempHotelResNo = new Array();
function getCustHotelReservationNo(valobj)
{
	doc = document.frmDeposit;
	Errmsg_objReserNo = document.getElementById("error_bHotResNo");
	Errmsg_objReserNo.style.display = "none";
	Errmsg_objReserNo.innerHTML = "";
	for(i=1;i<=6;i++)
	{
		arrTempHotelResNo.splice(i,1);				
		eval("doc.txtCusRno"+i).value = "";
		eval("doc.txtCusGuest"+i).value = "";
		eval("doc.txtCusGuest"+i).disabled = true;				
		eval("doc.selCusHotel"+i).disabled = true;	
		eval("doc.selCusHotel"+i).value = 0;
		eval("doc.txtArrival"+i).value = "Date";
		eval("document.getElementById('imgArrivalCus"+i+"')").style.display = "none";	
		
		eval("doc.txtCusAmount"+i).disabled = true;
		eval("doc.txtCusAmount"+i).value = 0;
	}

	arrTempHotelResNo = doc.reservation.value.split(",");
	if(arrTempHotelResNo.length > 6)
	{
		Errmsg_objReserNo.style.display = "";
		Errmsg_objReserNo.innerHTML = "Please dont enter more than 6 hotel reservation number";
		flag_sumit = false;	
	}
	else
	{
		for(i=0;i<=arrTempHotelResNo.length-1;i++)
		{
			eval("doc.txtCusRno"+(i+1)).value = "";
			if(arrTempHotelResNo[i].replace(/ /g,'') == "")
			{
				arrTempHotelResNo.splice(i,1);				
				eval("doc.txtCusRno"+(i+1)).value = "";
				eval("doc.txtCusGuest"+(i+1)).value = "";
				eval("doc.txtCusGuest"+(i+1)).disabled = true;				
				eval("doc.selCusHotel"+(i+1)).disabled = true;	
				eval("doc.selCusHotel"+(i+1)).value = 0;
				eval("doc.txtArrival"+(i+1)).value = "Date";
				eval("document.getElementById('imgArrivalCus"+(i+1)+"')").style.display = "none";	
				
				eval("doc.txtCusAmount"+(i+1)).disabled = true;
				eval("doc.txtCusAmount"+(i+1)).value = 0;
			}
			else
			{
				eval("doc.txtCusRno"+(i+1)).value = arrTempHotelResNo[i];
				eval("doc.txtCusGuest"+(i+1)).disabled = false;				
				eval("doc.selCusHotel"+(i+1)).disabled = false;	
				eval("document.getElementById('imgArrivalCus"+(i+1)+"')").style.display = "";	
				eval("doc.txtCusAmount"+(i+1)).disabled = false;
				
			}
		}
	}
}

function GetCustomerCopyTotalAmt(valObj,ErrmsgId)
{
	doc = document.frmDeposit;
	arrTempHotelResNo = doc.reservation.value.split(",");
	document.getElementById(ErrmsgId).style.display = "none";
	document.getElementById(ErrmsgId).innerHTML = "";

	if(!isNumber(valObj.value))
	{
		valObj.value = 0;
		document.getElementById(ErrmsgId).style.display = "";
		document.getElementById(ErrmsgId).innerHTML = "Please enter only numbers as amount";
		valObj.focus();
	}

	tempAddVal = 0;
	for(i=0;i<=arrTempHotelResNo.length-1;i++)
	{
		tempAddVal = parseInt(tempAddVal) + parseInt(eval("doc.txtCusAmount"+(i+1)).value);
	}

	doc.txtCusTotalAmount.value = tempAddVal;
}

function getAmountTotal(amt1,amt2,objId)
{
	doc = document.frmDeposit;
	docObj = document.getElementById(objId);

	objerr_cash_det = document.getElementById("err_cashdet");
	objerr_cash_det.style.display = "none";
	objerr_cash_det.innerHTML = "";
	if(!isNumber(amt2))
	{
		docObj.value = 0;
		objerr_cash_det.style.display = "";
		objerr_cash_det.innerHTML = " Please enter only numerics in cash details denomination";		
	}
	else
	{
		docObj.value = amt1 * amt2;		
	}

	tempTotalvalue = parseInt(doc.Amount1000.value) +  parseInt(doc.Amount500.value) +  parseInt(doc.Amount100.value) +  parseInt(doc.Amount50.value) +  parseInt(doc.Amount20.value) +  parseInt(doc.Amount10.value) + parseInt(doc.Others.value);
	doc.total.value = tempTotalvalue;
}

/*function chkDetailsAmt(objVal)
{
	if(!isNumber(objVal.value))
	{
		objVal.value = 0;
		objerr_cash_det.style.display = "";
		objerr_cash_det.innerHTML = " Please enter only numerics in Check detail amount";		
	}
	else
	{
		docObj.value = amt1 * amt2;		
	}
}*/
function chequeAmoutValidate(valObj,ErrMsg)
{
	doc = document.frmDeposit;
	objErr_Msg = document.getElementById(ErrMsg);
	/*for (i=1;i<=3;i++)
	{
		objCC_chqu_Err1 = eval("document.getElementById('error_CC_Det"+i+"')");
		objCC_chqu_Err1.style.display = "none";
		objCC_chqu_Err1.innerHTML = "";
	}*/
	if(!isNumber(valObj.value))
	{
		valObj.value = 0;
		objErr_Msg.style.display = "";
		objErr_Msg.innerHTML = " Please enter only numerics in Check detail amount";		
	}
	doc.txtChequetotal.value = parseInt(doc.txtAmount1.value) + parseInt(doc.txtAmount2.value) + parseInt(doc.txtAmount3.value);	
}

function doValidateDeposit()
{
	Errmsg_objTravellerName = document.getElementById("error_bname");
	Errmsg_obj_TravellerDate = document.getElementById("error_travDate")
	Errmsg_objReserNo = document.getElementById("error_bHotResNo");
	Errmsg_objbPhone = document.getElementById("error_bphone");
	Errmsg_objblocation = document.getElementById("error_blocation");
	Errmsg_objbEmail = document.getElementById("error_bemail");
	Errmsg_objamtWords = document.getElementById("error_bamtwords");
	Errmsg_objchk_cash_det = document.getElementById("error_cash_cheque_det");
	Errmsg_objpandcard = document.getElementById("err_pandcard");
	Errmsg_amtwords_cust = document.getElementById("err_AmtinWordsCust");
	Errmsg_custCopy = new Array();
	
	for(i=0;i<=arrTempHotelResNo.length-1;i++)
	{
		Errmsg_custCopy[i] = eval("document.getElementById('err_custCopy"+(i+1)+"')");
		Errmsg_custCopy[i].style.display = "none";
		Errmsg_custCopy[i].innerHTML = "";
	}	

	Errmsg_obj_TravellerDate.style.display = "none"
	Errmsg_obj_TravellerDate.innerHTML = "";

	Errmsg_amtwords_cust.style.display = "none";
	Errmsg_amtwords_cust.innerHTML = "";	
	Errmsg_objTravellerName.style.display = "none";
	Errmsg_objTravellerName.innerHTML = "";
	Errmsg_objReserNo.style.display = "none";
	Errmsg_objReserNo.innerHTML = "";
	Errmsg_objbPhone.style.display = "none";
	Errmsg_objbPhone.innerHTML = "";
	Errmsg_objblocation.style.display = "none";
	Errmsg_objblocation.innerHTML = "";
	Errmsg_objbEmail.style.display = "none";
	Errmsg_objbEmail.innerHTML = "";
	Errmsg_objamtWords.style.display = "none";
	Errmsg_objamtWords.innerHTML = "";
	Errmsg_objchk_cash_det.style.display = "none";
	Errmsg_objchk_cash_det.innerHTML = "";
	Errmsg_objpandcard.style.display = "none";
	Errmsg_objpandcard.innerHTML = "";

	flag_sumit = true;	

	doc = document.frmDeposit;
	arrTempHotelResNo = doc.reservation.value.split(",");

	for(i=0;i<=arrTempHotelResNo.length-1;i++)
	{
		if(arrTempHotelResNo[i].replace(/ /g,'') == "")
		{
			arrTempHotelResNo.splice(i,1);
		}		
	}
	document.getElementById("err_custCopy6").style.display = "none";
	document.getElementById("err_custCopy6").innerHTML = "";

	if(doc.txttraveller.value.replace(/ /g,'') == "")
	{
		Errmsg_objTravellerName.style.display = "";
		Errmsg_objTravellerName.innerHTML = "Please enter a name";		
		if(flag_sumit)
			doc.txttraveller.focus();
		flag_sumit = false;
	}
	if(doc.txtBnkArrival.value == "" || doc.txtBnkArrival.value == "Date")
	{
		Errmsg_obj_TravellerDate.style.display = ""
		Errmsg_obj_TravellerDate.innerHTML = "Please select a date";		
		if(flag_sumit)
			doc.txtBnkArrival.focus();
		flag_sumit = false;
	}
	if(doc.reservation.value.replace(/ /g,'') == "")
	{
		Errmsg_objReserNo.style.display = "";
		Errmsg_objReserNo.innerHTML = "Please enter hotel reservation number";
		if(flag_sumit)
			doc.reservation.focus();
		flag_sumit = false;
	}
	else
	{
		if(!isHotelReservNo(doc.reservation.value))
		{
			Errmsg_objReserNo.style.display = "";
			Errmsg_objReserNo.innerHTML = "Please enter valid hotel reservation number";
			if(flag_sumit)
				doc.reservation.focus();
			flag_sumit = false;
		}
	}

	if(doc.txtLocation.value.replace(/ /g,'') == "")
	{
		Errmsg_objblocation.style.display = "";
		Errmsg_objblocation.innerHTML = "Please enter a location";
		if(flag_sumit)
			doc.txtLocation.focus();
		flag_sumit = false;
	}
	if(doc.txtemail.value.replace(/ /g,'') == "")
	{
		Errmsg_objbEmail.style.display = "";
		Errmsg_objbEmail.innerHTML = "Please enter an email";
		if(flag_sumit)
			doc.txtemail.focus();
		flag_sumit = false;
	}
	else
	{
		if(!isEmail(doc.txtemail.value))
		{
			Errmsg_objbEmail.style.display = "";
			Errmsg_objbEmail.innerHTML = "Please enter a valid email address";
			if(flag_sumit)
				doc.txtemail.focus();
			flag_sumit = false;
		}
	}
	if(doc.txtStd.value.replace(/ /g,'') == "" || doc.txtphone.value.replace(/ /g,'') == "")
	{
		Errmsg_objbPhone.style.display = "";
		Errmsg_objbPhone.innerHTML = "Please enter a phone number";
		if(flag_sumit)
				doc.txtStd.focus();
		flag_sumit = false;
	}
	if(doc.txtamount.value.replace(/ /g,'') == "")
	{
		Errmsg_objamtWords.style.display = "";
		Errmsg_objamtWords.innerHTML = "Please enter the amount in words";
		if(flag_sumit)
				doc.txtamount.focus();
		flag_sumit = false;
	}
	else
	{
		if(!isAmtInWords(doc.txtamount.value))
		{
			Errmsg_objamtWords.style.display = "";
			Errmsg_objamtWords.innerHTML = "Please enter the valid amount in words";
			if(flag_sumit)	
				doc.txtamount.focus();
			flag_sumit = false;
		}
	}

	if(doc.BB1.value.replace(/ /g,'') == "" && doc.City1.value.replace(/ /g,'') == "" && doc.Drawer1.value.replace(/ /g,'') == "" && doc.Cheque1.value.replace(/ /g,'') == "" && (doc.txtAmount1.value.replace(/ /g,'') == "" || doc.txtAmount1.value == "0") && doc.BB2.value.replace(/ /g,'') == "" && doc.BB3.value.replace(/ /g,'') == "" && doc.City2.value.replace(/ /g,'') == "" && doc.City3.value.replace(/ /g,'') == "" && doc.Drawer2.value.replace(/ /g,'') == "" && doc.Drawer3.value.replace(/ /g,'') == "" && doc.Cheque2.value.replace(/ /g,'') == "" && doc.Cheque3.value.replace(/ /g,'') == "" && (doc.txtAmount2.value == "0" || doc.txtAmount2.value.replace(/ /g,'') == "") && (doc.txtAmount3.value == "0" || doc.txtAmount3.value.replace(/ /g,'') == "")&& doc.Amount1000.value == "0" && doc.Amount500.value == "0" && doc.Amount100.value == "0" && doc.Amount50.value == "0" && doc.Amount20.value == "0" && doc.Amount10.value == "0" && (doc.Others.value == "0" ||doc.Others.value.replace(/ /g,'') == "" ))
	//if(doc.total.value == 0 && doc.txtChequetotal.value == 0)
	{
		for (i=1;i<=3;i++)
		{
			objCC_chqu_Err1 = eval("document.getElementById('error_CC_Det"+i+"')");
			objCC_chqu_Err1.style.display = "none";
			objCC_chqu_Err1.innerHTML = "";
		}
		Errmsg_objchk_cash_det.style.display = "";
		Errmsg_objchk_cash_det.innerHTML = "Please enter the cash or cheque details";
		if(flag_sumit)
			doc.BB1.focus();		
		flag_sumit = false;
	}
	else
	{
		for(i=1;i<=3;i++)
		{
			objCC_bb = eval("doc.BB"+i);
			objCC_city = eval("doc.City"+i);
			objCC_drawer = eval("doc.Drawer"+i);
			objCC_cheque = eval("doc.Cheque"+i);
			objCC_Amount = eval("doc.txtAmount"+i);
			objCC_chqu_Err = eval("document.getElementById('error_CC_Det"+i+"')");
			
			objCC_chqu_Err.style.display = "none";
			objCC_chqu_Err.innerHTML = "";

			if(objCC_bb.value.replace(/ /g,'') != "" || objCC_city.value.replace(/ /g,'') != "" || objCC_drawer.value.replace(/ /g,'') != "" || objCC_cheque.value.replace(/ /g,'') != "" || objCC_Amount.value != 0)
			{
				//objCC_Amount.value.replace(/ /g,'') != ""
				if(objCC_bb.value.replace(/ /g,'') == "")
				{
					objCC_chqu_Err.style.display = "";
					objCC_chqu_Err.innerHTML = "Please fill the all cheque details";
					if(flag_sumit)
						objCC_bb.focus();
					flag_sumit = false;
				}				
				if(objCC_city.value.replace(/ /g,'') == "")
				{
					objCC_chqu_Err.style.display = "";
					objCC_chqu_Err.innerHTML = "Please fill the all cheque details";
					if(flag_sumit)
						objCC_city.focus();
					flag_sumit = false;
				}
				if(objCC_drawer.value.replace(/ /g,'') == "")
				{
					objCC_chqu_Err.style.display = "";
					objCC_chqu_Err.innerHTML = "Please fill the all cheque details";
					if(flag_sumit)
						objCC_drawer.focus();
					flag_sumit = false;
				}
				if(objCC_cheque.value.replace(/ /g,'') == "")
				{
					objCC_chqu_Err.style.display = "";
					objCC_chqu_Err.innerHTML = "Please fill the all cheque details";
					if(flag_sumit)
						objCC_cheque.focus();
					flag_sumit = false;
				}
				else
				{
					if(!isNumber(objCC_cheque.value))
					{
						objCC_chqu_Err.style.display = "";
						objCC_chqu_Err.innerHTML = "Please enter only numbers as cheque number.";
						if(flag_sumit)
							objCC_cheque.focus();
						flag_sumit = false;
					}
				}
				if(objCC_Amount.value.replace(/ /g,'') == "" ||objCC_Amount.value.replace(/ /g,'') == "0" )
				{
					objCC_chqu_Err.style.display = "";
					objCC_chqu_Err.innerHTML = "Please fill the all cheque details";
					if(flag_sumit)
							objCC_Amount.focus();
					flag_sumit = false;
				}
			}
		}

	}
	if(doc.txtPANNumber.value.replace(/ /g,'') == "")
	{
		Errmsg_objpandcard.style.display = "";
		Errmsg_objpandcard.innerHTML = "Please enter pancard number";
		if(flag_sumit)
			doc.txtPANNumber.focus();
		flag_sumit = false;
	}
	else
	{
		if(!isAlphaNumeric(doc.txtPANNumber.value))
		{
			Errmsg_objpandcard.style.display = "";
			Errmsg_objpandcard.innerHTML = "Please enter valid pancard number";
			if(flag_sumit)
				doc.txtPANNumber.focus();
			flag_sumit = false;
		}
	}
	
	for(i=0;i<=arrTempHotelResNo.length-1;i++)
	{
		obj_GuestName = eval("doc.txtCusGuest"+(i+1));
		obj_hotelname_cust = eval("doc.selCusHotel"+(i+1));
		obj_arrivalDate_cust = eval("doc.txtArrival"+(i+1));
		obj_custAmt_cust = eval("doc.txtCusAmount"+(i+1));
		if(obj_GuestName.value.replace(/ /g,'') == "")
		{
			Errmsg_custCopy[i].style.display = "";
			Errmsg_custCopy[i].innerHTML = "Please fill the all details which showing above of details";
			if(flag_sumit)				
				obj_GuestName.focus();
			flag_sumit = false;			
		}
		if(obj_hotelname_cust.value == "0")
		{
			Errmsg_custCopy[i].style.display = "";
			Errmsg_custCopy[i].innerHTML = "Please fill the all details which showing above of details";
			if(flag_sumit)				
				obj_hotelname_cust.focus();
			flag_sumit = false;			
		}
		if(obj_arrivalDate_cust.value == "" || obj_arrivalDate_cust.value == "Date")
		{
			Errmsg_custCopy[i].style.display = "";
			Errmsg_custCopy[i].innerHTML = "Please fill the all details which showing above of details";
			if(flag_sumit)	
				obj_arrivalDate_cust.focus();
			flag_sumit = false;			
		}
		if(obj_arrivalDate_cust.value == "" || obj_arrivalDate_cust.value == "Date")
		{
			Errmsg_custCopy[i].style.display = "";
			Errmsg_custCopy[i].innerHTML = "Please fill the all details which showing above of details";
			if(flag_sumit)	
				obj_arrivalDate_cust.focus();
			flag_sumit = false;			
		}
		if(obj_custAmt_cust.value.replace(/ /g,'') == "" || obj_custAmt_cust.value.replace(/ /g,'') == "0")
		{
			Errmsg_custCopy[i].style.display = "";
			Errmsg_custCopy[i].innerHTML = "Please fill the all details which showing above of details";
			if(flag_sumit)	
				obj_custAmt_cust.focus();
			flag_sumit = false;			
		}
	}
	if(doc.txtCusAmountwords.value.replace(/ /g,'') == "")
	{
		Errmsg_amtwords_cust.style.display = "";
		Errmsg_amtwords_cust.innerHTML = "Please enter the amount in words";
		if(flag_sumit)	
			doc.txtCusAmountwords.focus();
		flag_sumit = false;
	}
	else
	{
		if(!isAmtInWords(doc.txtCusAmountwords.value))
		{
			Errmsg_amtwords_cust.style.display = "";
			Errmsg_amtwords_cust.innerHTML = "Please enter the valid amount in words";
			if(flag_sumit)	
				doc.txtCusAmountwords.focus();
			flag_sumit = false;
		}
	}
	/*if(doc.txtCusTotalAmount.value != doc.txtChequetotal.value && doc.txtCusTotalAmount.value != doc.total.value )
	{
		document.getElementById("err_custCopy6").style.display = "";
		document.getElementById("err_custCopy6").innerHTML = "Your total amount is not matching with bank copy total.";
		flag_sumit = false;

	}*/
	if(flag_sumit)
	{
		doc.method="post";
		doc.action = "Advance_deposit_form_Ac.asp";
		doc.submit();

	}
}

function validateMaxlength(obj,errobj,msg,NoofChar)
{
	/*if(dolimit(obj,NoofChar)==false)
		{
			divobj=document.getElementById(errobj)
			divobj.style.display="";
			divobj.innerHTML=msg;
			obj.focus();
		}
	*/	
}
