/* * jPreLoader - jQuery plugin * Create a Loading Screen to preload images and content for you website * * Name: jPreLoader.js * Author: Kenny Ooi - http://www.inwebson.com * Date: July 11, 2012 * Version: 2.0 * Example: http://www.inwebson.com/demo/jpreloader-v2/ * */ (function($) { var items = new Array(), errors = new Array(), onComplete = function() {}, current = 0; var jpreOptions = { splashVPos: '35%', loaderVPos: '75%', splashID: '#jpreContent', showSplash: true, showPercentage: true, autoClose: true, closeBtnText: 'Start!', onetimeLoad: false, debugMode: false, splashFunction: function() {} } //cookie var getCookie = function() { if( jpreOptions.onetimeLoad ) { var cookies = document.cookie.split('; '); for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) { if ((parts.shift()) === "jpreLoader") { return (parts.join('=')); } } return false; } else { return false; } } var setCookie = function(expires) { if( jpreOptions.onetimeLoad ) { var exdate = new Date(); exdate.setDate( exdate.getDate() + expires ); var c_value = ((expires==null) ? "" : "expires=" + exdate.toUTCString()); document.cookie="jpreLoader=loaded; " + c_value; } } //create jpreLoader UI var createContainer = function() { jOverlay = $('
') .attr('id', 'jpreOverlay') .css({ position: "fixed", top: 0, left: 0, width: '100%', height: '100%', zIndex: 9999999 }) .appendTo('body'); if(jpreOptions.showSplash) { jContent = $('
') .attr('id', 'jpreSlide') .appendTo(jOverlay); var conWidth = $(window).width() - $(jContent).width(); $(jContent).css({ position: "absolute", top: jpreOptions.splashVPos, left: Math.round((50 / $(window).width()) * conWidth) + '%' }); $(jContent).html($(jpreOptions.splashID).wrap('
').parent().html()); $(jpreOptions.splashID).remove(); jpreOptions.splashFunction() } jLoader = $('
') .attr('id', 'jpreLoader') .appendTo(jOverlay); var posWidth = $(window).width() - $(jLoader).width(); $(jLoader).css({ position: 'absolute', top: jpreOptions.loaderVPos, left: Math.round((50 / $(window).width()) * posWidth) + '%' }); jBar = $('
') .attr('id', 'jpreBar') .css({ width: '0%', height: '100%' }) .appendTo(jLoader); if(jpreOptions.showPercentage) { jPer = $('
') .attr('id', 'jprePercentage') .css({ position: 'relative', height: '100%' }) .appendTo(jLoader) .html('Loading...'); } if( !jpreOptions.autoclose ) { jButton = $('
') .attr('id', 'jpreButton') .on('click', function() { loadComplete(); }) .css({ position: 'relative', height: '100%' }) .appendTo(jLoader) .text(jpreOptions.closeBtnText) .hide(); } } //get all images from css and tag var getImages = function(element) { $(element).find('*:not(script)').each(function() { var url = ""; if ($(this).css('background-image').indexOf('none') == -1) { url = $(this).css('background-image'); if(url.indexOf('url') != -1) { var temp = url.match(/url\((.*?)\)/); url = temp[1].replace(/\"/g, ''); } } else if ($(this).get(0).nodeName.toLowerCase() == 'img' && typeof($(this).attr('src')) != 'undefined') { url = $(this).attr('src'); } if (url.length > 0) { items.push(url); } }); } //create preloaded image var preloading = function() { for (var i = 0; i < items.length; i++) { if(loadImg(items[i])); } } var loadImg = function(url) { var imgLoad = new Image(); $(imgLoad) .load(function() { completeLoading(); }) .error(function() { errors.push($(this).attr('src')); completeLoading(); }) .attr('src', url); } //update progress bar once image loaded var completeLoading = function() { current++; var per = Math.round((current / items.length) * 100); // move faders to top 134 px, each 25 = 134 , starting from 298, diff is 164 var topFader1 = 298; var topFader2 = 298; var topFader3 = 298; var topFader4 = 298; if ( per >0 && per <= 25) { topFader1 = 298 - ((per * 4)/100)*164; } else if ( per >25 && per <= 50) { topFader1 = 134; topFader2 = 298 - (( (per-25) * 4)/100)*164; } else if ( per >50 && per <= 75) { topFader1 = 134; topFader2 = 134; topFader3 = 298 - (( (per-50) * 4)/100)*164; } else if ( per >75 && per <= 100) { topFader1 = 134; topFader2 = 134; topFader3 = 134; topFader4 = 298 - (( (per-75) * 4)/100)*164; } $("#preloadFader1").css({ top: topFader1 }); $("#preloadFader2").css({ top: topFader2 }); $("#preloadFader3").css({ top: topFader3 }); $("#preloadFader4").css({ top: topFader4 }); $("#preloadPeak").css({ height: (-(per-100)/100)*341 }); $(jBar).stop().animate({ width: per + '%' }, 500, 'linear'); if(jpreOptions.showPercentage) { $(jPer).text(per+"%"); } //if all images loaded if(current >= items.length) { current = items.length; setCookie(); //create cookie if(jpreOptions.showPercentage) { $(jPer).text("100%"); } //fire debug mode if (jpreOptions.debugMode) { var error = debug(); } //max progress bar $(jBar).stop().animate({ width: '100%' }, 500, 'linear', function() { //autoclose on if( jpreOptions.autoClose ) loadComplete(); else $(jButton).fadeIn(1000); }); } } //triggered when all images are loaded var loadComplete = function() { $(jOverlay).fadeOut(800, function() { $(jOverlay).remove(); $("#preloaderPlate").remove(); onComplete(); //callback function }); } //debug mode var debug = function() { if(errors.length > 0) { var str = 'ERROR - IMAGE FILES MISSING!!!\n\r' str += errors.length + ' image files cound not be found. \n\r'; str += 'Please check your image paths and filenames:\n\r'; for (var i = 0; i < errors.length; i++) { str += '- ' + errors[i] + '\n\r'; } return true; } else { return false; } } $.fn.jpreLoader = function(options, callback) { if(options) { $.extend(jpreOptions, options ); } if(typeof callback == 'function') { onComplete = callback; } //show preloader once JS loaded $('body').css({ 'display': 'block' }); return this.each(function() { if( !(getCookie()) ) { createContainer(); getImages(this); preloading(); } else { //onetime load / cookie is set $(jpreOptions.splashID).remove(); onComplete(); } }); }; })(jQuery);$(document).ready(function(){$(".grindSignature").hover(function(){$("#grindSignature").show()},function(){$("#grindSignature").hide()})}); $(document).ready(function() { //when the document is ready... $(document).ready(function() { var _0x8eb0=["\x23\x6A\x53\x70\x6C\x61\x73\x68","\x31\x30\x25","\x68\x69\x64\x65","\x2E\x73\x65\x6C\x65\x63\x74\x65\x64","\x6E\x6F\x74","\x73\x65\x63\x74\x69\x6F\x6E","\x63\x68\x69\x6C\x64\x72\x65\x6E","\x66\x61\x64\x65\x49\x6E","\x68\x69\x64\x64\x65\x6E","\x72\x65\x6D\x6F\x76\x65\x43\x6C\x61\x73\x73","\x23\x70\x61\x67\x65","\x23\x6D\x65\x6E\x75","\x23\x74\x65\x78\x74\x5F\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x6A\x70\x72\x65\x4C\x6F\x61\x64\x65\x72","\x62\x6F\x64\x79"];$(_0x8eb0[14])[_0x8eb0[13]]({splashID:_0x8eb0[0],splashVPos:_0x8eb0[1],autoClose:true,splashFunction:function (){$(_0x8eb0[0])[_0x8eb0[6]](_0x8eb0[5])[_0x8eb0[4]](_0x8eb0[3])[_0x8eb0[2]]();$(_0x8eb0[0])[_0x8eb0[2]]()[_0x8eb0[7]](800);} },function (){$(_0x8eb0[10])[_0x8eb0[9]](_0x8eb0[8]);$(_0x8eb0[11])[_0x8eb0[9]](_0x8eb0[8]);$(_0x8eb0[12])[_0x8eb0[9]](_0x8eb0[8]);} ); }); function rotate(a){var b=15;$projectorRot1.css({WebkitTransform:"rotate("+a+"deg)"});$projectorRot2.css({WebkitTransform:"rotate("+ -a+"deg)"});$projectorRot1.css({"-moz-transform":"rotate("+a+"deg)"});$projectorRot2.css({"-moz-transform":"rotate("+ -a+"deg)"});setTimeout(function(){if(a<=b&&rotateFlip){rotate(++a);if(a==b){rotateFlip=false}}else{rotate(--a);if(a==-b){rotateFlip=true}}},70)}function RepositionNav(){var a=$window.height();var b=$("#nav").height()/2;var c=a/2;var d=c-b;$("#nav").css({top:d})}function RepositionTopNav(a){var b="0";if(a>65){$("#subMenu .backToTop").fadeIn();b=0}else{$("#subMenu .backToTop").fadeOut();b=65-a}$("#subMenu").css({top:b})}function newPos(a,b,c,d,e){return a+"% "+ -(b+c-d)*e+"px"}if($.browser.msie==true){var msg="Unfortunately, you are using Internet Explorer.\nThis website is best viewed in Google Chrome (chrome.google.com) or Firefox (firefox.com).";if($.browser.version<="8.0"){msg="Unfortunately, you are using an old version of Internet Explorer that does not properly support this website.\nPlease download Google Chrome (chrome.google.com) or Firefox (firefox.com) for best viewing."}alert(msg)}galleryDisplayed=false;$("#menu").localScroll({duration:4e3});$(".submitFormDoAction").click(function(a){var b=$("#contact_form_data");var c=b.serialize();$("#submit_form_button").removeClass("submitFormDoAction").html("...");var d=b.find(" :input");d.each(function(a,b){$(this).attr("disabled","true")});$.ajax({url:"sendMail.php",type:"POST",dataType:"json",data:c,success:function(a,b,c){if(!a||a.status!="success"){d.each(function(a,b){$(this).removeAttr("disabled")});$("#submit_form_button").addClass("submitFormDoAction").html("Submit");$("#contact_status").stop().show().html(a.message).fadeOut(6e3);return false}if(a.status=="success"){$("#submit_form_button").addClass("submitFormDoAction").html("Submit");d.each(function(a,b){$(this).removeAttr("disabled")});$("#contact_status").stop().show().html("Email sent, we will contact you shortly.").fadeOut(6e3)}},error:function(a,b,c){d.each(function(a,b){$(this).removeAttr("disabled")});$("#submit_form_button").addClass("submitFormDoAction").html("Submit");alert("There was an error. Please try again.");return false;if(typeof console!="undefined")console.dir(a);return false}})});$(".closeContactBoxDoAction").click(function(a){a.preventDefault();$("#contact_form_container").fadeOut()});$("#menu li a").click(function(a){$("#menu li a").removeClass("bold");$(a.target).addClass("bold")});$(".closeGalleryDoAction").die("live").live("click",function(a){a.preventDefault();$("#gallery_container").hide()});var $projectorRot1=$("#s5_projector1");var $projectorRot2=$("#s5_projector2");rotate(0);rotateFlip=true;$(".openGallery").click(function(a){a.preventDefault();var b=$(a.target).attr("gallery_id");$("#gallery_container").html("

Please wait...
");$("#gallery_container").show();$.ajax({url:"actions/gallery.php",type:"POST",dataType:"html",data:"galleryId="+b,success:function(a,b,c){$("#gallery_container").html(a)},error:function(a,b,c){alert("There was an error. Please try again.")}})});var $window=$(window);var $page=$("#page");var actualWindowHeight=$window.height();var windowHeight=800;$("#page").bind("inview",function(a,b){if(b==true){$(this).addClass("inview")}else{$(this).removeClass("inview")}}) function Move(){ var _0xe86f=["\x73\x63\x72\x6F\x6C\x6C\x54\x6F\x70","\x63\x73\x73","\x23\x62\x67\x32","\x23\x73\x32\x5F\x73\x68\x61\x64\x6F\x77","\x23\x73\x32\x5F\x6C\x69\x67\x68\x74\x73\x5F\x62\x61\x63\x6B","\x23\x73\x32\x5F\x6C\x69\x67\x68\x74\x73\x5F\x66\x72\x6F\x6E\x74","\x23\x73\x32\x5F\x72\x6F\x6F\x66","\x23\x62\x67\x33","\x23\x73\x33\x5F\x73\x68\x61\x64\x6F\x77","\x6D\x61\x72\x67\x69\x6E\x2D\x74\x6F\x70","\x23\x74\x65\x78\x74\x5F\x77\x72\x61\x70\x70\x65\x72","\x23\x73\x33\x5F\x6C\x65\x66\x74\x5F\x74\x6F\x77\x65\x72","\x23\x73\x33\x5F\x72\x69\x67\x68\x74\x5F\x74\x6F\x77\x65\x72","\x23\x73\x33\x5F\x73\x70\x65\x61\x6B\x65\x72\x73\x5F\x6C\x65\x66\x74","\x23\x73\x33\x5F\x73\x70\x65\x61\x6B\x65\x72\x73\x5F\x72\x69\x67\x68\x74","\x23\x62\x67\x34","\x23\x73\x34\x5F\x67\x72\x65\x65\x6E\x5F\x72\x65\x64\x5F\x79\x65\x6C\x6C\x6F\x77\x5F\x6C\x69\x67\x68\x74\x73","\x23\x73\x34\x5F\x6F\x72\x61\x6E\x67\x65\x5F\x6C\x69\x67\x68\x74\x73","\x23\x73\x34\x5F\x70\x72\x6F\x6A\x65\x63\x74\x6F\x72\x73","\x23\x73\x34\x5F\x74\x6F\x77\x65\x72\x5F\x6C\x69\x67\x68\x74\x73\x31","\x23\x73\x34\x5F\x74\x6F\x77\x65\x72\x5F\x6C\x69\x67\x68\x74\x73\x32","\x23\x73\x34\x5F\x6C\x69\x6E\x65\x5F\x61\x72\x72\x61\x79\x31","\x23\x73\x34\x5F\x6C\x69\x6E\x65\x5F\x61\x72\x72\x61\x79\x32","\x23\x73\x34\x5F\x62\x61\x63\x6B\x64\x72\x6F\x70","\x23\x73\x34\x5F\x73\x74\x61\x67\x65\x5F\x74\x6F\x70","\x23\x73\x34\x5F\x73\x75\x62\x77\x6F\x6F\x66\x65\x72\x73","\x23\x73\x35\x5F\x70\x72\x6F\x6A\x65\x63\x74\x6F\x72\x31","\x23\x73\x35\x5F\x70\x72\x6F\x6A\x65\x63\x74\x6F\x72\x32","\x73\x68\x6F\x77","\x23\x63\x6F\x6E\x74\x61\x63\x74\x5F\x66\x6F\x72\x6D\x5F\x63\x6F\x6E\x74\x61\x69\x6E\x65\x72","\x66\x61\x64\x65\x49\x6E","\x23\x73\x35\x5F\x6C\x69\x67\x68\x74\x73\x5F\x72\x65\x64\x5F\x62\x61\x63\x6B","\x23\x73\x35\x5F\x6C\x69\x67\x68\x74\x73\x5F\x79\x65\x6C\x6C\x6F\x77\x5F\x66\x72\x6F\x6E\x74","\x23\x73\x35\x5F\x6C\x69\x67\x68\x74\x73\x5F\x67\x72\x65\x65\x6E\x5F\x66\x72\x6F\x6E\x74","\x23\x73\x35\x5F\x6C\x69\x67\x68\x74\x73\x5F\x72\x65\x64\x5F\x66\x72\x6F\x6E\x74","\x23\x73\x35\x5F\x6C\x69\x67\x68\x74\x73\x5F\x67\x72\x65\x65\x6E\x5F\x62\x61\x63\x6B","\x23\x73\x35\x5F\x62\x61\x6E\x64","\x66\x61\x64\x65\x4F\x75\x74","\x23\x73\x35\x5F\x73\x74\x61\x72\x73","\x23\x73\x35\x5F\x63\x6B\x61","\x23\x63\x6F\x6E\x74\x61\x63\x74\x5F\x66\x6F\x72\x6D","\x23\x73\x35\x5F\x63\x72\x6F\x77\x64\x31","\x23\x73\x35\x5F\x63\x72\x6F\x77\x64\x32","\x23\x73\x35\x5F\x63\x72\x6F\x77\x64\x33","\x23\x73\x35\x5F\x63\x72\x6F\x77\x64\x34","\x23\x62\x67\x35"];var pos=$window[_0xe86f[0]]();var pageHeight=400;if(pos<=pageHeight){opacity2=(pos/pageHeight);opacity2_2=(pos/pageHeight)*2-1;opacity2_3=(pos/pageHeight)*3-2;} else {opacity2=1;opacity2_2=1;opacity2_3=1;} ;$(_0xe86f[2])[_0xe86f[1]]({opacity:opacity2});$(_0xe86f[3])[_0xe86f[1]]({opacity:opacity2});var offset=400;var s2_light_back_final=388+offset;var s2_lights_front_final=310+offset;var s2_roof_final=325+offset;var lightsBack=opacity2*s2_light_back_final-offset;var lightsFront=opacity2_2*s2_lights_front_final-offset;var roof=opacity2_3*s2_roof_final-offset;$(_0xe86f[4])[_0xe86f[1]]({top:lightsBack});$(_0xe86f[5])[_0xe86f[1]]({top:lightsFront});$(_0xe86f[6])[_0xe86f[1]]({top:roof});if(pos>=pageHeight*2){opacity3=1;opacity3_2=1;} else {opacity3=(pos-pageHeight)/pageHeight;opacity3_2=((pos-pageHeight)/pageHeight)*1.5-0.5;if(opacity3<0){opacity3=0;opacity3_2=0;opacity3_shadow=0;} ;} ;opacity3_shadow=((pos-(pageHeight+340))/(pageHeight+340));$(_0xe86f[7])[_0xe86f[1]]({opacity:opacity3});$(_0xe86f[8])[_0xe86f[1]]({opacity:opacity3_shadow});if(opacity3>0){$(_0xe86f[3])[_0xe86f[1]]({opacity:(-opacity3+1)});} ;$(_0xe86f[10])[_0xe86f[1]](_0xe86f[9],-pos/1.5);var offset2=-2000;var s3_left_tower_final=-106+offset2;var s3_right_tower_final=750+offset2;var s3_speakers_left_final=-97+offset2;var s3_speakers_right_final=660+offset2;var leftTower=(-opacity3+1)*s3_left_tower_final-106;var rightTower=opacity3*s3_right_tower_final-offset2;var leftSpeakers=(-opacity3_2+1)*s3_speakers_left_final-97;var rightSpeakers=opacity3_2*s3_speakers_right_final-offset2;$(_0xe86f[11])[_0xe86f[1]]({marginLeft:leftTower});$(_0xe86f[12])[_0xe86f[1]]({marginLeft:rightTower});$(_0xe86f[13])[_0xe86f[1]]({marginLeft:leftSpeakers});$(_0xe86f[14])[_0xe86f[1]]({marginLeft:rightSpeakers});if(pos>=pageHeight*3){opacity4=1;opacity4_2=1;} else {opacity4=(pos-pageHeight*2)/pageHeight;opacity4_2=((pos-pageHeight*2)/pageHeight)*4-3;if(opacity4<0){opacity4=0;opacity4_2=0;} ;} ;var arrayHeight=opacity4*195;var backdropHeight=opacity4_2*152;var s4_stage_top_final=295+offset;var stageTop=opacity4_2*s4_stage_top_final-offset;$(_0xe86f[15])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[16])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[17])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[18])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[19])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[20])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[21])[_0xe86f[1]]({height:arrayHeight,opacity:opacity4});$(_0xe86f[22])[_0xe86f[1]]({height:arrayHeight,opacity:opacity4});$(_0xe86f[23])[_0xe86f[1]]({opacity:1,height:backdropHeight});$(_0xe86f[24])[_0xe86f[1]]({top:stageTop});$(_0xe86f[25])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[26])[_0xe86f[1]]({opacity:opacity4});$(_0xe86f[27])[_0xe86f[1]]({opacity:opacity4});if(pos>=pageHeight*4){opacity5=1;opacity5_2=1;opacity5_3=1;opacity5_4=1;$(_0xe86f[29])[_0xe86f[28]]();} else {opacity5=(pos-pageHeight*3)/pageHeight;opacity5_2=((pos-pageHeight*3)/pageHeight)*3-2;opacity5_3=((pos-pageHeight*3)/pageHeight)*4-3;opacity5_4=((pos-pageHeight*3)/pageHeight)*5-4;if(opacity5<0){opacity5=0;opacity5_2=0;opacity5_3=0;opacity5_4=0;} ;} ;var offset5=1100;var s5_crowd_final_1=-674;var s5_crowd_final_2=-703;var s5_crowd_final_3=-701;var s5_crowd_final_4=-734;var s5Crowd1=(11)*opacity5_4*100-(offset5-s5_crowd_final_1);var s5Crowd2=(11)*opacity5_3*100-(offset5-s5_crowd_final_2);var s5Crowd3=(11)*opacity5_2*100-(offset5-s5_crowd_final_3);var s5Crowd4=(11)*opacity5*100-(offset5-s5_crowd_final_4);var contactBox=(opacity5-1)*900+75;if(opacity5>0.9){$(_0xe86f[31])[_0xe86f[30]](500);$(_0xe86f[35])[_0xe86f[30]](500,function (){$(_0xe86f[34])[_0xe86f[30]](300,function (){$(_0xe86f[33])[_0xe86f[30]](500,function (){$(_0xe86f[32])[_0xe86f[30]](1000);} );} );} );$(_0xe86f[36])[_0xe86f[30]](2000);} else {$(_0xe86f[35])[_0xe86f[37]]();$(_0xe86f[33])[_0xe86f[37]]();$(_0xe86f[31])[_0xe86f[37]]();$(_0xe86f[34])[_0xe86f[37]]();$(_0xe86f[32])[_0xe86f[37]]();$(_0xe86f[36])[_0xe86f[37]]();} ;$(_0xe86f[38])[_0xe86f[1]]({opacity:opacity5});$(_0xe86f[39])[_0xe86f[1]]({opacity:opacity5});$(_0xe86f[40])[_0xe86f[1]]({marginRight:contactBox});$(_0xe86f[41])[_0xe86f[1]]({bottom:s5Crowd1});$(_0xe86f[42])[_0xe86f[1]]({bottom:s5Crowd2});$(_0xe86f[43])[_0xe86f[1]]({bottom:s5Crowd3});$(_0xe86f[44])[_0xe86f[1]]({bottom:s5Crowd4});$(_0xe86f[45])[_0xe86f[1]]({opacity:opacity5}); } $window.resize(function(){ Move(); }); $window.bind('scroll', function(){ Move(); }); }); /** * jQuery Galleriffic plugin * * Copyright (c) 2008 Trent Foley (http://trentacular.com) * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php * * Much thanks to primary contributer Ponticlaro (http://www.ponticlaro.com) */ ;(function($) { // Globally keep track of all images by their unique hash. Each item is an image data object. var allImages = {}; var imageCounter = 0; // Galleriffic static class $.galleriffic = { version: '2.0.1', // Strips invalid characters and any leading # characters normalizeHash: function(hash) { return hash.replace(/^.*#/, '').replace(/\?.*$/, ''); }, getImage: function(hash) { if (!hash) return undefined; hash = $.galleriffic.normalizeHash(hash); return allImages[hash]; }, // Global function that looks up an image by its hash and displays the image. // Returns false when an image is not found for the specified hash. // @param {String} hash This is the unique hash value assigned to an image. gotoImage: function(hash) { var imageData = $.galleriffic.getImage(hash); if (!imageData) return false; var gallery = imageData.gallery; gallery.gotoImage(imageData); return true; }, // Removes an image from its respective gallery by its hash. // Returns false when an image is not found for the specified hash or the // specified owner gallery does match the located images gallery. // @param {String} hash This is the unique hash value assigned to an image. // @param {Object} ownerGallery (Optional) When supplied, the located images // gallery is verified to be the same as the specified owning gallery before // performing the remove operation. removeImageByHash: function(hash, ownerGallery) { var imageData = $.galleriffic.getImage(hash); if (!imageData) return false; var gallery = imageData.gallery; if (ownerGallery && ownerGallery != gallery) return false; return gallery.removeImageByIndex(imageData.index); } }; var defaults = { delay: 3000, numThumbs: 20, preloadAhead: 40, // Set to -1 to preload all images enableTopPager: false, enableBottomPager: true, maxPagesToShow: 7, imageContainerSel: '', captionContainerSel: '', controlsContainerSel: '', loadingContainerSel: '', renderSSControls: true, renderNavControls: true, playLinkText: 'Play', pauseLinkText: 'Pause', prevLinkText: 'Previous', nextLinkText: 'Next', nextPageLinkText: 'Next ›', prevPageLinkText: '‹ Prev', enableHistory: false, enableKeyboardNavigation: true, autoStart: false, syncTransitions: false, defaultTransitionDuration: 1000, onSlideChange: undefined, // accepts a delegate like such: function(prevIndex, nextIndex) { ... } onTransitionOut: undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... } onTransitionIn: undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... } onPageTransitionOut: undefined, // accepts a delegate like such: function(callback) { ... } onPageTransitionIn: undefined, // accepts a delegate like such: function() { ... } onImageAdded: undefined, // accepts a delegate like such: function(imageData, $li) { ... } onImageRemoved: undefined // accepts a delegate like such: function(imageData, $li) { ... } }; // Primary Galleriffic initialization function that should be called on the thumbnail container. $.fn.galleriffic = function(settings) { // Extend Gallery Object $.extend(this, { // Returns the version of the script version: $.galleriffic.version, // Current state of the slideshow isSlideshowRunning: false, slideshowTimeout: undefined, // This function is attached to the click event of generated hyperlinks within the gallery clickHandler: function(e, link) { this.pause(); if (!this.enableHistory) { // The href attribute holds the unique hash for an image var hash = $.galleriffic.normalizeHash($(link).attr('href')); $.galleriffic.gotoImage(hash); e.preventDefault(); } }, // Appends an image to the end of the set of images. Argument listItem can be either a jQuery DOM element or arbitrary html. // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. appendImage: function(listItem) { this.addImage(listItem, false, false); return this; }, // Inserts an image into the set of images. Argument listItem can be either a jQuery DOM element or arbitrary html. // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. // @param {Integer} position The index within the gallery where the item shouold be added. insertImage: function(listItem, position) { this.addImage(listItem, false, true, position); return this; }, // Adds an image to the gallery and optionally inserts/appends it to the DOM (thumbExists) // @param listItem Either a jQuery object or a string of html of the list item that is to be added to the gallery. // @param {Boolean} thumbExists Specifies whether the thumbnail already exists in the DOM or if it needs to be added. // @param {Boolean} insert Specifies whether the the image is appended to the end or inserted into the gallery. // @param {Integer} position The index within the gallery where the item shouold be added. addImage: function(listItem, thumbExists, insert, position) { var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem; var $aThumb = $li.find('a.thumb'); var originalSource = $aThumb.attr('original'); var slideUrl = $aThumb.attr('href'); var title = $aThumb.attr('title'); var $caption = $li.find('.caption').remove(); var hash = $aThumb.attr('name'); // Increment the image counter imageCounter++; // Autogenerate a hash value if none is present or if it is a duplicate if (!hash || allImages[''+hash]) { hash = imageCounter; } // Set position to end when not specified if (!insert) position = this.data.length; var imageData = { title:title, slideUrl:slideUrl, originalSource:originalSource, caption:$caption, hash:hash, gallery:this, index:position }; // Add the imageData to this gallery's array of images if (insert) { this.data.splice(position, 0, imageData); // Reset index value on all imageData objects this.updateIndices(position); } else { this.data.push(imageData); } var gallery = this; // Add the element to the DOM if (!thumbExists) { // Update thumbs passing in addition post transition out handler this.updateThumbs(function() { var $thumbsUl = gallery.find('ul.thumbs'); if (insert) $thumbsUl.children(':eq('+position+')').before($li); else $thumbsUl.append($li); if (gallery.onImageAdded) gallery.onImageAdded(imageData, $li); }); } // Register the image globally allImages[''+hash] = imageData; // Setup attributes and click handler $aThumb.attr('rel', 'history') .attr('href', '#'+hash) .removeAttr('name') .click(function(e) { gallery.clickHandler(e, this); }); return this; }, // Removes an image from the gallery based on its index. // Returns false when the index is out of range. removeImageByIndex: function(index) { if (index < 0 || index >= this.data.length) return false; var imageData = this.data[index]; if (!imageData) return false; this.removeImage(imageData); return true; }, // Convenience method that simply calls the global removeImageByHash method. removeImageByHash: function(hash) { return $.galleriffic.removeImageByHash(hash, this); }, // Removes an image from the gallery. removeImage: function(imageData) { var index = imageData.index; // Remove the image from the gallery data array this.data.splice(index, 1); // Remove the global registration delete allImages[''+imageData.hash]; // Remove the image's list item from the DOM this.updateThumbs(function() { var $li = gallery.find('ul.thumbs') .children(':eq('+index+')') .remove(); if (gallery.onImageRemoved) gallery.onImageRemoved(imageData, $li); }); // Update each image objects index value this.updateIndices(index); return this; }, // Updates the index values of the each of the images in the gallery after the specified index updateIndices: function(startIndex) { for (i = startIndex; i < this.data.length; i++) { this.data[i].index = i; } return this; }, // Scraped the thumbnail container for thumbs and adds each to the gallery initializeThumbs: function() { this.data = []; var gallery = this; this.find('ul.thumbs > li').each(function(i) { gallery.addImage($(this), true, false); }); return this; }, isPreloadComplete: false, // Initalizes the image preloader preloadInit: function() { if (this.preloadAhead == 0) return this; this.preloadStartIndex = this.currentImage.index; var nextIndex = this.getNextIndex(this.preloadStartIndex); return this.preloadRecursive(this.preloadStartIndex, nextIndex); }, // Changes the location in the gallery the preloader should work // @param {Integer} index The index of the image where the preloader should restart at. preloadRelocate: function(index) { // By changing this startIndex, the current preload script will restart this.preloadStartIndex = index; return this; }, // Recursive function that performs the image preloading // @param {Integer} startIndex The index of the first image the current preloader started on. // @param {Integer} currentIndex The index of the current image to preload. preloadRecursive: function(startIndex, currentIndex) { // Check if startIndex has been relocated if (startIndex != this.preloadStartIndex) { var nextIndex = this.getNextIndex(this.preloadStartIndex); return this.preloadRecursive(this.preloadStartIndex, nextIndex); } var gallery = this; // Now check for preloadAhead count var preloadCount = currentIndex - startIndex; if (preloadCount < 0) preloadCount = this.data.length-1-startIndex+currentIndex; if (this.preloadAhead >= 0 && preloadCount > this.preloadAhead) { // Do this in order to keep checking for relocated start index setTimeout(function() { gallery.preloadRecursive(startIndex, currentIndex); }, 500); return this; } var imageData = this.data[currentIndex]; if (!imageData) return this; // If already loaded, continue if (imageData.image) return this.preloadNext(startIndex, currentIndex); // Preload the image var image = new Image(); image.onload = function() { imageData.image = this; gallery.preloadNext(startIndex, currentIndex); }; image.alt = imageData.title; image.src = imageData.slideUrl; return this; }, // Called by preloadRecursive in order to preload the next image after the previous has loaded. // @param {Integer} startIndex The index of the first image the current preloader started on. // @param {Integer} currentIndex The index of the current image to preload. preloadNext: function(startIndex, currentIndex) { var nextIndex = this.getNextIndex(currentIndex); if (nextIndex == startIndex) { this.isPreloadComplete = true; } else { // Use setTimeout to free up thread var gallery = this; setTimeout(function() { gallery.preloadRecursive(startIndex, nextIndex); }, 100); } return this; }, // Safe way to get the next image index relative to the current image. // If the current image is the last, returns 0 getNextIndex: function(index) { var nextIndex = index+1; if (nextIndex >= this.data.length) nextIndex = 0; return nextIndex; }, // Safe way to get the previous image index relative to the current image. // If the current image is the first, return the index of the last image in the gallery. getPrevIndex: function(index) { var prevIndex = index-1; if (prevIndex < 0) prevIndex = this.data.length-1; return prevIndex; }, // Pauses the slideshow pause: function() { this.isSlideshowRunning = false; if (this.slideshowTimeout) { clearTimeout(this.slideshowTimeout); this.slideshowTimeout = undefined; } if (this.$controlsContainer) { this.$controlsContainer .find('div.ss-controls a').removeClass().addClass('play') .attr('title', this.playLinkText) .attr('href', '#play') .html(this.playLinkText); } return this; }, // Plays the slideshow play: function() { this.isSlideshowRunning = true; if (this.$controlsContainer) { this.$controlsContainer .find('div.ss-controls a').removeClass().addClass('pause') .attr('title', this.pauseLinkText) .attr('href', '#pause') .html(this.pauseLinkText); } if (!this.slideshowTimeout) { var gallery = this; this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay); } return this; }, // Toggles the state of the slideshow (playing/paused) toggleSlideshow: function() { if (this.isSlideshowRunning) this.pause(); else this.play(); return this; }, // Advances the slideshow to the next image and delegates navigation to the // history plugin when history is enabled // enableHistory is true ssAdvance: function() { if (this.isSlideshowRunning) this.next(true); return this; }, // Advances the gallery to the next image. // @param {Boolean} dontPause Specifies whether to pause the slideshow. // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. next: function(dontPause, bypassHistory) { this.gotoIndex(this.getNextIndex(this.currentImage.index), dontPause, bypassHistory); return this; }, // Navigates to the previous image in the gallery. // @param {Boolean} dontPause Specifies whether to pause the slideshow. // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. previous: function(dontPause, bypassHistory) { this.gotoIndex(this.getPrevIndex(this.currentImage.index), dontPause, bypassHistory); return this; }, // Navigates to the next page in the gallery. // @param {Boolean} dontPause Specifies whether to pause the slideshow. // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. nextPage: function(dontPause, bypassHistory) { var page = this.getCurrentPage(); var lastPage = this.getNumPages() - 1; if (page < lastPage) { var startIndex = page * this.numThumbs; var nextPage = startIndex + this.numThumbs; this.gotoIndex(nextPage, dontPause, bypassHistory); } return this; }, // Navigates to the previous page in the gallery. // @param {Boolean} dontPause Specifies whether to pause the slideshow. // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. previousPage: function(dontPause, bypassHistory) { var page = this.getCurrentPage(); if (page > 0) { var startIndex = page * this.numThumbs; var prevPage = startIndex - this.numThumbs; this.gotoIndex(prevPage, dontPause, bypassHistory); } return this; }, // Navigates to the image at the specified index in the gallery // @param {Integer} index The index of the image in the gallery to display. // @param {Boolean} dontPause Specifies whether to pause the slideshow. // @param {Boolean} bypassHistory Specifies whether to delegate navigation to the history plugin when history is enabled. gotoIndex: function(index, dontPause, bypassHistory) { if (!dontPause) this.pause(); if (index < 0) index = 0; else if (index >= this.data.length) index = this.data.length-1; var imageData = this.data[index]; if (!bypassHistory && this.enableHistory) $.historyLoad(String(imageData.hash)); // At the moment, historyLoad only accepts string arguments else this.gotoImage(imageData); return this; }, // This function is garaunteed to be called anytime a gallery slide changes. // @param {Object} imageData An object holding the image metadata of the image to navigate to. gotoImage: function(imageData) { var index = imageData.index; if (this.onSlideChange) this.onSlideChange(this.currentImage.index, index); this.currentImage = imageData; this.preloadRelocate(index); this.refresh(); return this; }, // Returns the default transition duration value. The value is halved when not // performing a synchronized transition. // @param {Boolean} isSync Specifies whether the transitions are synchronized. getDefaultTransitionDuration: function(isSync) { if (isSync) return this.defaultTransitionDuration; return this.defaultTransitionDuration / 2; }, // Rebuilds the slideshow image and controls and performs transitions refresh: function() { var imageData = this.currentImage; if (!imageData) return this; var index = imageData.index; // Update Controls if (this.$controlsContainer) { this.$controlsContainer .find('div.nav-controls a.prev').attr('href', '#'+this.data[this.getPrevIndex(index)].hash).end() .find('div.nav-controls a.next').attr('href', '#'+this.data[this.getNextIndex(index)].hash); } var previousSlide = this.$imageContainer.find('span.current').addClass('previous').removeClass('current'); var previousCaption = 0; if (this.$captionContainer) { previousCaption = this.$captionContainer.find('span.current').addClass('previous').removeClass('current'); } // Perform transitions simultaneously if syncTransitions is true and the next image is already preloaded var isSync = this.syncTransitions && imageData.image; // Flag we are transitioning var isTransitioning = true; var gallery = this; var transitionOutCallback = function() { // Flag that the transition has completed isTransitioning = false; // Remove the old slide previousSlide.remove(); // Remove old caption if (previousCaption) previousCaption.remove(); if (!isSync) { if (imageData.image && imageData.hash == gallery.data[gallery.currentImage.index].hash) { gallery.buildImage(imageData, isSync); } else { // Show loading container if (gallery.$loadingContainer) { gallery.$loadingContainer.show(); } } } }; if (previousSlide.length == 0) { // For the first slide, the previous slide will be empty, so we will call the callback immediately transitionOutCallback(); } else { if (this.onTransitionOut) { this.onTransitionOut(previousSlide, previousCaption, isSync, transitionOutCallback); } else { previousSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0, transitionOutCallback); if (previousCaption) previousCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 0.0); } } // Go ahead and begin transitioning in of next image if (isSync) this.buildImage(imageData, isSync); if (!imageData.image) { var image = new Image(); // Wire up mainImage onload event image.onload = function() { imageData.image = this; // Only build image if the out transition has completed and we are still on the same image hash if (!isTransitioning && imageData.hash == gallery.data[gallery.currentImage.index].hash) { gallery.buildImage(imageData, isSync); } }; // set alt and src image.alt = imageData.title; image.src = imageData.slideUrl; $("#gallery_download_link").attr('href',imageData.originalSource); $("#gallery_facebook_link").attr('href',"http://www.facebook.com/sharer.php?u=http://www.cka-lb.com"+imageData.originalSource); } // This causes the preloader (if still running) to relocate out from the currentIndex this.relocatePreload = true; return this.syncThumbs(); }, // Called by the refresh method after the previous image has been transitioned out or at the same time // as the out transition when performing a synchronous transition. // @param {Object} imageData An object holding the image metadata of the image to build. // @param {Boolean} isSync Specifies whether the transitions are synchronized. buildImage: function(imageData, isSync) { var gallery = this; var nextIndex = this.getNextIndex(imageData.index); // Construct new hidden span for the image var newSlide = this.$imageContainer .append(' ') .find('span.current').css('opacity', '0'); newSlide.find('a') .append(imageData.image) .click(function(e) { gallery.clickHandler(e, this); }); var newCaption = 0; if (this.$captionContainer) { // Construct new hidden caption for the image newCaption = this.$captionContainer .append('') .find('span.current').css('opacity', '0') .append(imageData.caption); } // Hide the loading conatiner if (this.$loadingContainer) { this.$loadingContainer.hide(); } // Transition in the new image if (this.onTransitionIn) { this.onTransitionIn(newSlide, newCaption, isSync); } else { newSlide.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0); if (newCaption) newCaption.fadeTo(this.getDefaultTransitionDuration(isSync), 1.0); } if (this.isSlideshowRunning) { if (this.slideshowTimeout) clearTimeout(this.slideshowTimeout); this.slideshowTimeout = setTimeout(function() { gallery.ssAdvance(); }, this.delay); } return this; }, // Returns the current page index that should be shown for the currentImage getCurrentPage: function() { return Math.floor(this.currentImage.index / this.numThumbs); }, // Applies the selected class to the current image's corresponding thumbnail. // Also checks if the current page has changed and updates the displayed page of thumbnails if necessary. syncThumbs: function() { var page = this.getCurrentPage(); if (page != this.displayedPage) this.updateThumbs(); // Remove existing selected class and add selected class to new thumb var $thumbs = this.find('ul.thumbs').children(); $thumbs.filter('.selected').removeClass('selected'); $thumbs.eq(this.currentImage.index).addClass('selected'); return this; }, // Performs transitions on the thumbnails container and updates the set of // thumbnails that are to be displayed and the navigation controls. // @param {Delegate} postTransitionOutHandler An optional delegate that is called after // the thumbnails container has transitioned out and before the thumbnails are rebuilt. updateThumbs: function(postTransitionOutHandler) { var gallery = this; var transitionOutCallback = function() { // Call the Post-transition Out Handler if (postTransitionOutHandler) postTransitionOutHandler(); gallery.rebuildThumbs(); // Transition In the thumbsContainer if (gallery.onPageTransitionIn) gallery.onPageTransitionIn(); else gallery.show(); }; // Transition Out the thumbsContainer if (this.onPageTransitionOut) { this.onPageTransitionOut(transitionOutCallback); } else { this.hide(); transitionOutCallback(); } return this; }, // Updates the set of thumbnails that are to be displayed and the navigation controls. rebuildThumbs: function() { var needsPagination = this.data.length > this.numThumbs; // Rebuild top pager if (this.enableTopPager) { var $topPager = this.find('div.top'); if ($topPager.length == 0) $topPager = this.prepend('').find('div.top'); else $topPager.empty(); if (needsPagination) this.buildPager($topPager); } // Rebuild bottom pager if (this.enableBottomPager) { var $bottomPager = this.find('div.bottom'); if ($bottomPager.length == 0) $bottomPager = this.append('').find('div.bottom'); else $bottomPager.empty(); if (needsPagination) this.buildPager($bottomPager); } var page = this.getCurrentPage(); var startIndex = page*this.numThumbs; var stopIndex = startIndex+this.numThumbs-1; if (stopIndex >= this.data.length) stopIndex = this.data.length-1; // Show/Hide thumbs var $thumbsUl = this.find('ul.thumbs'); $thumbsUl.find('li').each(function(i) { var $li = $(this); if (i >= startIndex && i <= stopIndex) { $li.show(); } else { $li.hide(); } }); this.displayedPage = page; // Remove the noscript class from the thumbs container ul $thumbsUl.removeClass('noscript'); return this; }, // Returns the total number of pages required to display all the thumbnails. getNumPages: function() { return Math.ceil(this.data.length/this.numThumbs); }, // Rebuilds the pager control in the specified matched element. // @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt. buildPager: function(pager) { var gallery = this; var numPages = this.getNumPages(); var page = this.getCurrentPage(); var startIndex = page * this.numThumbs; var pagesRemaining = this.maxPagesToShow - 1; var pageNum = page - Math.floor((this.maxPagesToShow - 1) / 2) + 1; if (pageNum > 0) { var remainingPageCount = numPages - pageNum; if (remainingPageCount < pagesRemaining) { pageNum = pageNum - (pagesRemaining - remainingPageCount); } } if (pageNum < 0) { pageNum = 0; } // Prev Page Link if (page > 0) { var prevPage = startIndex - this.numThumbs; pager.append(''+this.prevPageLinkText+''); } // Create First Page link if needed if (pageNum > 0) { this.buildPageLink(pager, 0, numPages); if (pageNum > 1) pager.append(''); pagesRemaining--; } // Page Index Links while (pagesRemaining > 0) { this.buildPageLink(pager, pageNum, numPages); pagesRemaining--; pageNum++; } // Create Last Page link if needed if (pageNum < numPages) { var lastPageNum = numPages - 1; if (pageNum < lastPageNum) pager.append(''); this.buildPageLink(pager, lastPageNum, numPages); } // Next Page Link var nextPage = startIndex + this.numThumbs; if (nextPage < this.data.length) { pager.append(''+this.nextPageLinkText+''); } pager.find('a').click(function(e) { gallery.clickHandler(e, this); }); return this; }, // Builds a single page link within a pager. This function is called by buildPager // @param {jQuery} pager A jQuery element set matching the particular pager to be rebuilt. // @param {Integer} pageNum The page number of the page link to build. // @param {Integer} numPages The total number of pages required to display all thumbnails. buildPageLink: function(pager, pageNum, numPages) { var pageLabel = pageNum + 1; var currentPage = this.getCurrentPage(); if (pageNum == currentPage) pager.append(''+pageLabel+''); else if (pageNum < numPages) { var imageIndex = pageNum*this.numThumbs; pager.append(''+pageLabel+''); } return this; } }); // Now initialize the gallery $.extend(this, defaults, settings); // Verify the history plugin is available if (this.enableHistory && !$.historyInit) this.enableHistory = false; // Select containers if (this.imageContainerSel) this.$imageContainer = $(this.imageContainerSel); if (this.captionContainerSel) this.$captionContainer = $(this.captionContainerSel); if (this.loadingContainerSel) this.$loadingContainer = $(this.loadingContainerSel); // Initialize the thumbails this.initializeThumbs(); if (this.maxPagesToShow < 3) this.maxPagesToShow = 3; this.displayedPage = -1; this.currentImage = this.data[0]; var gallery = this; // Hide the loadingContainer if (this.$loadingContainer) this.$loadingContainer.hide(); // Setup controls if (this.controlsContainerSel) { this.$controlsContainer = $(this.controlsContainerSel).empty(); if (this.renderSSControls) { if (this.autoStart) { this.$controlsContainer .append('
'+this.pauseLinkText+'
'); } else { this.$controlsContainer .append('
'+this.playLinkText+'
'); } this.$controlsContainer.find('div.ss-controls a') .click(function(e) { gallery.toggleSlideshow(); e.preventDefault(); return false; }); } if (this.renderNavControls) { this.$controlsContainer .append('') .find('div.nav-controls a') .click(function(e) { gallery.clickHandler(e, this); }); } } var initFirstImage = !this.enableHistory || !location.hash; if (this.enableHistory && location.hash) { var hash = $.galleriffic.normalizeHash(location.hash); var imageData = allImages[hash]; if (!imageData) initFirstImage = true; } // Setup gallery to show the first image if (initFirstImage) this.gotoIndex(0, false, true); // Setup Keyboard Navigation if (this.enableKeyboardNavigation) { $(document).keydown(function(e) { var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; switch(key) { case 32: // space gallery.next(); e.preventDefault(); break; case 33: // Page Up gallery.previousPage(); e.preventDefault(); break; case 34: // Page Down gallery.nextPage(); e.preventDefault(); break; case 35: // End gallery.gotoIndex(gallery.data.length-1); e.preventDefault(); break; case 36: // Home gallery.gotoIndex(0); e.preventDefault(); break; case 37: // left arrow gallery.previous(); e.preventDefault(); break; case 39: // right arrow gallery.next(); e.preventDefault(); break; } }); } // Auto start the slideshow if (this.autoStart) this.play(); // Kickoff Image Preloader after 1 second setTimeout(function() { gallery.preloadInit(); }, 1000); return this; }; })(jQuery); /** * jQuery Opacity Rollover plugin * * Copyright (c) 2009 Trent Foley (http://trentacular.com) * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ ;(function($) { var defaults = { mouseOutOpacity: 0.67, mouseOverOpacity: 1.0, fadeSpeed: 'fast', exemptionSelector: '.selected' }; $.fn.opacityrollover = function(settings) { // Initialize the effect $.extend(this, defaults, settings); var config = this; function fadeTo(element, opacity) { var $target = $(element); if (config.exemptionSelector) $target = $target.not(config.exemptionSelector); $target.fadeTo(config.fadeSpeed, opacity); } this.css('opacity', this.mouseOutOpacity) .hover( function () { fadeTo(this, config.mouseOverOpacity); }, function () { fadeTo(this, config.mouseOutOpacity); }); return this; }; })(jQuery);