function getRandomizer(a,b){return(Math.floor(Math.random()*(b-a)))+a;}
function enableCheckAll(){jQuery('#checkall').click(function(){jQuery(this).parents('div').find(':checkbox').attr('checked',this.checked);});jQuery(':checkbox').click(function(){if(!jQuery(this).attr('checked'))
jQuery('#checkall').attr('checked','');});}
function enableQuickLook(){jQuery('#find-employers .industries').hide().before('<a href="#" class="quicklook">Show Industries</a>').prepend('<li style="list-style:none;"><a href="#" class="quickhide">Hide List</a></li>');jQuery('#find-employers .careers').hide().before('<a href="#" class="quicklook">Show Career Paths</a>').prepend('<li style="list-style:none;"><a href="#" class="quickhide">Hide List</a></li>');jQuery('.quicklook').click(function(){jQuery(this).slideUp('slow').next().slideDown('slow');return false;});jQuery('.quickhide').click(function(){jQuery(this).parent().parent().slideUp('slow').prev().slideDown('slow');return false;});}
function enableDataTable(){var oTable=jQuery('table.sortable').dataTable({"oLanguage":{"sSearch":"Search:"},"sPaginationType":"full_numbers","bAutoWidth":false,"iDisplayLength":50});jQuery("table.sortable:not(.noFilter) tfoot th").each(function(i){this.innerHTML=fnCreateSelect(oTable.fnGetColumnData(i));jQuery('select',this).change(function(){oTable.fnFilter(jQuery(this).val(),i);});});}
function enableFormValidation(){jQuery('form.validate').validator({inputEvent:'blur change',errorInputEvent:'change keyup',position:'bottom left'});jQuery.tools.validator.fn('[type=tel]','Please supply a valid phone number.',function(input,value){return/^\(?(\d{3})\)?[-]?(\d{3})[-]?(\d{4})$/.test(value);});}
jQuery(document).ready(function(){jQuery('a[href*="jpg"]').overlay({effect:'apple'});jQuery('a[rel*="external-overlay"]').overlay({onBeforeLoad:function(){var wrap=this.getOverlay().find('.contentWrap');wrap.load(this.getTrigger().attr('href'));}});enableQuickLook();enableDataTable();enableCheckAll();enableFormValidation();jQuery('textarea[maxlength]').after('<p class="counter"></p>');jQuery('textarea[maxlength]').keyup(function(){max_chars=jQuery(this).attr('maxlength');current_chars=jQuery(this).val().length;remaining_chars=max_chars-current_chars;jQuery(this).next().html(remaining_chars+' characters remaining');});});sfHover=function(){var sfEls=document.getElementById("nav").getElementsByTagName("LI");for(var i=0;i<sfEls.length;i++){sfEls[i].onmouseover=function(){this.className+=" sfhover";}
sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"");}}
var sfParentEl=document.getElementById("nav");sfParentEl.onmouseover=function(){this.className+=" sfhover";}
sfParentEl.onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"");}}
if(window.attachEvent)window.attachEvent("onload",sfHover);var pathname=window.location.pathname;var host=window.location.host;var protocol=window.location.protocol;jQuery(document).ready(function(){if(!jQuery.browser.msie){loadPage();updateLinks();jQuery(window).bind('hashchange',function(){loadPage();});}});function updateLinks(){jQuery('a[href^=/]:not("[href^=\"/#\"],[href*=\"wp-\"],[href$=\".com\"],[href$=\"com/\"],[href$=\".org\"],[href$=\"org/\"],[href$=\".net\"],[href$=\"net/\"]")').each(function(){href=jQuery(this).attr('href').replace(/^\//g,'/#/');jQuery(this).attr('href',href);});jQuery('a[href^='+protocol+'//'+host+']:not("[href^=\"/#\"],[href*=\"wp-\"],[href$=\".com\"],[href$=\"com/\"]")').each(function(){href=jQuery(this).attr('href').replace(/^http:\/\/www.myternnow.com/g,'/#');jQuery(this).attr('href',href);});}
function showCircles(){pageHeight=jQuery(window).height()
pageWidth=jQuery(window).width();circleSize=getRandomizer(50,200);jQuery('body').append('<div class="circle"></div>').children(':last').attr('style','top:'+getRandomizer(200,pageHeight)+'px; left:'+(pageWidth)+'px; width:'+circleSize+'px; height:'+circleSize+'px;').animate({'top':getRandomizer(0,pageHeight)+'px','left':'-400px','opacity':'0'},2000,function(){jQuery(this).remove();});}
function showLoader(){jQuery('#loader').fadeIn('fast');}
function loadPage(){if(loading!=true){var loading=true;var hash=window.location.hash;var nohash=hash.replace(/^#/,'');var slug=nohash.replace(/\/$/,'').split('/').reverse();var slug=slug[0];failsafeRedirect=setTimeout('hash = window.location.hash; nohash = hash.replace(/^#/,""); window.location = window.location.protocol + "//" + window.location.host + nohash;',6000);if(nohash!=''){jQuery('html, body').css('overflow','hidden').animate({scrollTop:0},600);var showLoader=setTimeout('showLoader()',2000);jQuery('#nav').load(nohash+' #nav > *',function(){updateLinks();});jQuery('div.error').remove();jQuery('#current-page *').each(function(){jQuery(this).css('position','relative').animate({'top':getRandomizer(-200,200)+'px','left':'-600px','opacity':'0'},1000,'linear',function(){jQuery('#current-page').remove();});});var circleAnim=setInterval('showCircles()',100);jQuery('#current-page').after('<div id="content-incubator" class="content"></div>').next().load(nohash+' #current-page > *',function(){clearInterval(circleAnim);jQuery('html, body').attr('style','');clearTimeout(showLoader);jQuery(this).children().children().each(function(){jQuery(this).css({'position':'relative','top':getRandomizer(-200,200)+'px','left':'600px','opacity':'0'}).animate({'top':'0px','left':'0px','opacity':'1'},600,'linear',function(){jQuery(this).css('filter','');});});jQuery(this).attr('id','current-page');slugSplit=slug.split('?');if(slugSplit[0]!='')
jQuery('body').attr('id',slugSplit[0]);else
jQuery('body').attr('id','home');updateLinks();pageTitle=jQuery('.post h1:first').text();document.title=pageTitle;enableQuickLook();enableDataTable();enableCheckAll();enableFormValidation();jQuery('#loader').fadeOut('slow');});}
var loading=false;clearTimeout(failsafeRedirect);}}
