/********************************************** Blackbaud Design Custom JavaScript *********************************************** Site: The Arc Author: Chris Wolf Created: 4/8/10 BBNC: 6.10 *********** CHANGE LOG ************************ **********************************************/ /************* global definitions ************/ var bbpage = Sys.WebForms.PageRequestManager.getInstance(); //BBNC var isEditView = window.location.href.match('edit='); /************* stand alone functions *************/ function ActivateSlideshow(s,d) { // create carousel list container $('#mediaSlideshow').append('<ul id="slideshow"></ul>'); // add control buttons $("#mediaSlideshow .slideItem").each(function (i) { i = i+1; $(this).wrap('<li class="item'+i+'" />'); $('.item'+i).appendTo('#slideshow'); }); // activate slideshow $('#slideshow').cycle({ fx: 'fade', speed: s*1000, timeout: d*1000, pause: 1, prev: '.prevButton', next: '.nextButton', after: onAfter }); $(function() { $('.navButtons pre code').each(function() { eval($(this).text()); }); }); function onAfter(curr, next, opts) { var index = opts.currSlide; $('.prevButton')[index == 0 ? 'hide' : 'show'](); $('.nextButton')[index == opts.slideCount - 1 ? 'hide' : 'show'](); } // reveal slideshow $('#mediaSlideshow').show(); $('.preloader').removeClass('preloader'); }; // preload functions document.write('<style>#mediaSlideshow{display:none;}</style>'); /* * jQuery Cycle Plugin (core) * Examples and documentation at: http://jquery.malsup.com/cycle/ * Copyright (c) 2007-2010 M. Alsup * Version: 2.79 (03-MAR-2010) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * Requires: jQuery v1.2.6 or later */ (function($){var ver="2.79";if($.support==undefined){$.support={opacity:!($.browser.msie)} ;}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){i f(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.upd ateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePag erLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleT imeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}va r startTime=opts2.continuous?10:getTimeout(opts2.currSlide,opts2.nextSlide, opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime< 10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts 2.rev);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cyc leStop=0;}if(options===undefined||options===null){options={};}if(options. constructor==String){switch(options){case"stop":cont.cycleStop++;if(cont. cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont ).removeData("cycle.opts");return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;if(arg2===true){options=$(cont).data ("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTi meout=0;}go(options.elements,options,1,1);}return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycl eTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num >=options.currSlide);return false;}}return options;}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.fil ter){try{el.style.removeAttribute("filter");}catch(smother){}}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadat a():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autosto pCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCou nt=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before] :[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){o pts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(func tion(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(fu nction(){go(els,opts,0,!opts.rev);});}saveOriginalOpts(opts);if(!$.suppor t.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if ($cont.css("position")=="static"){$cont.css("position","relative");}if(op ts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$ cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parse Int(opts.startingSlide);}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(functio n(a,b){return Math.random()0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(o pts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts .startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}). hide().each(function(i){var z=first?i>=first?els.length-(i-first):firsti:els.length-i;$(this).css("zindex",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first ],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&& opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offs etWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e .attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0 ){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.ho ver(function(){this.cyclePause++;},function(){this.cyclePause-;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides. each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height() ||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opt s.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width| |$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.comple te);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.com plete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cy cleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingI E||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoad ed&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycl e(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts .animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefor e);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeou t){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String) {opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync) {opts.speed=opts.speed/2;}while((opts.timeoutopts.speed)<250){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=o pts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!o pts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.c urrSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els. length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomInde x];}else{opts.nextSlide=opts.startingSlide>=(els.length1)?0:opts.startingSlide+1;}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$s lides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,o pts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,tr ue]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){retur n advance(opts,opts.rev?1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){re turn advance(opts,opts.rev?1:1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}expo seAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.c ssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},o pts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original .animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.ori ginal.before.push(this);});$.each(opts.after,function(){opts.original.aft er.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=t rue;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.len gth;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction( tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i-;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push( p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splic e(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prep end?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"]( s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?" prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.next Slide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clea rTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit& &opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH= (opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts. width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.p agerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAdd Slide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx= fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts. original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opt s.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts. original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){o pts.before.push(this);});$.each(opts.original.after,function(){opts.after .push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$( opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){$(els).st op(true,true);opts.busy=false;}if(opts.busy){return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cy cleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual& &!p.cyclePause&&((opts.autostop&&(-opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.curr Slide))){if(opts.end){opts.end(opts);}return;}if((manual||!p.cyclePause)& &(opts.nextSlide!=opts.currSlide)){var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cyc leW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycle W=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined ||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx] ;opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null ;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.befor e,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[cur r,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.sto pCount){return;}o.apply(next,[curr,next,opts,fwd]);});};opts.busy=1;if(op ts.fxFn){opts.fxFn(curr,next,opts,after,fwd);}else{if($.isFunction($.fn.c ycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after);}else{$.fn.cycl e.custom(curr,next,opts,after,manual&&opts.fastOnEvent);}}opts.lastSlide= opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.ra ndomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[ opts.randomIndex];}else{var roll=(opts.nextSlide+1)==els.length;opts.nextSlide=roll?0:opts.nextSlide+ 1;opts.currSlide=roll?els.length-1:opts.nextSlide1;}if(opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,op ts.activePagerClass);}}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(curr,next,opts,fwd) ;}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout= setTimeout(function(){go(els,opts,0,!opts.rev);},ms);}}$.fn.cycle.updateA ctivePagerLink=function(pager,currSlide,clsName){$(pager).each(function() {$(this).find("a").removeClass(clsName).filter("a:eq("+currSlide+")").add Class(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn(curr,next,opts,fwd);while((topts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout); p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(-opts.randomIndex==-2){opts.randomIndex=els.length2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random) {opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opt s.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}if($.isFunction(opts.prevNextClick)){opts.pre vNextClick(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>= 0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i, o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlid e,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,e ls,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,e l);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$( arr);}else{$a.appendTo($p);}}$a.bind(opts.pagerEvent,function(e){e.preven tDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout); p.cycleTimeout=0;}if($.isFunction(opts.pagerClick)){opts.pagerClick(opts. nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);return false;});if(opts.pagerEvent!="click"){$a.click(function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cy clePause++;},function(){opts.$cont[0].cyclePause-;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?cl:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&& v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("backgroundcolor",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w, h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cs sBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width =next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cyc leH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr) .css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts .slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts ,cb,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=op ts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=spe edOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts .animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAft er);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions ={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")" ).css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.c ommonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opaci ty:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycl e.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuo us:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextCl ick:null,prevNextEvent:"click",pager:null,pagerClick:null,pagerEvent:"cli ck",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,e aseIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:n ull,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0 ,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopC ount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg: false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,re queueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSli de",updateActivePagerLink:null};})(jQuery); /********************************************** The Arc Custom JavaScript *********************************************** Site: The Arc Author: David A. Kennedy Created: 6/5/12 BBNC: 6.35 *********** CHANGE LOG ************************ **********************************************/ /************* stand alone functions ************/ // Highlight focusable areas. $(document).ready(function(){ // Set tabindex on the main and section divs so IE knows they are focusable, and so Webkit browsers will focus() them. $('#contentPrimary').attr('tabindex', -1); var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1; var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1; // If there is a '#' in the URL (someone linking directly to a page with an anchor), highlight that section and set focus to it. if (document.location.hash) { var myAnchor = document.location.hash; $(myAnchor).css("backgroundColor","#ffff66").animate({ backgroundColor: "#ffffff" }, 1000); $(myAnchor).focus(); } // Highlight targets of in-page links when clicked. If Webkit, set focus to it. $("a[href^='#']").click(function(event){ var clickAnchor="#"+this.href.split('#')[1]; $(clickAnchor).css("backgroundColor","#ffff66").animate({ backgroundColor: "#ffffff" }, 1000); if(is_webkit || is_opera) { $(clickAnchor).focus(); } }); // If there's a 'fade' id (used for error identification), highlight it and set focus to it. if ($('#fade').length ) { $('#fade').css("backgroundColor","#ffff66").animate({ backgroundColor: "#ffffff" }, 1000); $('#fade').attr('tabindex', -1); $('#fade').focus(); } }); // Select areas on site for rounding. $(document).ready(function() { $("#wrapNav").corner("10px"); $(".topRound a").corner("cc:#fff top 10px"); $(".bottomRound a").corner("cc:#fff bottom 10px"); }); /*! * jQuery corner plugin: simple corner rounding * Examples and documentation at: http://jquery.malsup.com/corner/ * version 2.12 (23-MAY-2011) * Requires jQuery v1.3.2 or later * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * Authors: Dave Methvin and Mike Alsup */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners) * width: width of the effect; in the case of rounded corners this is the radius. * specify this value using the px suffix such as 10px (yes, it must be pixels). */ ;(function($) { var style = document.createElement('div').style, moz = style['MozBorderRadius'] !== undefined, webkit = style['WebkitBorderRadius'] !== undefined, radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined, mode = document.documentMode || 0, noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8), expr = $.browser.msie && (function() { var div = document.createElement('div'); try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); } catch(e) { return false; } return true; })(); $.support = $.support || {}; $.support.borderRadius = moz || webkit || radius; // so you can do: (!$.support.borderRadius) $('#myDiv').corner(); function sz(el, p) { return parseInt($.css(el,p))||0; }; function hex2(s) { s = parseInt(s).toString(16); if return ( s.length < 2 ) ? '0'+s : s; }; function gpc(node) { while(node) { var v = $.css(node,'backgroundColor'), rgb; if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') { if (v.indexOf('rgb') >= 0) { rgb = v.match(/\d+/g); return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]); } return v; } if (node.nodeName.toLowerCase() == 'html') break; node = node.parentNode; // keep walking if transparent } return '#ffffff'; }; function getWidth(fx, i, width) { switch(fx) { case 'round': return Math.round(width*(1Math.cos(Math.asin(i/width)))); case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width)))); case 'sharp': return width-i; case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i1)/width)))); case 'slide': return Math.round(width*(Math.atan2(i,width/i))); case 'jut': return Math.round(width*(Math.atan2(width,(width-i1)))); case 'curl': return Math.round(width*(Math.atan(i))); case 'tear': return Math.round(width*(Math.cos(i))); case 'wicked': return Math.round(width*(Math.tan(i))); case 'long': return Math.round(width*(Math.sqrt(i))); case 'sculpt': return Math.round(width*(Math.log((width-i1),width))); case 'dogfold': case 'dog': return (i&1) ? (i+1) : width; case 'dog2': return (i&2) ? (i+1) : width; case 'dog3': return (i&3) ? (i+1) : width; case 'fray': return (i%2)*width; case 'notch': return width; case 'bevelfold': case 'bevel': return i+1; case 'steep': return i/2 + 1; case 'invsteep':return (width-i)/2+1; } }; $.fn.corner = function(options) { // in 1.3+ we can fix mistakes with the ready state if (this.length == 0) { if (!$.isReady && this.selector) { var s = this.selector, c = this.context; $(function() { $(s,c).corner(options); }); } return this; } return this.each(function(index){ var $this = $(this), // meta values override options o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase(), keep = /keep/.test(o), // keep borders? cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]), // corner color sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]), // strip color width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10, // corner width re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wic ked|sculpt|long|dog3|dog2|dogfold|dog|invsteep|steep/, fx = ((o.match(re)||['round'])[0]), fold = /dogfold|bevelfold/.test(o), edges = { T:0, B:1 }, opts = { TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o), BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o) }, // vars used in func later strip, pad, cssHeight, j, bot, d, ds, bw, i, w, e, c, common, $horz; if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR ) opts = { TL:1, TR:1, BL:1, BR:1 }; // support native rounding if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) { if (opts.TL) $this.css(radius ? 'border-top-left-radius' : moz ? 'moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px'); if (opts.TR) $this.css(radius ? 'border-top-right-radius' : moz ? 'moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px'); if (opts.BL) $this.css(radius ? 'border-bottom-left-radius' : moz ? 'moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px'); if (opts.BR) $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px'); return; } strip = document.createElement('div'); $(strip).css({ overflow: 'hidden', height: '1px', minHeight: '1px', fontSize: '1px', backgroundColor: sc || 'transparent', borderStyle: 'solid' }); pad = { T: parseInt($.css(this,'paddingTop'))||0, parseInt($.css(this,'paddingRight'))||0, B: parseInt($.css(this,'paddingBottom'))||0, parseInt($.css(this,'paddingLeft'))||0 }; R: L: if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE if (!keep) this.style.border = 'none'; strip.style.borderColor = cc || gpc(this.parentNode); cssHeight = $(this).outerHeight(); for (j in edges) { bot = edges[j]; // only add stips if needed if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) { strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none'); d = document.createElement('div'); $(d).addClass('jquery-corner'); ds = d.style; bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild); if (bot && cssHeight != 'auto') { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.bottom = ds.left = ds.padding = ds.margin = '0'; if (expr) ds.setExpression('width', 'this.parentNode.offsetWidth'); else ds.width = '100%'; } else if (!bot && $.browser.msie) { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.top = ds.left = ds.right = ds.padding = ds.margin = '0'; // fix ie6 problem when blocked element has a border width if (expr) { bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth'); ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"'); } else ds.width = '100%'; } else { ds.position = 'relative'; ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : (pad.B-width)+'px -'+pad.R+'px '+pad.B+'px -'+pad.L+'px'; } for (i=0; i < width; i++) { w = Math.max(0,getWidth(fx,i, width)); e = strip.cloneNode(false); e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px'; bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild); } if (fold && $.support.boxModel) { if (bot && noBottomFold) continue; for (c in opts) { if (!opts[c]) continue; if (bot && (c == 'TL' || c == 'TR')) continue; if (!bot && (c == 'BL' || c == 'BR')) continue; common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor }; $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' }); switch(c) { case 'TL': $horz.css({ bottom: 0, left: 0 }); break; case 'TR': $horz.css({ bottom: 0, right: 0 }); break; case 'BL': $horz.css({ top: 0, left: 0 }); break; case 'BR': $horz.css({ top: 0, right: 0 }); break; } d.appendChild($horz[0]); var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' }); switch(c) { case 'TL': $vert.css({ left: width }); break; case 'TR': $vert.css({ right: width }); break; case 'BL': $vert.css({ left: width }); break; case 'BR': $vert.css({ right: width }); break; } d.appendChild($vert[0]); } } } } }); }; $.fn.uncorner = function() { if (radius || moz || webkit) this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0); $('div.jquery-corner', this).remove(); return this; }; // expose options $.fn.corner.defaults = { useNative: true, // true if plugin should attempt to use native browser support for border radius rounding metaAttr: 'data-corner' // name of meta attribute to use for options }; })(jQuery);