TooStep.Forms.SendMessage=function(){this.baseUrl="/corporate/jobCandidateProfile.html?popin=sendMessage"};TooStep.Forms.SendMessage.prototype=new TooStep.PopinForm();TooStep.Forms.SendMessage.prototype.getHeight=function(){return""};TooStep.Forms.SendMessage.prototype.getWidth=function(){return"600px"};TooStep.Forms.SendMessage.prototype.getDailogName=function(){return"SendMessage"};TooStep.Forms.SendMessage.prototype.getHeaderText=function(){return(this.attachedDocumentId==0)?"Send message":"Send Document"};TooStep.Forms.SendMessage.prototype.getPostingHeaderText=function(){return"Submitting your request, please wait..."};TooStep.Forms.SendMessage.prototype.getCancelButtonId=function(){return"sendMessageCancelBtn"};TooStep.Forms.SendMessage.prototype.getSubmitButtonId=function(){return"sendMessageSubmitBtn"};TooStep.Forms.SendMessage.prototype.getFormUrl=function(){return this.url};TooStep.Forms.SendMessage.prototype.getFormId=function(){return"sendMessageFormId"};TooStep.Forms.SendMessage.prototype.getSubmitUrl=function(){return"/job/jobApplication.html?task=sendMessage"};TooStep.Forms.SendMessage.prototype.getMessageDivId=function(){return this.messageDiv};TooStep.Forms.SendMessage.prototype.getUIErrorMessageDivId=function(){return"sendMessageUIErrorDiv"};TooStep.Forms.SendMessage.prototype.doAfterShow=function(){if(ge("hiddenContactsList")){var contacts;eval("contacts="+ge("hiddenContactsList").value);var contactList=new Array();for(var i=0;i<contacts.length;i++){contactList.push(contacts[i].contactId)}initAutocomplete("userFileEmails","userFileEmailsContainer",contactList,false)}};TooStep.Forms.SendMessage.prototype.doAfterSuccess=function(){this.close()};TooStep.Forms.SendMessage.prototype.doBeforeClose=function(){removeTextAreaTinyMCE("messageId")};TooStep.Forms.SendMessage.prototype.setAppId=function(E,C,A,D,B){this.url=this.baseUrl+"&applicationIdList="+encodeURIComponent(C)+"&candidateIdList="+encodeURIComponent(E)+"&attachedDocumentId="+D;this.url+="&fromJobsiteId="+B;this.messageDiv=A};TooStep.PopinFormHolder.getSendMessage=function(F,G,A,D,C){if(!TooStep.PopinFormHolder.sendMessage){TooStep.PopinFormHolder.sendMessage=new TooStep.Forms.SendMessage()}if(D&&D!=null){this.attachedDocumentId=D}else{this.attachedDocumentId=0}if(C&&(C!=null)){this.jobsiteId=C}var B=[];var E=[];if(G==""&&F==""){if(typeof applicationIdList!="undefined"&&applicationIdList.length>0){B=applicationIdList}else{if(typeof checkList!="undefined"&&checkList.length>0){E=checkList}}}else{if(F!=""){E.push(F)}else{if(G!=""){B.push(G)}}}TooStep.PopinFormHolder.sendMessage.setAppId(E,B,A,D,C);return TooStep.PopinFormHolder.sendMessage};var showLatestDocuments=true;var hasOpenApplications=true;function attachDocumentCallback(B){var D=B.argument.candidateId;var A=B.argument.applicationId;var J=B.argument.popinView;showDiv(B.argument.div);var E=B.responseXML.documentElement.getElementsByTagName("error")[0];if(E&&E!=null){var F=E.firstChild.nodeValue.trim();ge(B.argument.div).innerHTML=F;new YAHOO.widget.Effects.Fade(B.argument.div,{ease:YAHOO.util.Easing.easeOut,seconds:30})}else{showDivInline(B.argument.div);var H=B.responseXML.documentElement.getElementsByTagName("success")[0].firstChild.nodeValue.trim();var C=B.responseXML.documentElement.getElementsByTagName("time")[0].firstChild.nodeValue.trim();var G=B.responseXML.documentElement.getElementsByTagName("userFileId")[0].firstChild.nodeValue.trim();var I=B.responseXML.documentElement.getElementsByTagName("fileType")[0].firstChild.nodeValue.trim();ge(B.argument.div).innerHTML=H;new YAHOO.widget.Effects.Fade(B.argument.div,{ease:YAHOO.util.Easing.easeOut,seconds:30});ge("documentToAttach").value="";if(I.toLowerCase()=="resume"&&A){setResumeLinkToApplicationInApplicationListing(A,"Resume Available")}if(hasOpenApplications&&G&&J=="false"){TooStep.PopinFormHolder.getAttachFileToApplicationForm(D,G).show()}getAttachedDocumentsListing(D,A,J,G,true)}}function uploadSelectedFile(E,G,D){ge("documentStatusDiv").style.opacity="100";ge("documentStatusDiv").style.visibility="visible";var A=ge("fileTypeSelector").value;var C=ge("documentToAttach").value;if(!A||A==""||A=="_new_item"){A=ge("fileType").value}if(!A||A==""){showDivInline("documentStatusDiv");ge("documentStatusDiv").innerHTML="Tag cannot be empty";new YAHOO.widget.Effects.Fade("documentStatusDiv",{ease:YAHOO.util.Easing.easeOut,seconds:30});return }else{if(!C||C==""){showDivInline("documentStatusDiv");ge("documentStatusDiv").innerHTML="Select a file";new YAHOO.widget.Effects.Fade("documentStatusDiv",{ease:YAHOO.util.Easing.easeOut,seconds:30});return }}ge("fileType").value=A;var B=TooStep.util.getUrl("/uploadFile.html");B+="?forUserId="+E+"&applicationId="+G;var F={div:"documentStatusDiv",candidateId:E,applicationId:G,popinView:D,showAttachFilePopin:true};uploadFile("attachDocumentForm",B,attachDocumentCallback,F);new YAHOO.widget.Effects.Appear("documentStatusDiv",{ease:YAHOO.util.Easing.easeOut,seconds:0.1});showDivInline("documentStatusDiv");return false}function fileTypeChangeAction(A,B){if(B=="_new_item"){ge("fileType").value="";showDiv("fileTypeInputDiv")}else{hideDiv("fileTypeInputDiv");ge("fileType").value=B}}function getAttachedDocumentsListing(E,F,D,C,A){if(!A){A=false}var B=TooStep.util.getUrl("/j/jobsitePanel.html?pa=resumeUpload&p=resumeUpload&candidateId=")+E+"&showLatestDocuments="+showLatestDocuments+"&applicationId="+F+"&popinView="+D;setTimeout(function(){loadWithParams(B,fillAttachedDocumentsListing,"GET",{candidateId:E,userFileId:C,showAttachFilePopin:A,popinView:D})},1000)}function fillAttachedDocumentsListing(A){ge("attachedDocumentPanelDiv").innerHTML=A.responseText}function showAttachedDocuments(C){var A=ge("showLatestTab");var B=ge("showAllTab");if(C){B.className="";A.className="on";hideDiv("allDocumentListing");showDiv("latestDocumentListing");showLatestDocuments=true}else{A.className="";B.className="on";hideDiv("latestDocumentListing");showDiv("allDocumentListing");showLatestDocuments=false}}TooStep.Forms.AttachFileToApplication=function(B,A){this.candidateId=B;this.userJobsiteFileId=A};TooStep.Forms.AttachFileToApplication.prototype=new TooStep.PopinForm();TooStep.Forms.AttachFileToApplication.prototype.getHeight=function(){return""};TooStep.Forms.AttachFileToApplication.prototype.getWidth=function(){return""};TooStep.Forms.AttachFileToApplication.prototype.getDailogName=function(){return"attachFileToApplication"};TooStep.Forms.AttachFileToApplication.prototype.getHeaderText=function(){return"Attach File"};TooStep.Forms.AttachFileToApplication.prototype.getCancelButtonId=function(){return"contactUsCancelBtn"};TooStep.Forms.AttachFileToApplication.prototype.getSubmitButtonId=function(){return"contactUsSubmitBtn"};TooStep.Forms.AttachFileToApplication.prototype.getFormUrl=function(){return"/j/jobsitePanel.html?pa=resumeUpload&p=resumeUpload&action=showAttachFileToApplication&candidateId="+this.candidateId+"&userJobsiteFileId="+this.userJobsiteFileId};TooStep.Forms.AttachFileToApplication.prototype.getCancelButtonId=function(){return"closeAttachApplications"};TooStep.PopinFormHolder.AttachFileToApplication={};TooStep.PopinFormHolder.getAttachFileToApplicationForm=function(B,A){if(!TooStep.PopinFormHolder.AttachFileToApplication[B+"_"+A]){TooStep.PopinFormHolder.AttachFileToApplication[B+"_"+A]=new TooStep.Forms.AttachFileToApplication(B,A)}return TooStep.PopinFormHolder.AttachFileToApplication[B+"_"+A]};function attachResumeToApplication(chkBox,applicationId,userJobsiteFileId,messageDiv,candidateId){var url="/j/jobsitePanel.html?pa=resumeUpload&p=resumeUpload&action=attachFileToApplication";url+="&applicationId="+applicationId;url+="&userJobsiteFileId="+userJobsiteFileId;if(chkBox.checked){url+="&attach=1"}else{url+="&attach=0"}loadWithParams(url,function(o){var response;eval("response = "+o.responseText);clearAndAddMessageDiv(messageDiv);if(response.hasError){clearAndAddMessageDiv(messageDiv);ge(messageDiv).innerHTML=response.errors.join(" ");Dom.addClass(messageDiv,"error");Dom.removeClass(messageDiv,"info")}else{ge(messageDiv).innerHTML=response.successMessages.join(" ");Dom.addClass(messageDiv,"info");Dom.removeClass(messageDiv,"error");getAttachedDocumentsListing(candidateId,null,false,userJobsiteFileId,false)}},"GET",{})}function showAddAttachmentDiv(A){if(A){hideDiv("addAttachmentButton");showDiv("profileUploadDocumentDiv")}else{hideDiv("profileUploadDocumentDiv");showDiv("addAttachmentButton")}}function callBackAfterDocumentFilter(A){hideDiv("documentFilterLoading");ge("attachedDocumentPanelDiv").innerHTML=A.responseText}function getDocumentsByFilter(B,C){var A=TooStep.util.getUrl("/j/jobsitePanel.html?pa=resumeUpload&p=resumeUpload&action=getAttachedDocumentsListing")+"&candidateId="+C+"&task=getAttachedDocumentsListing&showLatestDocuments="+showLatestDocuments+"&applicationId="+B;showDivInline("documentFilterLoading");loadWithParams(A,callBackAfterDocumentFilter,"GET",{})}function setResumeLinkToApplicationInApplicationListing(C,B){var A=Dom.getElementsBy(function(D){return true},"tr","dataset");map(A,function(D){if(D.getAttribute("applicationId")==C){D.setAttribute("resumelink",B)}})}function deleteAttachedDocument(C,E,B,F){var D=confirm("Deleting this document will remove its association with the existing applications. Continue?");if(D==false){return }var A=TooStep.util.getUrl("/corporate/jobCandidateProfile.html")+"?candidateId="+E+"&documentId="+C+"&task=delete";loadWithParams(A,callBackAfterActionOnAttachedDocuments,"GET",{candidateId:E,popinView:B,applicationId:F})}function callBackAfterActionOnAttachedDocuments(o){var res;var candidateId=o.argument.candidateId;var popinView=o.argument.popinView;var applicationId=o.argument.applicationId;eval("res="+o.responseText);if(!res.hasError){showDiv("attachDocumentSuccessDiv");ge("attachDocumentSuccessDiv").innerHTML=res.successMessages}else{ge("attachDocumentErrorDiv").innerHTML=res.errors;showDiv("attachDocumentErrorDiv")}getAttachedDocumentsListing(candidateId,applicationId,popinView,null,false)}TooStep.Forms.CandidateInfo=function(){};TooStep.Forms.CandidateInfo.prototype=new TooStep.PopinForm();TooStep.Forms.CandidateInfo.prototype.getHeight=function(){return"auto"};TooStep.Forms.CandidateInfo.prototype.getWidth=function(){return"700px"};TooStep.Forms.CandidateInfo.prototype.getDailogName=function(){return"CandidateInfo"};TooStep.Forms.CandidateInfo.prototype.getHeaderText=function(){return(this.showAppDetails)?"Candidate Info":"Attached Documents"};TooStep.Forms.CandidateInfo.prototype.getCancelButtonId=function(){return"CandidateInfoCancelBtn"};TooStep.Forms.CandidateInfo.prototype.getFormUrl=function(){return"/j/jobsitePanel.html?pa=jobApplicationPanelHandler&show=candidateinfo&candidateId="+this.candidateId+"&applicationId="+this.applicationId+"&showAppDetails="+this.showAppDetails};TooStep.PopinFormHolder.getCandidateInfoForm=function(B,C,A){if(!TooStep.PopinFormHolder.CandidateInfoForm){TooStep.PopinFormHolder.CandidateInfoForm=new TooStep.Forms.CandidateInfo()}TooStep.PopinFormHolder.CandidateInfoForm.candidateId=B;TooStep.PopinFormHolder.CandidateInfoForm.applicationId=C;TooStep.PopinFormHolder.CandidateInfoForm.showAppDetails=A;return TooStep.PopinFormHolder.CandidateInfoForm};TooStep.Forms.CandidateInfo.prototype.doAfterShow=function(){formatAllDates();(function(){var startInsertingAfterTr=Dom.getElementsByClassName("_fullNamePhoneEndProfile","tr")[0];var d=new Array();eval("d="+ge("additionalFieldsHiddenCandidateInfo").value);if(d.length==0){return }for(var iIndex=0;iIndex<d.length;iIndex++){var headerName=d[iIndex];var els=Dom.getElementsBy(function(elem){return elem.getAttribute("headerName")==headerName},"tr","candidateInfoTable");if(els.length>0){var elem=els[0];Dom.removeClass(elem,"_trHidden");Dom.insertAfter(elem,startInsertingAfterTr);startInsertingAfterTr=elem}}})()};
