function advancedSaveSearch(form,freq,doneSearchUrl){var formElem=$(form);var postData={};try{if(formElem.advanced_form_use){postData={"current_action":window.currentTabAction,"advanced_form_use":true,"keywords":formElem.keywords.value,"job_title":formElem.job_title.value,"job_title_current":formElem.job_title_current.value,"name":formElem.name.value,"company":formElem.company.value,"company_date_current":formElem.company_date_current.value,"school":formElem.school.value,"zip":formElem.zip.value,"range":formElem.range.value,"toggle_date_range":formElem.toggle_date_range.value,"from":formElem.from.value,"to":formElem.to.value,"country":formElem.country.value,"doneSearchUrl":doneSearchUrl,"emailFreq":freq};}else{postData={"current_action":window.currentTabAction,"advanced_form_use":false,"keywords":formElem.keywords.value,"doneSearchUrl":doneSearchUrl,"emailFreq":freq};}
postData.done=location.href;}catch(e){showErrorMessage(pulse.res.plaxoPro.errorCallBack);return false;}
var successCallback=function(response){var el=$('advancedSearchFormActions');if(el){el.innerHTML=response.template;var searchSaveOptions=new HiddenElementController('searchAction_saveOptions',1000);dojo.connect($('searchAction_saveAction'),"mouseover",searchSaveOptions,"show");var searchRunOptions=new HiddenElementController('searchAction_runOptions',1000);dojo.connect($('searchAction_runAction'),"mouseover",searchRunOptions,"show");if(response.emptyFields&&response.emptyFieldsText){showErrorMessage(response.emptyFieldsText);}else if(response.reachedSavedSearchLimit){showErrorMessage(response.reachedSavedSearchLimitText);if(!response.reachedSavedSearchLimitPro){location.href=response.reachedSavedSearchLimitRedirect;}}else{showSuccessMessage(pulse.res.plaxoPro.searchSaveSuccess);}}};var errorCallback=function(response){showErrorMessage('Error saving your search. Please try again in a minute.');};sendXhrJson('/search/saveSearch',postData,successCallback,errorCallback);return false;}
function showNewSavedSearch(){if(numSavedSearches>=maxSavedSearches){showErrorMessage(pulse.res.myCareer.maxSavedSearchError);}else{var el=$('ss00_module');var link=$('addNewSearchLink');if(el){fadeIn(el,500);}
if(link){dojo.style(link,'display','none');}}}
function setEditedFlag(){savedSearchEditedFlag=true;}
function checkForEditedSearches(){if(savedSearchEditedFlag){alert('Are you sure you want to exit without saving? Press the "Save All" button to save your changes, or click "Done editing" again to exit.');savedSearchEditedFlag=false;return false;}
return true;}
function toggleEditSavedSearchAdvancedOptions(savedSearchId){var el=$('ss'+savedSearchId+'_advancedOptionsWrapper');var elHeight=dojo.style($('ss'+savedSearchId+'_advancedOptions'),'height')+25;if(el&&elHeight){if(dojo.style(el,'height')<='0'){dojo.anim(el,{height:elHeight},500);}else{dojo.anim(el,{height:'0'},500);}}}
function toggleCollapseSavedSearches(){var savedSearches=dojo.query('.searchAdvancedOptionsWrapper');for(var i=0;i<savedSearches.length;i++){savedSearches[i].style.height=0;}}
function deleteSavedSearch(search_id){var answer=confirm('Are you sure you want to delete this search?');if(answer){var postData={"search_id":search_id};var successCallback=function(response){var moduleElem=$('ss'+search_id+'_module');if(moduleElem){dojo.anim(moduleElem,{height:'0'},600,null,function(){dojo.style(moduleElem,'display','none');});numSavedSearches--;if(!numSavedSearches){fadeIn($('noSavedSearchesMessage'));}}};var errorCallback=function(response){showErrorMessage('Error deleting your search. Please try again in a minute.');};sendXhrJson('/search/deleteSearch',postData,successCallback,errorCallback);}
return false;}
function changeTab(tabLinkObject){window.currentTabAction=tabLinkObject.id;var form;if(window.currentTabAction=='abPeopleSearch'||window.currentTabAction=='index'){form=$(window.currentSearchLevel);}else{form=$('basicForm');window.currentSearchLevel='basicForm';}
createActionAndSubmit(form,true);}
function createActionAndSubmit(form,submitFromTab){var currURL=document.URL;var componentList=currURL.split('?');var baseURL=componentList[0];var nextComponentList=baseURL.split('/');var fullURL=nextComponentList[0]+'//';fullURL=fullURL+nextComponentList[2];var i;if(nextComponentList.length==4){for(i=3;i<nextComponentList.length;i++){fullURL=fullURL+'/'+nextComponentList[i];}}else{for(i=3;i<nextComponentList.length-1;i++){fullURL=fullURL+'/'+nextComponentList[i];}}
fullURL=fullURL+'/'+window.currentTabAction;form.action=fullURL;window.isRunning=false;if(!submitFromTab){return true;}else{document.doSubmit=function(){form.submit();};setTimeout("document.doSubmit();",50);}
return true;}
function toggle_advanced_search(){var basic=$('basic_search');var advanced=$('ss000_module');var advancedSave=$('saved_searches_module');if(basic.style.display=='none'){hide(advancedSave);hide(advanced);show(basic);show(advancedSave);window.currentSearchLevel='basicForm';}else{hide(advancedSave);hide(basic);show(advanced);show(advancedSave);window.currentSearchLevel='advancedForm';}}
function checkForUSAEdit(countryInput){var ssPrefix='';if(countryInput.name.charAt(0)=='s'&&countryInput.name.charAt(1)=='s'){var componentList=countryInput.name.split('_');ssPrefix=componentList[0]+'_'+componentList[1]+'_';}
var advancedSave=$('saved_searches_module');if(countryInput.value!="US"){$(ssPrefix+'zip').value='';$(ssPrefix+'range').value='';hide(advancedSave);hide($(ssPrefix+'allSection'));hide($(ssPrefix+'zipSection'));hide($(ssPrefix+'rangeSection'));show(advancedSave);}else{hide(advancedSave);show($(ssPrefix+'allSection'));show($(ssPrefix+'zipSection'));show($(ssPrefix+'rangeSection'));show(advancedSave);}}
function checkForZipEdit(zipTextInput){var ssPrefix='';if(zipTextInput.name.charAt(0)=='s'&&zipTextInput.name.charAt(1)=='s'){var componentList=zipTextInput.name.split('_');ssPrefix=componentList[0]+'_'+componentList[1]+'_';}
if(zipTextInput.value.length>0){$(ssPrefix+'range').value=25;}else{$(ssPrefix+'range').value='';}}
function toggleCheckBoxEdit(checkbox,isPro){var ssPrefix='';if(checkbox.name.charAt(0)=='s'&&checkbox.name.charAt(1)=='s'){var componentList=checkbox.name.split('_');ssPrefix=componentList[0]+'_'+componentList[1]+'_';}
if(checkbox.checked){checkbox.value=1;if(isPro){if(checkbox.name==ssPrefix+'company_date_current'){$(ssPrefix+'from').value='';$(ssPrefix+'to').value='';$(ssPrefix+'toggle_date_range').value=0;$(ssPrefix+'toggle_date_range').checked=false;setVisibility($(ssPrefix+'fromSection'),false);setVisibility($(ssPrefix+'toSection'),false);hide($(ssPrefix+'dateRangeSection'));}else if(checkbox.name==ssPrefix+'toggle_date_range'){setVisibility($(ssPrefix+'fromSection'),true);setVisibility($(ssPrefix+'toSection'),true);}}}else{checkbox.checked=false;checkbox.value=0;if(isPro){if(checkbox.name==ssPrefix+'company_date_current'){show($(ssPrefix+'dateRangeSection'));}
if(checkbox.name==ssPrefix+'company_date_current'||checkbox.name==ssPrefix+'toggle_date_range'){if($(ssPrefix+'toggle_date_range').checked&&!$(ssPrefix+'company_date_current').checked){setVisibility($(ssPrefix+'fromSection'),true);setVisibility($(ssPrefix+'toSection'),true);}else{$(ssPrefix+'toggle_date_range').value=0;$(ssPrefix+'from').value='';$(ssPrefix+'to').value='';setVisibility($(ssPrefix+'fromSection'),false);setVisibility($(ssPrefix+'toSection'),false);}}}}}
function textLimit(field,max){var count=field.value.length;if(max-count<0){field.value=field.value.substring(0,max);}}
function showRangeSection(prefix){if(!prefix){prefix='';}
show($(prefix+'rangeSection'));}
function isNumeric(sText){var ValidChars="0123456789.";var IsNumber=true;var Char;for(var i=0;i<sText.length&&IsNumber;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1){IsNumber=false;}}
return IsNumber;}
function checkFields(form,prefix){if(!window.isRunning){if(!dojo.trim(dojo.query('.keywords')[0].value)&&!dojo.trim($(prefix+'name').value)&&!dojo.trim($(prefix+'job_title').value)&&!dojo.trim($(prefix+'company').value)&&!dojo.trim($(prefix+'school').value)&&!dojo.trim($(prefix+'country').value)){showErrorMessage("Please enter a search criteria");window.isRunning=false;return false;}
window.isRunning=true;if(form.id=='advancedForm'&&$(prefix+'from')&&$(prefix+'from').value>$(prefix+'to').value){showErrorMessage('You cannot search for a date that starts before it ends');window.isRunning=false;return false;}
if(form.id=='advancedForm'&&$(prefix+'company')&&!$(prefix+'company').value&&$(prefix+"toggle_date_range")&&$(prefix+'toggle_date_range').checked){showErrorMessage('You must enter a company in order to search by company date range');window.isRunning=false;return false;}
if(form.id=='advancedForm'&&$(prefix+'country').value=='US'&&$(prefix+'zip')&&$(prefix+'zip').value&&($(prefix+'zip').value.length!=5||!isNumeric($(prefix+'zip').value))){showErrorMessage('You must enter a valid zip code');window.isRunning=false;return false;}
if(form.id=='advancedForm'&&$(prefix+'country').value=='US'&&$(prefix+'zip')&&$(prefix+'zip').value&&$(prefix+'zip').value.length==5&&isNumeric($(prefix+'zip').value)&&!$(prefix+'range').value){showErrorMessage('You must pick a range along with your zip code');window.isRunning=false;return false;}
return createActionAndSubmit(form,false);}else{return false;}}
function toggleMore(summary){if(summary.nextSibling.className!='full'){show(summary.nextSibling.nextSibling);}else{show(summary.nextSibling);}
hide(summary);}
function changeText(keywordsField){if(keywordsField.className=='text wideInput basic'){var advancedKeywords=dojo.query('.keywords');advancedKeywords[0].value=keywordsField.value;}else{var basicKeywords=dojo.query('.basic');basicKeywords[0].value=keywordsField.value;}}