var isNS4 = (navigator.appName=="Netscape")?true:false;
	function CompareDates(strFromDate, strToDate)
	{
		if (Date.parse(strFromDate) > Date.parse(strToDate))
			return false;
		else
			return true;
	}
	function fnCompareDate(strDate1,strDate2)// Function To comapair Two Dates of format dd/mm/yyyy
	{
		var strDay		= strDate1.substr(0,strDate1.indexOf("/"));
		var strAfterMon = strDate1.substr(strDate1.indexOf("/")+1);
		var strMon		= strAfterMon.substr(0,strAfterMon.indexOf("/"));
		var strYear		= strAfterMon.substr(strAfterMon.indexOf("/")+1);
		var startdate	= new Date(parseInt(strYear,10),parseInt(strMon,10)-1,parseInt(strDay,10));
		var strDay1		= strDate2.substr(0,strDate2.indexOf("/"));
		var strAfterMon1= strDate2.substr(strDate2.indexOf("/")+1);
		var strMon1		= strAfterMon1.substr(0,strAfterMon1.indexOf("/"));
		var strYear1	= strAfterMon1.substr(strAfterMon1.indexOf("/")+1);
		var enddate		= new Date(parseInt(strYear1,10),parseInt(strMon1,10)-1,parseInt(strDay1,10));
		datediff		= enddate - startdate
		if(datediff == 0)
		{
			return 0; // End Date = Start Date
		}   
		if(datediff<0)
		{
			return 1; // End Date > Start Date
		} 
		
		return 2; // End Date < Start Date
	}
	function fnRoundDecimals(originalnumber, decimals) 
	{
		var result1 = originalnumber * Math.pow(10, decimals)
		var result2 = Math.round(result1)
		var result3 = result2 / Math.pow(10, decimals)
		return padwithzeros(result3, decimals)
	}
	function padwithzeros(roundedvalue, decimalplaces) 
	{
		var valuestring = roundedvalue.toString()
		var decimallocation = valuestring.indexOf(".")
		if (decimallocation == -1) {
		    decimalpartlength = 0
		    valuestring += decimalplaces > 0 ? "." : ""
		}
		else {
		    decimalpartlength = valuestring.length - decimallocation - 1
		}
		var padtotal = decimalplaces - decimalpartlength
		if (padtotal > 0) 
		{
		    for (var counter = 1; counter <= padtotal; counter++) 
		        valuestring += "0"
	    }
		return valuestring
	}
	function funMakeUpperCase(obj,formname)
	{
		var objControl, strValue
		objControl=eval('document.'+formname+'.'+obj.name)
		strValue=objControl.value;
		strValue=strValue.toUpperCase();
		objControl.value=strValue;
	}
	function fnLTrim(str) 
	{
		return str.replace(/^\s+/,'');
	}
	
	function fnRTrim(str) 
	{
		return str.replace(/\s+$/,'');
	}
	function fnTrim(str) 
	{
		return str.replace(/^\s+/,'').replace(/\s+$/,'');
	}
	function fnCodeValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if (val.length == 0 && n == 32)
			return false;
		if(fnValidateCommonKeys(n))
			return true;
		if (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n >= 48 && n <= 57) || (n == 45) || (n == 47) || (n == 92))) 
			return false;
		return true;
	}   
	function fnNameValidation(val, e)
	{ 
		var n = fnGetKeyCode(e);
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if (val.length == 0 && n == 32)
			return false;
		if(fnValidateCommonKeys(n))
			return true;
		if (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || n == 40 || n == 41 || n == 45 || n == 46 || n == 3 || n == 22 || n == 32 || n == 24 ))	// || (n >= 48 && n <= 57)
			return false;
		else
			if (n == 35 || n == 124 || n == 43 || n == 38 || n == 39 || n == 64 )
				return false;
		return true;
	}
	function fnDescriptionValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if (val.length == 0 && n == 32)
			return false;
		if(fnValidateCommonKeys(n))
			return true;
		if  (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n >= 48 && n <= 57) || (n == 32) || (n == 33) || (n >= 35 && n <= 47) || (n == 58) || (n == 59) || (n == 64) || (n == 91) || (n == 92) || (n == 93) || (n == 95) || (n == 123) || (n == 125)))
			return false;
		return true;
	}
	function fnAddressValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if (val.length == 0 && n == 32)
			return false;
		if(fnValidateCommonKeys(n))
			return true;
		if  (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n >= 48 && n <= 57) || (n == 32) || (n == 38) || (n == 40) || (n == 41) || (n >= 44 && n <= 47) || (n == 58) || (n == 59) || (n >= 91 &&  n <= 93) || (n == 93) || (n == 95) || (n == 123) || (n == 125) || (n == 3) || (n == 13) || (n == 22) || (n == 24)))
			return false;
		return true;
	}
	function fnPhFaxPgMobValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if (val.length == 0 && n == 32)
			return false;
		if(fnValidateCommonKeys(n))
			return true;
			if (!((n >= 48 && n <= 57) || (n == 40) || (n == 41) || (n == 43) || (n == 45) || (n == 47) || (n == 60) || (n == 62) || (n == 92)))
				return false;
		return true;
	}
	function fnEmailValidation(oBj) // oBj will be (document.frmSample.txtEmail)
	{
		var emailID = oBj.value;
		if (emailID != "")
		{
			var mailPat = new RegExp(/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/);
			if(!mailPat.test(emailID))
			{
				alert("Invalid Email Address");
				oBj.focus();
				return false;
			}
			return true;
		}
		return true;
	}
	function fnGetKeyCode(e)
	{
		return (navigator.appName=="Netscape") ? e.which : event.keyCode;
	}
	function fnAmountValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;
		if ((n < 48 || n > 57 ) && (n != 46 ))
			return false;
		if (n == 46)
		{	
			firstindex = strValue.indexOf(".");
			if (firstindex >= 0)
				return false;
		}
		return true;
	}
	function fnIntegerValidation(e)	
	{
		var n = fnGetKeyCode(e);
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if(fnValidateCommonKeys(n))
			return true;
		if ((n > 47 && n < 58) || n == 8 || n == 9)
			return true; 
        return false;
	}
	function fnURLValidation(val)	
	{
		return true;
	}       
	function intValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;
		if (!(n >= 48 && n <= 57)) 
		{
			alert("Enter proper Numeric Characters.");
			return false;
		}
		return true;
	}
	function intOnlyValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if (!(n >= 48 && n <= 57)) 
			return false;
		return true;
	}
	function fnPhoneValidation(valcode, valphone)
	{
		if ((valcode != "" && valcode !="--STD--" && valcode !="--STD") && (valphone != "" && valphone!="--PHONE--" && valphone!="--PHONE-"))
		{
			if(valcode.indexOf('0') == 0)
				valcode = valcode.substring(1,valcode.length);
			if(valcode.length + valphone.length != 10) 
			{
				alert("Please enter valid phone number");
				return false
			}
			else
				return true;
		}
		else
			return false;
	}
	function intValidationPrecision(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if (!((n >= 48 && n <= 57 ) || (n == 46)))
		{
			alert("Enter proper Numeric Characters(0-9) and precision.");
			return false;
		}
		return true;
	}
	function fnChangeToUCase(obj, formname)
	{
		var objControl, strValue
		objControl=eval('document.'+formname+'.'+obj.name)
		strValue=objControl.value;
		strValue=strValue.toUpperCase();
		objControl.value=strValue;
	}
	function fnIPAddressValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;
		var i, intNoOfDots;
		intNoOfDots = 0;
		if (n <= 45 || n > 57 )
			return false;
		if (n == 46)
		{	
			for (i=0; i<val.length; i++)
			{
				if (val.charAt(i) == ".")
					intNoOfDots = intNoOfDots + 1;
			}
			if (intNoOfDots >= 3)
				return false;
		}
		return true;
	}
    function fnGetCurrentDate_DMY() //('dd-mm-yyyy') Added by Rupam CR 92 14/05/2008 
	{
		var strCurrentDate = new Date();
		strCurrentDate =strCurrentDate.getDate()+"-"+(strCurrentDate.getMonth()+1)+"-"+strCurrentDate.getFullYear();
		return 	strCurrentDate;		
	}
	function fnGetCurrentDateOnly()
	{
		var strCurrentDate = new Date();
		strCurrentDate = new Date(strCurrentDate.getFullYear(),strCurrentDate.getMonth(),strCurrentDate.getDate());
		return 	strCurrentDate;		
	}
	function fn_DMY_TO_MDY(strDate, Seperator)
	{
		var arrstrDate = strDate.split(Seperator); 
		strDate	= arrstrDate[1]+Seperator+arrstrDate[0]+Seperator+arrstrDate[2];
		return strDate;	
	}
	function fn_DMY_TO_YMD(strDate, Seperator)
	{
		var arrstrDate = strDate.split(Seperator); 
		strDate	= arrstrDate[2]+Seperator+arrstrDate[1]+Seperator+arrstrDate[0];
		return strDate;	
	}
	function fn_SendingDate(strDate, Seperator)
	{
		var arrstrDate = strDate.split(Seperator); 
		strDate	= arrstrDate[2]+"-"+arrstrDate[1]+"-"+arrstrDate[0];
		return strDate;	
	}
	function fnIsEmpty(CntlName, LableName)
	{
		if( (fnTrim(CntlName.value) == "") || (fnTrim(CntlName.value) == "dd/mm/yyyy") )
		{
			alert( "Enter " + LableName);
			CntlName.focus();
			return false;
		}
		return true;
	}
	function fnIsEmptyCombo(CntlName, LableName)
	{
		if(CntlName != null && CntlName.selectedIndex > -1)
		{
			if(CntlName.options[CntlName.selectedIndex].value.trim() == "-1")
			{
				alert("Please Select " + LableName);
				CntlName.focus();
				return false;
			}
		}
		else
		{
			alert("Please Select " + LableName);
			CntlName.focus();
			return false;
		}
		return true;
	} 
	function fnTextAreaLength(CntlName,LableName,Length,e)
	{
		CntlName.value = CntlName.value.trim();
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if(fnTrim(CntlName.value).length > Length)
		{
			alert("Please Enter " + LableName  + " upto "+ Length +" Characters");
			CntlName.focus();
			return false;
		}
		else
			return true;
	} 	
	function Validate_TextArea(source,value) 
	{
		str = value.Value;
		str = strtrim(str);
		if ( str.length > 2500 || str.length< 5 )
			value.IsValid = false;
		else
			value.IsValid = true;
	}
	function Debug(strValue)
	{
		var mWinOpen = window.open('','','width=500,height=300,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,left=160,top=100');
		mWinOpen.document.write(strValue);
		mWinOpen.document.close();
	}
	function MemberidValidation(e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if(!((n>=65 && n<=90)||(n>=97 && n<=122)||(n>=48 && n<=57)||(n==32)|| (n == 45)))
			return false;
		return true;
	}
	function fnDateAdd(mDatePart , mNumber, mDate)
	{
		var arrDate = mDate.split("/");	
		var dt = new Date(fnCInt(arrDate[2]), fnCInt(arrDate[1])-1, fnCInt(arrDate[0]));
		if (mDatePart.toLowerCase() == 'd')
			return dt.addDays(mNumber).toDateFormat('dd/MM/yyyy');
		else if (mDatePart.toLowerCase() == 'm')
			return dt.addMonths(mNumber).toDateFormat('dd/MM/yyyy');
		else if (mDatePart.toLowerCase() == 'y')
			return dt.addYears(mNumber).toDateFormat('dd/MM/yyyy');
		else
			return dt.toDateFormat('dd/MM/yyyy');
	}
	function fnDateDiffAll(mNumber, mDate)
	{
		var xml = clienCallback("Date", "DateDiffAll|"+mNumber+"|"+mDate+"|");
		return xml.responseText;
	}
	function fnDateDiff(mDatePart, mStartDate, mEndDate)
	{
		var arrDate = mStartDate.split("/");
		var stdt = new Date(fnCInt(arrDate[2]), fnCInt(arrDate[1])-1, fnCInt(arrDate[0]));
		var arrDate = mEndDate.split("/");
		var endt = new Date(fnCInt(arrDate[2]), fnCInt(arrDate[1])-1, fnCInt(arrDate[0]));
		return endt.subtract(stdt).dateDiff(mDatePart);
	}
	function isValidDate(mDate) 
	{
		dateStr = fnReplace(mDate.value, "-", "/");
		if (dateStr == "dd/mm/yyyy" || dateStr == "")
		{
			mDate.value = "dd/mm/yyyy";
			return true;
		}
		var datePat1 = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
		var datePat = new RegExp("^[0-9]{1,2}[/]{1,1}[0-9]{1,2}[/]{1,1}([0-9]{2}|[0-9]{4})$"); 
		if(!datePat.test(dateStr))
		{
			alert("Date is not in a valid format.");
			mDate.value = "";
			mDate.focus();
			return false;
		}
		var matchArray = dateStr.match(datePat1); // if the format is ok.
		month = matchArray[3]; // parse date into variables
		day = matchArray[1];
		year = matchArray[4];
		if (month < 1 || month > 12) 
		{ // check month range
			alert("Month must be between 1 and 12.");
			return false;
		}
		if (day < 1 || day > 31) 
		{
			alert("Day must be between 1 and 31.");
			return false;
		}
		if ((month==4 || month==6 || month==9 || month==11) && day==31) 
		{
			alert("Month "+month+" doesn't have 31 days!")
				return false
				}
		if (month == 2) 
		{ // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (day>29 || (day==29 && !isleap)) 
			{
				alert("February " + year + " doesn't have " + day + " days!");
				return false;
			}
		}
		month = "0"+month;
		month = month.substring(month.length-2,month.length)
			day = "0"+day;
		day = day.substring(day.length-2,day.length)
			year = "20" + year;
		year = year.substring(year.length-4,year.length)
		mDate.value = day + "/" + month + "/" + year;
		return true;  // Added by Deepak on 12-08-2006
	}
	function fnPasswordValidation(mObject)
	{
		var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*";
		for (var i=0; i<=mObject.value.length; i++) 
		{
			if (valid.indexOf(mObject.value.charAt(i)) < 0) 
			{
				alert("Your password contains invalid characters");
				mObject.focus();
				return false;
			}
		}
		return true;
	}
	function isValidDateCommon(mDate,mLabel) 
	{
		dateStr = fnReplace(mDate.value, "-", "/");
		if (dateStr == "dd/mm/yyyy" || dateStr == "")
		{
			mDate.value = "dd/mm/yyyy";
			return true;
		}
		if (dateStr!='')
		{
			var datePat1 = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
			var datePat = new RegExp("^[0-9]{1,2}[/]{1,1}[0-9]{1,2}[/]{1,1}([0-9]{2}|[0-9]{4})$"); 
			if(!datePat.test(dateStr))
			{
				alert("Please enter " + mLabel + " in dd/mm/yyyy format")
				mDate.value="";
				mDate.focus();
				return false;
			}
			var matchArray = dateStr.match(datePat1); // if the format is ok.
			var month = matchArray[3]; // parse date into variables
			var day = matchArray[1];
			var year = matchArray[4];
		if (month < 1 || month > 12) 
			{ // check month range
				alert("Month must be between 1 and 12.");
				mDate.value="";
				mDate.focus();
				return false;
			}
			if (day < 1 || day > 31) 
			{
				alert("Day must be between 1 and 31.");
				mDate.value="";
				mDate.focus();
				return false;
			}
			if ((month==4 || month==6 || month==9 || month==11) && day==31) 
			{
				alert("Month "+month+" doesn't have 31 days!")
				mDate.value="";
				mDate.focus();
				return false
			}
			if (month == 2) 
			{ // check for february 29th
				var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
				if (day>29 || (day==29 && !isleap)) 
				{
					alert("February " + year + " doesn't have " + day + " days!");
					mDate.value="";
					mDate.focus();
					return false;
				}
			}
			month = "0"+month;
			month = month.substring(month.length-2,month.length)
			day = "0"+day;
			day = day.substring(day.length-2,day.length)
			year = "20" + year;
			year = year.substring(year.length-4,year.length)
			mDate.value = day + "/" + month + "/" + year;
			return true;
		}
		return false;
	}
	function isLombardSpecialChars(strValue, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((strValue.length == 0) && (n == 32))
			return false;
		if(strValue.length >=1)
		{
			if(n == 45 && strValue.substring(strValue.length -1, strValue.length) == "-")
				return false;
		}
		if (n == 37 || n == 34 || n == 42 || n == 59 || n == 60 || n == 62 || n == 35 || n == 124 || n == 43 || n == 38 || n == 39)
			return false;
		return true;
	}
	function fnGenericValidation(strvalue)
	{
	}
	function isValidDateCommonMonthYear(mDate,mLabel) 
	{
		dateStr = fnReplace(mDate.value, "-", "/");
		if (dateStr == "dd/mm/yyyy" || dateStr == "")
		{
			alert(mLabel + " is Blank.")
			return false;
		}
		if (dateStr!='')
		{
			var datePat1 = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
			var datePat = new RegExp("^[0-9]{1,2}[/]{1,1}[0-9]{1,2}[/]{1,1}[0-9]{2,4}$"); // do  not delete
			dateStr = '01/'+ dateStr;
			if(!datePat.test(dateStr))
			{
				alert(mLabel + " is not in a valid format.")
				mDate.value="";
				mDate.focus();
				return false;
			}
			var matchArray = dateStr.match(datePat1); // if the format is ok.
			if(matchArray !=null)
			{
				month = matchArray[3]; // parse date into variables
				day = matchArray[1];
				year = matchArray[4];
				if (month < 1 || month > 12) 
				{ // check month range
					alert("Month must be between 1 and 12.");
					mDate.value="";
					mDate.focus();
					return false;
				}
				if (day < 1 || day > 31) 
				{
					alert("Day must be between 1 and 31.");
					mDate.value="";
					mDate.focus();
					return false;
				}
				if ((month==4 || month==6 || month==9 || month==11) && day==31) 
				{
					alert("Month "+month+" doesn't have 31 days!")
					mDate.value="";
					mDate.focus();
						return false
				}
				if (month == 2) 
				{ // check for february 29th
					var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
					if (day>29 || (day==29 && !isleap)) 
					{
						alert("February " + year + " doesn't have " + day + " days!");
						mDate.value="";
					mDate.focus();
						return false;
					}
				}
				month = "0"+month;
				month = month.substring(month.length-2,month.length)
				day = "0"+day;
				day = day.substring(day.length-2,day.length)
				year = "20" + year;
				year = year.substring(year.length-4,year.length)
				mDate.value = month + "/" + year;
			}//if(matchArray !=null)
			else
			{
				return false;
			}//if(matchArray !=null)
			return true;
		}
	}
	function fnDisplayDateFormat(DataString)
	{
		var	monthName =	new	Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
		var arrDataString = DataString.split("/");
		return arrDataString[0] +"-"+  monthName[parseFloat(arrDataString[1])-1] +"-"+ arrDataString[2];
	}
	function fnAlphaCharactersValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((val.length == 0) && (n == 32))
			return false;
		if (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122)) ) 
			return false;
		return true;
	}   
	function fnOnPaste()
	{
		event.returnValue = false;
	}
	
	function fnSetEmiValue(mTotalPremium, mEMIPeriod)
	{
	if((vDealNo=='False')||(vDealNo==null)||(vDealNo==""))   //cr-56 Added by sapna 24/04/2008
		{
		
			if (blnEMI)
			{
				var mEMIValue = parseInt(mTotalPremium)/mEMIPeriod;
				if (parseFloat(mTotalPremium) >= 1500)
				{
					//CR 201 - EMI Text Highlight Modified By Roupika  //document.getElementById('lblEMIDetails').innerHTML = "Interest free EMI Rs."+ fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") +" for 12 months on ICICI Bank Credit Card"; 
					 //document.getElementById('lblEMIDetails').innerHTML = "<span style='font size=18pt'>Interest free EMI Rs."+ fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") +" for 12 months<Font style='font size=11pt'><b>&nbsp;(on ICICI Bank Credit Cards)</b></Font></span>";
					//added by Reshma on 26-Dec-2008
					//Commented By Roupika CR-Cosmatic Changes document.getElementById('lblEMIDetails').innerHTML = "<b><span style='font size=10pt' ><Font style='font size=11pt'><b>&nbsp;Special Offer:&nbsp;</B></Font>Now pay your Premium in 12 Interest Free EMIs of Rs."+ fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") +"&nbsp;each</b>&nbsp;<Font style='font size=11pt'>&nbsp;(on ICICI Bank Credit Cards)<br></Font>Rs.&nbsp;" + fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") + "&nbsp;per month x 12 months<Font color=#000000 style='font-size=8pt'>&nbsp;(you can select this option on payments page)</Font></span>";
					//Added By Roupika CR-Cosmatic Changes
						document.getElementById('lblEMIDetails').innerHTML = "<b><span style='font size=10pt' ><Font style='font size=11pt'><B>&nbsp;Special Offer:&nbsp; </Font>You can now pay your premium of Rs." + fnFormatCurrency(fnFormatNumber(mTotalPremium,0)).trim().replace(".00","") +"&nbsp;in 12 monthly EMIs of Rs."+  fnFormatCurrency(fnFormatNumber(mEMIValue,2)).trim().replace(".00","") +"&nbsp;each</B><br/>&nbsp;<Font color=#000000>&nbsp;(without any extra charges on ICICI Bank Credit Cards)</Font><br> <Font style='font-size=8pt'>&nbsp;<B>You can select this option on Payment page.</B></Font></span>";
				}		
				else
					document.getElementById('lblEMIDetails').innerHTML = "";
			}
		}
		else
		{
			document.getElementById('lblEMIDetails').innerHTML = "";
		}
	}
	// Added By Rupam For CR-134 Date 11/07/08
	function fnSetEmiValueForHealth(mTotalPremium, mEMIPeriod)
	{
	
	if((vDealNo=='False')||(vDealNo==null)||(vDealNo==""))   
		{		
			if (blnEMI)
			{	
				var mEMIValue = parseInt(mTotalPremium)/mEMIPeriod;
				if (parseFloat(mTotalPremium) >= 1500)
					//document.getElementById('lblEMIDetails').innerHTML = "<span style='font size=18pt'>Interest free EMI of Rs. "+ fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") + " for 12 months<Font style='font size=11pt'><b>&nbsp;(on ICICI Bank Credit Cards)</b></Font></span>";
				//added by Reshma on 26-Dec-2008
			//Commented By Roupika CR-Cosmatic Changes	document.getElementById('lblEMIDetails').innerHTML = "<b><span style='font size=10pt' ><Font style='font size=11pt'><b>&nbsp;Special Offer:&nbsp;</B></Font>Now pay your Premium in 12 Interest Free EMIs of Rs."+ fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") +"&nbsp;each</b>&nbsp;<Font style='font size=11pt'>&nbsp;(on ICICI Bank Credit Cards)<br></Font>Rs.&nbsp;" + fnFormatCurrency(fnFormatNumber(mEMIValue,0)).trim().replace(".00","") + "&nbsp;per month x 12 months<Font color=#000000 style='font-size=8pt'>&nbsp;(you can select this option on payments page)</Font></span>";
			//Added By Roupika CR-Cosmatic Changes
						document.getElementById('lblEMIDetails').innerHTML = "<b><span style='font size=10pt' ><Font style='font size=11pt'><B>&nbsp;Special Offer:&nbsp; </Font>You can now pay your premium of Rs." + fnFormatCurrency(fnFormatNumber(mTotalPremium,0)).trim().replace(".00","") +"&nbsp;in 12 monthly EMIs of Rs."+  fnFormatCurrency(fnFormatNumber(mEMIValue,2)).trim().replace(".00","") +"&nbsp;each</B><br/> <Font color=#000000>&nbsp;(without any extra charges on ICICI Bank Credit Cards)</Font><br> <Font  style='font-size=10pt'>&nbsp;<B>You can select this option on Payment page.</B></Font></span>";
					
				else
					document.getElementById('lblEMIDetails').innerHTML = "";
					
					
			}
		}
		else
		{
			document.getElementById('lblEMIDetails').innerHTML = "";
			
		}
	}
	//End CR-134
	
	
	function fnValidateNRIDelyAddress()
	{
		var retDely;
		retDely = fnIsEmpty(document.getElementById('txtDeliverAdd'), 'Delivery Address')
		if (retDely == true )
			retDely = fnIsEmpty(document.getElementById('txtDeliverCity'), 'Delivery City')
		if (retDely == true )
			retDely = fnIsEmpty(document.getElementById('txtDeliverState'), 'Delivery State')
		if (retDely == true )
			retDely = fnIsEmptyCombo(document.getElementById('ddlDeliverCountry'), 'Delivery Country')
		if (retDely == true )
			retDely = fnIsEmpty(document.getElementById('txtDeliverZipcode'), 'Zipcode')
		if (retDely == true && document.getElementById('txtDeliverPhoneNo')!=null)
			retDely = fnIsEmpty(document.getElementById('txtDeliverPhoneNo'), 'Contact No.')
		if (retDely == true )
				return true;					
			else
				return false;
	}
	function fnAlphNumericValidation(Val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if ((Val.length == 0) && (n == 32))
			return false;
		if (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n >= 48 && n <= 57)) ) 
			return false;
		return true;
	}
	function fnSetDOBAttribute(mObject, mLoginID, mRelationFor)
	{
		var xml = clienCallback("Combo", mLoginID+"|"+mRelationFor+"|");
		var Models = xml.responseText;
		var modelArray = Models.split("#@!");
		var i = 0;
		mObject.length = modelArray.length;
		mObject.options[0].value = "-1";
		mObject.options[0].text  = "--Select--";
		mObject.options[0].dob = "";
		for(var i=1; i < modelArray.length; i++)
		{
			arr = modelArray[i-1].split("|");
			mObject.options[i].value = arr[0];
			mObject.options[i].text  = arr[1];
			mObject.options[i].dob = arr[2];
			mObject.options[i].name = arr[3];
		}
	}
	function fnFillCombo(mObject, spName, param)
	{

		var xml = clienCallback("FillDropDown", spName+"|"+param+"|");
		var Models = xml.responseText;
		//alert(Models);
		if(Models != "")
		{
			var modelArray = Models.split("#@!");
			var i = 0;
			mObject.length = modelArray.length;
			mObject.options[0].value = "-1";
			mObject.options[0].text  = "--Select--";
			mObject.options[0].dob = "";
			for(var i=1; i < modelArray.length; i++)
			{
				arr = modelArray[i-1].split("|");
				mObject.options[i].value = arr[0];
				mObject.options[i].text  = arr[1];
			}
			return true;
		}
		else
		{
			return false;
		}
	}
	// Added for FFH CR -261
	function fnFillCombo_for_FFH(mObject, spName, param1,param2)
	{
		var xml = clienCallback("FillDropDown", spName+"|"+param1+"*"+param2+"|");
		var Models = xml.responseText;
		/*alert("jitendra common");
		alert(spName);
		alert(mObject);
		alert(Models);
		alert("jitendra after Model");*/
		
		if(Models != "")
		{
			var modelArray = Models.split("#@!");
			var i = 0;
			mObject.length = modelArray.length-1;
			for(var i=0; i < modelArray.length-1; i++)
			{
				arr = modelArray[i].split("|");
				mObject.options[i].value = arr[0];
				mObject.options[i].text  = arr[1];
			}
			return true;
		}
		else
		{
			return false;
		}
	}
	// ENDS here
	function fnClearCombo(mObject,strVal,strDesc)
	{
		var noitems=0;
		noitems = mObject.length;
		var i = 0;
		while(mObject.length != 0)
			mObject.remove(i);
		mObject.length = 1;	
		mObject.options[0].value = strVal;
		mObject.options[0].text  = strDesc;
		return "";
	}
	// added by jitendra For CRE 261 06/jan/09
	/*function fnRemoveValuesCombo(mObject,strVal)
	{
		alert(mObject);
		alert(strVal);
		var noitems=0;
		noitems = mObject.length;
		var i = 0;
		while(mObject.length != 0)
			if(mObject.options[0].value == strVal)
			{
			alert(strVal);
			 mObject.remove(i);
			}
		return "";
	}*/
	//fnRemoveValuesCombo($('ddlKids'),"2");  ENDS jitendra For CRE 261 06/jan/09
	function fnTxtMinLen(Ctrl,CharLength, ForCtrl)
	{
		var Ctrlval=Ctrl.value;	
		if(Ctrlval.length<CharLength)
		{
			alert("Please Enter Min " + CharLength + " Characters "+ForCtrl);
			Ctrl.focus();
			return false;
		}	
		return true;	
	}
	function fnNameValidate(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if((n>=65 && n<=90) || (n>=97 && n<=122) ||(n==32) ||(n==39)||(n==47)||(n==39) ||(n==46))// || (n>=97 && n<=122))
			return true;
		return false;
	}
	function DeleteText(CntlName,CntlValue)	
	{
		var docElemt = eval("document.forms[0]."+CntlName);
		CntlValue = CntlValue.substring(0,2);
		if(CntlValue =="--")
			docElemt.value = "";
	}
	function fnYesNo(mPar)
	{
		if ((mPar == "N") || (parseInt(mPar) == 0))
			return "No";
		else
			return "Yes";
	}
	function isLombardPasswordChars(strValue, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((strValue.length == 0) && (n == 32))
			return false;
		if (n == 38 || n == 36 || n == 37)
			return false;
		return true;
	}
	function fnWindowPopUPOpen(URL)
	{
		window.open(URL,'Project10','width=800,height=600,status=yes,toolbar=no,menubar=no,scrollbars=yes,left=160,top=100');
	}
	function fnWindowPopUPOpenHealthOffline(URL)
	{
		window.open(URL,'CustomerCare','width=700, height=350, menubar=no, resizable=no');
	}
	function fnWindowPopUPOpenResizable(URL)
	{
		window.open(URL,'Project10','width=800,height=600,status=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,left=160,top=100');
	}
	function fnSetSelectedText(mObject, val)
	{
		for (var i=0;i<mObject.length;i++)
		{
			if (mObject.options[i].text.toLowerCase() == val.toLowerCase())
				mObject.selectedIndex = i;
		}
	}
	function fnSetSelectedValue(mObject, val)
	{
		for (var i=0;i<mObject.length;i++)
		{
			if (mObject.options[i].value.toLowerCase() == val.toLowerCase())
				mObject.selectedIndex = i;
		}
	}
	function fnAlphNumericSpaceValidation(Val, e)
	{
		var n = fnGetKeyCode(e);
		
		if(fnValidateCommonKeys(n))
			return true;		
		if ((Val.length == 0) && (n == 32))
			return false;
		if (!((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n >= 48 && n <= 57) || (n == 32)) ) 
			return false;
		return true;
	}
	function fnNameValidationWithOutHypehen(val, e)
	{ 
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if ((val.length == 0) && (n == 32))
			return false;
		if (!( (n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n == 40) || (n == 41)|| (n == 46) || (n == 3) || (n == 22) || (n == 24) || (n == 32) ))	
			return false;
		else
		{
			if (n == 35 || n == 124 || n == 43 || n == 38 || n == 39 || n == 64 )
				return false;
		}
	}
	function fnFinancerAddressValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;	
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if ((val.length == 0) && (n == 32))
			return false;
		if  (!( (n >= 65 && n <= 90)   || (n >= 97 && n <= 122) ||(n == 32) || (n == 45) || (n == 44) || (n == 47) ||(n == 13)))
			return false;
		return true;
	}
	function fnOtherDiseaseValidation(val, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if ((val.length == 0) && (n == 32))
			return false;
		if(!((n == 32) || (n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n == 44)))
			return false;
		return true;
	}
	function fnSetSelectedvalue(mObject, val)
	{
		for (var i=0;i<mObject.length;i++)
		{
			if (mObject.options[i].text == val)
				mObject.selectedIndex = i;
		}
	}		
	function calcHeight()
	{
		var mWidth = document.body.scrollWidth + 4;
		var mHeight = document.body.scrollHeight + 5;
		self.resizeTo(mWidth, mHeight);
	}
	function fnValidateDateInput(strValue, e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if ((n == 8) || (n == 9) || (n==0))
			return true;
		if ((strValue.length == 0) && (n == 32))
			return false;
		if(strValue.length >1)
		{		
			if(n == 45 && strValue.substring(strValue.length -1, strValue.length) == "-")
				return false;
		}
		if (!(n >=47 && n <= 57))
			return false;
		return true;
	}
	function fnPolicyNoValidation(e)
	{
		var n = fnGetKeyCode(e);
		if(fnValidateCommonKeys(n))
			return true;		
		if((n>=65 && n<=90)||(n>=97 && n<=122))
			return true;
		else if((n>=48 && n<=57)  || (n == 47) || (n == 45))
			return true;		
		else
			return false;
	}
	function fnRedirectPage(mUrl, mFrom, mDealNo)
	{
		if (mFrom == "Y")
		{
			lomwin = window.open(mUrl,'lomwin','top=5,left=5,width=' + (parseInt(screen.width) - 6) + ',height=' + (parseInt(screen.height) - 6) + ',toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes');
			location.href = "../../../../Common/Empty.aspx?DealNo=" + mDealNo;
		}
		else
		{
			document.forms[0].action = mUrl;
			document.forms[0].submit();
		}
	}
	function fnGenderCheck(objGender,CustTitle)
	{
		if(CustTitle == "Mr")
			objGender.value = "Male";
		else
			objGender.value = "Female";
	}
	function fnValidateDepositAmt(DealNo, PremiumAmt)
	{
		var xml = clienCallback("CHECKMBTBAL",DealNo + "|" + PremiumAmt + "|");
		var Models = xml.responseText;
		if(xml.status == '200' || xml.status == '0')
		{
			if (Models == '-2')
			{
				alert("Insufficent Balance");
				return false;
			}
			else if(Models == '-1' || Models == '1')
				return true;
		}

		return true;
	}
function fnFormatNumber(mValue, mDecimal)
{
	return mValue.formatNumber(mDecimal);
}
function fnFormatCurrency(mValue)
{
	return mValue.formatCurrency();
}
function fnReplace(mValue, findStr, replaceStr)
{
	return mValue.toString().replaceAll(findStr, replaceStr, false);
}
function fnValidateObject(mObject)
{
	return true;
}
function fnCInt(mValue)
{
	return new Number(mValue);
}
function fnValidateCommonKeys(keyCode)	
{
	if ((keyCode == 8) || (keyCode == 9) || (keyCode == 0))
		return true;
	else
	    return false;

	return true;
}
function fnIsCheckRadio(CntlName, LableName)
	{
		var retval = false;
		for(var i=0;i<CntlName.length;i++)
		{
			if(CntlName[i].checked)
			{
				retval = true;

				break;
			}
		}
		if(!retval)
		{
			alert("Please Select " + LableName);
		}
		return retval;
	} 
function fnLoginIdValidate(val, e)
{
	var n = fnGetKeyCode(e);
	if(fnValidateCommonKeys(n))
			return true;
	if(val.length<1)
	{
		if((n>=65 && n<=90) || (n>=97 && n<=122) )
		{
			return true;	
		}
		else
		{
			alert("First Character should be alphabatic for Login ID");
			return false;
		}	
	}
	if (!((n >= 48 && n <= 57) || (n >= 65 && n <= 90) ||
	(n >= 97 && n <= 122) ||(n==45) ||(n==95)) )
	{			
		return false;
	}		
}


//Added By Arohi for CR-242 Mobile no validation
function fnMobileNoWith9(cntlName)
{
	var strMobileNo=document.getElementById(cntlName).value;
	var strSubstring=strMobileNo.substring(0,1);
	if(strSubstring!="9")
	{
		alert("Mobile Number should start with 9");
		document.getElementById(cntlName).focus();
		return false;
	}
	else
	{
		return true;
	}
}


function fnMobileLength10(ctrlName)
{
	var strMobileNo=document.getElementById(ctrlName).value;
	if(strMobileNo.length<10)
	{
		alert("Mobile Number should be of 10 digits");
		document.getElementById(ctrlName).focus();
		return false;
	}
	else
	{
		return true;
	}
}

function fnValidMobileNo(cntlName)
{
			  var digits="0123456789";
			   var temp;
			   var flag=1;
				for (var i=0;i<document.getElementById(cntlName).value.length;i++)
				{
						temp= document.getElementById(cntlName).value.substring(i,i+1);
						if (digits.indexOf(temp)==-1)
						{
									flag = 0;
									
						}
				}
				if(flag==0)
				{
					alert("Please enter correct Mobile Number.");
					document.getElementById(cntlName).focus();
					return false;
				}
				else
				{
					return true;
				}
}


//End By Arohi for CR-242 Mobile no validation