var frm; var form; var sFUCVal = ""; var autoSaveTimeOut; //alert( "entering commonjs" ) function openhelp( ohForm ) { window.open( ohForm.thisDatabaseWithPath.value + "/formHelp?openform", 'show_details_window', 'top=100, left=150, width=600, height=590,scrollbars'); } function delcat(docid) { document.location = "./deletecat?openAgent&u=" + docid + ""; } function newWin1( urlToOpen, windowName ) { window.open( urlToOpen, windowName, 'location=no,resizable=yes,scrollbars=yes,status=yes,width=600, height=600, top=50, left=50' ) } function newWin(wURL, wWidth, wHeight, wTop, wLeft, wResize, wStatus) { // usage: newWin( document.forms(0).thisDatabaseWithPath.value + '/luCategories?open', 700, 420, 25, 200, true, true); features = 'dependent,menubar=1,toolbar=1,location=0,directories=0,scrollbars=1,status=1,resizable=' + ((wResize) ? 1 : 0) + ((wResize) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '') + ((wTop) ? ',top=' + wTop : '') + ((wLeft) ? ',left=' + wLeft : ''); popWin = window.open(wURL,'ChildWin',features); if (popWin.focus) popWin.focus(); return popWin; } function newWindow(wURL) { // usage: newWin( document.forms(0).thisDatabaseWithPath.value + '/luCategories?open', 700, 420, 25, 200, true, true); features = 'dependent,menubar=0,toolbar=0,location=0,directories=0,scrollbars=1,status=1,resizable=1,width=600,height=500,top=100,left=100'; popWin = window.open(wURL,'ChildWin2',features); if (popWin.focus) popWin.focus(); return popWin; } function childWin(wURL, sName, wWidth, wHeight, wTop, wLeft, wResize, wStatus, wScrollbars) { // usage: childWin( document.forms(0).thisDatabaseWithPath.value + '/luCategories?open', 'WindowName', 700, 420, 25, 200, true, true, true); features = 'dependent,menubar=0,toolbar=0,location=0,directories=0,resizable=' + ((wResize) ? 1 : 0) + ',status=' + ((wStatus) ? 1 : 0) + ',scrollbars=' + ((wScrollbars) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '') + ((wTop) ? ',top=' + wTop : '') + ((wLeft) ? ',left=' + wLeft : ''); popWin = window.open(wURL, sName, features); if (popWin.focus) popWin.focus(); return popWin; } function show_props(obj, obj_name) { // usage : alert( show_props( document.forms(0), "forms.0" ) ) var result = ""; for (var i in obj) { var sTmp = new String( obj[i] ); result += obj_name + "." + i + " = " + sTmp.substr( 0, 30 ) + "\t"; } return result; } function setMsg( msg ){ window.status = msg return true } function assignParentOld( sParent, sParentID ) { //, vCatReaders ){ //eParent + @If( eParent!=""; "\\"; "" ) + eTitle; currParent = document.forms(0).eParent.value; currTitle = document.forms(0).eTitle.value; currCategory = ''; if ( currParent == '' ) currCategory = currTitle else currCategory = currParent + "\\" + currTitle if ( currCategory == sParent ) alert( "Can't select the current category as parent" ); else { document.forms(0).eParent.value = sParent; document.forms(0).eParentID.value = sParentID; // document.forms(0).dplyeCatReaders.value = vCatReaders // alert( "Assigned Category " + sParent + " with ID " + sParentID ); } } function assignParent( sParent, sParentID ) { if ( document.forms(0).dplyForm.value == "formCategory" ){ // alert( document.forms(0).dplyForm.value ); currParent = document.forms(0).eParent.value; currTitle = document.forms(0).eTitle.value; currCategory = ''; if ( currParent == '' ) currCategory = currTitle else currCategory = currParent + "\\" + currTitle if ( currCategory == sParent ) { alert( "Can't select the current category as parent" ); return false; } } // alert( document.forms(0).dplyForm.value ); document.forms(0).eParent.value = sParent; document.forms(0).eParentID.value = sParentID; // alert( "Assigned Category " + sParent + " with ID " + sParentID ); // } } function pullCategory( ) { catWin = newWin( document.forms(0).thisDatabaseWithPath.value + '/luCategories?open', 700, 420, 25, 200, true, true); if (catWin.opener == null) catWin.opener = self; } function doExpandCollapse( ) { // since 'window.location.href = form.NewURL.value;' opens a separate page in the history, replace is used. // alert( document.forms(0).NewURL.value ) window.location.replace( document.forms(0).NewURL.value ) } function doRefresh( ) { window.location.reload( true ) } function addressBox( fieldName ) { abURL = '/segbcentral.nsf/AddressBox?OpenForm'; addressField = fieldName; opts = 'resizable=1, status=1, width=560,height=220'; popupWin=window.open( abURL,'abWindow', opts); } function linkWindow( linkURL ) { linkURL = document.forms(0).thisDatabaseWithPath.value + linkURL catWin = newWin( linkURL, 700, 420, 25, 200, true, true); if (catWin.opener == null) catWin.opener = self; } function refreshCalc( rcForm ) { // recalculates the computed fields in the form and also assigns back the FileUploadControl's value, which will disappear while recalculating for ( var i=0; i0) { tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter)); tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); Count=Count+1 } tempArray[Count]=tempString; return tempArray; } function linkExtWindow( linkURL ) { catWin = newWin( linkURL, 700, 420, 25, 200, true, true); if (catWin.opener == null) catWin.opener = self; } function assignExternalLink( aelForm, aelDB, aelView, aelUNID, aelText ) { // given the document Unique ID (UNID), this function constructs the link to that document sURL = aelDB + "/" + aelView + "/" + aelUNID; sLinkURL = "Javascript:linkExtWindow( '" + sURL + "' )"; aelForm.eExtLink.value = sLinkURL + "|" + aelText; } function refreshDoc( rdForm ) { // check the alternate function refreshCalc - as above rdForm.__Click.value = '$Refresh' rdForm.submit() } //
Next
function Navigate(linkto, link) { var sLink; var found; sLink =new Array(); j=document.links.length-1; alert ( "links length = " + j ); found = j for (i=0 ; i Previous" + document.links[j].href ); alert ( document.links[j].href + document.links[j].id); j=j-1; } alert ( "Name = Previous" + document.links[found].href ); alert( show_props( document.links[found], "links." + found ) ) alert( document.links[found].onclick ); // link.attachEvent( "onclick", document.links[found].onclick ) document.links[found].target = '_self' document.links[found].onclick // return document.links[found].handleEvent( Event.CLICK ) // window.location=sLink[linkto]; } function nexttab(){ s= new String(currtab); val = s.substring(3); val2 =parseInt(val); val2 = val2 +1; showtab(val2) } function previoustab(){ s= new String(currtab); val = s.substring(3); val2 =parseInt(val); val2 = val2 -1; showtab(val2) } function showtab( tabnum ) { tabname = "tab" + tabnum if ( tabname != currtab ) { if (window.document.layers) { handle="window.document.layers"; stylevar=""; }else{ handle="document.all"; stylevar=".style"; } eval(handle+'["'+currtab+'"]'+stylevar+'.visibility = "hidden"'); eval(handle+'["'+tabname+'"]'+stylevar+'.visibility = "visible"'); currtab = tabname; void( scroll( 0 , 0 ) ) ; } } function showtabOld( tabnum ) { tabname = "tab" + tabnum if ( tabname != currtab ) { if (window.document.layers) { handle="window.document.layers"; stylevar=""; }else{ handle="document.all"; stylevar=".style"; } eval(handle+'["'+currtab+'"]'+stylevar+'.visibility = "hidden"'); eval(handle+'["'+tabname+'"]'+stylevar+'.visibility = "visible"'); currtab = tabname; void( scroll( 0 , 0 ) ) ; } } //************************************************************************************** // trim the leading and trailing blank spaces in the field value - given its field name; //************************************************************************************** function trim( f ) { while( '' + f.charAt( f.length-1 ) == ' ' ) f = f.substring( 0, f.length-1 ); while( '' + f.charAt(0) == ' ' ) f = f.substring( 1, f.length ); return f } /*********************************************************** doSubmit( dsForm ) - this function exists in scripts/formLib.js page This function is passed an form object. On validating the form based on the arguments, the form object will be submitted. function doSubmit( dsForm ) { if ( validateForm( dsForm ) ) { dsForm.submit(); } } ************************************************************/ /*********************************************************** doClose( dcForm ) This function is passed an form object. Resets the href to URLOnCancel value. Arguments: obj = form object. ************************************************************/ function doClose( dcForm ) { // history.go(-1) sCloseURL = dcForm.thisDatabaseWithPath.value + "/formHome?open" location.href = sCloseURL } /*********************************************************** doBack( ) ************************************************************/ function doBack( ) { if ( history.length == 0 ) { // alert( "No History to go back. Closing the window." ) window.close() } else { // alert( history.length + " - History to go back. Closing the window." ) history.go(-1) } } /*********************************************************** doBackClose( dcForm ) This function is passed an form object. if no history then Resets the href to URLOnCancel value else go back Arguments: obj = form object. ************************************************************/ function doBackClose( dcForm ) { if ( history.length == 0 ) { sCloseURL = dcForm.thisDatabaseWithPath.value + "/formHome?open"; location.href = sCloseURL; } else history.go(-1); } /*********************************************************** doDelete( ddForm, ddDelFlag, ddSaveOnlyFlag ) This function is passed an form object, delflag-a boolean, SaveOnlyFlag-a boolean. On validating the form based on the arguments, the form object will be submitted. Arguments: obj = form object. delflag = true / false to say whether current document is marked for deletion saveonlyflag = true / false to say whether the current document is actioned for just save only ************************************************************/ function doDelete( ddForm, ddDelFlag, ddSaveOnlyFlag ) { // alert( "Entering doDelete-" + ddForm.eTitle.value ); if ( validateForm( ddForm, ddDelFlag, ddSaveOnlyFlag ) ) { ddForm.submit(); } } function doEdit( deUNID, deFocusField ) { location.href = form.thisDatabaseWithPath.value + "/AllIDs/" + deUNID + "?EditDocument"; for( var i=0; i<200000; i++ ); if ( deFocusField != "" ) { var deField = form[ deFocusField ]; ( typeof deField != "undefined" ) ? deField.focus(): ""; } } /* This Script can be used to validate your form for numeric values. The Numeric TextBox allows only numbers and accepts one decimal Point. Compatible with both Netscape and Internet Explorer. Usage : onKeyPress="return keyCheck(event, this)" */ function keyCheck(eventObj, obj) { var keyCode // Check For Browser Type if (document.all){ keyCode=eventObj.keyCode } else{ keyCode=eventObj.which } var str=obj.value if(keyCode==46){ if (str.indexOf(".")>0){ return false } } if((keyCode<48 || keyCode >58) && (keyCode != 46)){ // Allow only integers and decimal points return false } return true } /********************* helpCS_Old( formHCS ) *********************/ function helpCS_Old( formHCS ) { if ( formHCS.helpKey.value == "" ) { alert( "No Help Key found." ) } else { if ( formHCS.helpKey.value == "Annual Appraisal" ) { s= new String(currtab); val = s.substring(3); val2 =parseInt(val); newWin( formHCS.thisDatabaseWithPath.value + '/contextsensitive/' + formHCS.helpKey.value + val2 + '?open', 700, 420, 25, 200, true, true) } else { newWin( formHCS.thisDatabaseWithPath.value + '/contextsensitive/' + formHCS.helpKey.value + '?open', 700, 420, 25, 200, true, true) } } } //http://aagb0013.gb.schneider-electric.com/intranetgb/hr/hr_empdev_help.nsf/formFolderWin?open /********************* helpCSOld( formHCS ) *********************/ function helpCSOld( formHCS ) { newWin( '/intranetgb/hr/hr_empdev_help.nsf/formFolderWin?open', 700, 420, 25, 200, true, true) } /********************* helpCS( ) - Central FAQ database *********************/ function helpCS( formHCS ) { newWin( '/intranetgb/segbcentralfaq.nsf/formFolderCentralWin?open&ID=GEMY-5JYL3W', 700, 420, 25, 200, true, true) } /******************************* Tool Tip *******************************/ var ns4 = document.layers; var ns6 = document.getElementById && !document.all; var ie4 = document.all; offsetX = 0; offsetY = 20; var toolTipSTYLE=""; function initToolTips() { if(ns4||ns6||ie4) { if(ns4) toolTipSTYLE = document.toolTipLayer; else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style; else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style; if(ns4) document.captureEvents(Event.MOUSEMOVE); else { toolTipSTYLE.visibility = "visible"; toolTipSTYLE.display = "none"; } document.onmousemove = moveToMouseLoc; } } function toolTip(msg, fg, bg) { if(toolTip.arguments.length < 1) { // hide if(ns4) toolTipSTYLE.visibility = "hidden"; else toolTipSTYLE.display = "none"; } else { // show if(!fg) fg = "#777777"; if(!bg) bg = "#FFFFFF"; var content = '
' + '
 \;' + msg + ' \;
'; if(ns4) { toolTipSTYLE.document.write(content); toolTipSTYLE.document.close(); toolTipSTYLE.visibility = "visible"; } if(ns6) { document.getElementById("toolTipLayer").innerHTML = content; toolTipSTYLE.display='block' } if(ie4) { document.all("toolTipLayer").innerHTML=content; toolTipSTYLE.display='block' } } } function moveToMouseLoc(e) { if(ns4||ns6) { x = e.pageX; y = e.pageY; } else { x = event.x + document.body.scrollLeft; y = event.y + document.body.scrollTop; } toolTipSTYLE.left = x + offsetX; toolTipSTYLE.top = y + offsetY; // window.status = x + "," + y + " | " + offsetX + "," + offsetY return true; } /*********************************************************** doDeleteAgent( ddUNID, vDelUndelFlag ) to delete the current form - by adding a field 'toBeDeleted' Arguments: ddUNID = UNID. ************************************************************/ function doDeleteAgent( ddKey, vDelUndelFlag ) { if ( vDelUndelFlag==1) { if ( confirm( "This action deletes the current account. Are you sure?" ) ) location.href = form.thisDatabaseWithPath.value + "/deleteAccount?openAgent&Key=" + ddKey + "&delflag=1"; } // else { // if ( confirm( "This action undeletes the current account. Are you sure?" ) ) // location.href = form.thisDatabaseWithPath.value + "/deleteDoc?openAgent&UNID=" + ddUNID + "&delflag=0"; // } } /* This script allows only delete key in a field. Compatible with both Netscape and IE. Usage : onKeyPress="return allowOnlyFieldValueDelete(event)" */ function allowOnlyFieldValueDelete(eventObj) { var keyCode // Check For Browser Type if (document.all) { keyCode=eventObj.keyCode } else { keyCode=eventObj.which } // alert( keyCode ) if(keyCode!=127) { // Allow only Del key return false } return true } /* replaces the location with the given URL */ function replaceURL( sURL ) { // alert( sURL ) window.location.replace( sURL ) } /*********************************************************** refreshAALabels( ) ************************************************************/ function refreshAALabels( sParamVal ) { var sURL; if ( sParamVal == "1" ) sQual = "full qualification" else sQual = "quick qualification" if ( confirm( "This action will update the criteria for " + sQual + ".\n\nPlease cancel this action to save any data you have modified. \n\nOr click Ok to continue." ) ) { sParamStr = form.param1.value + "=" + form.paramVal1.value + "&" + form.param2.value + "=" + form.paramVal2.value; sParamStr = sParamStr + "&" + form.param3.value + "=" + form.paramVal3.value sParamStr = sParamStr + "&" + form.param4.value + "=" + form.paramVal4.value + "&refreshAA=" + sParamVal; // sURL = form.thisDatabaseWithPath.value + "/formAccountQualify?open" + form.queryParamString.value + "&refreshAA=" + sParamVal; sURL = form.thisDatabaseWithPath.value + "/formAccountQualify?open&" + sParamStr; replaceURL( sURL ) } } /*********************************************************** markAsRead_Old( ) ************************************************************/ function markAsRead_Old( sForm ) { var sURL; var sCustTypeCode; var sDataKeys; var fnAccess; var fnData1; sCustTypeCode = form["customerTypeCode"].value; sDataKeys = form["dataKeys"].value; fnAccess = form["functionAccess"].value; fnData1 = form["functionData1"].value; // alert( "function Access=" + fnAccess + "\n\n" + sDataKeys + "\n\n" + sCustTypeCode + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) if ( ( fnAccess == "2" ) || ( fnAccess == "1" && fnData1 == "1" && sDataKeys.indexOf( sCustTypeCode ) >= 0 ) ) { if ( form["readyn"].value == "1" ) { alert( "Already marked as read" ) } else { if ( confirm( "This action will mark this feedback as read.\n\nPlease click Ok to continue." ) ) { sParamStr = "&" + form.param1.value + "=" + form.paramVal1.value + "&" + form.param2.value + "=" + form.paramVal2.value; sParamStr = sParamStr + "&" + form.param3.value + "=" + form.paramVal3.value; sParamStr = sParamStr + "&" + form.param4.value + "=1"; sURL = form.thisDatabaseWithPath.value + "/" + sForm + "?open" + sParamStr; // alert( sURL ) replaceURL( sURL ) } } } else { sMsg = "Sorry! You are not authorised to edit this record." if ( fnAccess == "1" && fnData1 == "1" ) { sMsg = sMsg + "\n\nYou are allowed to amend the records with customer types " + sDataKeys } alert( sMsg ) } } /*********************************************************** markAsRead( ) ************************************************************/ function markAsRead( sForm ) { var vDebug = false; var sURL; var sCustTypeCode; var sDataKeys; var fnAccess; var fnData1; var accessYN, sMsg1; sCustTypeCode = form["customerTypeCode"].value; sMktSegCode = form["marketSegmentCode"].value; fnAccess = form["functionAccess"].value; fnData1 = form["functionData1"].value; fnData2 = form["functionData2"].value; sDataKeys = form["dataKeys"].value; sDataKeys2 = form["dataKeys2"].value; accessYN = form["accessYN"].value; var vAllow1, vAllow2; if ( fnAccess == "2" ) vAllow1 = true else vAllow1 = false if ( vDebug ) alert( "function Access=" + fnAccess + "\n\n" + "function Data 1=" + fnData1 + "\n\n" + "function Data 2=" + fnData2 ) sMsg1 = "" if( fnAccess == "1" ) { if( fnData1 == "1" && fnData2 == "1" ) { if( ( sDataKeys == "*" || sDataKeys == "") && sDataKeys2.indexOf( sMktSegCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys + "\n\n" + sMktSegCode + "\n\n" + sDataKeys2.indexOf( sMktSegCode ) ) } else if( ( sDataKeys2 == "*" || sDataKeys2 == "" ) && sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2 + "\n\n" + sCustTypeCode + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) } else if( ( sDataKeys2.indexOf( sMktSegCode ) >= 0 ) || sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sCustTypeCode + "\n\n" + sDataKeys + "\n\n" + sMktSegCode + "\n\n" + sDataKeys2 + "\n\n" + sDataKeys2.indexOf( sMktSegCode ) + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with customer types " + sDataKeys sMsg1 = sMsg1 + "\n\nor with market segments " + sDataKeys2 } } else if ( fnData1 == "1" && fnData2 == "" ) { if ( sDataKeys == "*" || sDataKeys == "" ) { vAllow2 = true if ( vDebug ) alert( sDataKeys ) } else if ( sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys.indexOf( sCustTypeCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with customer types " + sDataKeys } } else if ( fnData1 == "" && fnData2 == "1" ) { if ( sDataKeys2 == "*" || sDataKeys2 == "" ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2 ) } else if ( sDataKeys2.indexOf( sMktSegCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2.indexOf( sMktSegCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with market segments " + sDataKeys2 } } else { vAllow2 = false } } else { vAllow2 = false } // alert( "function Access=" + fnAccess + "\n\n" + sDataKeys + "\n\n" + sCustTypeCode + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) // if ( ( fnAccess == "2" ) || ( fnAccess == "1" && fnData1 == "1" && sDataKeys.indexOf( sCustTypeCode ) >= 0 ) ) { if ( vAllow1 || vAllow2 ) { if ( form["readyn"].value == "1" ) { alert( "Already marked as read" ) } else { if ( confirm( "This action will mark this feedback as read.\n\nPlease click Ok to continue." ) ) { sParamStr = "&" + form.param1.value + "=" + form.paramVal1.value + "&" + form.param2.value + "=" + form.paramVal2.value; sParamStr = sParamStr + "&" + form.param3.value + "=" + form.paramVal3.value; sParamStr = sParamStr + "&" + form.param4.value + "=1"; sURL = form.thisDatabaseWithPath.value + "/" + sForm + "?open" + sParamStr; // alert( sURL ) replaceURL( sURL ) } } } else { sMsg = "Sorry! You are not authorised to edit this record." if ( fnAccess == "1" && fnData1 == "1" ) { // sMsg = sMsg + "\n\nYou are allowed to amend the records with customer types " + sDataKeys sMsg = sMsg + sMsg1 } alert( sMsg ) } } /*********************************************************** qualifyAccount( ) ************************************************************/ function qualifyAccount( sLocFlag ) { var vDebug = false; var sURL; var sCustTypeCode; var sDataKeys; var fnAccess; var fnData1; var accessYN, sMsg1; sCustTypeCode = form["customerTypeCode"].value; sMktSegCode = form["marketSegmentCode"].value; fnAccess = form["functionAccess"].value; fnData1 = form["functionData1"].value; fnData2 = form["functionData2"].value; sDataKeys = form["dataKeys"].value; sDataKeys2 = form["dataKeys2"].value; accessYN = form["accessYN"].value; var vAllow1, vAllow2; if ( fnAccess == "2" ) vAllow1 = true else vAllow1 = false if ( vDebug ) alert( "function Access=" + fnAccess + "\n\n" + "function Data 1=" + fnData1 + "\n\n" + "function Data 2=" + fnData2 ) sMsg1 = "" if( fnAccess == "1" ) { if( fnData1 == "1" && fnData2 == "1" ) { if( ( sDataKeys == "*" || sDataKeys == "") && sDataKeys2.indexOf( sMktSegCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys + "\n\n" + sMktSegCode + "\n\n" + sDataKeys2.indexOf( sMktSegCode ) ) } else if( ( sDataKeys2 == "*" || sDataKeys2 == "" ) && sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2 + "\n\n" + sCustTypeCode + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) } else if( ( sDataKeys2.indexOf( sMktSegCode ) >= 0 ) || sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sCustTypeCode + "\n\n" + sDataKeys + "\n\n" + sMktSegCode + "\n\n" + sDataKeys2 + "\n\n" + sDataKeys2.indexOf( sMktSegCode ) + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with customer types " + sDataKeys sMsg1 = sMsg1 + "\n\nor with market segments " + sDataKeys2 } } else if ( fnData1 == "1" && fnData2 == "" ) { if ( sDataKeys == "*" || sDataKeys == "" ) { vAllow2 = true if ( vDebug ) alert( sDataKeys ) } else if ( sDataKeys.indexOf( sCustTypeCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys.indexOf( sCustTypeCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with customer types " + sDataKeys } } else if ( fnData1 == "" && fnData2 == "1" ) { if ( sDataKeys2 == "*" || sDataKeys2 == "" ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2 ) } else if ( sDataKeys2.indexOf( sMktSegCode ) >= 0 ) { vAllow2 = true if ( vDebug ) alert( sDataKeys2.indexOf( sMktSegCode ) ) } else { vAllow2 = false sMsg1 = "\n\nYou are allowed to qualify the accounts with market segments " + sDataKeys2 } } else { vAllow2 = false } } else { vAllow2 = false } // alert( "function Access=" + fnAccess + "\n\n" + sDataKeys + "\n\n" + sCustTypeCode + "\n\n" + sDataKeys.indexOf( sCustTypeCode ) ) /* if ( ( fnAccess == "2" ) || ( fnAccess == "1" && ( ( fnData1 == "1" && ( sDataKeys == '*' || sDataKeys.indexOf( sCustTypeCode ) >= 0 ) ) || ( fnData2 == "1" && ( sDataKeys2 == '*' || sDataKeys2.indexOf( sMktSegCode ) >= 0 ) ) ) ) ) { */ if ( vAllow1 || vAllow2 ) { if ( sLocFlag == "1" ) { // when Qualify Account action is clicked in 'formAccountView' sParamStr = "&" + form.param1.value + "=" + form.paramVal1.value; sParamStr = sParamStr + "&" + form.param2.value + "=" + form.paramVal2.value sParamStr = sParamStr + "&" + form.param3.value + "=" + form.paramVal3.value; sParamStr = sParamStr + "&" + form.param4.value + "=" + form.paramVal4.value; sParamStr = sParamStr + "&" + form.param5.value + "=" + form.paramVal5.value; sURL = form.thisDatabaseWithPath.value + "/formAccountQualify?open" + sParamStr; window.location.href = sURL // replaceURL( sURL ) } else { // when Save & Close action is clicked in 'formAccountQualify' calcAttractAccess() calcMktShare() doSubmit( form ) } } else { sMsg = "Sorry! You are not authorised to qualify this account." if ( fnAccess == "1" && fnData1 == "1" ) { // sMsg = sMsg + "\n\nYou are allowed to qualify the accounts with customer types " + sDataKeys sMsg = sMsg + sMsg1 } alert( sMsg ) } } /*You need two routines: split() and toPC(). This function is the JavaScript equivalent to the notes @ProperCase (or as near as I can make it). For example thIs iS NOT proper-case returns This Is Not Proper-Case. You might have to adjust the formating of the code below to get it to work properly. I used tabs to indent each code segment. Call the routine using newString=toPC(originalString). Note that you should probably strip any apostrophes or extraneous characters first.*/ //split a string s with the delimeter del function split(s,del){ arrS= new Array(); var i=0; var j=0; var k=0; var delim=new String(del); //Is the delimeter in the string if(s.indexOf(delim)!=-1) { for (i=0; i