jQuery.noConflict();
var narrow = false;
function relocateSocial() {
if (jQuery(window).width() < 770 && narrow == false) {
narrow = true;
var mobArray = new Array();
var atArray = new Array();
jQuery(".sn_mobile_placeholder").each(function(index, el){
mobArray.push(jQuery(el));
});
jQuery(".addthis_toolbox").each(function(index, el){
atArray.push(jQuery(el));
});
jQuery.each(mobArray, function(i, el) {
jQuery(el).children("div").replaceWith(jQuery(atArray[i]));
});
}
if (jQuery(window).width() > 770 && narrow == true) {
narrow = false;
var smallArray = new Array();
var atArray = new Array();
jQuery(".sn_small_placeholder").each(function(index, el){
smallArray.push(jQuery(el));
});
jQuery(".addthis_toolbox").each(function(index, el){
atArray.push(jQuery(el));
});
jQuery.each(smallArray, function(i, el) {
jQuery(el).children("div").replaceWith(jQuery(atArray[i]));
});
}
};
var resizeTimer = null;
var resizeDiscsTimer = null;
jQuery(window).bind('resize', function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(relocateSocial, 100);
if (resizeDiscsTimer) clearTimeout(resizeDiscsTimer);
resizeTimer = setTimeout(function(){resizeDisciplines()}, 100);
});
relocateSocial();
jQuery("ul.sf-menu li:nth-child(3) ul.sub-menu li a").prepend("");
/*-----------------------------------------------------------------------------------*/
/* Preloader & Initialize Masonry Script
/*-----------------------------------------------------------------------------------*/
jQuery('.ajaxloading').fadeIn(500);
jQuery(window).load(function(){
jQuery('.ajaxloading').fadeOut(500);
});
jQuery(window).load(function(){
jQuery(".slideshowpreload").fadeOut('slow');
});
/*-----------------------------------------------------------------------------------*/
/* 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' } });
};
/*-----------------------------------------------------------------------------------*/
/* Hover Effects
/*-----------------------------------------------------------------------------------*/
function hover_overlay() {
jQuery('.flexslider .slides').each(function() {
var $this = jQuery(this);
$this.hover( function() {
jQuery($this).stop().animate({opacity : 0.1}, 500);
}, function() {
jQuery($this).stop().animate({opacity : 1}, 500);
});
});
}
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 : .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)
});
});
/*-----------------------------------------------------------------------------------*/
/* Twitter Image Hovers
/*-----------------------------------------------------------------------------------*/
jQuery(".twMedia[alt!='era404']").hover(function(){
console.log("attr: "+$(this).attr("alt"));
var img = jQuery(this).attr("data-url");
jQuery(this).parent().prepend("");
jQuery(".twImage").fadeIn("slow");
}, function(){
jQuery(".twImage").clearQueue().stop().fadeOut("fast", function(){
jQuery(this).remove();
});
});
});
/*-----------------------------------------------------------------------------------*/
/* 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) */
var url = jQuery('#ajaxinner').attr('data-url'); /* Set the post ID from the outer container */
var $postId = null;
var $nextitem = null;
var $nextId = null;
var $prevId = null;
var $this = null;
var $state = 'closed';
$(".flexslider ul.slides li a").live('click', function(e){ e.preventDefault();
/*Set Function Variables */
$this = $(this);
$postId = $($this).attr('data-url'); //alert("Post ID: "+$postId);
$nextitem = $($this).closest('.portfolioitem').next('.portfolioitem').find('a');
$previtem = $($this).closest('.portfolioitem').prev('.portfolioitem').find('a');
$prevId = $($this).closest('.portfolioitem').prev('.portfolioitem').find('a').attr('data-url');
$nextId = $($this).closest('.portfolioitem').next('.portfolioitem').find('a').attr('data-url');
$('.ajaxloading').fadeIn(500);
if ( $.browser.msie && $.browser.version == '7.0') {
$('html,body').parent().animate({scrollTop: $('#loadingcontainer').offset().top}, 2000, 'easeOutCubic');
} else {
$('html,body').animate({scrollTop: $('#loadingcontainer').offset().top}, 2000, 'easeOutCubic');
}
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);
initTips();
showPortfolio();
}
);
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;
$previtem = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a');
$nextitem = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a');
$prevId = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a').attr('data-url');
$nextId = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a').attr('data-url');
/* If there's a Next*/
if(typeof $nextId == 'string') {
jQuery('a#next-port').css('display', 'block');
} else {
jQuery('a#next-port').css('display', 'none');
}
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
jQuery('.ajaxloading').fadeOut(500);
initTips();
showPortfolio();
});
}
});
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;
$previtem = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a');
$nextitem = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a');
$prevId = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a').attr('data-url');
$nextId = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a').attr('data-url');
/* If there's a previous */
if(typeof $prevId == 'string') {
jQuery('a#prev-port').css('display', 'block');
} else {
jQuery('a#prev-port').css('display', 'none');
}
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
jQuery('.ajaxloading').fadeOut(500);
initTips();
showPortfolio();
});
}
});
jQuery('a.portfolio-close').live('click', function(e){
e.preventDefault();
$state = 'closed';
if ( jQuery.browser.msie && jQuery.browser.version == '7.0' ) {
jQuery('html,body').parent().animate({scrollTop: jQuery('body').offset().top}, 2000, 'easeOutCubic');
} else {
jQuery('html,body').animate({scrollTop: jQuery('body').offset().top}, 2000, 'easeOutCubic');
}
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic', function(){
jQuery('.ajaxslider').remove(); // so videos stop playing
});
});
$this = jQuery('.slideshow .portfolioitem:first').children('div.flexslider').children('ul.slides').children('li:first').children('a');
$initialopen = jQuery($this).attr('data-url');
$postId = $initialopen;
$nextitem = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a');
$previtem = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a');
$prevId = jQuery($this).closest('.portfolioitem').prev('.portfolioitem').find('a').attr('data-url');
$nextId = jQuery($this).closest('.portfolioitem').next('.portfolioitem').find('a').attr('data-url');
jQuery('.ajaxloading').fadeIn(500);
ajaxouter.load(url, {
id: $initialopen
},
function() {
if ($state == 'closed'){
jQuery('#ajaxcontainer').animate({ height: "toggle"}, 500, 'easeOutCubic');
$state = 'open';
jQuery('a#prev-port').css('display', 'none');
jQuery('.ajaxloading').fadeOut(500);
initTips();
showPortfolio();
} // endif
} //end function
); //ajaxouter
});
/*-----------------------------------------------------------------------------------*/
/* Filter Portfolio
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function() {
jQuery('ul.filter a').click(function() {
jQuery(this).css('outline','none');
jQuery('ul.filter .active').removeClass('active');
jQuery(this).parent().addClass('active');
/* var filterVal = jQuery(this).text().toLowerCase().replace(' ','-'); */
var filterVal = jQuery(this).attr("rel").toLowerCase().replace(' ','-');
if(jQuery(this).hasClass('filterall')) {
jQuery('.portfolioitem .disable').stop().animate({opacity: 0}, 500, function(){
jQuery(this).css('display', 'none');
});
} else {
jQuery('.portfolioitem .disable').each(function() {
if(!jQuery(this).hasClass(filterVal)) {
jQuery(this).css('display', 'block');
jQuery(this).stop().animate({opacity: .95}, 500);
} else {
jQuery(this).stop().animate({opacity: 0}, 500, function(){jQuery(this).css('display', 'none');});
}
});
}
return false;
});
});
/*-----------------------------------------------------------------------------------*/
/* Portfolio Flexible Slider
/*-----------------------------------------------------------------------------------*/
jQuery('.projectslideshow').wmuSlider({
animation: 'fade',
animationDuration: 600,
slideshow: true,
slideshowSpeed: 7000,
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();
showPortfolio();
// Show Disciplines on top of Portfolio pages
setTimeout(showDisciplines, 2000);
jQuery("#does div.close a, div.pagename h3").click(function(e){
e.preventDefault();
showDisciplines();
});
});
/*-----------------------------------------------------------------------------------*/
/* Force slideshows to start initially collapsed (see .wmuSliderWrapper in style.css)
/*-----------------------------------------------------------------------------------*/
function showPortfolio(){
//alert("Length: "+jQuery('.wmuSliderWrapper').length()+".");
jQuery(".wmuSliderWrapper").children("span").children("a").children("img").css({"display": "block", "opacity": "0"});
jQuery(".wmuSliderWrapper").children("span").children("a").children("img").animate({"opacity": "1"}, 1000);
jQuery(".wmuSliderWrapper").children("span").css({"height": "auto"});
};
/*-----------------------------------------------------------------------------------*/
/* Force disciplinary container to start initially collapsed and expand when loaded
/*-----------------------------------------------------------------------------------*/
function showDisciplines(){
var newH = getDisciplineHeight(jQuery("#doescon").height());
jQuery("#doescon").css({opacity: 1});
if (jQuery("#doescon").height() > 10){
var st = jQuery(document).scrollTop() - newH;
jQuery('html,body').animate({scrollTop: st}, 500);
jQuery("#doescon").animate({height: 0}, 500);
}else{
if(jQuery(document).scrollTop() < 180){
jQuery("#doescon").animate({height: newH+"px"}, 1000);
}
}
};
// Resize when changing browser dimensions (resize, reorient, etc.)
function resizeDisciplines(){
var h = jQuery("#doescon").height();
if (h > 0){
var newH = getDisciplineHeight(h);
var st = jQuery(document).scrollTop() - (h - newH);
jQuery('html,body').clearQueue().animate({scrollTop: st}, 500);
jQuery("#doescon").clearQueue().animate({height: newH+"px"}, 500);
}
};
function getDisciplineHeight(h){
jQuery("#doescon").css("height", "inherit");
var _h = jQuery("#doescon").height();
jQuery("#doescon").css({position: "relative", height: h+"px"});
return _h;
}
/*-----------------------------------------------------------------------------------*/
/* Show tooltips on disciplines (https://github.com/jaz303/tipsy)
/*-----------------------------------------------------------------------------------*/
jQuery(document).ready(function(){
initTips();
});
function initTips(){
// triggered on document ready and at the end of slideshow inits;
jQuery(function() {
jQuery('.mytip a').tipsy({fade: true, gravity: 's'});
});
}