/* Staffing sections */ staffingSection = ""; function callClearExpertise() { var theField = document.forms[0].FieldToUpdate.value; frm = self.opener.document.forms[0]; if (theField == "S1Program") { moduleProgObj = frm.S1Program_ke; experticeObj = frm.S1ExperticeWithinProgram_ke; expertiseDispObj = frm.S1ExperticeWithinProgramDisp_ke; moduleStr = "S1Expertise"; self.opener.clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr); } if (theField == "S2Program") { moduleProgObj = frm.S2Program_ke; experticeObj = frm.S2ExperticeWithinProgram_ke; expertiseDispObj = frm.S2ExperticeWithinProgramDisp_ke; moduleStr = "S2Expertise"; self.opener.clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr); } if (theField == "S3Program") { moduleProgObj = frm.S3Program_ke; experticeObj = frm.S3ExperticeWithinProgram_ke; expertiseDispObj = frm.S3ExperticeWithinProgramDisp_ke; moduleStr = "S3Expertise"; self.opener.clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr); } if (theField == "S4Program") { moduleProgObj = frm.S4Program_ke; experticeObj = frm.S4ExperticeWithinProgram_ke; expertiseDispObj = frm.S4ExperticeWithinProgramDisp_ke; moduleStr = "S4Expertise"; self.opener.clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr); } if (theField == "S5Program") { moduleProgObj = frm.S5Program_ke; experticeObj = frm.S5ExperticeWithinProgram_ke; expertiseDispObj = frm.S5ExperticeWithinProgramDisp_ke; moduleStr = "S5Expertise"; self.opener.clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr); } } // Function clearFldExpertise: If a program is removed, also assiciated expertice should be removed. function clearFldExpertise(moduleProgObj, experticeObj, expertiseDispObj, moduleStr) { var newExp= new Array(); var newExpDisp= new Array(); var fldProgram = new String(moduleProgObj.value ); // get the field // First check if any values at all are available. If not, just clear the other fields. if (moduleProgObj == "") { for(var count = experticeObj.options.length - 1; count >= 0; count--) experticeObj.options[count] = null; } else { var arrayProgram = fldProgram.split(","); // make the string into an array var fldExpertise = new String(experticeObj.value); // get the field true values var arrayExpertise = fldExpertise.split(","); // make the string into an array newArrayIndex = 0; // Loop through the available programs the user selected for (y=0; y < arrayProgram.length; y++) { var pgmStr = new String( arrayProgram[y] ); if ( pgmStr != "" ) { // Loop thru all entries in the expertise field, and see if any beginning of a string (alias) matches the current program dispIndex = 0 for (a=0; a < arrayExpertise.length; a++) { var expStr = new String( arrayExpertise[a] ); if ( expStr != "" ) { // If string found // add this expertise to a new string, which later will replace the current value in the expertise field if (expStr.indexOf( moduleStr + Trim( pgmStr ), 0 ) != -1 ) { newExp[newArrayIndex ] = Trim( expStr ); newExpDisp[ newArrayIndex ] = Trim( expertiseDispObj.options[dispIndex].text ); newArrayIndex = newArrayIndex + 1; } dispIndex = dispIndex + 1; } } } // end if pgmStr empty } destinationList = expertiseDispObj; // Clear the expertise display field for(var count = destinationList.options.length - 1; count >= 0; count--) { destinationList.options[count] = null; } // Insert the expertises again for(var i = 0; i < newExp.length; i++) { destinationList.options[i] = new Option(newExpDisp[i], newExp[i] ); } // Insert the cleaned expertise values into the expertice field experticeObj.value = newExp.join( ",") } // end else } /* Function to control if any field is changed in MyData - if so, then prompt user upon window close if not saved. */ function setChangeFlg() { theParent = getMDparent(); var frm = theParent.frmMain.frmMainInfo.document.forms[0]; frm.ChangeFlg.value = "1" } function checkChangeFlg( section, keyString, ctryOptions, msgPrompt ) { theParent = getMDparent(); var frm = theParent.frmMain.frmMainInfo.document.forms[0]; var str = theParent.frmMain.frmMainInfo.location.href.toLowerCase(); var pos = str.indexOf( "getmydata") if( pos >= 0 ) { if(frm.ChangeFlg.value == "1") { window.event.returnValue = msgPrompt; checkWindowWait() } } } /* Function to get hold of the parent frameset for MyData */ function getMDparent() { var str = parent.location.href.toLowerCase(); var pos = str.indexOf( "framesetmd?readform") if( pos >= 0 ) theParent = parent; else theParent = parent.parent; return theParent } /* Function to get hold of the section ID */ function getSectionID( menu ) { var i, k, chars, id, section, sectionList; switch( menu ) { case "areaWelcome" : return "a11"; break; case "profile" : return "a12"; break; case "sectionPersonalDetails": return "b11"; break; case "sectionCurrentJob": return "b12"; break; case "sectionPreviousJob": return "b13"; break; case "sectionEducation": return "b14"; break; case "sectionTraining": return "b15"; break; case "sectionPersonalSkills": return "b16"; break; case "sectionFuturePlans": return "b17"; break; case "sectionMotivationLetter": return "b18"; break; case "sectionAttachments": return "b19"; break; case "sectionCVstatus": return "c11"; break; case "sectionCVaccess": return "c12"; break; case "areaJobApplications": return "d11"; break; default : /* Staffing sections */ chars = new Array( "e", "f", "g" ); i = 0; k = 0; sectionList = getWord( 0, staffingSection, "#" ); section = getWord( 0, sectionList, "," ); while ( section != "" && section != menu ) { while ( section != "" && section != menu ) { ++k; section = getWord( k, sectionList, "," ); } if ( section == "" ) { ++i; k = 0; sectionList = getWord( i, staffingSection, "#" ); section = getWord( 0, sectionList, "," ); } } if ( section != "" ) id = chars[i] + "1" + (k + 1); else id = ""; return id; } } function loadFromIntro( section, ctryOptions ) { if ( section == "profile" ) loadMyProfile( ctryOptions ); else if ( section == "areaJobApplications" ) loadJobApplications( ctryOptions ); else loadMyCV( section, ctryOptions ); highlightSection( section, ctryOptions ); } function highlightSection( showSection, ctryOptions ) { sectionID = getSectionID( showSection ); theParent.frmSection.location = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/frameSection?ReadForm&unid=" + sectionID + "&CTRY=" + ctryOptions; } /* Function to check status of the wait window */ function checkWindowWait() { theParent = getMDparent() if (theParent.windowWait != null ) { // theParent.windowWait.focus(); return false; } } /* Function - which buttons should be displayed for CV status ? */ function displayActivateCV( style ) { theParent = getMDparent() if( style == "deactivate" ) { theParent.frmMain.frmButton.document.getElementById( "saveContButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "activateCVButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "deactivateCVButton" ).style.display = "block"; theParent.frmMain.frmButton.document.getElementById( "saveButton" ).style.display = "none"; } else if( style == "show" ) { theParent.frmMain.frmButton.document.getElementById( "saveContButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "activateCVButton" ).style.display = "block"; theParent.frmMain.frmButton.document.getElementById( "deactivateCVButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "saveButton" ).style.display = "none"; } else { theParent.frmMain.frmButton.document.getElementById( "saveContButton" ).style.display = "block"; theParent.frmMain.frmButton.document.getElementById( "activateCVButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "deactivateCVButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "saveButton" ).style.display = "none"; } } /* Function - which buttons should be displayed for CV access */ function displayContinue( style ) { theParent = getMDparent(); if( style == "show" ) { theParent.frmMain.frmButton.document.getElementById( "saveContButton" ).style.display = "block"; theParent.frmMain.frmButton.document.getElementById( "saveButton" ).style.display = "none"; } else { theParent.frmMain.frmButton.document.getElementById( "saveContButton" ).style.display = "none"; theParent.frmMain.frmButton.document.getElementById( "saveButton" ).style.display = "block"; } } /* *** Switch Section ** */ function switchSection( section ) { // Get the top MyData frameset theParent = getMDparent(); /* Switch to selected section: new main frame */ if ( nn ) theParent.frmMain.frmMainInfo.location.hash = section; else theParent.frmMain.frmMainInfo.document.getElementById( section ).style.display = "block"; actSection = theParent.getDivSection( ); if( actSection != "" & actSection != section ) { // Hide section if( nn == false) theParent.frmMain.frmMainInfo.document.getElementById( actSection ).style.display = "none"; } theParent.setDivSection( section ); window.status = ""; /* *** Which button to display, "Save & Continue" or "Activate CV" *** */ /* *** If we are going TO the CV Status section, do this *** */ webFlg = theParent.frmMain.frmMainInfo.document.forms[0].WebFlg.value; if( section == 'sectionCVstatus' ) { if( theParent.frmMain.frmMainInfo.document.forms[0].CVActivatedFlag.value == "1" ) { displayActivateCV( "deactivate" ); } else { displayActivateCV( "show" ); } } /* *** If we are going FROM the CV Status section, do this *** */ if( actSection == 'sectionCVstatus' && section != 'sectionCVstatus' ) { displayActivateCV( "hide" ); } /* If we are going to the CV access section */ if( section == "sectionCVaccess" ) { displayContinue( "hide" ); } /* If we are going from the CV access section */ if( actSection == "sectionCVaccess" && section != "sectionCVaccess" && section != "sectionCVstatus" ) { displayContinue( "show" ); } /* If we are going to the attachments section in external MyData */ if( section == "sectionAttachments" && webFlg == "INTERNET" ) { displayContinue( "hide" ); } /* If we are going from the attachments section in external MyData */ if( actSection == "sectionAttachments" && section != "sectionAttachments" && webFlg == "INTERNET" ) { displayContinue( "show" ); } /* *** End "which-button-to-display" *** */ } function setNextSection( ctryOptions, webFlg ) { var i, k, section, sectionList; theParent = getMDparent(); actSection = theParent.getDivSection(); switch( actSection ) { case "sectionPersonalDetails" : theParent.setDivSection( "sectionCurrentJob" ); break; case "sectionCurrentJob" : theParent.setDivSection( "sectionPreviousJob" ); break; case "sectionPreviousJob" : theParent.setDivSection( "sectionEducation" ); break; case "sectionEducation" : theParent.setDivSection( "sectionTraining" ); break; case "sectionTraining" : theParent.setDivSection( "sectionPersonalSkills" ); break; case "sectionPersonalSkills" : theParent.setDivSection( "sectionFuturePlans" ); break; case "sectionFuturePlans" : theParent.setDivSection( "sectionMotivationLetter" ); break; case "sectionMotivationLetter" : theParent.setDivSection( "sectionAttachments" ); break; case "sectionAttachments" : if (webFlg == "INTERNET" ) { loadJobApplications( ctryOptions ); } else { if (staffingSection != "") { sectionList = getWord( 0, staffingSection, "#" ); theParent.setDivSection( getWord( 0, sectionList, "," ) ); } else { theParent.setDivSection( "sectionCVstatus"); } } break; case "sectionCVaccess" : loadJobApplications( ctryOptions ); break; default : /* Staffing sections */ i = 0; k = 0; sectionList = getWord( 0, staffingSection, "#" ); section = getWord( 0, sectionList, "," ); while ( section != "" && section != actSection ) { while ( section != "" && section != actSection ) { ++k; section = getWord( k, sectionList, "," ); } if ( section == "" ) { ++i; k = 0; sectionList = getWord( i, staffingSection, "#" ); section = getWord( 0, sectionList, "," ); } } ++k; section = getWord( k, sectionList, "," ); if ( section == "" ) { ++i; sectionList = getWord( i, staffingSection, "#" ); section = getWord( 0, sectionList, "," ); } if ( section != "" ) theParent.setDivSection( section ); else { theParent.setDivSection( "sectionCVstatus"); } } } function setPreviousSection() { theParent = getMDparent(); actSection = theParent.getDivSection(); switch( actSection ) { case "sectionCurrentJob" : theParent.setDivSection( "sectionPersonalDetails" ); break; case "sectionPreviousJob" : theParent.setDivSection( "sectionCurrentJob" ); break; case "sectionEducation" : theParent.setDivSection( "sectionPreviousJob" ); break; case "sectionTraining" : theParent.setDivSection( "sectionEducation" ); break; case "sectionPersonalSkills" : theParent.setDivSection( "sectionTraining" ); break; case "sectionCRBusinessSkills" : theParent.setDivSection( "sectionPersonalSkills" ); break; case "sectionCRSoftwareSkills" : theParent.setDivSection( "sectionCRBusinessSkills" ); break; case "sectionFuturePlans" : theParent.setDivSection( "sectionCRSoftwareSkills" ); break; case "sectionMotivationLetter" : theParent.setDivSection( "sectionFuturePlans" ); break; case "sectionAttachments" : theParent.setDivSection( "sectionMotivationLetter"); break; case "sectionCVstatus" : theParent.setDivSection( "sectionAttachments" ); break; } } /* *** Load selection ** */ function loadWelcome( section, ctryOptions, keyOptions ) { theParent = getMDparent(); if ( keyOptions != "" ) keyString = "&KEY=" + keyOptions; else keyString = ""; // Load the frameset theParent.frmMain.location = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDintro?ReadForm" + keyString + "&CTRY=" + ctryOptions; } function loadMyProfile( ctryOptions ) { theParent = getMDparent(); // Check wait dialog if ( checkWindowWait() == false ) return; // Load wait dialog theParent.loadWaitDlg(); // Load frameset for My Profile theParent.frmMain.location = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDprofile?ReadForm&CTRY=" + ctryOptions; } function loadMyCV( section, ctryOptions ) { theParent = getMDparent(); // Check wait dialog if ( checkWindowWait() == false ) return; // Load My CV with the right section var str = theParent.frmMain.location.href; var pos = str.indexOf( "framesetMDmain") if( pos >= 0 ) { switchSection( section ) } else { // Load wait dialog theParent.loadWaitDlg(); // Check language options if( ctryOptions.toLowerCase() != "international" ) newURL = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDmain?ReadForm&KEY=" + section + "&CTRY="+ctryOptions; else newURL = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDmain?ReadForm&KEY="+ section + "&"; // Open the new url theParent.setDivSection( section ); theParent.frmMain.location = newURL; } } function loadManageCV( section, ctryOptions ) { theParent = getMDparent(); // Check wait dialog if ( checkWindowWait() == false ) return; var str = theParent.frmMain.location.href; var pos = str.indexOf( "framesetMDmain") if( pos >= 0 ) { switchSection( "sectionCVstatus" ); } else { // Load wait dialog theParent.loadWaitDlg(); // Check language options if( ctryOptions.toLowerCase() != "international" ) newURL = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDmain?ReadForm&KEY=" + section + "&CTRY="+ctryOptions; else newURL = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDmain?ReadForm&KEY="+ section + "&"; // Open the new url theParent.setDivSection( section ); theParent.frmMain.location = newURL; } } function loadJobApplications( ctryOptions ) { theParent = getMDparent(); // Check wait dialog // if ( checkWindowWait() == false ) // return; theParent.frmMain.location = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/framesetMDjobs?ReadForm&CTRY=" + ctryOptions; theParent.setDivSection( "areaJobApplications" ); } function viewMyCV( access, viewStaffing, ctryOptions, staffingType ) { theParent = getMDparent(); if( staffingType != "" && viewStaffing == true ) //Preview Staffing CV whatToOpen = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/frmPreview" + staffingType + "?OpenForm&KEY=" + access + "&MODULE=" + staffingType + "&CTRY=" + ctryOptions; else //Preview CV whatToOpen = "/APPL_ALV/HR_PERS/REGISTRATION.NSF/frmPreviewCV?OpenForm&KEY=" + access + "&CTRY=" + ctryOptions; myWin = window.open( whatToOpen, 'winViewMyCV', 'scrollbars=yes,width=650,height=500'); myWin.focus(); } function saveMyCV( section, keyString, ctryOptions, webFlg ) { theParent = getMDparent() var frm = theParent.frmMain.frmMainInfo.document.forms[0]; if ( checkWindowWait() == false ) return; // Validate input if ( theParent.frmMain.frmMainInfo.validation( theParent.frmMain.frmMainInfo.document.forms[0], true ) == true) { // Should we go to next section ? if( section == "next" ) { if ( webFlg == "INTERNET" && theParent.getDivSection() == "sectionAttachments" ) { var tmp1 = true; } else { // Set the next section setNextSection( ctryOptions, webFlg ); // Make sure the change is visible in the left navigator highlightSection( theParent.getDivSection(), ctryOptions ); } } var str = theParent.frmMain.frmMainInfo.location.href.toLowerCase(); var pos = str.indexOf( "myprofile") if( pos >= 0 ) { // Make sure the change is visible in the left navigator highlightSection( "areaWelcome", ctryOptions ); } else { // Saved from MyData or a Staffing section var actSection = theParent.getDivSection(); if ( actSection.indexOf("S1") >= 0 || actSection.indexOf("S2") >= 0 ) { theParent.frmMain.frmMainInfo.document.forms[0].CVUpdatedFlag.value = "MyDataStaffing"; } else if ( theParent.frmMain.frmMainInfo.document.forms[0].CVUpdatedFlag.value != "MyDataStaffing" ) { theParent.frmMain.frmMainInfo.document.forms[0].CVUpdatedFlag.value = "MyData"; } } // Load wait dialog theParent.loadWaitDlg(); // Save the document, first reset update flg (is set to 1 if any field is changed) frm.ChangeFlg.value = ""; frm.submit(); // Is needed since that in external MD from attachments should go to jobs applied for // if ( webFlg == "INTERNET" && theParent.getDivSection() == "sectionAttachments" ) if ( webFlg == "INTERNET" && tmp1 == true ) { loadJobApplications( ctryOptions ) highlightSection( theParent.getDivSection(), ctryOptions ); } } } function nextSection( ctryOptions, webFlg ) { theParent = getMDparent() var frm = theParent.frmMain.frmMainInfo.document.forms[0]; if ( checkWindowWait() == false ) return; // Hide section actSection = theParent.getDivSection(); theParent.frmMain.frmMainInfo.document.getElementById( actSection ).style.display = "none"; // Set the next section setNextSection( ctryOptions, webFlg ); // Switch section actSection = theParent.getDivSection(); loadMyCV( actSection, ctryOptions ); // Make sure the change is visible in the left navigator highlightSection( actSection, ctryOptions ); } function activateMyCV( db ) { theParent = getMDparent(); if ( theParent.frmMain.frmMainInfo.validation( theParent.frmMain.frmMainInfo.document.forms[0], true ) == true) { var frm = theParent.frmMain.frmMainInfo.document.forms[0]; // OK - activate the CV for CV Posting theParent.frmMain.frmMainInfo.document.forms[0].CVActivatedFlag.value = "1" ; displayActivateCV( "deactivate" ); // Saved from MyData if ( theParent.frmMain.frmMainInfo.document.forms[0].CVUpdatedFlag.value != "MyDataStaffing" ) theParent.frmMain.frmMainInfo.document.forms[0].CVUpdatedFlag.value = "MyData"; // Load wait dialog theParent.loadWaitDlg(); // Save the entry frm.ChangeFlg.value = ""; theParent.frmMain.frmMainInfo.document.forms[0].submit(); } } function deactivateMyCV( db ) { theParent = getMDparent(); var frm = theParent.frmMain.frmMainInfo.document.forms[0]; // OK - deactivate the CV for CV Posting theParent.frmMain.frmMainInfo.document.forms[0].CVActivatedFlag.value = "2" ; displayActivateCV( "show" ); // Load wait dialog theParent.loadWaitDlg(); // Save the entry frm.ChangeFlg.value = ""; theParent.frmMain.frmMainInfo.document.forms[0].submit(); } //This function sets the full company name, based on the user's Abacus selection function setCpyName() { // Should only be triggered from INTRANET if( window.document.forms[0].WebFlg.value == "INTRANET" ) { var abacus = window.document.forms[0].CurrentABBCompany_txt; var cpyName = window.document.forms[0].CompanyName1; var cpyName2 = window.document.forms[0].CompanyName; var i = abacus.selectedIndex; cpyName.options[i].selected = true; cpyName2.value = cpyName.options[i].text; } } function setBABU( flag ) { // Set Business Area and Business Unit combobox and default value selBA = this.document.forms[0].BusinessArea_ke.value; selBU = this.document.forms[0].BusinessUnit_ke.value; // Business Area changeDivision(flag); for ( var i= 0; i < this.document.forms[0].BAselect.length; i++) { if ( this.document.forms[0].BAselect.options[ i ].text == selBA ) { this.document.forms[0].BAselect.options[ i ].selected = true; } } // Business Unit changeBA(flag); for ( var i= 0; i < this.document.forms[0].BUselect.length; i++) { if ( this.document.forms[0].BUselect.options[ i ].text == selBU ) { this.document.forms[0].BUselect.options[ i ].selected = true; } } } function changeDivision( flg ) { var frm = window.document.forms[0] ; //var div = frm.SegmentBA_ke.options[frm.SegmentBA_ke.selectedIndex].text ; //var def = frm.SegmentBA_ke.options[0].text; //default value var div = frm.SegmentBA_ke.value; var def = ""; frm.BAselect.length = 1 ; frm.BAselect.options[0].text = def; if( flg == "scratch" ) { frm.BUselect.length = 1; frm.BUselect.options[0].text = def; frm.BusinessUnit_ke.value = def; } //Change the combobox content changeCombobox( frm.BAhided.value, div, frm.BAselect.length, frm.BAselect ) } function changeBA( flg ) { var frm = window.document.forms[0] ; //var def = frm.SegmentBA_ke.options[0].text; //default value var def = ""; var ba = frm.BAselect.options[frm.BAselect.selectedIndex].text ; frm.BusinessArea_ke.value = ba ; if ( flg == "scratch" ) { frm.BUselect.length = 1; frm.BUselect.options[0].text = def; frm.BusinessUnit_ke.value = def; } //var div = frm.SegmentBA_ke.options[ frm.SegmentBA_ke.selectedIndex ].text ; var div = frm.SegmentBA_ke.value; var ba = frm.BusinessArea_ke.value ; var ba_div = ba + "+" + div; //Change the combobox content changeCombobox( frm.BUhided.value, ba_div, frm.BUselect.length, frm.BUselect ); } /* *** Change value in combolookups...*** */ function changeCombobox( totString, checkString, actLen, comboField ) { var more = 1 ; var pos1 ; var pos2 ; var string1 ; var string2 ; var string3 ; var n = 0 ; while ( more ) { pos1 = totString.indexOf( ";" ) ; if ( pos1 > -1 ) { string1 = totString.substr( 0 , pos1) ; totString = totString.substr( pos1+1 ) ; pos2 = string1.indexOf( "|" ) ; string2 = string1.substr( 0 , pos2 ) ; string3 = string1.substr( pos2+1 ) ; } else { pos2 = totString.indexOf( "|" ) ; string2 = totString.substr( 0 , pos2 ) ; string3 = totString.substr( pos2+1 ) ; more = 0 ; } while ( string2.substr(0,1) == " " ) { string2 = string2.substr(1) ; } while ( string2.substr(string2.length-1, 1) == " " ) { string2 = string2.substr(0, string2.length-1) ; } while ( string3.substr(0,1) == " " ) { string3 = string3.substr(1) ; } while ( string3.substr(string3.length-1, 1) == " " ) { string3 = string3.substr(0, string3.length-1) ; } if ( string3 == checkString ) { actLen = comboField.length; comboField.length = actLen + 1 ; n++ ; comboField.options[n].text = string2 ; } } } // Add section function addSection( a, prefix, max, min ) { var secDiv = prefix + a; // Show right numbers of employeers document.getElementById( secDiv ).style.display = "block"; // Take care of the buttons var addButtonHide = prefix + "AddButt" + a ; if( a != max ) var addButtonShow = prefix + "AddButt" + eval(a + 1); var delButtonHide = prefix + "DelButt" + eval(a - 1); var delButtonShow = prefix + "DelButt" + a; document.getElementById( addButtonHide ).style.display = "none"; //Add button to be hidden if( a != max ) document.getElementById( addButtonShow ).style.display = "block"; //Add button to be displayed if( a != min ) document.getElementById( delButtonHide ).style.display = "none"; //Remove button to be hidden document.getElementById( delButtonShow ).style.display = "block"; //Remove button to be displayed if ( prefix == "c" ) { // Courses. Change field "NoCourse". document.forms[0].NoCourse.value = a; } if ( prefix == "S1projects" ) { // Courses. Change field "S1ProjectNo". document.forms[0].S1ProjectNo.value = a; } if ( prefix == "S2projects" ) { // Courses. Change field "S2ProjectNo". document.forms[0].S2ProjectNo.value = a; } if ( prefix == "S3projects" ) { // Courses. Change field "S3ProjectNo". document.forms[0].S3ProjectNo.value = a; } if ( prefix == "S4projects" ) { // Courses. Change field "S4ProjectNo". document.forms[0].S4ProjectNo.value = a; } if ( prefix == "S5projects" ) { // Courses. Change field "S5ProjectNo". document.forms[0].S5ProjectNo.value = a; } } //Remove employee function delSection( a, prefix, max, min, webFlg ) { var secDiv = prefix + a; var addButtonHide = prefix + "AddButt" + eval(a + 1) var addButtonShow = prefix + "AddButt" + a var delButtonHide = prefix + "DelButt" + a var delButtonShow = prefix + "DelButt" + eval(a - 1) //Clear the fields in the section to be hidden if( prefix == "emp" ) { // Previous Employeer var doc = document.forms[0]; var empName = "PreviousEmployer" + a + "_txt"; var empTitle = "PreviousJobTitle" + a + "_txt"; var empCtry = "PreviousJobCountry" + a + "_ke"; var empCity = "PreviousJobCity" + a + "_txt"; var empTask = "MainTask" + a; var empMonth = "PreviousMonth" + a + "_ke"; var empYear = "PreviousYear" + a + "_ke"; var empMonth2 = "PreviousMonth" + a + a + "_ke"; var empYear2 = "PreviousYear" + a + a + "_ke"; var empRef = "PreviousRef" + a + "_rtf"; doc.elements[empName].value = ""; doc.elements[empTitle].value = ""; doc.elements[empTask].value = ""; doc.elements[empCtry].selectedIndex = 0; doc.elements[empCity].value = ""; doc.elements[empMonth].value = ""; doc.elements[empYear].value = ""; doc.elements[empMonth2].value = ""; doc.elements[empYear2].value = ""; doc.elements[empRef].value = ""; } else if ( prefix == "edu" ) { // Education var doc = document.forms[0]; var eduDegree = "Degree" + a + "_ke"; var eduDetails = "DegreeDetails" + a + "_txt"; var eduUni = "University" + a + "_txt"; var eduYear = "YearOfGraduation" + a + "_txt"; var eduMajor = "FieldOfStudyMajor" + a + "Disp_ke" var eduMinor = "FieldOfStudyMinor" + a + "Disp_ke"; doc.elements[eduDegree].selectedIndex = 0; doc.elements[eduDetails].value = ""; doc.elements[eduUni].value = ""; doc.elements[eduYear].selectedIndex = 0; doc.elements[eduMajor].options.length = 0; doc.elements[eduMinor].options.length = 0; } else if ( prefix == "c" ) { // Courses var doc = document.forms[0]; doc.NoCourse.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var cTitle = "CTitle_" + i; var cInst = "CInstitution_" + i; var cStart = "CStartDate_" + i; var cEnd = "CEndDate_" + i; doc.elements[ cTitle ].value = ""; doc.elements[ cInst ].value = ""; doc.elements[ cStart ].options.selectedIndex = 0; doc.elements[ cEnd ].value = ""; if( webFlg!= "INTERNET" ) { var cType = "CType_" + i; doc.elements[ cType][0].checked = false; doc.elements[ cType][1].checked = true; } } } if ( prefix == "S1projects" ) { // S1 Software skills var doc = document.forms[0]; var S1projDurationCheck = "Yes"; doc.S1ProjectNo.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var S1projectsName = "S1ProjName_" + i; doc.elements[ S1projectsName ].value = ""; var S1projectsRole = "S1ProjRole_" + i; var S1projectsSize = "S1ProjSize_" + i; var S1projectsCountry = "S1ProjCountry_" + i; doc.elements[S1projectsRole].selectedIndex = 0; doc.elements[S1projectsSize ].selectedIndex = 0; doc.elements[S1projectsCountry].selectedIndex = 0; if ( S1projDurationCheck == "Yes" ) { var S1projectsDuration = "S1ProjDuration_" + i; doc.elements[S1projectsDuration].selectedIndex = 0; } } } if ( prefix == "S2projects" ) { // S2 Software skills var doc = document.forms[0]; var S2projDurationCheck = "Yes"; doc.S2ProjectNo.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var S2projectsName = "S2ProjName_" + i; doc.elements[ S2projectsName ].value = ""; var S2projectsRole = "S2ProjRole_" + i; var S2projectsSize = "S2ProjSize_" + i; var S2projectsCountry = "S2ProjCountry_" + i; doc.elements[S2projectsRole].selectedIndex = 0; doc.elements[S2projectsSize ].selectedIndex = 0; doc.elements[S2projectsCountry].selectedIndex = 0; if ( S2projDurationCheck == "Yes" ) { var S2projectsDuration = "S2ProjDuration_" + i; doc.elements[S2projectsDuration].selectedIndex = 0; } } } if ( prefix == "S3projects" ) { // S3 Software skills var doc = document.forms[0]; var S3projDurationCheck = "Yes"; doc.S3ProjectNo.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var S3projectsName = "S3ProjName_" + i; doc.elements[ S3projectsName ].value = ""; var S3projectsRole = "S3ProjRole_" + i; var S3projectsSize = "S3ProjSize_" + i; var S3projectsCountry = "S3ProjCountry_" + i; doc.elements[S3projectsRole].selectedIndex = 0; doc.elements[S3projectsSize ].selectedIndex = 0; doc.elements[S3projectsCountry].selectedIndex = 0; if ( S3projDurationCheck == "Yes" ) { var S3projectsDuration = "S3ProjDuration_" + i; doc.elements[S3projectsDuration].selectedIndex = 0; } } } if ( prefix == "S4projects" ) { // S4 Software skills var doc = document.forms[0]; var S4projDurationCheck = "Yes"; doc.S4ProjectNo.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var S4projectsName = "S4ProjName_" + i; doc.elements[ S4projectsName ].value = ""; var S4projectsRole = "S4ProjRole_" + i; var S4projectsSize = "S4ProjSize_" + i; var S4projectsCountry = "S4ProjCountry_" + i; doc.elements[S4projectsRole].selectedIndex = 0; doc.elements[S4projectsSize ].selectedIndex = 0; doc.elements[S4projectsCountry].selectedIndex = 0; if ( S4projDurationCheck == "Yes" ) { var S4projectsDuration = "S4ProjDuration_" + i; doc.elements[S4projectsDuration].selectedIndex = 0; } } } if ( prefix == "S5projects" ) { // S5 Software skills var doc = document.forms[0]; var S5projDurationCheck = "Yes"; doc.S5ProjectNo.value = a - 1; if ( a == '2' ) var startNo = '5'; else if ( a == '3' ) var startNo = '10'; else if ( a == '4' ) var startNo = '15' else if ( a == '5' ) var startNo = '20' endNo = parseInt( startNo ) + 4; for ( i = startNo; i <= endNo; i++ ) { var S5projectsName = "S5ProjName_" + i; doc.elements[ S5projectsName ].value = ""; var S5projectsRole = "S5ProjRole_" + i; var S5projectsSize = "S5ProjSize_" + i; var S5projectsCountry = "S5ProjCountry_" + i; doc.elements[S5projectsRole].selectedIndex = 0; doc.elements[S5projectsSize ].selectedIndex = 0; doc.elements[S5projectsCountry].selectedIndex = 0; if ( S5projDurationCheck == "Yes" ) { var S5projectsDuration = "S5ProjDuration_" + i; doc.elements[S5projectsDuration].selectedIndex = 0; } } } //Set the hide & display document.getElementById( secDiv ).style.display = "none"; if( a != max ) document.getElementById( addButtonHide ).style.display = "none"; //Add button to be hidden document.getElementById( addButtonShow ).style.display = "block"; //Add button to be displayed document.getElementById( delButtonHide ).style.display = "none"; // Remove button to be hidden if( a != min ) document.getElementById( delButtonShow ).style.display = "block"; // Remove button to be displayed } /* Clear language level selection */ function clearLangLevel( langobj, levelobj ) { if ( langobj.options[0].selected ) { for ( i = 0 ; i < levelobj.length ; i++ ) { levelobj[i].checked = false ; } langobj.focus() ; } } // Open new multiple selection window function addRemoveChoices( myurl , winH, winName ) { //Close the dlg if already exist but not yet closed theParent = getMDparent() theParent.closeAddRemoveDlg(); winHeight = winH + 20 var props = 'scrollBars=yes, width=600, height=' + winHeight; theParent.windowAddRemove = window.open(myurl, "Add_from_Src_to_Dest", props); theParent.windowAddRemove.focus(); } // Call for add remove depending choices with help information function addRemoveDependingChoicesHelp( db, ctryKey, fld, fldCat, lukey, staffModule ) { var skillist = ""; var srcList = window.document.getElementById( fldCat ) for(var i = 0; i < srcList.options.length; i++) { if (srcList.options[i] != null) { if (skillist == "") { if( srcList.options[i].value == "" ) skillist = srcList.options[i].text; else skillist = srcList.options[i].text + "|" + srcList.options[i].value } else { if( srcList.options[i].value == "" ) skillist = skillist + ", " + srcList.options[i].text; else skillist = skillist + ", " +srcList.options[i].text + "|" + srcList.options[i].value } } } myurl = "/" + db + "/frmFramesetAddRemoveChoices4?ReadForm&fld=" + fld + "&lukey=" + lukey + "&staff=" + staffModule + "&fldcat=" + replaceString("&","~",skillist) + "&ctry=" + ctryKey addRemoveChoices( myurl, 310 ); } /* *** Functions used for the multiple selection window *** */ // Add the selected items in the parent by calling method of parent function addSelectedItemsToParent( dbType, fldCheck ) { self.opener.addToParentField(destList, parentSrcList, parentNotesList, fldCheck, dbType ); callClearExpertise(); window.close(); } function addSelectedItemsToParent3(obj, srcPage, fldCheck, dbType ) { obj.addToParentField(srcPage.destList, srcPage.parentSrcList, srcPage.parentNotesList, fldCheck, dbType ); window.top.close(); } // Initiate the variables that are used in several functions function initVar( mySelf ) { destList = window.document.forms[0].destList; if(window.document.forms[0].FieldToUpdate.value =="WorkExpSubCat") selectList = "WorkExpSubCatDisp_txt" ; else selectList = window.document.forms[0].FieldToUpdate.value + "Disp_ke" ; if(window.document.forms[0].FieldToUpdate.value == "WorkExpSubCat") notesList = "WorkExpSubCat_txt" else notesList = window.document.forms[0].FieldToUpdate.value + "_ke" ; // only used in function that sends values back to parent thisSrcList = window.document.forms[0].SrcList; parentSrcList = mySelf.opener.window.document.forms[0].elements[ selectList ]; parentNotesList = mySelf.opener.document.forms[0].elements[ notesList ]; } // Fill the selcted item list with the items already present in parent. function fillInitialDestList() { for (var count = destList.options.length - 1; count >= 0; count--) { destList.options[count] = null; } for(var i = 0; i < parentSrcList.options.length; i++) { if (parentSrcList.options[i].text !="") { destList.options[i] = new Option(parentSrcList.options[i].text, parentSrcList.options[i].value); } } } // Add the selected items from the source to destination list function addSrcToDestList( selectedValue, selectedAlias ) { var len = destList.length; for(var i = 0; i < thisSrcList.length; i++) { if ((thisSrcList.options[i] != null) && (thisSrcList.options[i].selected)) { // Check if this value already exist in the destList or not if not then add it otherwise do not add it. var found = false; for(var count = 0; count < len; count++) { if (destList.options[count] != null) { if (selectedAlias ) { if ( selectedAlias == destList.options[count].value ) { found = true; break; } } else if (thisSrcList.options[i].text == destList.options[count].text) { found = true; break; } } } if (found != true) { if (selectedAlias ) destList.options[len] = new Option( selectedValue, selectedAlias ) else destList.options[len] = new Option(thisSrcList.options[i].text, thisSrcList.options[i].value); len++; } } } } // Deletes from the destination list. function deleteFromDestList() { var len = destList.options.length; for(var i = (len-1); i >= 0; i--) { if ((destList.options[i] != null) && (destList.options[i].selected == true)) { destList.options[i] = null; } } } // Add and Remove values function addToParentField(sourceList, parentSrcList, notesList1, fldCheck, dbType ) { destinationList = parentSrcList; notesList = notesList1; notesList.value = ""; // Make sure the values in the list are not duplicated... for(var count = destinationList.options.length - 1; count >= 0; count--) { destinationList.options[count] = null; } for(var i = 0; i < sourceList.options.length; i++) { if (sourceList.options[i] != null ) destinationList.options[i] = new Option(sourceList.options[i].text, sourceList.options[i].value ); if (sourceList.options[i].text == sourceList.options[i].value) notesList.value = notesList.value + "," + sourceList.options[i].value; else { if( sourceList.options[i].value == "" ) notesList.value = notesList.value + "," + sourceList.options[i].text ; else { // If Job Posting and local language then set the value according to "local value [english value]" if ( dbType.toLowerCase() == "careergallery" ) { if ( sourceList.options[i].value.indexOf( "[" ) > 0 ) notesList.value = notesList.value + "," + sourceList.options[i].value ; else notesList.value = notesList.value + "," + sourceList.options[i].text + " [" + sourceList.options[i].value + "]"; } else if ( fldCheck != null ) { if ( fldCheck.indexOf( "CustomerCompetitor" ) >= 0 ) notesList.value = notesList.value + "," + sourceList.options[i].text ; else notesList.value = notesList.value + "," + sourceList.options[i].value ; } else notesList.value = notesList.value + "," + sourceList.options[i].value ; } } } // If field check is CareerPath, verify if the user have selected to be part of the role "member of the research staff" // If so, show the extra field for the true job title if( fldCheck == "S1CareerPath" ) { var staffFlg = false for(var i = 0; i < sourceList.options.length; i++) { var checkStr = sourceList.options[i].text; if( checkStr.toLowerCase() == "member of research staff" ) staffFlg = true } if ( staffFlg == true ) window.document.getElementById( "careerPath").style.display = "block"; else window.document.getElementById( "careerPath").style.display = "none"; } } function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) { var i, j; var prompt; // empty existing items for (i = selectCtrl.options.length; i >= 0; i--) { selectCtrl.options[i] = null; } prompt = (itemArray != null) ? goodPrompt : badPrompt; if (prompt == null) { j = 0; } else { selectCtrl.options[0] = new Option(prompt); j = 1; } if (itemArray != null) { // add new items for (i = 0; i < itemArray.length; i++) { selectCtrl.options[j] = new Option(itemArray[i][0]); if (itemArray[i][1] != null) { selectCtrl.options[j].value = itemArray[i][1]; } j++; } // select first item (prompt) for sub list selectCtrl.options[0].selected = true; } } /* *** Functions used for the multiple selection window *** */ // Set button width. Needed to have good layout in translations function setButton( minWidth ) { if (nn) return; allInps = document.all.tags("INPUT"); for (i=0;i -1 ) { string1 = totstring.substr( 0 , pos1) ; totstring = totstring.substr( pos1+1 ) ; pos2 = string1.indexOf( "|" ) ; string2 = string1.substr( 0 , pos2 ) ; string3 = string1.substr( pos2+1 ) ; } else { pos2 = totstring.indexOf( "|" ) ; string2 = totstring.substr( 0 , pos2 ) ; string3 = totstring.substr( pos2+1 ) ; more = 0 ; } while ( string2.substr(0,1) == " " ) { string2 = string2.substr(1) ; } while ( string2.substr(string2.length-1, 1) == " " ) { string2 = string2.substr(0, string2.length-1) ; } while ( string3.substr(0,1) == " " ) { string3 = string3.substr(1) ; } while ( string3.substr(string3.length-1, 1) == " " ) { string3 = string3.substr(0, string3.length-1) ; } if ( string3 == div ) { lengthBA = frm.BAselect.length ; frm.BAselect.length = lengthBA + 1 ; n++ ; frm.BAselect.options[n].text = string2 ; } } } function openPrivacy( db ) { whatToOpen = "/" + db + "/privacy"; myWin = window.open( whatToOpen, 'FriendWin', 'scrollbars=yes,width=650,height=500'); myWin.focus(); } function openConditions( db ) { whatToOpen = "/" + db + "/conditions"; myWin = window.open( whatToOpen, 'FriendWin', 'scrollbars=yes,width=650,height=500'); myWin.focus(); } function addressBook( dbPathName, fieldName, dlgH, dlgW ) { var winnew; var dialogWidth = dlgW; var dialogHeight = dlgH; var adrURL = '/' + dbPathName + '/wAddress?OpenForm&field=' + fieldName; var winProps = 'toolbar=no, location=no ,status=no ,menubar=no, scrollbars=no, resizable=no,width='+dialogWidth+',height='+dialogHeight+',top='+(screen.height-dialogHeight)/2 + ' ,left='+(screen.width-dialogWidth)/2 + ', hotkeys=no, dependent=yes' winnew=window.open( adrURL,'', winProps, name='Addressdlg'); winnew.focus(); } /* Scripts for Staffing module */ function changeStaffcompany( comp, deptSelect, deptHided, compName, compNameHided, hrMgr, hrMgrHided, deptDefaultStr, deptDefault ) { var frm = window.document.forms[0] ; var div = comp.options[comp.selectedIndex].text ; var totstring = deptHided.value ; var totstringCompName = compNameHided.value ; var totstringHRManager = hrMgrHided.value ; var totstringDeptDefault = deptDefault.value; deptSelect.length = 1 ; deptSelect.options[0].text = "" ; compName.value = "" ; hrMgr.length = 1 ; hrMgr.value = "" ; deptDefaultStr.value = "" // Get the substring for Department getSubString( totstring, div, "list", deptSelect ); // Get the substring for Company name getSubString( totstringCompName, div, "text", compName ); // Get the substring for Company name getSubString( totstringHRManager, div, "text", hrMgr ); // Get the substring for department default value getSubString( totstringDeptDefault, div, "text", deptDefaultStr ) // Default department value for ( i = 0; i < deptSelect.length ; i++) { if ( deptSelect.options[ i ].text == deptDefaultStr.value ) deptSelect.selectedIndex = i; } } function changeDeptLeader( companyFN, deptSelectFN, deptLeaderFN, deptLeaderHidedFN ) { // Change department leader when department is selected var frm = window.document.forms[0] ; var companySelect = companyFN.options[companyFN.selectedIndex].text ; // Get the selected company var deptSelect = deptSelectFN.options[deptSelectFN.selectedIndex].text ; // Get the selected department var totstring = deptLeaderHidedFN.value ; // All department leaders deptLeaderFN.value = "" ; // Get the substring for Department leader getSubString( totstring, companySelect + " # " + deptSelect, "text", deptLeaderFN ); // Get the correct dept. leader and update field } /* *** Handle department list *** */ function setDepartment( selDept, comp, deptSelect, deptHided ) { // Set Department combobox and default value // Department changeDepartment( comp, deptHided, deptSelect ); for ( var i= 0; i < deptSelect.length; i++) { if ( deptSelect.options[ i ].text == selDept ) { deptSelect.options[ i ].selected = true; } } } function changeDepartment( comp, deptHided,deptSelect ) { var frm = window.document.forms[0] ; var div = comp.options[comp.selectedIndex].text ; var totstring = deptHided.value ; // Get the substring for Department getSubString( totstring, div, "list", deptSelect ); } function getSubString( totstring, div, fldType, fldObj ) { var more = 1 ; var pos1 ; var pos2 ; var string1 ; var string2 ; var string3 ; var n = 0 ; while ( more ) { pos1 = totstring.indexOf( ";" ) ; if ( pos1 > -1 ) { string1 = totstring.substr( 0 , pos1) ; totstring = totstring.substr( pos1+1 ) ; pos2 = string1.indexOf( "|" ) ; string2 = string1.substr( 0 , pos2 ) ; string3 = string1.substr( pos2+1 ) ; } else { pos2 = totstring.indexOf( "|" ) ; string2 = totstring.substr( 0 , pos2 ) ; string3 = totstring.substr( pos2+1 ) ; more = 0 ; } while ( string2.substr(0,1) == " " ) { string2 = string2.substr(1) ; } while ( string2.substr(string2.length-1, 1) == " " ) { string2 = string2.substr(0, string2.length-1) ; } while ( string3.substr(0,1) == " " ) { string3 = string3.substr(1) ; } while ( string3.substr(string3.length-1, 1) == " " ) { string3 = string3.substr(0, string3.length-1) ; } if ( string3 == div ) { if (fldType == "list" ) { lengthDep = fldObj.length ; if (lengthDep == 0 ) { fldObj.length = 1; n = -1; } else { fldObj.length = lengthDep + 1 ; } n++ ; fldObj.options[n].text = string2 ; } else fldObj.value = string2 } } } function setCRProgramExpertice( experticeObj, experticeSelect ) { experticeObj.value = ""; //Catch all selected choices in an array... var expArray = new Array(); for (i = 0; i < (experticeSelect.length) ; i++) { if (experticeSelect.options[i].selected == true) { expArray[i] = experticeSelect.options[i].text; } } experticeObj.value = expArray; } function ReplaceStringWithMatch(sValue,sDelimeter,sMatch) { var i; var sTempString = ""; for(i=0; i maxwidth & h > maxheight) { w = (theimg.width * scalefactor) / theimg.width; h = (theimg.height * scalefactor) / theimg.width; if (h > maxheight) { h = maxheight; w = (theimg.width * maxheight) / theimg.height; } } // ----- end ------- // ------ If only w is larger than allowed ---- else if (w > maxwidth & h <= maxheight) { w = (theimg.width * scalefactor) / theimg.width; h = (theimg.height * scalefactor) / theimg.width; } // ----- end ------- // ------ If only h is larger than allowed ---- else if (w <= maxwidth & h > maxheight) { h = maxheight; w = (theimg.width * maxheight) / theimg.height; } // ----- end ------- pic = ReplaceStringWithMatch(pic," ","%20"); // if( w == 0 && h == 0 ) // loadPhoto( pic, imgname, maxwidth, scalefactor, maxheight ) // else document.writeln(""); } function browsePhoto(myurl) { var newWindow; var props = 'scrollBars=yes, width=475, height=150'; newWindow = window.open(myurl, "Browse_for_photo", props); newWindow.focus(); } function removePhoto(myurl, msg) { if (confirm(msg)) { //set a hidden field? window.location.replace(myurl) //this.document.forms[0].submit(); } else { return; } } /* Functions for handling showRequests */ function showRequest(openThis) { openThis=openThis + "&dedicatedWindow&"; myWin = window.open(openThis,"request", "scrollbars=yes,width=550,height=550"); myWin.focus(); } /* Functions for handling showApplications */ function showApplications(openThis) { openThis=openThis; myWin = window.open(openThis,"request", "scrollbars=yes,width=800,height=550"); myWin.focus(); } /* Functions to handle Log-off / Close MyData */ function logoffMyData(section, keyString, ctryOptions) { checkChangeFlg( section, keyString, ctryOptions ) theParent = getMDparent(); theParent.closeMyData(); } /* Functions to show group members or role description */ function showMember( name, dispName, typeToShow ) { if ( typeToShow == "group" ) { //Show member in a specific group openThis="./frmMember?ReadForm&KEY=" + name + "--" + dispName + "&" myWin = window.open(openThis,"showMember", "scrollbars=yes,width=300,height=300"); myWin.focus(); } else if( typeToShow == "role" ) { //Show member in a specific group openThis="./frmMember?ReadForm&KEY=" + name + "--" + dispName + "&" myWin = window.open(openThis,"showMember", "scrollbars=yes,width=300,height=300"); myWin.focus(); } } /* *** Function to open Data Privacy text *** */ function openDataPrivacy( param, db, staffModule ) { switch (param) { case "Profile" : var whatToOpen = "/" + db + "/frmPrivacyProfile?OpenForm"; break; case "Staffing" : var whatToOpen = "/" + db + "/frmPrivacyStaffing?OpenForm&KEY=" + staffModule + "&"; break; default : var whatToOpen = "/" + db + "/0/" + param + "?OpenDocument"; } myWin = window.open( whatToOpen, 'PrivacyWin', 'scrollbars=yes,width=650,height=500'); myWin.focus(); } /* *** Function to create Data Privacy doc, signed by user *** */ function createDataPrivacy( form, db, staffModule ) { switch (form) { case "frmPrivacyProfile" : window.opener.document.getElementById( "privacyProfileAccepted" ).style.display = "block"; window.opener.document.getElementById( "privacyProfile" ).style.display = "none"; window.opener.document.forms[0].elements['ProfileCheck'].checked = true; window.opener.document.forms[0].PrivacyCheckProfile.value = "Accepted"; break; case "frmPrivacyStaffing" : window.opener.document.getElementById( "privacy" + staffModule + "Accepted" ).style.display = "block"; window.opener.document.getElementById( "privacy" + staffModule ).style.display = "none"; window.opener.document.forms[0].elements[ staffModule + 'Check'].checked = true; window.opener.document.forms[0].elements[ "PrivacyCheck" + staffModule ].value = "Accepted"; break; default : } // Close the window window.close(); } function replaceString(oldS,newS,fullS) { // Replaces oldS with newS in the string fullS for (var i=0; i Check if Staffing *** */ function checkIfStaffing( form ) { theParent = getMDparent(); var allStaffings = "x,"; // <= HERE IS COMPUTED TEXT, LU FROM HR CD /* ************************************************************** Close all sections *************************************************************** */ k = 0; stafSel = getWord( 0, allStaffings, "," ); while ( stafSel != "") { ++k; // Show staffing fields if( form == "myprofile" ) { // hide staffing mandatory fields on the profile document.getElementById( "profile" + stafSel + "staffing" ).style.display = "none"; document.getElementById( "profile" + stafSel + "Privacy" ).style.display = "none"; } stafSel = getWord( k, allStaffings, "," ); } /* ************************************************************** Open selected sections *************************************************************** */ selStr = document.forms[0].elements['StaffingMember_ke'].value + ","; selStr = replaceString(", ",",", selStr); k = 0; stafSel = getWord( 0, selStr, "," ); if ( stafSel == "") { stafSel = getWord( 1, selStr, "," ); ++k; } while ( stafSel != "") { ++k; if (stafSel != "") { //Replace the found value with nothing allStaffings = replaceString(stafSel,"",allStaffings) // Show staffing fields if( form == "myprofile" ) { // Show staffing mandatory fields on the profile document.getElementById( "profile" + stafSel + "staffing" ).style.display = "block"; document.getElementById( "profile" + stafSel + "Privacy" ).style.display = "block"; } } stafSel = getWord( k, selStr, "," ); } } function setPreviewField( obj, field ) { var a = 0; for (var i=0; i < obj.length; i++) { if ( obj[i].checked && a == 0) { a = i + 1; } else { //a = -1; } } f = document.forms[0]; var fieldToSet = 'Preview' + field.name; f.elements[fieldToSet].selectedIndex = a; } function getWord( num, message, sep ) { /* Get a word from a list */ var section; section = message.split( sep ); if ( num < section.length ) return( section[num] ); else return( "" ); } /* ================================================================== LTrim(string) : Returns a copy of a string without leading spaces. ================================================================== */ function LTrim(str) /* PURPOSE: Remove leading blanks from our string. IN: str - the string we want to LTrim */ { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { // We have a string with leading blank(s)... var j=0, i = s.length; // Iterate from the far left of string until we // don't have any more whitespace... while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; // Get the substring from the first non-whitespace // character to the end of the string... s = s.substring(j, i); } return s; } /* ================================================================== RTrim(string) : Returns a copy of a string without trailing spaces. ================================================================== */ function RTrim(str) /* PURPOSE: Remove trailing blanks from our string. IN: str - the string we want to RTrim */ { // We don't want to trip JUST spaces, but also tabs, // line feeds, etc. Add anything else you want to // "trim" here in Whitespace var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { // We have a string with trailing blank(s)... var i = s.length - 1; // Get length of string // Iterate from the far right of string until we // don't have any more whitespace... while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; // Get the substring from the front of the string to // where the last non-whitespace character is... s = s.substring(0, i+1); } return s; } /* ============================================================= Trim(string) : Returns a copy of a string without leading or trailing spaces ============================================================= */ function Trim(str) /* PURPOSE: Remove trailing and leading blanks from our string. IN: str - the string we want to Trim RETVAL: A Trimmed string! */ { return RTrim(LTrim(str)); }