/**
 * sfPhotoGallery
 *
 * @version: 1.0
 * @author SimpleFlame http://www.simpleflame.com/
 *
 * Available options:
 *  transition - by default "fade", can also use FALSE to disable transition or any of the jQuery UI effects if UI is included. !NOTICE - will throw an exception if you try to use an effect without including UI
 *  transitionSpeed - photo transition speed, by default 300 ms
 *  transitionInOptions - options used on the "in" transition if one of the UI effects is used 
 *  transitionOutOptions - options used on the "out" transition if one of the UI effects is used 
 *  goodbarry - boolean flag, by default "true". If turned on and no ".thumb" element is present in the data list, then GB image resize utility will be used
 *  thumbsLocation - top|right|bottom|left - location of thumbs slider in reference to the main image area, by default "left"
 *  descriptionLocation - top|right|bottom|left - location of the description area in reference to the main image area, by default bottom
 *  autorotate - boolean, if true will add an option to start/top autorotation, by default false
 *  autorotateDuration - if "autorotate" option is set to true, it determines how long image is visilbe, by default 3000 ms
 *  thumbsPerPage - number of thumbnails visible at once, by default 8
 *  numbersPerPaginationPage - number of items visible on one page in the pagination list. This option has to be set depending on the layout, as it won't work otherwise
 *  thumbWidth - width of thumbnail to show/generate
 *  thumbHeight - height of thumbnail to show/generate
 */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(7(){g w=7(29,4){3.1P=6(29).Q();3.4={};3.4.1t=1u 4.1t==="36"?\'2l\':4.1t;3.4.1q=4.1q||1J;3.4.2a=4.2a||{};3.4.2s=4.2s||{};3.4.1v=1u 4.1v===\'2c\'?4.1v:2O;3.4.1z=4.1z||\'I\';3.4.1C=4.1C||\'M\';3.4.N=1u 4.N===\'2c\'?4.N:19;3.4.1I=4.1I||2I;3.4.Z=4.Z||8;3.4.1f=4.1f||20;3.4.1i=4.1i||2T;3.4.1o=4.1o||2V;3.16=3.1P.u(\'o\').2C(7(f,q){q=6(q);J{f:f,k:q.u(\'.k\').y(),U:q.u(\'.U\').2u(\'1A\'),v:q.u(\'.v\').y(),G:q.u(\'.G\').y()}});3.13=3.16.2A};w.E.2o=7(){3.1Q=3.1Z();3.1r=3.23();3.2h=3.1V();3.2j=3.1Y();3.1P.2D(3.2q());3.B(0);3.1j=3.1Q.14();3.$x.14(3.1j*3.1p);3.1y=1e.1E(3.1r.u(\'.9-h-1d\').14()-3.1r.u(\'.9-h-1d o\').14()*2);3.$h.14(3.1y*3.1F)};w.E.2q=7(){g 1M=6(\'<A l="9"/>\'),z=6(\'<A l="9-Y-a"/>\'),C=6(\'<A l="9-Y-b"/>\'),t=3.1Q,m=6(\'<A l="9-Y-c"/>\').5(3.2h,3.1r),d=3.2j;1M.5(z,C);z.5(t);C.5(m,d);g 1D=3.4.1C+\'-\'+3.4.1z;2f(1D){n\'O-O\':n\'I-I\':z.5(d,t);C.5(m);D;n\'O-K\':n\'O-M\':z.5(d,m);C.5(t);D;n\'O-I\':z.5(t);C.5(d,m);D;n\'K-K\':n\'M-M\':z.5(m);C.5(d,t);D;n\'K-M\':z.5(m,t);C.5(d);D;n\'K-O\':n\'K-I\':z.5(t,m);C.5(d);D;n\'M-O\':n\'M-I\':z.5(t);C.5(m,d);D;n\'M-K\':z.5(m,d);C.5(t);D;n\'I-O\':z.5(d);C.5(t,m);D;n\'I-K\':n\'I-M\':z.5(d);C.5(m,t);D}r(1D.2y(/(I|K)/)){z.1b(\'9-2v-I\');C.1b(\'9-2v-K\')}J 1M};w.E.1R=7(){g j=3;3.1S();g 27=3.4.1I+2*3.4.1q;3.$N=22.2w(7(){g 1n=j.17+1;r(1n===j.13){1n=0}j.B(1n)},27)};w.E.1S=7(){22.2z(3.$N)};w.E.1V=7(){g k=6(\'<A l="9-1X"/>\');3.$k=6(\'<A l="9-1X-k"/>\');k.5(3.$k);J k};w.E.1Y=7(){g G=6(\'<A l="9-G"/>"\');3.$v=6(\'<2x l="9-v"/>\');3.$G=6(\'<p l="9-2B"/>\');G.5(3.$v,3.$G);J G};w.E.1Z=7(){g j=3;3.1p=1e.24(3.13/3.4.Z);3.1j=0;3.1a=0;g x=6(\'<A l="9-L"><P l="9-L-1c"><o l="9-L-1c-1w"/><o l="9-L-1c-1g"/></P></A>\');3.$x=6(\'<A l="9-L-Y"/>\');x.25(3.$x);3.$1m=6(\'<a X="#">2S</a>\').V(7(e){e.T();j.1k(j.1a-1)});3.$1s=6(\'<a X="#">2Y</a>\').V(7(e){e.T();j.1k(j.1a+1)});x.u(\'.9-L-1c-1w\').5(3.$1m);x.u(\'.9-L-1c-1g\').5(3.$1s);g 21=7(f,q){g o=j.2m(q);x.u(\'.9-L-Y P:2X\').5(o)};2W(g i=0,1x,1L;i<3.1p;i++){x.u(\'.9-L-Y\').5(\'<P/>\');1x=i*3.4.Z;1L=1x+3.4.Z;6.1G(3.16.2U(1x,1L),21)}r(3.4.N){g 1B=6(\'<p l="9-N"/>\'),26=6(\'<a X="#">1U</a>\').V(7(e){e.T();r(6(3).2Z(\'S\')){6(3).1K(\'S\').y(\'1U\');j.1S()}11{6(3).1b(\'S\').y(\'30\');j.1R()}});1B.5(26);x.25(1B)}J x};w.E.23=7(){g j=3;3.1F=1e.24((3.13-2)/(3.4.1f-2));3.1y=0;3.1O=0;g h=6(\'<A l="9-h"><P l="9-h-18"><o l="9-h-18-1w"/><o l="9-h-18-1g"/></P><A l="9-h-1d"></A></A>\');3.$h=6(\'<P/>\');h.u(\'.9-h-1d\').5(3.$h);g 28=7(e){e.T();j.B(e.2p.f)};6.1G(3.16,7(f,q){g o=6(\'<o />\');g 10=6(\'<a X="#">\'+(f+1)+\'</a>\').2r(\'V\',{"f":f},28);o.5(10);h.u(\'.9-h-1d P\').5(o)});3.$1h=6(\'<a X="#">«</a>\').V(7(e){e.T();j.B(j.17-1)});h.u(\'.9-h-18-1w\').5(3.$1h);3.$1l=6(\'<a X="#">»</a>\').V(7(e){e.T();j.B(j.17+1)});h.u(\'.9-h-18-1g\').5(3.$1l);J h};w.E.2m=7(q){g o=6(\'<o/>\'),10,U,j=3,12;r(q.U){12=q.U}11{12=6(q.k).2u(\'1A\');r(3.4.1v){12=\'/35/34.33?\'+6.31({"32":1,"W":3.4.1i,"H":3.4.1o,"R":1,"2K":12})}}10=6(\'<a X="#"/>\').2r(\'V\',{f:q.f},7(e){e.T();j.B(e.2p.f)});U=6(\'<2H 1A="\'+12+\'" 2F="\'+q.v+\'" 14="\'+3.4.1i+\'" 2E="\'+3.4.1o+\'" />\');10.5(U);o.5(10);J o};w.E.B=7(f){r(f===3.17||f<0||f>=3.13){J 19}r(3.$k.2n(\':2e\')||3.$x.2n(\':2e\')){J 19}3.17=f;g q=3.16[f];3.2b(q);3.$h.u(\'o\').1K(\'S\').2d(f).1b(\'S\');3.$x.u(\'o\').1K(\'S\').2d(f).1b(\'S\');r(3.4.N&&3.$N){3.1R()}3.1k(1e.1E(f/3.4.Z));3.2t(f)};w.E.2b=7(i){g $2k=(1u 6.1T.2G===\'7\'),s=3.4.1q,t=3.4.1t,k=3.$k,v=3.$v,15=3.$G;2f(t){n 19:k.y(i.k);v.y(i.v);15.y(i.G);D;n\'2l\':k.1N(s,7(){k.y(i.k).1H(s)});v.1N(s,7(){v.y(i.v).1H(s)});15.1N(s,7(){15.y(i.G).1H(s)});D;2L:r($2k===19){2M"2R 2Q 2P 6 2N"}k.Q(t,s,7(){k.y(i.k).B(t,s)});v.Q(t,s,7(){v.y(i.v).B(t,s)});15.Q(t,s,7(){15.y(i.G).B(t,s)});D}};w.E.1k=7(F){r(F!==3.1a){3.$x.2i({\'2g\':-1*F*3.1j},1J);3.1a=F}r(F===0){3.$1m.Q()}11{3.$1m.B()}r(F+1<3.1p){3.$1s.B()}11{3.$1s.Q()} };w.E.2t=7(f){g F=1e.1E((f-1)/(3.4.1f-2));r(F<0){F=0}r(F!==3.1O&&F<3.1F){3.$h.2i({\'2g\':-1*F*3.1y},1J);3.1O=F}r(f===0){3.$1h.Q()}11{3.$1h.B()}r(f+1<3.13){3.$1l.B()}11{3.$1l.Q()}};6.1T.w=7(4){4=4||{};J 3.1G(7(){g 1W=2J w(3,4);1W.2o()})}})();',62,193,'|||this|options|append|jQuery|function||sfmg||||||index|var|pagination||self|media|class||case|li||item|if|||find|title|sfPhotoGallery|slider|html|colA|div|show|colB|break|prototype|page|description||left|return|right|thumbs|bottom|autorotate|top|ul|hide||active|preventDefault|thumb|click||href|wrapper|thumbsPerPage|trigger|else|thumbURL|count|width|desc|dataItems|currentItem|steps|false|currentThumbPage|addClass|nav|pages|Math|numbersPerPaginationPage|next|paginationPrev|thumbWidth|thumbsContainerWidth|cycleThumbs|paginationNext|thumbPrev|nextItem|thumbHeight|thumbPagesCount|transitionSpeed|paginationWrapper|thumbNext|transition|typeof|goodbarry|prev|start|paginationContainerWidth|thumbsLocation|src|ar|descriptionLocation|location|floor|paginationPagesCount|each|fadeIn|autorotateDuration|300|removeClass|end|container|fadeOut|currentPaginationPage|dataList|thumbsSlider|restartAutorotate|stopAutorotate|fn|Start|createMediaWrapper|pf|main|createDescriptionWrapper|createThumbsSlider||appendItem|window|createPagination|ceil|prepend|arTrigger|duration|paginationItemClick|el|transitionInOptions|switchItem|boolean|eq|animated|switch|marginLeft|mediaWrapper|animate|descriptionWrapper|ui|fade|createThumbnail|is|build|data|buildStructure|bind|transitionOutOptions|cyclePaging|attr|col|setInterval|h3|match|clearInterval|length|content|map|replaceWith|height|alt|effect|img|3000|new|Img|default|throw|UI|true|load|to|Unable|Previous|120|slice|80|for|last|Next|hasClass|Stop|param|USM|aspx|ShowThumbnail|Utilities|undefined'.split('|'),0,{}));


/*
 * Scripts
 *
 */
jQuery(function($) {
 
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			},
			activeNav : function(nav,activeClass){								
				$('#' + nav + ' li a').each(function(){
					var path = document.location.href; 
					var current_href = this.getAttribute('href',2);

					if (path.split(".com")[1] == current_href) {
					  $(this).addClass(activeClass);
					}
				});		
			},
caseStudyNav : function(){
$('.gallery-sub-navigation').html('<li class="back"><a href="/case-studies">Back to Case Studies</a></li>' + $('.gallery-sub-navigation').html())
}
		},
		ui : {
			galleryInit : function () {				
$('#gallery ul li:first').addClass('active');
			}			
		}
	};

	Engine.utils.links();
	Engine.utils.mails();
	//Engine.utils.activeNav('nav_399727','active');
	Engine.utils.caseStudyNav();
	Engine.ui.galleryInit();	
});
