function doRecaptcha(a){$("#currentdata").hide();Recaptcha.create("6Ld7NQkAAAAAAGu3Gepqn0Uyrihd5Y38ZGQkM1gs",a,{theme:"white",callback:Recaptcha.focus_response_field});$("#newdata").show()}function doEmailRecaptcha(a){$("#"+a).parent().show();Recaptcha.create("6Ld7NQkAAAAAAGu3Gepqn0Uyrihd5Y38ZGQkM1gs",a,{theme:"white",callback:Recaptcha.focus_response_field})}function checkCaptcha(){$.post("/interactive/directory/captcha_and_email.php",{challenge:Recaptcha.get_challenge(),response:Recaptcha.get_response(),curname:$("#curname").val(),curphone:$("#curphone").val(),curdept:$("#curdept").val(),curoffice:$("#curoffice").val(),curtitle:$("#curtitle").val(),cururl:$("#cururl").val(),newname:$("#newname").val(),newphone:$("#newphone").val(),newdept:$("#newdept").val(),newoffice:$("#newoffice").val(),newtitle:$("#newtitle").val(),newurl:$("#newurl").val()},function(a){if(a=='success'){$("#pplresult").html("Thank you, the corrections have been submitted for review.")}else{Recaptcha.reload();alert("The words didn't seem to match the image; please try again")}})}function checkEmailCaptcha(b){$.post("/interactive/directory/email_link_captcha.php",{challenge:Recaptcha.get_challenge(),response:Recaptcha.get_response(),encoded:$("#"+b).val()},function(a){if(a!='fail'){$(".getemail").hide();if(b=='encoded')$("#empemail").html("<a href=\"mailto:"+a+"\"><u>"+a+"</u></a>");if(b=='stencoded')$("#stemail").html("<a href=\"mailto:"+a+"\"><u>"+a+"</u></a>");if(b=='locencoded')$("#locemail").html("<a href=\"mailto:"+a+"\"><u>"+a+"</u></a>")}else{Recaptcha.reload();alert("The words didn't seem to match the image; please try again")}})}function myCancel(){$("#pplresult").slideUp()}function toggleDir(){$(".result").hide();$(".search").val('');$("#tabs").tabs('select',0);$("#directory").toggle();$("#employee").focus()}function tabIni(a){$("#"+a).focus();$(".search").val('');$(".result").hide();$(".error").html("Enter the first few letters of what you are looking for.")}function changeSearchType(a){$("#"+a).flushCache();$("#"+a).val('');$("#"+a).focus();$(".result").slideUp();$(".error").html('Enter the first few letters of what you are looking for.')}function formatEmp(a,i,n,b){if(a=="No Match!"){$("#pplerror").html("No "+$("#pplby").val()+" results for '"+$("#employee").val()+"' - try different letters or search type.")}else{$("#pplerror").html('');if($("#pplby").val()=='first name'){return"<span class=\"name\">"+a[1]+" "+a[0]+"</span><span class=\"dept\">"+a[4]+"</span><span class=\"phone\">"+a[2]+"</span>"}else{return"<span class=\"name\">"+a[0]+", "+a[1]+"</span><span class=\"dept\">"+a[4]+"</span><span class=\"phone\">"+a[2]+"</span>"}}}function empResult(a,b,c){var d='';d="<div id=\"getempemail\" class=\"getemail\"><div id=\"pplcaptcha\"></div><button onClick=\"checkEmailCaptcha('encoded');\" type=\"button\" id=\"empemailsubmit\">Display Clickable Email</button></div><div id=\"currentdata\">"+"<label>Name:</label>"+b[1]+" "+b[0]+"<input type=\"hidden\" id=\"curname\" value=\""+b[1]+" "+b[0]+"\"><br />"+"<label>Phone: </label>"+b[2]+"<input type=\"hidden\" id=\"curphone\" value=\""+b[2]+"\"><br />"+"<label>Email:</label><span id=\"empemail\"><img src=\"/interactive/directory/ifr.php?text="+b[3]+"\" class=\"emailimg\">&nbsp;&nbsp;(<a href=\"javascript:;\" onClick=\"doEmailRecaptcha('pplcaptcha');\">make clickable</a>)</span><input type=\"hidden\" id=\"encoded\" value=\""+b[3]+"\"><br />"+"<label>Dept:</label>"+b[4]+"<input type=\"hidden\" id=\"curdept\" value=\""+b[4]+"\"><br />"+"<label>Office:</label>"+b[5]+"<input type=\"hidden\" id=\"curoffice\" value=\""+b[5]+"\"><br />"+"<label>Title:</label>"+b[6]+"<input type=\"hidden\" id=\"curtitle\" value=\""+b[6]+"\"><br />";if(b[7]!='')d+="<label>Web:</label><a href=\""+b[7]+"\">"+b[7]+"</a><input type=\"hidden\" id=\"cururl\" value=\""+b[7]+"\"><br />";d+="<div style=\"text-align: center\"><button type=\"button\" style=\"font-size:9px\" onClick=\"doRecaptcha('captcha');\" >Suggest an Update</button></div>"+"</div>"+"<div id=\"newdata\" style=\"display: none\">"+"<label>Directions:</label>Modify the information and enter the two security words to submit."+"<label>Name:</label><input id=\"newname\" type=\"text\" maxlength=\"75\" value=\""+b[1]+" "+b[0]+"\"><br />"+"<label>Phone: </label><input id=\"newphone\" type=\"text\" maxlength=\"75\" value=\""+b[2]+"\"><br />"+"<label>Dept:</label><input id=\"newdept\" type=\"text\" maxlength=\"75\" value=\""+b[4]+"\"><br />"+"<label>Office:</label><input id=\"newoffice\" type=\"text\" maxlength=\"75\" value=\""+b[5]+"\"><br />"+"<label>Title:</label><input id=\"newtitle\" type=\"text\" maxlength=\"75\" value=\""+b[6]+"\"><br />"+"<label>Web:</label><input id=\"newurl\" type=\"text\" maxlength=\"128\" value=\""+b[7]+"\">"+"<div id=\"captcha\"></div>"+"<button onClick=\"checkCaptcha();\" type=\"button\" id=\"mysubmit\">Submit Changes</button>&nbsp;<button type=\"button\" onClick=\"myCancel();\">Cancel</button>"+"</div>";$("#pplresult").html(d);$("#pplresult").slideDown()}function formatStudent(a,i,n,b){if(a=="No Match!"){$("#sterror").html("No "+$("#stby").val()+" results for '"+$("#student").val()+"' - try different letters or search type.")}else{if($("#stby").val()=='first name'){return"<span class=\"stname\">"+a[1]+" "+a[0]+"</span><span class=\"phone\">"+a[2]+"</span>"}else{return"<span class=\"stname\">"+a[0]+", "+a[1]+"</span><span class=\"phone\">"+a[2]+"</span>"}}}function stResult(a,b,c){$("#sterror").html('');$("#stresult").html("<div id=\"getstemail\" class=\"getemail\"><div id=\"stcaptcha\"></div><button onClick=\"checkEmailCaptcha('stencoded');\" type=\"button\" id=\"stemailsubmit\">Display Clickable Email</button></div><label>Name:</label>"+b[1]+" "+b[0]+"<br /><label>Email:</label><span id=\"stemail\"><img src=\"/interactive/directory/ifr.php?text="+b[3]+"\" class=\"emailimg\">&nbsp;&nbsp;(<a href=\"javascript:;\" onClick=\"doEmailRecaptcha('stcaptcha');\">make clickable</a>)</span><input type=\"hidden\" id=\"stencoded\" value=\""+b[3]+"\">");$("#stresult").slideDown()}function locResult(a,b,c){$("#locresult").html("<div id=\"getlocemail\" class=\"getemail\"><div id=\"loccaptcha\"></div><button onClick=\"checkEmailCaptcha('locencoded');\" type=\"button\" id=\"locemailsubmit\">Display Clickable Email</button></div><label>Name:</label>"+b[0]+"<input type=\"hidden\" id=\"curlocname\" value=\""+b[0]+"\"><br /><label>Location: </label>"+b[2]+"<input type=\"hidden\" id=\"curloclocation\" value=\""+b[2]+"\"><br /><label>Phone: </label>"+b[1]+"<input type=\"hidden\" id=\"curlocphone\" value=\""+b[1]+"\"><br /><label>Fax: </label>"+b[3]+"<input type=\"hidden\" id=\"curlocfax\" value=\""+b[3]+"\">");if(b[4]!=''){$("#locresult").append("<br /><label>Email:</label><span id=\"locemail\"><img src=\"/interactive/directory/ifr.php?text="+b[4]+"\" class=\"emailimg\">&nbsp;&nbsp;(<a href=\"javascript:;\" onClick=\"doEmailRecaptcha('loccaptcha');\">make clickable</a>)</span><input type=\"hidden\" id=\"locencoded\" value=\""+b[4]+"\">")};if(b[5]!='')$("#locresult").append("<br /><label>Web:</label><a href=\""+b[5]+"\">"+b[5]+"</a><input type=\"hidden\" id=\"curlocurl\" value=\""+b[5]+"\">");$("#locresult").slideDown()}function formatEmp(a,i,n,b){if(a=="No Match!"){$("#pplerror").html("No "+$("#pplby").val()+" results for '"+$("#employee").val()+"' - try different letters or search type.")}else{$("#pplerror").html('');if($("#pplby").val()=='first name'){return"<span class=\"name\">"+a[1]+" "+a[0]+"</span><span class=\"dept\">"+a[4]+"</span><span class=\"phone\">"+a[2]+"</span>"}else{return"<span class=\"name\">"+a[0]+", "+a[1]+"</span><span class=\"dept\">"+a[4]+"</span><span class=\"phone\">"+a[2]+"</span>"}}}function log(a,b,c){$("<li>").html(!b?"No match!":"Selected: "+c).appendTo("#result")}function formatItem(a){return a[0]+" (<strong>id: "+a[1]+"</strong>)"}function formatResult(a){return a[0].replace(/(<.+?>)/gi,'')}function locItem(a,i,n,b){if(a=="No Match!"){$("#locerror").html("No office/location results for '"+$("#employee").val()+"' - try different letters or search type.")}else{$("#locerror").html('');return"<span class=\"stname\">"+a[0]+"</span><span class=\"phone\">"+a[1]+"</span>"}}function stFillResult(a,i,n){if($("#stby").val()=='first name'){return a[1]+" "+a[0]}else{return a[0]+", "+a[1]}}function empFillResult(a,i,n){if($("#pplby").val()=='first name'){return a[1]+" "+a[0]}else{return a[0]+", "+a[1]}}
