-1&&i(E[D]).length===0){this._debug("Your "+D+" found no elements.");return false}}return true},bind:function p(){this._binding("bind")},destroy:function C(){this.options.state.isDestroyed=true;return this._error("destroy")},pause:function e(){this._pausing("pause")},resume:function h(){this._pausing("resume")},beginAjax:function B(G){var E=this,I=G.path,F,D,K,J;G.state.currPage++;F=i(G.contentSelector).is("table")?i(""):i("");D=(typeof I==="function")?I(G.state.currPage):I.join(G.state.currPage);E._debug("heading into ajax",D);K=(G.dataType==="html"||G.dataType==="json")?G.dataType:"html+callback";if(G.appendCallback&&G.dataType==="html"){K+="+callback"}switch(K){case"html+callback":E._debug("Using HTML via .load() method");F.load(D+" "+G.itemSelector,k,function H(L){E._loadcallback(F,L,D)});break;case"html":E._debug("Using "+(K.toUpperCase())+" via $.ajax() method");i.ajax({url:D,dataType:G.dataType,complete:function H(L,M){J=(typeof(L.isResolved)!=="undefined")?(L.isResolved()):(M==="success"||M==="notmodified");if(J){E._loadcallback(F,L.responseText,D)}else{E._error("end")}}});break;case"json":E._debug("Using "+(K.toUpperCase())+" via $.ajax() method");i.ajax({dataType:"json",type:"GET",url:D,success:function(N,O,M){J=(typeof(M.isResolved)!=="undefined")?(M.isResolved()):(O==="success"||O==="notmodified");if(G.appendCallback){if(G.template!==k){var L=G.template(N);F.append(L);if(J){E._loadcallback(F,L)}else{E._error("end")}}else{E._debug("template must be defined.");E._error("end")}}else{if(J){E._loadcallback(F,N,D)}else{E._error("end")}}},error:function(){E._debug("JSON ajax request failed.");E._error("end")}});break}},retrieve:function b(F){F=F||null;var D=this,E=D.options;if(!!E.behavior&&this["retrieve_"+E.behavior]!==k){this["retrieve_"+E.behavior].call(this,F);return}if(E.state.isDestroyed){this._debug("Instance is destroyed");return false}E.state.isDuringAjax=true;E.loading.start.call(i(E.contentSelector)[0],E)},scroll:function f(){var D=this.options,E=D.state;if(!!D.behavior&&this["scroll_"+D.behavior]!==k){this["scroll_"+D.behavior].call(this);return}if(E.isDuringAjax||E.isInvalidPage||E.isDone||E.isDestroyed||E.isPaused){return}if(!this._nearbottom()){return}this.retrieve()},toggle:function y(){this._pausing()},unbind:function m(){this._binding("unbind")},update:function j(D){if(i.isPlainObject(D)){this.options=i.extend(true,this.options,D)}}};i.fn.infinitescroll=function d(F,G){var E=typeof F;switch(E){case"string":var D=Array.prototype.slice.call(arguments,1);this.each(function(){var H=i.data(this,"infinitescroll");if(!H){return false}if(!i.isFunction(H[F])||F.charAt(0)==="_"){return false}H[F].apply(H,D)});break;case"object":this.each(function(){var H=i.data(this,"infinitescroll");if(H){H.update(F)}else{H=new i.infinitescroll(F,G,this);if(!H.failed){i.data(this,"infinitescroll",H)}}});break}return this};var x=i.event,s;x.special.smartscroll={setup:function(){i(this).bind("scroll",x.special.smartscroll.handler)},teardown:function(){i(this).unbind("scroll",x.special.smartscroll.handler)},handler:function(G,D){var F=this,E=arguments;G.type="smartscroll";if(s){clearTimeout(s)}s=setTimeout(function(){i.event.handle.apply(F,E)},D==="execAsap"?0:100)}};i.fn.smartscroll=function(D){return D?this.bind("smartscroll",D):this.trigger("smartscroll",["execAsap"])}})(window,jQuery);
/*-----------------------------------------------------------------------------------*/
/* Preloader & Initialize Masonry Script
/*-----------------------------------------------------------------------------------*/
jQuery.noConflict();
jQuery('.ajaxloading').fadeIn(500);
jQuery(window).load(function(){
jQuery('.ajaxloading').fadeOut(500);
});
jQuery(window).load(function(){
jQuery(".slideshowpreload").fadeOut('slow');
});
/*-----------------------------------------------------------------------------------*/
/* Sticky Footer
/*-----------------------------------------------------------------------------------*/
(function($){
var footer;
$.fn.extend({
stickyFooter: function(options) {
footer = this;
positionFooter();
$(window)
.scroll(positionFooter)
.resize(positionFooter);
function positionFooter() {
var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
if(docHeight < $(window).height()){
var diff = $(window).height() - docHeight;
if (!$("#sticky-footer-push").length > 0) {
$(footer).before('');
}
$("#sticky-footer-push").height(diff);
}
}
}
});
})(jQuery);
jQuery("#footer").stickyFooter();
/*-----------------------------------------------------------------------------------*/
/* jQuery Isotope
/*-----------------------------------------------------------------------------------*/
if(jQuery().isotope) {
var $selectedthing,
$nextitem,
$previtem,
$nextId,
$prevId,
$filterstyle = 'Shuffle';
// Find Next Portfolio Posts Function
function findnext($this, $fade) {
if($this) {
if ($fade !== 'Fade') { // Check for filter style
$nextitem = $this.closest('.portfolioitem').next('.portfolioitem').find('a.homeportlink');
while ($nextitem.closest('.portfolioitem').hasClass('isotope-hidden') && $nextitem.length) {
$nextitem = $nextitem.closest('.portfolioitem').next('.portfolioitem').find('a.homeportlink');
}
} else {
$nextitem = $this.closest('.portfolioitem').next('.portfolioitem').find('a.homeportlink');
while ($nextitem.closest('.portfolioitem').find('.disable').css('display') === 'block' && $nextitem.length) {
$nextitem = $nextitem.closest('.portfolioitem').next('.portfolioitem').find('a.homeportlink');
}
}
}
return $nextitem;
}
// Find Previous Portfolio Posts Function
function findprev($this, $fade) {
if($this){
if ($fade !== 'Fade') { // Check for filter style
$previtem = $this.closest('.portfolioitem').prev('.portfolioitem').find('a.homeportlink');
while ($previtem.closest('.portfolioitem').hasClass('isotope-hidden') && $previtem.length) {
$previtem = $previtem.closest('.portfolioitem').prev('.portfolioitem').find('a.homeportlink');
}
} else {
$previtem = $this.closest('.portfolioitem').prev('.portfolioitem').find('a.homeportlink');
while ($previtem.closest('.portfolioitem').find('.disable').css('display') === 'block' && $previtem.length) {
$previtem = $previtem.closest('.portfolioitem').prev('.portfolioitem').find('a.homeportlink');
}
}
}
return $previtem;
}
function findprevnext($this, $filter, $fade) {
$nextitem = findnext($this, $filter);
$previtem = findprev($this, $filter);
if ($previtem) {
$prevId = $previtem.attr('data-url');
}
if ($nextitem) {
$nextId = $nextitem.attr('data-url');
}
if ($fade != 'none'){
if(typeof $prevId == 'string') {
jQuery('a#prev-port').stop().fadeIn(500);
} else {
jQuery('a#prev-port').stop().fadeOut(500);
}
if(typeof $nextId == 'string') {
jQuery('a#next-port').stop().fadeIn(500);
} else {
jQuery('a#next-port').stop().fadeOut(500);
}
} else {
if(typeof $prevId == 'string') {
jQuery('a#prev-port').stop().css('display', 'block');
} else {
jQuery('a#prev-port').stop().css('display', 'none');
}
if(typeof $nextId == 'string') {
jQuery('a#next-port').stop().css('display', 'block');
} else {
jQuery('a#next-port').stop().css('display', 'none');
}
}
}
var $selector = '*';
jQuery(window).load(function($){
var $container = jQuery('div.isotopecontainer');
$container.each(function($) {
var $this = jQuery(this),
columnNumber = $this.attr('data-value'),
isoBrick = jQuery('.isobrick'),
$colnum2;
isoBrick.css({
'margin-left': 0,
'margin-right': 0
});
/* Calculate column number */
/*====================================*/
if ($this.width() < 500 ) {
$colnum2 = 2;
} else {
$colnum2 = columnNumber;
}
/* Call Isotope with selected Columns */
/*====================================*/
if (columnNumber != '1') {
$this.isotope({
masonry: {
columnWidth: $this.width() / $colnum2
},
itemSelector : '.isobrick',
layoutMode : 'masonry'
});
}
/* Run Isotope on Resize Event */
/*=============================*/
jQuery(window).resize(function () {
if ($this.width() < 500 ) {
$colnum2 = 2;
} else {
$colnum2 = columnNumber;
}
if (columnNumber != '1') {
/* Resize Isotope Container */
$this.isotope({
// update columnWidth to a percentage of container width
masonry: {
columnWidth: $this.width() / $colnum2
},
itemSelector : '.isobrick',
layoutMode : 'masonry'
});
}
});
/* Filter when link is clicked */
/*=============================*/
jQuery('.filtershuffle a').click(function(){
jQuery('.filtershuffle li').removeClass("active");
jQuery(this).closest('li').addClass('active');
$selector = jQuery(this).attr('data-value');
jQuery('.filtershuffle a').each(function() {
$filterselect = jQuery(this).attr('data-value');
$filterselect = '.'+$filterselect;
if ($filterselect == '.'+$selector){
jQuery(this).addClass("active");
}
});
if ($selector != '*') {
$selector = '.'+$selector;
}
$this.isotope({ filter: $selector }, function() {
findprevnext($selectedthing, $filterstyle);
});
return false;
});
/* Run Infinite Scroll */
/*=============================*/
$this.infinitescroll({
navSelector : '.more-posts', // selector for the paged navigation
nextSelector : '.more-posts a', // selector for the NEXT link (to page 2)
itemSelector : '.isobrick', // selector for all items you'll retrieve
loading: {
finishedMsg: '',
img: 'http://localhost/identity/wp-content/themes/district/images/loader.gif',
msgText: ''
}
},
// call Isotope as a callback
function( newElements ) {
jQuery('.more-posts').fadeIn('slow');
$this.isotope( 'insert', jQuery( newElements ), function(){
$this.isotope('reLayout');
hover_overlay_portfolio();
});
}
);
// kill scroll binding for manual clicking of button
jQuery(window).unbind('.infscr');
jQuery('.more-posts a').click(function(){
jQuery(document).trigger('retrieve.infscr');
$this.infinitescroll('retrieve');
return false;
});
}); // End Each
}); // End Window Load
} // if isotope
/*-----------------------------------------------------------------------------------*/
/* Superfish Initialization
/*-----------------------------------------------------------------------------------*/
jQuery(function() {
jQuery('ul.sf-menu').superfish({
autoArrows: true
});
});
/*-----------------------------------------------------------------------------------*/
/* Tabs
/*-----------------------------------------------------------------------------------*/
if(jQuery() .tabs) {
jQuery( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
jQuery( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
jQuery( "#tabs" ).tabs({ fx: { opacity: 'toggle' } });
};
/*-----------------------------------------------------------------------------------*/
/* Pretty Photo
/*-----------------------------------------------------------------------------------*/
jQuery(function(){
jQuery("a[rel^='prettyPhoto']").prettyPhoto({
animation_speed: 'fast', /* fast/slow/normal */
slideshow: 5000, /* false OR interval time in ms */
autoplay_slideshow: false, /* true/false */
opacity: 0.80, /* Value between 0 and 1 */
show_title: false, /* true/false */
allow_resize: true, /* Resize the photos bigger than viewport. true/false */
default_width: 500,
default_height: 344,
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
horizontal_padding: 20, /* The padding on each side of the picture */
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
wmode: 'opaque', /* Set the flash wmode attribute */
autoplay: true, /* Automatically start videos: True/False */
modal: false, /* If set to true, only the close button will close the window */
deeplinking: true, /* Allow prettyPhoto to update the url to enable deeplinking. */
overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
callback: function(){}, /* Called when prettyPhoto is closed */
ie6_fallback: true
});
});
/*-----------------------------------------------------------------------------------*/
/* Hover Effects
/*-----------------------------------------------------------------------------------*/
function hover_overlay() {
jQuery('.flexslider .slides').each(function() {
var $this = jQuery(this),
$background = $this.closest('.portfolioitem');
$this.hover( function() {
$background.addClass('darkbg');
jQuery($this).stop().animate({opacity : 0.1}, 500);
}, function() {
jQuery($this).stop().animate({opacity : 1}, 500, function(){
$background.removeClass('darkbg');
});
});
});
}
hover_overlay();
function hover_overlay_slide() {
jQuery('.video').hover( function() {
jQuery(this).stop().animate({opacity : 1}, 100);
}, function() {
jQuery(this).stop().animate({opacity : .9}, 100);
});
}
hover_overlay_slide();
function hover_overlay_images() {
jQuery('a img').hover( function() {
jQuery(this).stop().animate({opacity : 0.7}, 500);
}, function() {
jQuery(this).stop().animate({opacity : 1}, 500);
});
}
hover_overlay_images();
/*-----------------------------------------------------------------------------------*/
/* Portfolio Mini Flexible Slideshow
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function() {
jQuery('.flexslider').each(function() {
var $this = jQuery(this);
$this.flexslider({
animation: "fade", //String: Select your animation type, "fade" or "slide"
slideDirection: "vertical", //String: Select the sliding direction, "horizontal" or "vertical"
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: Math.floor(Math.random()*10001) + 3000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationDuration: 2000, //Integer: Set the speed of animations, in milliseconds
directionNav: false, //Boolean: Create navigation for previous/next navigation? (true/false)
controlNav: false, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
keyboardNav: false, //Boolean: Allow slider navigating via keyboard left/right keys
mousewheel: false, //Boolean: Allow slider navigating via mousewheel
prevText: "Previous", //String: Set the text for the "previous" directionNav item
nextText: "Next", //String: Set the text for the "next" directionNav item
pausePlay: false, //Boolean: Create pause/play dynamic element
pauseText: 'Pause', //String: Set the text for the "pause" pausePlay item
playText: 'Play', //String: Set the text for the "play" pausePlay item
randomize: false, //Boolean: Randomize slide order
slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: true, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
controlsContainer: "", //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken.
manualControls: "", //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
end: function(){} //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
});
});
});
/*-----------------------------------------------------------------------------------*/
/* Scroll to Top by Andre Gagnon
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function() {
jQuery(window).scroll(function () {
var y_scroll_pos = window.pageYOffset;
var scroll_pos_test = 50; // set to whatever you want it to be
if(y_scroll_pos > scroll_pos_test) {
jQuery('.top').fadeIn(1000);
jQuery('.iphone').children('.top').css('display', 'none !important');
} else { jQuery('.top').fadeOut(500);
}
});
jQuery('.top').click(function(){
jQuery('html, body').animate({scrollTop:0}, 500, 'easeOutCubic');
return false;
});
});
/*-----------------------------------------------------------------------------------*/
/* Top Widgets Drawer by Andre Gagnon
/*-----------------------------------------------------------------------------------*/
jQuery(function($) {
var height = $('#top_panel_content').height();
$('#top_panel_button').click(function() {
var docHeight = $(document).height();
var windowHeight = $(window).height();
var scrollPos = docHeight - windowHeight + height;
$('#top_panel_content').animate({ height: "toggle"}, 500, 'easeOutCubic');
$('#toggle_button').toggleClass("downarrow");
jQuery('#top_panel').removeClass('active');
jQuery(this).addClass('active');
});
});
/*-----------------------------------------------------------------------------------*/
/* Ajax Load Post
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function($){
$.ajaxSetup({cache:false});
/* Declare Variables */
var ajaxouter = jQuery('#ajaxouter'), /* Outer Container (with data id = post id) */
url = jQuery('#ajaxinner').attr('data-url'), /* Set the post ID from the outer container */
$this = null,
$state = 'closed';
// Function to scroll the viewport
function scrollwindow($here) {
if ( $.browser.msie && $.browser.version == '7.0') {
$('html,body').parent().animate({scrollTop: $($here).offset().top}, 2000, 'easeOutCubic');
} else {
$('html,body').animate({scrollTop: $($here).offset().top}, 2000, 'easeOutCubic');
}
}
$(".flexslider ul.slides li a").live('click', function(e){ e.preventDefault();
/*Set Function Variables */
$this = $(this);
$selectedthing = $this;
$postId = $($this).attr('data-url');
// Find Previous and Next Portfolio Items
findprevnext($selectedthing, $filterstyle);
$('.ajaxloading').fadeIn(500);
// Scroll to the Loading Container
scrollwindow('#loadingcontainer');
if ($state !== 'closed'){
$('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
}
ajaxouter.load(url, {
id: $postId
},
function() {
if ($state == 'closed'){
$('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
/* If there's a previous */
if(typeof $prevId == 'string') {
$('a#prev-port').css('display', 'block');
} else {
$('a#prev-port').css('display', 'none');
}
/* If there's a Next*/
if(typeof $nextId == 'string') {
$('a#next-port').css('display', 'block');
} else {
$('a#next-port').css('display', 'none');
}
$state = 'open';
} else {
$('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
/* If there's a previous */
if(typeof $prevId == 'string') {
$('a#prev-port').css('display', 'block');
} else {
$('a#prev-port').css('display', 'none');
}
/* If there's a Next*/
if(typeof $nextId == 'string') {
$('a#next-port').css('display', 'block');
} else {
$('a#next-port').css('display', 'none');
}
}
$('.ajaxloading').fadeOut(500);
}
);
return false;
});
jQuery('a#next-port').live('click', function(e){ e.preventDefault();
if(typeof $nextId == 'string') {
jQuery('.ajaxloading').fadeIn(500);
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
ajaxouter.load(url, { id: $nextId },
function() {
$this = $nextitem;
$selectedthing = $this;
findprevnext($selectedthing, $filterstyle, 'none');
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
jQuery('.ajaxloading').fadeOut(500);
});
}
});
jQuery('a#prev-port').live('click', function(e){ e.preventDefault();
if(typeof $prevId == 'string') {
jQuery('.ajaxloading').fadeIn(500);
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
ajaxouter.load(url, { id: $prevId },
function() {
$this = $previtem;
$selectedthing = $this;
findprevnext($selectedthing, $filterstyle, 'none');
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
jQuery('.ajaxloading').fadeOut(500);
});
}
});
jQuery('a.portfolio-close').live('click', function(e){
e.preventDefault();
$state = 'closed';
// Scroll to the Loading Container
scrollwindow('body');
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic', function(){
jQuery('.ajaxslider').remove(); // so videos stop playing
});
});
});
/*-----------------------------------------------------------------------------------*/
/* Fade Filter Portfolio
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function() {
jQuery('ul.filterfade a').click(function() {
var HasBeenViewed = false;
jQuery(this).css('outline','none');
jQuery('ul.filter .active').removeClass('active');
jQuery(this).parent().addClass('active');
var filterVal = jQuery(this).text().toLowerCase().replace(' ','-').replace(' ','-').replace(' ','-').replace(' ','-').replace(' ','-').replace(' ','-');
if(jQuery(this).hasClass('filterall')) {
jQuery('.portfolioitem .disable').stop().animate({opacity: 0}, 500, function(){
jQuery(this).css('display', 'none');
//Check for previous and next arrows
window.setTimeout(function() {
if(!HasBeenViewed) {
findprevnext($selectedthing, $filterstyle);
HasBeenViewed = true;
}
}, 501);
});
} else {
jQuery('.portfolioitem .disable').each(function() {
if(!jQuery(this).hasClass(filterVal)) {
jQuery(this).css('display', 'block');
jQuery(this).stop().animate({opacity: .95}, 500, function(){
//Check for previous and next arrows
window.setTimeout(function() {
if(!HasBeenViewed) {
findprevnext($selectedthing, $filterstyle);
HasBeenViewed = true;
}
}, 501);
});
} else {
jQuery(this).stop().animate({opacity: 0}, 500, function(){
jQuery(this).css('display', 'none');
//Check for previous and next arrows
window.setTimeout(function() {
if(!HasBeenViewed) {
findprevnext($selectedthing, $filterstyle);
HasBeenViewed = true;
}
}, 501);
});
}
});
}
return false;
});
});
/*-----------------------------------------------------------------------------------*/
/* Portfolio Flexible Slider
/*-----------------------------------------------------------------------------------*/
jQuery('.projectslideshow').wmuSlider({
animation: 'fade',
animationDuration: 600,
slideshow: true,
slideshowSpeed: 5000,
slideToStart: 0,
navigationControl: true,
paginationControl: true,
previousText: 'Previous',
nextText: 'Next',
touch: true,
slide: 'span'
});
/*-----------------------------------------------------------------------------------*/
/* FitVid Fluid Video
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function(){
jQuery(".videocontainer").fitVids();
});
/*-----------------------------------------------------------------------------------*/
/* Coda Slider
/*-----------------------------------------------------------------------------------*/
if(jQuery() .codaSlider){
jQuery('#coda-slider-1').codaSlider({
dynamicArrows: false,
dynamicTabs: false
});
};
/*-----------------------------------------------------------------------------------*/
/* Form Validation
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function(){
jQuery("#contactform").validate();
jQuery("#quoteform").validate();
jQuery("#quickform").validate();
jQuery("#commentsubmit").validate();
});