AuthJobs={};AuthJobs.Global={isiOS:navigator.userAgent.match(/like Mac OS X/i),init:function(){$("li.dropdown>a,li.dropdown>span").click(function(b){b.stopPropagation();$(this).next("ul").toggle()});$("body").click(function(){$("li.dropdown ul").hide()});if(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)){var a=$("meta[name='viewport']");if(a){a.attr("content","width=device-width, minimum-scale=1.0, maximum-scale=1.0");$("body").bind("gesturestart",function(){a.attr("content","width=device-width, minimum-scale=0.25, maximum-scale=1.6")})}}$('input[title!=""], textarea[title!=""]').hint();$.tools.overlay.addEffect("panelSlide",function(c){overlay=this.getOverlay();h=overlay.outerHeight();var b={top:0};if(window.innerWidth<1040){$.scrollTo(0,{duration:250,axis:"y",easing:"easeInOutQuad",onAfter:function(){overlay.css("position","fixed");overlay.css("top","-"+h+"px");overlay.show().animate(b,400,"easeInQuint",c)}})}else{overlay.css("position","fixed");overlay.css("top","-"+h+"px");overlay.show().animate(b,400,"easeInQuint",c)}},function(c){overlay=this.getOverlay();h=overlay.outerHeight();var b={top:"-="+h};overlay.animate(b,400,"easeOutQuad",function(){$(this).hide();c.call()})});AuthJobs.Global.enhanceAccessibility();$("input.touchselect").focus(function(){$(this).select()});$("#channels .email a").click(function(b){$("#newsletter").slideToggle();b.preventDefault()});$(".banner .close").click(function(b){b.stopPropagation();b.preventDefault();$.cookie("hide-banner-ios-app",true,{expires:2592000,domain:"."+document.domain});$(".banner").slideUp()})},enhanceAccessibility:function(){$("#main").attr("role","main");$("aside").attr("role","complementary");$("#sitenav").attr("role","navigation").find("ul, li").attr("role","presentation")},errorPlacement:function(a,b){if(b.hasClass("adjacent")){if(b.siblings("p.example").length!=0){b.siblings("p.example:first").before(a)}else{a.appendTo(b.parent())}}else{if(b.attr("type")=="checkbox"){b.siblings("label:last").after(a)}else{if(b.attr("name")=="job_type"){$("#jobtype .options").after(a).addClass("error")}else{if(b.attr("id")=="description"){$("span#description_parent").after(a)}else{if(b.attr("id")=="twitter_username"){$("#companytwitter").append(a)}else{if(b.hasClass("stylish")){$(b).next(".newListSelected").after(a).addClass("error")}else{if(b.attr("id")=="ccnumber"){$(".ccnumber-img").after(a)}else{if(b.parents("li:first").attr("id")=="cardinfo"){}else{b.after(a)}}}}}}}}},highlightFieldError:function(b,a){var c=$(b);if(b.id=="description"){c=c.siblings("span")}c.addClass(a);c.nextAll(".wordcount, .charactercount").children("strong").css("color","#B30000")},unhighlightFieldError:function(b,a){$(b).removeClass(a);$(b).nextAll(".wordcount, .charactercount").children("strong").css("color","#222222");$(b).parent().find("label.error").remove()},countWords:function(a){words=(a.value.match(/([^\s\.\?]+)/g)||[]).length;$(a).nextAll(".wordcount").children("strong").html(words)},tinyMCEWordLimitUpdate:function(a){words=AuthJobs.Global.countWordsTinyMCE(a);original=a.getElement();$(original).parents("div:first").find(".wordcount").children("strong").html(words);if(words>$(original).rules().maxWordsTinyMCE){AuthJobs.Global.highlightFieldError($(original),"error");AuthJobs.Global.highlightFieldError($("span.mceEditor"),"error")}else{AuthJobs.Global.unhighlightFieldError($(original),"error");AuthJobs.Global.unhighlightFieldError($("span.mceEditor"),"error")}},countWordsTinyMCE:function(a){text=a.getContent();text=text.replace(/<[^>]+>/ig,"");text=text.replace(/&nbsp;/g,"");text=text.replace(/\n/g," ");text=text.replace(/\s+/g," ");text=$.trim(text);words=text.split(" ").length;if(text==""){words=0}return words},invalidHandler:function(c,b){var a=b.errorList[0].element;if($(a).hasClass("stylish")){a=$(a).next(".newListSelected").get(0)}$.scrollTo(a,{duration:250,axis:"y",offset:{left:0,top:-20},easing:"easeInOutQuad"})},supportsGeolocation:function(){return !!navigator.geolocation},getLocation:function(a){navigator.geolocation.getCurrentPosition(a,this.handleGeoError,{enableHighAccuracy:false,timeout:10000,maximumAge:60*60*1000});$("#geo_loader").show()},handleGeoError:function(a){$("#geo_loader").hide();alert(a);if(a.code==1){}else{if(a.code==2){}else{if(a.code==3){}else{}}}},selectElementText:function(c){var d=$(c).get(0);var a,b;if($.browser.msie){a=document.body.createTextRange();a.moveToElementText(d);a.select()}else{if($.browser.mozilla||$.browser.opera){b=window.getSelection();a=document.createRange();a.selectNodeContents(d);b.removeAllRanges();b.addRange(a)}else{if($.browser.safari){b=window.getSelection();b.setBaseAndExtent(d,0,d,1)}}}}};AuthJobs.Filter={search:"",location:"",onlyremote:"0",category:"0",types:"1,2,3,4",type_lookup:{"1":"full-time","2":"freelance","3":"contract","4":"internship"},page_size:50,initial_page_count:0,initial_page:0,initial_total_count:0,map_marker_x:0,map_marker_y:0,resetting:false,initialising:true,exceptionLimit:1,init:function(){$.history.init(function(c){if(c==""){c=$.cookie("filter_values")||""}if(c!=""){if(AuthJobs.Filter.initialising){var b=c.split("&");if(!b.types){b.types="1,2,3,4"}$.each(["location","category","search","onlyremote"],function(d,f){if(!b[f]){b[f]=""}});$.each(b,function(d,e){var g=e.substring(0,e.indexOf("="));var f=urldecode(e.substring(e.indexOf("=")+1));switch(g){case"types":AuthJobs.Filter.updateTypes(f);AuthJobs.Filter.types=f;break;case"category":AuthJobs.Filter.updateCategory(f);AuthJobs.Filter.category=f;break;case"location":AuthJobs.Filter.updateLocation(f);AuthJobs.Filter.location=f;break;case"onlyremote":AuthJobs.Filter.updateOnlyRemote(f);AuthJobs.Filter.onlyremote=f;break;case"search":AuthJobs.Filter.updateSearch(f);AuthJobs.Filter.search=f;break}});AuthJobs.Filter.execute();AuthJobs.Filter.initialising=false}}else{AuthJobs.Filter.initialising=false}},{unescape:",/=&"});$("input[name='search']").after("<a href='#' class='clear'>x</a>");if(AuthJobs.Filter.search!=""){$("#search .clear, #mobile-search .clear").addClass("activated")}$("#search .clear, #mobile-search .clear").click(function(){$(this).removeClass("activated");AuthJobs.Filter.dismissPulldown("mobile-search");if(AuthJobs.Filter.search!=""){$("input[name='search']").val("");AuthJobs.Filter.search="";AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute()}return false});$("#filtering input[type='submit'], .pages").fadeOut(200);$("#upper > ul > li:not(:last) > a").click(function(){var b=$(this);var c=b.parent("li").attr("id");b.parent("li").siblings("li:not(#search)").each(function(){AuthJobs.Filter.dismissPulldown($(this).attr("id"))});if(!b.next(".pulldown").is(":visible")){b.parent("li").addClass("open");b.next(".pulldown").fadeIn(200,function(){$(document).bind("click.pulldown",function(){AuthJobs.Filter.dismissPulldown(c)});$(document).bind("keyup.pulldown",function(d){if((d.keyCode||d.which)==27){AuthJobs.Filter.dismissPulldown(c)}})})}else{AuthJobs.Filter.dismissPulldown(c)}return false});$("#upper .mobile .search > a").click(function(){AuthJobs.Filter.dismissPulldown("status");var b=$(this);b.parent(".search").addClass("open");b.next(".pulldown").attr("droid",(new Date().getTime())).fadeIn(200,function(){$(document).bind("click.pulldown touchstart.pulldown",function(){AuthJobs.Filter.dismissPulldown("mobile-search")});$(document).bind("keyup.pulldown",function(c){if((c.keyCode||c.which)==27){AuthJobs.Filter.dismissPulldown("mobile-search")}})});return false});$("#status .refine > a").click(function(){AuthJobs.Filter.dismissPulldown("mobile-search");var b=$(this);b.parent(".refine").addClass("open");b.next(".pulldown").attr("droid",(new Date().getTime())).fadeIn(200,function(){$(document).bind("click.pulldown touchstart.pulldown",function(){AuthJobs.Filter.dismissPulldown("status")});$(document).bind("keyup.pulldown",function(c){if((c.keyCode||c.which)==27){AuthJobs.Filter.dismissPulldown("status")}})});return false});$(".refine label").bind("click touchstart",function(b){b.stopPropagation()});$(".pulldown").bind("click touchstart",function(b){b.stopPropagation()});$("#locations .wrap").append("<a href='#' class='clear'>x</a>");if(AuthJobs.Filter.location!=""){$("#locations .clear").addClass("activated")}$("#location").keyup(function(){if($(this).val()!=""){$(this).next(".clear").addClass("activated")}else{$(this).next(".clear").removeClass("activated")}});$("#locations .clear").click(function(b){$(this).removeClass("activated");$("#location").val("");b.preventDefault()});$("#locations .pulldown .controls").empty().append("<a href='#' class='save button'>Save</a> <a href='#' class='cancel button minor'>Cancel</a>");$("#locations .pulldown .cancel").click(function(b){AuthJobs.Filter.dismissPulldown("locations");b.preventDefault()});$("#status .refine .pulldown .controls").empty().append("<a href='#' class='save button'>Save</a> <a href='#' class='cancel button minor'>Cancel</a> <a href='#' class='resetAll button minor'>Reset</a>");$("#status .refine .pulldown .minor").click(function(b){AuthJobs.Filter.dismissPulldown("status");b.preventDefault()});$(".resetAll").click(function(b){AuthJobs.Filter.resetting=true;$("#categories .pulldown a:first").click();$("#mobile-duration, #mobile-category").val(0);$("input[name='search']").val("").blur();AuthJobs.Filter.search="";$("#search .clear, #mobile-search .clear").removeClass("activated");$("#types input[type='checkbox']").each(function(){if(!this.checked){$(this).click().trigger("change")}});$("#location").val("");$(".mobile .location").removeClass("set").unbind(".unlocate").unbind(".locate").bind("click.locate",function(c){AuthJobs.Filter.locate();c.preventDefault()});AuthJobs.Filter.location="";AuthJobs.Filter.onlyremote="0";AuthJobs.Filter.updateOnlyRemote(AuthJobs.Filter.onlyremote);$("#status").removeClass("active");AuthJobs.Filter.resetting=false;$.history.load("");$.cookie("filter_values","",{expires:90,domain:"."+document.domain});AuthJobs.Filter.execute();b.preventDefault()});$("#filtering").submit(function(){return false});$("#types input[type='checkbox']").change(function(){AuthJobs.Filter.types="";$(".refine .duration input[type='checkbox']").each(function(){this.checked=false});$("#types input[type='checkbox']").each(function(){if(this.checked){AuthJobs.Filter.types+=$(this).data("val")+",";$(".refine .duration input[data-val='"+$(this).data("val")+"']").get(0).checked=true}});AuthJobs.Filter.types=AuthJobs.Filter.types.substring(0,AuthJobs.Filter.types.length-1);AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute()});$("#categories .pulldown a").click(function(b){AuthJobs.Filter.category=$(this).data("val");AuthJobs.Filter.updateCategory(AuthJobs.Filter.category);AuthJobs.Filter.dismissPulldown("categories");AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute();b.preventDefault()});$(".refine .controls .save").click(function(b){AuthJobs.Filter.types="";$("#types input[type='checkbox']").each(function(){this.checked=false});$(".refine .duration input[type='checkbox']").each(function(){if(this.checked){AuthJobs.Filter.types+=$(this).data("val")+",";$("#types input[data-val='"+$(this).data("val")+"']").get(0).checked=true}});AuthJobs.Filter.types=AuthJobs.Filter.types.substring(0,AuthJobs.Filter.types.length-1);AuthJobs.Filter.category=$("#mobile-category").val();AuthJobs.Filter.updateCategory(AuthJobs.Filter.category);if($("#mobile-onlyremote").get(0).checked){AuthJobs.Filter.onlyremote="1";$("#onlyremote").get(0).checked=true;$("#locations .telecommute").css("display","inline")}else{AuthJobs.Filter.onlyremote="0";$("#onlyremote").get(0).checked=false;$("#locations .telecommute").hide("display","none")}$("#mobile-onlyremote").get(0).checked?$("#locations .telecommute").show():$("#locations .telecommute").hide();AuthJobs.Filter.dismissPulldown("status");AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute();b.preventDefault()});$("#locations .pulldown .save.button").click(function(b){AuthJobs.Filter.location=$("#location").val();if($("#onlyremote").get(0).checked){AuthJobs.Filter.onlyremote="1";$("#locations .telecommute").show();$("#mobile-onlyremote").get(0).checked=true}else{AuthJobs.Filter.onlyremote="0";$("#locations .telecommute").hide();$("#mobile-onlyremote").get(0).checked=false}AuthJobs.Filter.dismissPulldown("locations");AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute();b.preventDefault()});$("#location").keyup(function(b){if((b.keyCode||b.which)==13){$("#locations .pulldown .save.button").trigger("click")}});$("#search input[name='search']").keyup(function(){if($(this).val()!=""){$("#search .clear, #mobile-search .clear").addClass("activated")}else{$("#search .clear, #mobile-search .clear").removeClass("activated")}}).delayedObserver(function(){AuthJobs.Filter.search=this.val();AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute()},0.2);$(".mobile input[name='search']").keyup(function(b){if($(this).val()!=""){$("#search .clear, #mobile-search .clear").addClass("activated")}else{$("#search .clear, #mobile-search .clear").removeClass("activated")}if((b.keyCode||b.which)==13){$(this).blur();AuthJobs.Filter.dismissPulldown("mobile-search");AuthJobs.Filter.search=$(this).val();AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute()}});$(".pulldown ul li a").click(function(b){$(this).parents(".pulldown").find("li").removeClass("selected");$(this).parent("li").addClass("selected");b.preventDefault()});$(".mobile .location").bind("click.locate",function(b){AuthJobs.Filter.locate();b.preventDefault()});var a=$("ul#listings");AuthJobs.Filter.initial_page_count=a.data("page-count");AuthJobs.Filter.initial_page=a.data("page");AuthJobs.Filter.initial_total_count=a.data("total-count");AuthJobs.Filter.updateMoreLink(AuthJobs.Filter.initial_page_count,AuthJobs.Filter.initial_page,AuthJobs.Filter.initial_total_count)},locate:function(){var a=$(".mobile .location");a.unbind(".unlocate");if(navigator.geolocation){a.addClass("loading");navigator.geolocation.getCurrentPosition(function(b){AuthJobs.Filter.location="ll_"+b.coords.latitude+","+b.coords.longitude;AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute();a.toggleClass("loading set").unbind(".locate").bind("click.unlocate",function(c){AuthJobs.Filter.unlocate();c.preventDefault()})},function(b){a.removeClass("loading");alert("Sorry, we couldn't get your location.")})}else{alert("Sorry, your browser doesn't support geolocation.")}},unlocate:function(){$(".mobile .location").unbind(".locate").bind("click.locate",function(a){AuthJobs.Filter.locate();a.preventDefault()}).removeClass("set");AuthJobs.Filter.location="";AuthJobs.Filter.updateHistory();AuthJobs.Filter.execute()},updateCategory:function(b){var a;if(b=="0"||b==""){a=$("#categories .pulldown a[data-val='0']");$("#categories > a").addClass("default").html(a.html()+" <span>(choose a category&hellip;)</span>")}else{a=$("#categories .pulldown a[data-val='"+b+"']");$("#categories > a").removeClass("default").html($.trim(a.html().substring(0,a.html().indexOf("<span>"))))}$("#categories .pulldown li").removeClass("selected");a.parent("li").addClass("selected")},updateLocation:function(){var a=$("#locations .unknown").tooltip({tip:"#locations .tip",effect:"slide",relative:true,offset:[10,0]});if(AuthJobs.Filter.location==""){$("#locations .unknown").fadeOut(175);a.hide();$("#locations .marker").removeClass("set").fadeOut(175)}else{$("#location").val(unescape(AuthJobs.Filter.location));$(".mobile .location").addClass("set").unbind(".locate").bind("click.unlocate",function(b){AuthJobs.Filter.unlocate();b.preventDefault()});if(AuthJobs.Filter.map_marker_x!=0&&AuthJobs.Filter.map_marker_y!=0){$("#locations .marker").css({left:AuthJobs.Filter.map_marker_x,top:AuthJobs.Filter.map_marker_y}).fadeIn(200,function(){$(this).addClass("set")});$("#locations .unknown").hide();a.hide()}else{$("#locations .marker").fadeOut(175,function(){$(this).removeClass("set");if(AuthJobs.Filter.location!=""){$("#locations .unknown").fadeIn(175,function(){a.show();setTimeout(function(){a.hide()},3000)})}})}}},updateOnlyRemote:function(a){if(a=="1"){$("input[name='onlyremote']").each(function(){$(this).get(0).checked=true});$("#locations .telecommute").css("display","inline")}else{$("input[name='onlyremote']").each(function(){$(this).get(0).checked=false});$("#locations .telecommute").css("display","none")}},updateTypes:function(a){$("#types input[type='checkbox'], .refine .duration input[type='checkbox']").each(function(b,c){c.checked=false;$(c).removeAttr("checked")});$.each(a.split(","),function(b,d){var c=$("#types input[data-val='"+d+"']");if(c.length){c.attr("checked","checked").get(0).checked=true}c=$(".refine .duration input[data-val='"+d+"']");if(c.length){c.attr("checked","checked").get(0).checked=true}})},updateSearch:function(a){$("input[name='search']").val(unescape(a)).removeClass("blur");$("#search .clear, #mobile-search .clear").addClass("activated")},dismissPulldown:function(b){var a=$("#"+b+" .pulldown");if(a.is(":visible")){$("#"+b).removeClass("open");a.fadeOut(200);$(document).unbind(".pulldown")}},updateHistory:function(){if(AuthJobs.Filter.resetting){return}var a="";if(!AuthJobs.Filter.defaultTypes()){a+="types="+AuthJobs.Filter.types+"&"}if(!AuthJobs.Filter.defaultCategory()){a+="category="+AuthJobs.Filter.category+"&"}if(!AuthJobs.Filter.defaultLocation()){a+="location="+AuthJobs.Filter.location+"&"}if(!AuthJobs.Filter.defaultOnlyRemote()){a+="onlyremote="+AuthJobs.Filter.onlyremote+"&"}if(!AuthJobs.Filter.defaultSearch()){a+="search="+AuthJobs.Filter.search+"&"}a=a.substring(0,a.length-1);$.history.load(a);$.cookie("filter_values",a,{expires:90,domain:"."+document.domain})},execute:function(a,c,d){if(AuthJobs.Filter.resetting){return}c=(c==undefined)?1:c;a=(a==undefined)?true:a;var b={page:c,page_size:AuthJobs.Filter.page_size,search:AuthJobs.Filter.search,category:AuthJobs.Filter.category,location:AuthJobs.Filter.location,onlyremote:AuthJobs.Filter.onlyremote,types:AuthJobs.Filter.types};if(a){$("#more").remove();$("#noresults").hide();$("#listings, #more").fadeTo(200,0.3,function(){if($("#loading").length==0){$("#listings").before("<div id='loading'><span>Loading results ...</span></div>");$("#loading").fadeTo(200,1)}AuthJobs.Filter.updateStatus();AuthJobs.Filter.requestListings(b,a,d)})}else{AuthJobs.Filter.requestListings(b,a,d)}},requestListings:function(b,a,c){$.get("/filter.php",b,function(d,e,f){if(a){$("#listings").empty()}else{$("#listings li").removeClass("fold").filter(":last").addClass("fold")}AuthJobs.Filter.map_marker_x=d.location.x;AuthJobs.Filter.map_marker_y=d.location.y;AuthJobs.Filter.updateLocation();if(d.location.name!=undefined){$("#status .location").html("near <strong>"+d.location.name+"</strong>")}if(d.pagination.total_count==0){$("#listings").empty();$("#noresults").fadeTo(300,1)}else{$("#noresults").fadeTo(200,0);$.each(d.listings,function(i,j){var g="<li class='"+j.employment.toLowerCase()+"'>";g+="<a href='"+j.url_relative+"'>";g+="<span>";g+="<img src='"+j.company_logo+"' width='32px' height='32px' alt='' />";g+="<div class='role'>";g+="<h3>"+j.title+"</h3>";g+="<h4>"+j.company+"</h4>";if(j.company_tagline!=""){g+="<span>"+j.company_tagline+"</span>"}g+="</div>";g+="<span class='location'>"+j.loc+"</span>";g+="<div class='meta'>";g+="<strong class='type'>"+j.employment+"</strong>";if(j.is_new){g+="<span class='new'>New</span>"}else{g+="<span class='posted'>"+j.post_date_relative+"</span>"}g+="</div>";g+="</span></a></li>";$("#listings").append(g)});if(a){$("#listings").fadeTo(500,1,function(){if(c!=undefined){c()}})}else{if(c!=undefined){c()}}}AuthJobs.Filter.updateMoreLink(d.pagination.page_count,d.pagination.page,d.pagination.total_count);$("#loading").fadeTo(200,0,function(){$(this).remove()})})},updateMoreLink:function(g,f,d){if((g-f)>0){var e=f+1;var c=AuthJobs.Filter.page_size;var b=d-(f*AuthJobs.Filter.page_size);if(b<AuthJobs.Filter.page_size){c=b}var a="<a href='#' data-page='"+e+"'>";a+="Load the next <span class='next_size'>"+c+"</span> listings ";a+="<span class='remaining'>("+b+" more in total)</span></a>";if($("#more").size()==0){$("#listings").after("<div id='more'>"+a+"</div>");$("#more").attr("droid",(new Date().getTime()))}else{$("#more").html(a)}$("#more a").unbind("click").click(function(){$("#more").html("<span class='loading'>Loading results ...</span>");AuthJobs.Filter.execute(false,e,function(){$.scrollTo("#listings .fold",{duration:500,axis:"y",easing:"easeInOutQuad"})});$(this).blur();return false})}else{$("#more").remove()}},updateStatus:function(){if(AuthJobs.Filter.defaults()){$("#status").removeClass("active");a()}else{a();$("#status").addClass("active")}function a(){AuthJobs.Filter.updateCategoryStatus();AuthJobs.Filter.updateTypesStatus();AuthJobs.Filter.updateLocationStatus();AuthJobs.Filter.updateSearchStatus()}},updateCategoryStatus:function(){var b=$.trim($("#categories .selected a").clone().children().remove().end().text().toLowerCase());var a=AuthJobs.Filter.onlyremote!="0"?true:false;var c="";if(!$("#categories .selected").hasClass("reset")){if(a){c="<strong>telecommute</strong> "}$("#status .category").html(c+"jobs in <strong>"+b+"</strong>")}else{if(a){$("#status .category").html("<strong>telecommute</strong> jobs")}else{$("#status .category").html("<strong>"+b+"</strong>")}}},updateTypesStatus:function(){var e=AuthJobs.Filter.types.split(",");var d=[];$.each(AuthJobs.Filter.type_lookup,function(g,f){if($.inArray(g,e)==-1){d.push(g)}});var b=e.length;var a=d.length;var c="";if(a<=AuthJobs.Filter.exceptionLimit){$.each(d,function(g,i){var f=AuthJobs.Filter.type_lookup[i];if(f=="internship"){f+="s"}if(g==a-1){if(g!=0){c+=" </strong> &amp; <strong> "}c+=f}else{c+=f;if(g!=a-2){c+=", "}}})}else{$.each(e,function(g,i){var f=AuthJobs.Filter.type_lookup[i];if(f=="internship"){f+="s"}if(g==b-1){if(g!=0){c+="</strong> &amp; <strong>"}c+=f}else{c+=f;if(g!=b-2){c+=", "}}})}if(c.length!=0){if(a<=AuthJobs.Filter.exceptionLimit){$("#status .types").html("(except <strong>"+c+"</strong>)")}else{$("#status .types").html("(<strong>"+c+"</strong>)")}}else{$("#status .types").empty("")}},updateLocationStatus:function(){var a=$.trim(AuthJobs.Filter.location);if(a!=""){if(a.substring(0,2)=="ll"){$("#status .location").html("<strong>nearby</strong>")}else{$("#status .location").html("near <strong>"+a+"</strong>")}}else{$("#status .location").empty()}},updateSearchStatus:function(){var a=$.trim(AuthJobs.Filter.search);if(a!=""){$("#status .search").html("matching <strong>&ldquo;"+a+"&rdquo;</strong>")}else{$("#status .search").empty()}},defaults:function(){var a=true;if(!AuthJobs.Filter.defaultCategory()){return false}if(!AuthJobs.Filter.defaultLocation()){return false}if(!AuthJobs.Filter.defaultOnlyRemote()){return false}if(!AuthJobs.Filter.defaultSearch()){return false}if(!AuthJobs.Filter.defaultTypes()){return false}return a},defaultCategory:function(){if(AuthJobs.Filter.category!="0"){return false}else{return true}},defaultLocation:function(){if(AuthJobs.Filter.location!=""){return false}else{return true}},defaultOnlyRemote:function(){if(AuthJobs.Filter.onlyremote!="0"){return false}else{return true}},defaultSearch:function(){if(AuthJobs.Filter.search!=""){return false}else{return true}},defaultTypes:function(){if(AuthJobs.Filter.types=="0"){return true}var a=0;var b=10;$.each(AuthJobs.Filter.types.split(","),function(c,d){a+=parseInt(d,10)});if(a<b){return false}else{return true}}};AuthJobs.Home={init:function(){$("#alert a.dismiss").bind("click",function(){$("#alert").slideUp();$.post("/ajax/dismiss_alert.php","alert_dismissed");return false});AuthJobs.Subscribe.init()}};AuthJobs.Subscribe={init:function(){$(".subscribe").overlay({top:0,effect:"panelSlide",expose:{color:"#000",loadSpeed:200,opacity:0.75},speed:"fast",closeOnClick:false,onBeforeLoad:function(a){$("#subscribe header p").html("Your criteria: <strong class='criteria'>"+$.trim($("#status .criteria").text())+"</strong>");$.get("/ajax/subs.php",{},function(b){$("#customrss").attr("href",b.feed);$("#rssurl").val(b.feed)},"json")},onClose:function(a){AuthJobs.Subscribe.modalReset()}});$("#subscribe .methods").tabs("#subscribe .process > div",{effect:"fade",initialIndex:0,onBeforeClick:function(d,a){var c=$("#subscribe .methods li").eq(a),b;if($("#subscribe:visible").length==1){b=c.position().top+(c.height()/2)-($("#subscribe .notch").height()/2);$("#subscribe .notch").stop().animate({top:b+"px"},500,"easeOutExpo")}else{$("#subscribe").show();b=c.position().top+(c.height()/2)-($("#subscribe .notch").height()/2);$("#subscribe .notch").stop().css({top:b});$("#subscribe").hide()}$("#subscribe .methods li").removeClass("active");c.addClass("active")}});$("#subscribe form").validate({rules:{subscribeemail:{required:true,email:true}},messages:{subscribeemail:{email:"Please enter a valid email address."}},errorClass:"error",errorElement:"label",highlight:function(c,d){AuthJobs.Global.highlightFieldError(c,d)},unhighlight:function(c,d){AuthJobs.Global.unhighlightFieldError(c,d)},submitHandler:function(b){$.ajax({type:"POST",url:"/ajax/subscribe.php",data:{subscribeemail:$("#subscribeemail").val(),mailfrequency:$("#subscribe-email > :radio:checked").val()},success:function(a){$("#subscribe .body").slideUp(500,function(){$("#subscribe h2").html("Subscribed");$("#subscribe header p").html("We&#146;ll be sending you matching jobs as they come in. Good luck!")})},error:function(a,c,d){$("#subscribe .body").slideUp(500,function(){if(d=="Bad Request"){$("#subscribe header p").html("You already have an active subscription for this criteria.")}else{$("#subscribe header p").html("An error occurred! Whoa!")}$("#subscribe h2").html("Oops!")})},dataType:"text"});return false}})},modalReset:function(){$("#subscribe .body").css("display","block");$("#subscribe h2").html("Subscribe to Personalized Notifications")}};AuthJobs.Post={category_limit:2,init:function(){$("#jobtype .options input[type='radio']").click(function(){$("#jobtype .options li").removeClass("selected");$(this).parent("li").addClass("selected")});$("#jobtype .options a").click(function(){$("#jobtype .options input[type='radio']").removeAttr("checked");$(this).siblings("input[type='radio']").attr("checked","checked").trigger("click");return false});$("#jobtype .options input[type='radio']").each(function(b,c){if($(this).get(0).checked){$(this).parent("li").addClass("selected")}});$("#post_back").click(function(){$("#post").prepend('<input type="hidden" name="goto_part" value="1" />');$("#post").submit();return false});$("input[name='job_type']").click(function(){if($(this).parent("li").hasClass("freelance")){}else{}});var a="";$("#cat_master li").each(function(b,c){a+="<option value='"+$(c).find(".cat_id").text()+"'>"+$(c).find(".cat_name").text()+"</option>"});$(".category_add").click(function(d){var c=$("#categories > li").size();if(c<AuthJobs.Post.category_limit){var f=c+1;var b="<select name='category_"+f+"'><option value=''>Choose a category ...</option>"+a+"</select>";$("#categories").append("<li>"+b+"</li>");if(c==(AuthJobs.Post.category_limit-1)){$(this).hide()}$("#categories .category_delete").show().appendTo("#categories > li:last")}d.preventDefault()});$(".category_delete").click(function(d){var c=$(this),b=$("#categories > li").length;if(b>2){c.appendTo("#categories > li:eq("+(b-2)+")")}else{c.hide().appendTo("#categories > li:first")}$("#categories > li:last").remove();$(".category_add").show();d.preventDefault()});$("#jobperks-included").live("click",function(b){$("#perks-wrapper").slideDown(250);$("#jobperks").removeAttr("disabled");$(this).replaceWith("<label for='jobperks'>Add job perks</label>");$("#perks .close").removeClass("hidden");$("#jobperks").val("");b.preventDefault()});$("#perks .close").click(function(b){$("#perks-wrapper").slideUp(250,function(){$("#jobperks").attr("disabled","disabled");$("#perks label[for='jobperks']").replaceWith("<a href='#' id='jobperks-included'>Add job perks</a>");$("#perks .close").addClass("hidden")});b.preventDefault()});$("select[name='howapply']").change(function(){var c=$(this).get(0).value;var b=$("#apply .detail");b.find("input").hide().attr("disabled","disabled");if(c=="crew"){}else{if(c=="email"){$("input[name='apply_email']").show().attr("disabled",false)}else{if(c=="url"){$("input[name='apply_url']").show().attr("disabled",false)}}}});$("#add-instructions").live("click",function(b){$("#instructions-wrapper").slideDown(250).find("textarea").removeAttr("disabled");$(this).replaceWith("<label for='instructions'>Add instructions</label>");$("#apply .close").removeClass("hidden");$("#instructions").val("");b.preventDefault()});$("#apply .close").click(function(b){$("#instructions-wrapper").slideUp(250,function(){$(this).find("textarea").attr("disabled","disabled");$("#apply label[for='instructions']").replaceWith("<a href='#' id='add-instructions'>Add instructions</a>");$("#apply .close").addClass("hidden")});b.preventDefault()});$.validator.addMethod("maxWordsTinyMCE",function(c,b,d){return AuthJobs.Global.countWordsTinyMCE(tinyMCE.getInstanceById("description"))<=d},"Please enter 500 words or fewer");jQuery.validator.addMethod("maxWords",function(d,e,f){return this.optional(e)||d.match(/([^\s\.\?]+)/g).length<=f},jQuery.validator.format("Please enter {0} words or fewer."));$(".listing #main form").validate({rules:{job_type:{required:true},compname:{required:"#confidential:unchecked"},compurl:{required:"#confidential:unchecked",url:true},"complogo-file":{required:function(){return($("#complogo").val()=="upload"&&!$("#companylogo").hasClass("existing"))},accept:"png|jpe?g|gif"},twitter_username:{required:function(){return $("#complogo").val()=="twitter"}},comptagline:{required:"#confidential:unchecked",maxlength:40},compadminname:{required:true},compemail:{required:true,email:true},category_1:{required:true},category_2:{required:function(){return $("#categories select").length>=2}},category_3:{required:function(){return $("#categories select").length>=3}},complocale:{required:true},position:{required:true},description:{required:true,maxWordsTinyMCE:500},jobperks:{maxWords:50},howapply:{required:true,maxWords:50},apply_url:{required:"input[name=apply_url]:visible"},apply_email:{required:"input[name=apply_email]:visible"},agree:{required:true}},messages:{job_type:"Please select a job type.",compname:"Please enter your company name.",compurl:{required:"Please enter your company URL.",url:"Please enter a valid URL."},compadminname:{required:"Please enter your admin contact name."},compemail:{required:"Please enter your admin contact email address.",email:"Please enter a valid email address."},"complogo-file":{accept:"Please provide either a PNG, GIF or JPEG file.",required:"Please choose an image to upload."},twitter_username:"Please enter your Twitter username.",comptagline:"Please provide a brief description of your company.",category_1:"Please select at least one job category.",category_2:"Please select a valid job category.",category_3:"Please select a valid job category.",complocale:"Please specify the job's location.",position:"Please specify the job's title.",description:{required:"Please provide a job description."},howapply:{required:"Please provide instructions on how to apply for the job."},apply_url:{required:"Please provide a URL."},apply_email:{required:"Please provide an email address."},agree:{required:"Please agree to the listing terms."},category:"Please select at least one job category.",category_2:"Please select a job category, or remove the extra category.",category_3:"Please select a job category, or remove the extra category."},errorClass:"error",errorElement:"label",focusInvalid:false,errorPlacement:function(b,c){AuthJobs.Global.errorPlacement(b,c)},highlight:function(c,b){AuthJobs.Global.highlightFieldError(c,b)},unhighlight:function(c,b){AuthJobs.Global.unhighlightFieldError(c,b)},invalidHandler:function(c,b){AuthJobs.Global.invalidHandler(c,b)}});if(!AuthJobs.Global.isiOS){$("body:not(.preview) #description").tinymce({script_url:"/js/tiny_mce/tiny_mce.js",theme:"advanced",skin:"authenticjobs",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_buttons1:"bold,italic,bullist,link,unlink",theme_advanced_buttons2:"",theme_advanced_buttons3:"",plugins:"paste",valid_elements:"p,a[href|target=_blank],strong/b,em/i,ul,li",setup:function(b){b.onInit.add(function(d){AuthJobs.Global.tinyMCEWordLimitUpdate(d);var c=document.createElement("script");c.type="text/javascript";c.src=d.theme.url+"/langs/"+d.settings.language+"_dlg.js";document.getElementsByTagName("head")[0].appendChild(c);d.theme._mceLink=function(i,k){var e=this.editor,g=e.dom.getParent(e.selection.getNode(),"A"),f=e.dom.getAttrib(g,"href"),j=function(l){e.execCommand("mceInsertLink",false,{href:l})};if(!f){f="http://"}f=prompt(e.getLang("advanced_dlg.link_url","link url"),f);if(!f){return false}j(f);return false};tinymce.dom.Event.add(d.settings.content_editable?d.getBody():(tinymce.isGecko?d.getDoc():d.getWin()),"focus",function(f){$("#description_ifr").contents().find("body").addClass("focused")});tinymce.dom.Event.add(d.settings.content_editable?d.getBody():(tinymce.isGecko?d.getDoc():d.getWin()),"blur",function(f){$("#description_ifr").contents().find("body").removeClass("focused")})});b.onKeyUp.add(function(c,d){AuthJobs.Global.tinyMCEWordLimitUpdate(c);tinyMCE.getInstanceById("description").save()})}});$(".mce_wrap").append($('<a class="toggle_mce" data-mce-id="description" href="#">Switch to plain text</a>').toggle(function(){tinyMCE.execCommand("mceRemoveControl",false,$(this).data("mce-id"));$(this).html("Switch to basic HTML");$("#"+$(this).data("mce-id")).focus()},function(){tinyMCE.execCommand("mceAddControl",false,$(this).data("mce-id"));tinyMCE.execCommand("mceFocus",false,$(this).data("mce-id"));$(this).html("Switch to plain text")}))}$("input#confidential").bind("click",function(){if(this.checked){$("#compurl").removeClass("error");$("#companyurl label.error").remove();$("label[for='compname'], #compname, #companyurl, #companylogo, #tagline, #example").animate({opacity:0.5},100);$("#compname, #compurl, #twitter_username, #complogo, #comptagline").attr("disabled","disabled").removeClass("error").parents("fieldset").find("label.error").remove();$("#tagline .charactercount strong").removeAttr("style")}else{$("label[for='compname'], #compname, #companyurl, #companylogo, #tagline, #example").animate({opacity:1},100);$("#compname, #compurl, #twitter_username, #complogo, #comptagline").removeAttr("disabled")}});if($("input#confidential").attr("checked")){$("#compurl").removeClass("error");$("#companyurl label.error").remove();$("label[for='compname'], #compname, #companyurl, #companylogo, #tagline, #example").animate({opacity:0.5},100);$("#compname, #compurl, #complogo, #comptagline").attr("disabled","disabled");$("#tagline .charactercount strong").removeAttr("style")}$("select[name='complogo']").change(function(){var c=$(this).get(0).value;var b=$("#companylogo .detail");b.slideUp(250,function(){$("#companylogo .loading").hide();$(this).find("div").hide();$("#complogo-file, #twitter_username").attr("disabled","disabled");if(c=="twitter"){$("#companytwitter").show();$("#twitter_username").removeAttr("disabled");b.slideDown(250)}else{if(c=="upload"){$("#logo-upload").show();$("#complogo-file").removeAttr("disabled");b.slideDown(250);$("#companylogo .preview").attr("src","/img/employer_default.png")}else{$("#companylogo .preview").attr("src","/img/employer_default.png")}}})});$("#companytwitter .update").click(function(b){var c=$("#twitter_username").val();$("#companylogo .loading").css("display","inline-block").fadeTo(400,1);$("#companylogo .preview").attr("src","http://img.tweetimag.es/i/"+c+"_o").css({opacity:0}).load(function(){$("#companylogo .preview").fadeTo(400,1).unbind("load");$("#companylogo .loading").fadeTo(400,0)});b.preventDefault()});$("#comptagline").keyup(function(){$(this).nextAll(".charactercount").find("strong").text($(this).val().length)});$("#recipient input[type='radio']").click(function(){$("#recipient .options label").removeClass("selected");$(this).next("label").addClass("selected");if($(this).val()=="other"){$("#other").slideDown(250)}else{$("#other").slideUp(250)}});$(".countwords").each(function(){AuthJobs.Global.countWords(this);$(this).bind("keyup",function(){AuthJobs.Global.countWords(this)})});$("#listing.preview .button.apply").click(function(b){return false});$("#sponsored .more").click(function(){$(this).toggleClass("open").nextAll(".extra").slideToggle(250);return false});$("#sponsored .extra .close").click(function(){$("#sponsored .extra").slideUp(250);return false});$(".payment #payment").validate({rules:{ccnumber:{required:"#payCC:checked",creditcard:true},ccexpireMonth:{required:"#payCC:checked",min:1,max:12,number:true},ccexpireYear:{required:"#payCC:checked",min:2011,number:true},ccverify:{required:"#payCC:checked"},ccnameoncard:{required:"#payCC:checked"},ccbilladdress1:{required:"#payCC:checked"},cccity:{required:"#payCC:checked"},receipt_recipients:{required:true,email:false}},messages:{ccnumber:{required:"Please enter your credit card number."},ccexpireMonth:{required:""},ccexpireYear:{required:""},ccverify:{required:""},ccnameoncard:{required:"Please enter the name as it appears on your card."},ccbilladdress1:{required:"Please enter your card billing address."},cccity:{required:"Please enter your card billing city."},receipt_recipients:{required:"Please tell us where to send your receipt.",email:"Please enter a valid email address."}},errorClass:"error",errorElement:"label",errorPlacement:function(b,c){AuthJobs.Global.errorPlacement(b,c)},highlight:function(c,b){AuthJobs.Global.highlightFieldError(c,b)},unhighlight:function(c,b){AuthJobs.Global.unhighlightFieldError(c,b)},submitHandler:function(b){b.submit();$("#pay_button").attr("disabled",true);$("#pay_button").html("Please wait...")}})}};AuthJobs.Listing={init:function(){flag=$("#flag-trigger[rel]").overlay({top:0,effect:"panelSlide",api:true,expose:{color:"#000",loadSpeed:200,opacity:0.75},speed:"fast",closeOnClick:false});$("#flag_modal form").validate({rules:{conemail:{required:true,email:true},conname:"required",captcha_answer:"required"},messages:{conemail:{email:"Please enter a valid email address."},conname:"Please enter your name.",captcha_answer:"Please answer the question."},errorClass:"error",errorElement:"label",highlight:function(j,i){AuthJobs.Global.highlightFieldError(j,i)},unhighlight:function(j,i){AuthJobs.Global.unhighlightFieldError(j,i)},submitHandler:function(i){$("#captcha_error").remove();$.post($("#flag_modal form").attr("action"),{conemail:$("#conemail").val(),conname:$("#conname").val(),context:$("#context").val(),captcha_id:$("#captcha_id").val(),captcha_answer:$("#captcha_answer").val(),ajax:1},function(j){if(j=="Incorrect captcha"){$("#flag_modal form #captcha_answer").after('<label for="captcha_answer" generated="true" class="error id="captcha_error">Sorry, wrong answer.</label>')}else{$("#flag_modal .body").slideUp(500,function(){$("#flag_modal h2").html("Thanks for your vigilance! We'll look into it.");$("#flag_modal header").append("<p>You help us keep Authentic Jobs relevant and valuable to job seekers and employers, and we appreciate that.</p>");$("#flag_modal header").append("<a class='close button minor'>Close</a>");$("#flag_modal .close").click(function(){flag.close()})})}},"text");return false}});$("#location").click(function(i){$("#map").stop(true).fadeTo(250,1,function(){$("#map, #location").click(function(j){j.stopPropagation()});$(document).bind("click touchstart",function(){e()});$(document).bind("keyup.map",function(j){if((j.keyCode||j.which)==27){e()}})});i.preventDefault()});function e(){$("#map").stop(true).fadeTo(200,0,function(){$(this).hide();$(document).unbind(".map")})}e();var b=$(window),d=$(".aside-wrap"),g=$("footer"),f=d.offset().top;b.scroll(a);b.resize(a);function a(){if(window.innerWidth>1040){aside_foot_pos=b.scrollTop()+d.height();foot_top=g.offset().top;if(b.scrollTop()>=f){if(aside_foot_pos>=foot_top){d.css({position:"absolute",top:(foot_top-d.height()-60)+"px"})}else{d.css({position:"fixed",top:0,"margin-top":0})}}else{d.attr("style","")}}else{d.attr("style","")}}var c={ui_click:true};addthis.button(".addthis",c)},load_map:function(b){var d=new google.maps.LatLng(-34.397,150.644);var a={zoom:11,center:d,mapTypeId:google.maps.MapTypeId.ROADMAP,panControl:false,zoomControl:true,mapTypeControl:false,scaleControl:false,streetViewControl:false,overviewMapControl:false};var c=new google.maps.Map(document.getElementById("map_canvas"),a);geocoder=new google.maps.Geocoder();geocoder.geocode({address:b},function(g,f){if(f==google.maps.GeocoderStatus.OK){c.setCenter(g[0].geometry.location);var e=new google.maps.Marker({map:c,position:g[0].geometry.location})}else{}})}};AuthJobs.Payment={init:function(){$("#payment-method input[type='radio']").bind("click",function(){if($("#payCC")[0].checked){$("#payWithPayPal").hide();$("#payWithCC").slideDown(200)}else{$("#payWithCC").slideUp(200,function(){$("#payWithPayPal").show()})}});$("#ccnumber").bind("keyup",function(){number=$("#ccnumber").val();img="";if(number.match(/^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/)!==null){img="cc-visa.gif"}else{if(number.match(/^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/)!==null){img="cc-mc.gif"}else{if(number.match(/^3[4,7]\d{13}$/)!==null){img="cc-amex.gif"}else{if(number.match(/^6011-?\d{4}-?\d{4}-?\d{4}$/)!==null){img="cc-discover.gif"}else{img="cc-blank.gif"}}}}$(".ccnumber-img").attr("src","/img/"+img);if(img=="cc-amex.gif"){$(".ccverify-img").attr("src","/img/cc-verify-front.gif")}else{$(".ccverify-img").attr("src","/img/cc-verify-back.gif")}});$("#payment_form").submit(function(){$("input[type=submit]",this).attr("disabled","disabled")})}};AuthJobs.Contact={init:function(){$("form.contact").validate({rules:{conname:"required",conemail:{required:true,email:true},consub:"required",context:"required"},messages:{conname:"Please tell us your name.",conemail:{required:"Please give us your email address so we can get back to you.",email:"Please enter a valid email address."},consub:"Please tell us what you're writing to us about.",context:"Please enter your message."},errorClass:"error",errorElement:"label",errorPlacement:function(a,b){AuthJobs.Global.errorPlacement(a,b)},highlight:function(b,a){AuthJobs.Global.highlightFieldError(b,a)},unhighlight:function(b,a){AuthJobs.Global.unhighlightFieldError(b,a)}})}};AuthJobs.Contest={init:function(){var a={q:"#tussle",rpp:"100",since_id:"73433681074733056"};$.get("http://search.twitter.com/search.json",a,function(c){if(c.results.length>0){var b="";$.each(c.results,function(d,e){b+="<li><blockquote><cite>@"+e.from_user+"</cite> <p>"+e.text+"</p></blockquote></li>"});$("#tweets").append(b).find(".loading").remove();$("#tweets").cycle({fx:"scrollUp"})}else{$("#tweets").append("<li>No tweets found</li>").find(".loading").remove()}},"jsonp")}};AuthJobs.App={init:function(){$(".iphone nav").tabs(".iphone .display > img",{effect:"fade",rotate:true}).slideshow({autoplay:true,interval:5000})}};function urldecode(a){return decodeURIComponent((a+"").replace(/\+/g,"%20"))};
