function getHelp( compid ) { var path = document.location.href+""; // Changed the following line by using substring instead of substr(which was wrong) // Changed by Nitin Jadhav as on 25/02/2004 // var newPath = path.substr(path.indexOf("tangible"),path.indexOf(".jsp")+4); var newPath = path.substring(path.indexOf("tangible"),path.indexOf(".jsp")+4); var paramStr = newPath+":"+compid; var det = "/tangible/help/commonhelp.jsp?compid=" + paramStr ; window.open( det ,"Help","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=460,height=180,top=140,left=170"); } function getErrorPage(errCode) { var erpage = "/tangible/common/errorpage.jsp?errKey=" + errCode ; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); } function getErrorPageWithParam(errCode, param) { var erpage = "/tangible/common/errorpageWithParam.jsp?errKey=" + errCode+"¶mVal="+param ; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); } function getErrorWithParam(errCode, param) { var erpage = "/tangible/common/errorWithParam.jsp?errKey=" + errCode+"¶mVal="+param ; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); } function getMultiErrorPage(errCode) { var erpage = "/tangible/common/multierrorpage.jsp?errKey="+errCode; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes,width=450,height=300,top=200,left=230"); } function getErrorPageParam(errCode,paramValue) { var erpage = "/tangible/common/errorpage.jsp?errKey="+errCode+"¶mValue="+paramValue; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); } function setErrorColor(Obj) { Obj.style.backgroundColor=color; } function setDefaultColor(Obj) { Obj.style.backgroundColor=defaultColor; } function getRuntimeMessages(errCode,paramValues,formName,destinationyes,destinationno) { var erpage = "/tangible/common/getRuntimeMessages.jsp?errKey="+errCode+"¶mValues="+paramValues+"&formName="+formName+"&destinationyes="+destinationyes+"&destinationno="+destinationno ; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); } function getConfirmPage(errCode,formName) { var erpage = "/tangible/common/Confirm.jsp?errKey="+errCode+"&formName="+formName; deleteConfirmWin = window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); return deleteConfirmWin; } function getConfirmSave(errCode,formName,funcName) { var erpage = "/tangible/common/ConfirmSave.jsp?errKey="+errCode+"&formName="+formName+"&funcName="+funcName; SaveConfirmWin = window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); return SaveConfirmWin; } // Required for Banaglore Jsps..... function getConfirmMessages(errCode) { var erpage = "/tangible/common/getConfirmMessages.jsp?errKey="+errCode; window.open(erpage,"Error","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=350,height=150,top=200,left=230"); return true; } /* FUNCTION FOR ENTERKEY NAVIGATION */ function fn(form,field) { var next=0, found=false var f=form if(event.keyCode!=13) return; for(var i=0;i12 || intMonth<1) { err = "DATE_1002"; //Invalid Month return false; } if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intDay > 31 || intDay < 1)) { err = "DATE_1003"; //Invalid Day for the Month return false; } if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30 || intDay < 1)) { err = "DATE_1003";// Invalid Day for the Month return false; } if (intMonth == 2) { if (intDay < 1) { err = "DATE_1003"; //Invalid day for Month return false; } if (LeapYear(intYear) == true) { if (intDay > 29) { err = "DATE_1004"; //In Leap year February cannot have more than 29 days return false; } } else { if (intDay > 28) { err = "DATE_1005"; //Feb can not have more than 28 days return false; } } } if(beyondChkReq=="Y") { if (Math.abs(intYear-curYear)>invalidBeyond) { err="DATE_1006"; //Date beyond n Years is invalid return false; } } return true; } function LeapYear(intYear) { if (intYear % 100 == 0) { if (intYear % 400 == 0) { return true; } } else { if ((intYear % 4) == 0) { return true; } } return false; } function decimalChk(amt,ccyid) { var err="CCY_1001" //No of Decimals exceeds the number allowed for this currency var noDecAllowed; var ccyDecDelim; var amtLength; var decDelimIndex; if (ccyid != 0) { noDecAllowed=eval("document.commonService.CCYID_"+ccyid+".value"); } else { noDecAllowed=document.commonService.rateprecision.value; } ccyDecDelim=document.commonService.ccydecdelim.value; amtLength=amt.length; decDelimIndex=amt.indexOf(ccyDecDelim); if (amt.indexOf(ccyDecDelim) == -1) { return true; } else { if ((amtLength-decDelimIndex-1)>noDecAllowed) { getErrorPage(err); return false; } else if (amt.indexOf(ccyDecDelim) != amt.lastIndexOf(ccyDecDelim)) { getErrorPage(err); return false; } return true; } return true; } // This func used in bangalore do not change--Nilesh 170702 /* Commented By Prashanth KA 29-July-02 function decimalCheck(decNumber,ccyid,wno) { var decNum=decNumber; var ccydecdelim=document.commonService.ccydecdelim.value; var strArray=decNum.split(ccydecdelim); var dec1=strArray[0]; var dec2=strArray[1]; if(strArray.length>0) { for( i=0;iwno) { getErrorPage('NUM_1002'); //Length of amount exceeds the maximum size return false; } return true; } */ function replaceDate(comp) { var retdate; comp.value=giveFullDate(comp.value); } function giveFullDate(dateStr) { var strDate; var strDateArray; var strDay; var strMonth; var strYear; var intDay; var intMonth; var intYear; var booFound = false; var datedelim ; var dateformat; var returnDate; var curYear; curYear=parseInt(document.commonService.curyear.value); datedelim=document.commonService.datedelim.value; var intElementNr; strDate = dateStr; dateformat=document.commonService.dateformat.value; if ((strDate.length) < 1) { return ""; } if (strDate.indexOf(datedelim) != -1 && strDate.indexOf(datedelim) != 0) { strDateFormatArray=dateformat.split(datedelim); strDateArray = strDate.split(datedelim); booFound=true; for(i=0;i<3;++i) { if (strDateFormatArray[i]=="DD") strDay=strDateArray[i]; if (strDateFormatArray[i]=="MM") strMonth=strDateArray[i]; if (strDateFormatArray[i]=="YYYY") strYear=strDateArray[i]; } if (strDay.length < 2) strDay="0"+strDay; if (strMonth.length < 2) strMonth="0"+strMonth; if (strYear.length < 2) strYear="0"+strYear; if (strYear.length == 2) { strYear = document.commonService.currcentury.value + strYear; } returnDate=""; for(i=0;i<3;++i) { if (strDateFormatArray[i]=="DD") returnDate = returnDate +strDay ; if (strDateFormatArray[i]=="MM") returnDate = returnDate+strMonth ; if (strDateFormatArray[i]=="YYYY") returnDate=returnDate+strYear; if (i<2) returnDate=returnDate+datedelim; } }else{ returnDate = dateStr; } return returnDate; } function LeapYear(intYear) { if (intYear % 100 == 0) { if (intYear % 400 == 0) { return true; } } else { if ((intYear % 4) == 0) { return true; } } return false; } function checkNullString(formvalue) { if(formvalue.length==0||formvalue=="") return false; if(isAllSpaces(formvalue)) return false; return true; } function isAllSpaces(formvalue) { if (formvalue == " ") { return true; } var spaces = 0; for (var i = 0; i < formvalue.length; i++) { var ch = formvalue.substring(i, i + 1); if (ch == " ") { spaces++; } } if (spaces == formvalue.length) { return true; } return false; } // Function to check for Number //changed by NaliniSK function isNumber(formvalue) { var formvalue1=formvalue; var ccySepDelim=document.commonService.ccySeparatorDelim.value; var strArray=formvalue1.split(ccySepDelim); for(var i=0;i255) { return false } } return true } // Domain is symbolic name var domainArray=domain.match(domainPat) if (domainArray==null) { //alert("The domain name doesn't seem to be valid.") return false } /* Now we need to break up the domain to get a count of how many atoms it consists of. */ var atomPat=new RegExp(atom,"g") var domArr=domain.match(atomPat) var len=domArr.length if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) { // the address must end in a two letter or three letter word. //alert("The address must end in a three-letter domain, or two letter country.") return false } // Make sure there's a host name preceding the domain. if (len<2) { var errStr="This address is missing a hostname!" //alert(errStr) return false } // If we've gotten this far, everything's valid! return true; } //end email // Function for Date Validation function checkToDate(formvalue) { currentDate = new Date(); cutOffDate=new Date(formvalue); if(cutOffDatesecondDate) return false; else return true; } function validDate(formValue) { if(isAllSpaces(formValue)) return true; var x=formValue.indexOf("/") var y=formValue.lastIndexOf("/") strMM=formValue.substring(0,x); strDD=formValue.substring(x+1,y); strYY=formValue.substring(y+1,formValue.length); if(strYY.length!=4) return false; if(isNaN(strMM)|| isNaN(strDD) || isNaN(strYY)) { return false; } if (strMM < 1 || strMM >12) { return false; } var temp = parseInt(strMM); if(strMM==2) { if(((parseInt(strYY))%4) > 0) if(strDD > 29) return false; else if(strDD>28) return false; } if( (temp%2)== 0) { if(strMM < 7) { if(strDD < 1 || strDD > 30) return false; } else if(strDD < 1 || strDD > 31) return false; } else { if(strMM < 7 || strMM == 7) { if(strDD < 1 || strDD > 31) return false; } else if(strDD < 1 || strDD > 30) return false; } return true; } // pass string value from text field, it gives date value as dd/mm/yyyy from mm/dd/yyyy //changed by Bangalore Team 17 jan 2003 function convertDate( original ) { if(original.length > 6){ var datedelim=document.commonService.datedelim.value; var dateformat=document.commonService.dateformat.value; var strDateFormatArray=dateformat.split(datedelim); var toConverDate=original.split(datedelim); var j=0; var strMM; var strDD; var strYY; for(j=0;j<3;j++) { if(strDateFormatArray[j].toUpperCase()=='DD') strDD=toConverDate[j]; if((strDateFormatArray[j].toUpperCase()=='YY') ||(strDateFormatArray[j].toUpperCase()=='YYYY') ) strYY=toConverDate[j]; if(strDateFormatArray[j].toUpperCase()=='MM') strMM=toConverDate[j]; } }else{ strDD = original.substr(0,2); strMM = original.substr(2,2); strYY = original.substr(4,2); } var MM=parseInt(strMM,10); strMM=MM-1; var converted = new Date(strYY,strMM,strDD); return converted; } // used to disable checkbox function checkDisable(obj,disableind) { if (disableind==1) { obj.checked=false; return obj.disabled = true; } } //used to disable / enable a dropdown box depending on other checkbox is checked or not function disableSelect(dropdownbox,dependOnChkbox) { if (!dependOnChkbox.checked) dropdownbox.blur(); } //based on one checkbox disable the other checkbox function disableCheckbox(dependentCheckbox,mainCheckbox) { if (!mainCheckbox.checked) { dependentCheckbox.checked=false; return dependentCheckbox.disabled = true; } } //puts the '.' inplace of the Currency delem function getReplacedCurrency( amount) { var amt=amount; if(amt.length >0 ) { var ccydecdelim=document.commonService.ccydecdelim.value; var strArray = amt.split(ccydecdelim); if(strArray[0] == null) strArray[0]='0'; if(strArray[1] == null) return strArray[0]; var replacedAmount=strArray[0]+'.'+strArray[1]; return replacedAmount; } else return '0'; } //replaces the '.' with the Currency delem function getActualCurrency( amount) { var amt=amount; if(amt.length >0) { var ccydecdelim=document.commonService.ccydecdelim.value; var actdem='.'; var strArray = amt.split(actdem); if(strArray[0] == null) strArray[0]='0'; if(strArray[1] == null) return strArray[0]; var actAmount=strArray[0]+ccydecdelim+strArray[1]; return actAmount; } else return '0'; } //to the amount--it can be negative--and also empty //NaliniSK function checkAmount(amount) { var amt=amount; var ccydecdelim=document.commonService.ccydecdelim.value; var strArray = amt.split(ccydecdelim); if(amount.length >0 ) { if(strArray[0] != null ) { if(strArray[0].substring(0,1)=='-') { strArray[0]=strArray[0].substring(1,strArray[0].length) ; } if(!isNumber(strArray[0])) { return false; } } if(strArray[1] !=null) { if(!isNumber(strArray[1])) { return false; } } } return true; } //Ismail 18/02/2004 //This will change the precision of currency according to user specified //This function is duplicate of decimalCheck function decimalCheck2( field,decimalNumber,ccyid,wno, precision) { var _decimalNumber = getActualNumber( decimalNumber ); if(isNaN(_decimalNumber)) { return true; } if(precision == 0) { if(_decimalNumber.indexOf(".") > -1) { getErrorPage('DACCOUNT_1074'); eval(field+".focus()"); eval(field+".select()"); return false; } else return true; } if (ccyid != 0) { if(!decimalChkForCurrency(_decimalNumber,precision,wno)) { getErrorPage('DACCOUNT_1074'); eval(field+".focus()"); eval(field+".select()"); return false; } else return true; } else { if(!decimalChk(_decimalNumber,precision,wno)) { getErrorPage('DACCOUNT_1074'); eval(field+".focus()"); eval(field+".select()"); return false; } else return true; } } //Prashanth KA Start 11/May/02 function decimalCheck(decimalNumber,ccyid,wno) { var precision; var _decimalNumber = getActualNumber( decimalNumber ); if (ccyid != 0) { precision=getCurrencyPrecision(ccyid); return decimalChkForCurrency(_decimalNumber,precision,wno) } else { precision=document.commonService.rateprecision.value; return decimalChk(_decimalNumber,precision,wno); } } function decimalChk(decimalNumber,precision,wno) { if(decimalNumber.length==0) return true; if(precision==0) precision=document.commonService.rateprecision.value; var dprecision=parseInt(precision); var dwno=parseInt(wno); var decimaldelim=document.commonService.ccydecdelim.value; var strArray=decimalNumber.split(decimaldelim); if(strArray.length>2) { getErrorPage('DEC_1001'); return false; } var dec1=""; var dec2=""; if(strArray.length>0) { dec1=strArray[0]; if(dec1.length!=0&&!isNumber(dec1)) { getErrorPage('DEC_1001'); return false; } } if(strArray.length>1) { dec2=strArray[1]; if(dec2.length!=0&&!isNumber(dec2)) { getErrorPage('DEC_1001'); return false; } } if(dec2.length>dprecision) { getErrorPage('DEC_1002'); return false; } if(dwno>0) { //var wnlength=dwno-(dprecision+1); if(dec1.length>dwno) { getErrorPage('DEC_1001'); return false; } } return true; } var derr; function decimalChk(decimalNumber,precision,wno) { if(decimalNumber.length==0) return true; if(precision==0) precision=document.commonService.rateprecision.value; var dprecision=parseInt(precision); var dwno=parseInt(wno); var decimaldelim=document.commonService.ccydecdelim.value; var strArray=decimalNumber.split(decimaldelim); if(strArray.length>2) { derr="DEC_1001"; return false; } var dec1=""; var dec2=""; if(strArray.length>0) { dec1=strArray[0]; if(dec1.length!=0&&!isNumber(dec1)) { derr="DEC_1001"; return false; } } if(strArray.length>1) { dec2=strArray[1]; if(dec2.length!=0&&!isNumber(dec2)) { derr="DEC_1001"; return false; } } if(dec2.length>dprecision) { derr="DEC_1002"; return false; } if(dwno>0) { //var wnlength=dwno-(dprecision+1); if(dec1.length>dwno) { derr="DEC_1001"; return false; } } return true; } function decimalChkForCurrency(decimalNumber,precision,wno) { if(decimalNumber.length==0) return true; var dprecision=parseInt(precision); var dwno=parseInt(wno); var decimaldelim=document.commonService.ccydecdelim.value; var strArray=decimalNumber.split(decimaldelim); if(strArray.length>2) { derr="CCY_1008"; return false; } var dec1=""; var dec2=""; if(strArray.length>0) { dec1=strArray[0]; if(dec1.length!=0&&!isNumber(dec1)) { derr="CCY_1008"; return false; } } if(strArray.length>1) { dec2=strArray[1]; if(dec2.length!=0&&!isNumber(dec2)) { derr="CCY_1008"; return false; } } if(dec2.length>dprecision) { derr="CCY_1001"; return false; } if(dwno>0) { //var wnlength=dwno-(dprecision+1); if(dec1.length>dwno) { derr="CCY_1008"; return false; } } return true; } function getDecimalNumber(delimitedNumber) { if(delimitedNumber.length==0) return ""; //Prashanth KA Oct 10 02+ delimitedNumber=getActualNumber(delimitedNumber); var decimaldelim=document.commonService.ccydecdelim.value; var strArray=delimitedNumber.split(decimaldelim); var dec1=""; var dec2=""; if(strArray.length>0) dec1=strArray[0]; if(strArray.length>1) dec2=strArray[1]; var decimalNum=eval(dec1+'.'+dec2); if(isNaN(decimalNum)) return ""; return decimalNum; } // Pass 0 if precision is not required function getDelimitedNumber(decimalNum,precision) { var decimalNumber=""+decimalNum; if(decimalNumber.length==0) return true; var dprecision =parseInt(precision); var decimaldelim=document.commonService.ccydecdelim.value; var strArray=decimalNumber.split('.'); var dec1=""; var dec2=""; if(strArray.length>0) dec1=strArray[0]; if(strArray.length>1) dec2=strArray[1]; for(;dec2.length!=dprecision;) { dec2=dec2+0; } var delimitedNumber=dec1+decimaldelim+dec2; //alert(delimitedNumber); return delimitedNumber; } // Pass decimal amount not delimited .Returns decimal amount // Requires Change Doesn't work for large number Prashanth KA function roundit(Num, precision) { var dPlaces=parseInt(precision); var dNum=""+Num; if (dPlaces > 0) { if ((dNum.toString().length - dNum.toString().lastIndexOf('.')) > (dPlaces + 1)) { var Rounder = Math.pow(10, dPlaces); return Math.round(dNum * Rounder) / Rounder; } else return dNum; } else return Math.round(dNum); } function getDelimitedNumberForCurrency(decimalNum,ccyid) { var precision=getCurrencyPrecision(ccyid); return getDelimitedNumber(decimalNum, precision) ; } // Pass decimal amount not delimited .Returns decimal amount function rounditforcurrency(Num,ccyid) { var precision=getCurrencyPrecision(ccyid); return roundit(Num, precision) ; } //Prashanth KA End //Add by Girish //Trims Blank spaces from the begining of the text field function blankCheck(x) { var a =x; var p = 0; for (var i = 0; i <= a.length; i++) { var ch = a.substring(i, i + 1); if (ch == " ") { //alert('blank space at '+eval(i)); p++; } } if(p!=0) { a = a.substring(eval(p),a.length); } return a; } //added by NaliniSK--05-Aug-02 function checkCurrency(decimalNumber,ccyid,wno) { var precision=getCurrencyPrecision(ccyid); return decimalChkForCurrency(decimalNumber,precision,wno); } // added by Sreenivas Aug-07-2002 function checkNumber(formvalue) { for (var i = 0; i < formvalue.length; i++) { var ch = formvalue.substring(i, i + 1); if (ch < "0" || "9" < ch) { return false; } } return true; } /* Nilesh 09/08/2002 This function returns actual number which will be used for number validation function . It will remove digit separator and gives actual number .Like if you pass 1,000.00 and in application prop separator is used as , then it will return 1000.00 . */ function getActualNumber( numberToParse ) { var _numberToParse = numberToParse ; var _ActualValue =''; var ccySeparatorDelim = document.commonService.ccySeparatorDelim.value; strDigitArray = _numberToParse.split(ccySeparatorDelim); for(i=0;i