// GENERAL BEHAVIOUR //
$(function() {
$.each($('.wp-caption img'), function() {
$(this).one("load",function(){
var imgWidth = $(this) .width();
$(this) .parent() .css('width', imgWidth);
})
.each(function(){
if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 9)) $(this).trigger("load");
});
});
$.each($('a.load-img img'), function() {
$(this) .after('');
});
$('a.load-img img').one("load",function(){
$(this) .parent() .find('span.img-load-wrap') .css('display', 'none');
$(this) .hide() .fadeIn();
})
.each(function(){
if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 9)) $(this).trigger("load");
});
$.each($('a.zoom-img img'), function() {
$(this) .after('');
$(this) .parent() .find('span.zoom-wrap') .css('display', 'none');
});
$.each($('a.play-img img'), function() {
$(this) .after('');
$(this) .parent() .find('span.play-wrap') .css('display', 'none');
});
$.each($('a.read-img img'), function() {
$(this) .after('');
$(this) .parent() .find('span.read-wrap') .css('display', 'none');
});
$.each($('.pull-right, .pull-left'), function() {
$(this) .next('p') .replaceWith('' + $(this).next('p').text() + '');
});
$('.featured-item:last, div.latest-news-item:last') .css({'border' : 'none', 'marginBottom' : '0px'});
$.each($('.popular-posts-list, .recent-tweets, .widget-list, .sidebar-widget ul, #sidebar-menu, #sidebar-menu li ul, #sidebar-menu li ul li ul, ul.menu, ul.menu li ul, #big-footer #recentcomments, #big-footer .widget_recent_entries ul, #big-footer .widget_recent_entries ul, #big-footer .widget_alt_style .widget_archive ul, #big-footer .widget_alt_style .widget_categories ul, #big-footer .widget_alt_style .widget_links ul, #big-footer .widget_alt_style .widget_meta ul, #big-footer .widget_alt_style .widget_pages ul'), function() {
$(this) .find('li:last') .css({'border' : 'none', 'marginBottom' : '0px'});
});
});
// MBIZ SLIDER //
(function($){
$.fn.mbizslider = function(options) {
var defaults = {
autoRotate: true,
interval: 6000
},
settings = $.extend({}, defaults, options);
slidesCount = $('#mbiz-slides .mbiz-slide-bg') .length;
i = 1;
var mbizSlide = '#mbiz-slides .mbiz-slide-bg';
$(mbizSlide + ':first') .addClass('first');
$(mbizSlide + ':last') .addClass('last');
$('#mbiz-slides .mbiz-slide-img') .hide();
$(mbizSlide + ':not(:first)') .css('display', 'none');
$('#mbiz-slides .mbiz-slide-info') .css('top', '-370px');
//$(mbizSlide + ':first .mbiz-slide-img') .css('top', '370px');
//$('#mbiz-slides') .css('overflow', 'hidden');
while (i <= slidesCount) {
$('#mbiz-slider-nav') .append('');
i++;
}
$(mbizSlide + ':first img.mbiz-slide-bg-img') .one("load",function(){
//firstslideIMG = $(mbizSlide + ':first .mbiz-slide-img img') .length;
if ($(mbizSlide + ':first .mbiz-slide-img img') .length != 0) {
$(mbizSlide + ':first .mbiz-slide-img img') .one("load",function(){
showSlides();
}) .each(function(){
if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 9)) $(this).trigger("load");
});
} else {
showSlides();;
}
if(settings.autoRotate) {
MbizPause = 0;
$('#mbiz-pause') .click(function() {
if (MbizPause == 0) {
MbizPause = 1;
$(this) .css('backgroundPosition', 'center bottom');
} else if (MbizPause == 1) {
MbizPause = 0;
$(this) .css('backgroundPosition', 'center top');
};
});
}
function showSlides() {
$.each($(mbizSlide), function() {
var mbizSlideBG = $(this) .find('img.mbiz-slide-bg-img') .attr('src');
$(this) .css("background-image", "url("+mbizSlideBG+")");
});
$(mbizSlide + ':first .mbiz-slide-info') .animate({'top' : '10px'}, 600);
$(mbizSlide + ':first .mbiz-slide-img') .fadeIn(); //.animate({'top' : '0px'}, 600);
$('.slide-img-has-border .slide-img-border') .css('border', '7px solid #000');
$('#mbiz-slider-nav span:first') .css('backgroundPosition', 'center bottom');
$('#mbiz-slides') .css('backgroundImage', 'none');
// Auto Rotator //
if(settings.autoRotate) { autoRotate = 1; } else { autoRotate = 0; }
var $autoR;
var rotatorInterval = setInterval(function() {
if (autoRotate) {
$autoR = $(mbizSlide + ':visible');
$currNavIndex = $autoR .index();
$currNav = $('#mbiz-slider-nav span:eq('+$currNavIndex+')');
if ($autoR .hasClass('last')) {
$autoR = $(mbizSlide + ':first');
$currNav .css('backgroundPosition', 'center top');
$currNav = $('#mbiz-slider-nav span:first');
} else {
$autoR = $autoR.next();
$currNav .css('backgroundPosition', 'center top');
$currNav = $currNav.next();
}
$(mbizSlide + ':visible .mbiz-slide-info') .animate({'top' : '-370px'}, 100);
$(mbizSlide + ':visible .mbiz-slide-img') .hide();
$(mbizSlide + ':visible') .hide();
$autoR .fadeIn();
//setTimeout(function() {
$autoR .find('.mbiz-slide-info') .animate({'top' : '10px'}, 300);
$autoR .find('.mbiz-slide-img') .fadeIn();
//}, 700);
$currNav .css('backgroundPosition', 'center bottom');
}
if(settings.autoRotate) {
$('#pre-body-area') .hover(function() {
autoRotate = 0;
$('#mbiz-pause') .show();
}, function() {
if (MbizPause == 0) {autoRotate = 1};
$('#mbiz-pause') .hide();
});
}
}, settings.interval);
} // end function showSlides
// ------------ //
}) .each(function(){
if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 9)) $(this).trigger("load");
});
$('#mbiz-slider-nav span') .click(function() {
if(settings.autoRotate) {
$('#pre-body-area') .hover(function() {
autoRotate = 0;
}, function() {
if (MbizPause == 0) {autoRotate = 1};
});
}
slideIndex = $(this) .index();
$('#mbiz-slider-nav span') .css('backgroundPosition', 'center top');
$(this) .css('backgroundPosition', 'center bottom');
$(mbizSlide + ':visible .mbiz-slide-info') .animate({'top' : '-370px'}, 100);
$(mbizSlide + ':visible .mbiz-slide-img') .hide();
$(mbizSlide + ':visible') .hide();
$(mbizSlide + ":eq("+slideIndex+")") .fadeIn();
//setTimeout(function() {
$(mbizSlide + ":eq("+slideIndex+") .mbiz-slide-info") .animate({'top' : '10px'}, 300);
$(mbizSlide + ":eq("+slideIndex+") .mbiz-slide-img") .fadeIn();
//}, 700);
});
}
})(jQuery);
// Slider fixed image
$(function() {
$('.fixed-slider-loader') .css('display', 'block');
$('img.fixed-slide-bg-img').one("load",function() {
$('.fixed-slider-loader') .fadeOut();
$('img.fixed-slide-bg-img') .remove();
})
.each(function(){
if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 9)) $(this).trigger("load");
});
});
// LOGIN FROM //
$(function() {
$('#login-button') .click(function() {
$('#login-box') .slideDown(100);
});
$('#close-login') .click(function() {
$('#login-box') .slideUp(100);
});
});
// LOGO DESCRIPTION //
$(function() {
$('#logo') .mouseover(function() {
$('#logo-desc') .stop() .animate({'opacity' : '1', 'marginLeft' : '5px'}, 100);
$('#logo-desc') .css('display', 'block');
});
$('#logo') .mouseout(function() {
$('#logo-desc') .stop() .animate({'opacity' : '0', 'marginLeft' : '0px'}, 300);
$('#logo-desc') .css('display', 'none');
});
});
// MAIN MENU //
$(function() {
$('#main-menu li ul') .parent() .children('a') .addClass('has-submenu');
$('#main-menu li').hoverIntent(function() {
$(this) .children('ul') .stop(true, true) .slideDown(100);
}, function() {
$(this) .children('ul') .stop(true,true) .slideUp(80);
});
$('#main-menu li') .find('li.current-menu-item') .parents('li') .addClass('current-parent');
$('#main-menu li ul li ul') .parent() .addClass('sub-has-sub');
});
// SIDEBAR MENU //
$(function() {
$('#sidebar-menu li ul') .parent() .children('a') .addClass('has-submenu');
$('#sidebar-menu li').hoverIntent(function() {
$(this) .children('ul') .stop(true, true) .slideDown(100);
}, function() {
$(this) .children('ul') .stop(true,true) .slideUp(80);
});
$('#sidebar-menu li.current-menu-item') .children('a') .addClass('current-a');
$('#sidebar-menu li.current-menu-item') .parents('li') .children('a') .addClass('current-parent');
//-----------------//
$('ul.menu li ul') .parent() .children('a') .addClass('has-submenu');
$('ul.menu li').hoverIntent(function() {
$(this) .children('ul') .stop(true, true) .slideDown(100);
}, function() {
$(this) .children('ul') .stop(true,true) .slideUp(80);
});
$('ul.menu li.current-menu-item') .children('a') .addClass('current-a');
$('ul.menu li.current-menu-item') .parents('li') .children('a') .addClass('current-parent');
});
// SHARE THIS //
$(function() {
$('.share-this-wrap') .mouseover(function() {
$('#share-social-icons') .stop() .animate({'opacity' : '1', 'marginLeft' : '10px'}, 100);
$('#share-social-icons') .css('visibility', 'visible');
});
$('.share-this-wrap') .mouseout(function() {
$('#share-social-icons') .stop() .animate({'opacity' : '0', 'marginLeft' : '5px'}, 300);
$('#share-social-icons') .css('visibility', 'hidden');
});
});
// PORTFOLIOS //
$(function() {
$('.portfolio-post-wrap .portfolio-post-info') .css('display', 'none');
$('.scrollable') .css('overflow', 'hidden');
$('#portfolio-nav') .css('display', 'block');
var portfolioLength = $('.portfolio-page') .length;
i = 1;
$('span.portfolio-length').replaceWith("OF "+portfolioLength+"");
$('.next-portfolio') .click(function() {
i++;
$('.portfolio-count') .contents() .remove();
$('.portfolio-count') .append(i);
});
$('.prev-portfolio') .click(function() {
i--;
$('.portfolio-count') .contents() .remove();
$('.portfolio-count') .append(i);
});
$('.portfolio-post-2columns') .css({'minHeight' : 'none', 'maxHeight' : 'none'});
$('.text-out-2col') .css({'minHeight' : 'none', 'maxHeight' : 'none'});
$('.portfolio-post-3columns') .css({'minHeight' : 'none', 'maxHeight' : 'none'});
$('.text-out-3col') .css({'minHeight' : 'none', 'maxHeight' : 'none'});
var portfolio2Length = $('.portfolio-post-2columns') .length;
i2 = 1;
if (portfolio2Length > 1) {
while (i2 < portfolio2Length) {
$(".portfolio-post-2columns:eq("+i2+")") .after('
');
i2 = i2 + 2;
};
};
var portfolio3Length = $('.portfolio-post-3columns') .length;
i3 = 2;
if (portfolio3Length > 2) {
while (i3 < portfolio3Length) {
$(".portfolio-post-3columns:eq("+i3+")") .after('
');
i3 = i3 + 3;
};
};
$('.portfolio-post-2columns') .hover(function() {
$(this) .find('div.portfolio-post-info') .show();
}, function() {
$('.portfolio-post-info') .stop(true, true) .fadeOut(200);
});
$('.portfolio-post-3columns') .hover(function() {
$(this) .find('div.portfolio-post-info') .show();
}, function() {
$('.portfolio-post-info') .stop(true, true) .fadeOut(200);
});
});
// TABS //
$(function() {
$.each($('.tabs-style1 .tabs-navigation'), function() {
$(this) .find('li:first') .addClass('current-tab');
});
$.each($('.tabs-style1 .tabs-content, .tabs-style1 .tabs-content-nostyle'), function() {
$(this) .children('br') .remove();
$(this) .children('div:not(:first)') .hide();
});
$('.tabs-style1 .tabs-nav li') .click(function() {
var clickedTab = $(this) .find('a') .attr('title');
$(this) .parent() .children('.tabs-nav li') .removeClass('current-tab');
$(this) .addClass('current-tab');
$(this) .parent() .parent() .parent() .find('.tabs-content, .tabs-content-nostyle') .children('div') .slideUp(50);
$(this) .parent() .parent() .parent() .find('.tabs-content .'+clickedTab) .slideDown(100);
$(this) .parent() .parent() .parent() .find('.tabs-content-nostyle .'+clickedTab) .slideDown(100);
return false;
});
});
// H5 TABS //
$(function() {
$('.tabs-posts .fancy-header a:first') .addClass('current-title');
$('.tabs-posts .tabs-content') .children('div:not(:first)') .hide();
$('.tabs-posts .fancy-header a') .click(function() {
var clickedTab = $(this) .attr('title');
$(this) .parent() .children('a') .removeClass('current-title');
$(this) .addClass('current-title');
$(this) .parent() .parent() .parent() .find('.tabs-content') .children('div') .hide();
$(this) .parent() .parent() .parent() .find('.tabs-content .'+clickedTab) .slideDown();
return false;
});
});
// Toggles //
$(function() {
$('.faq-block') .children('p, br') .remove();//.next('p, br') .remove();
$('.faq-answer, .toggle-content') .css('display', 'none');
$.each($('.toggle-block'), function() {
$(this) .children('br') .remove();
});
$('.faq-q, .toggle-t') .click(function() {
$(this) .toggleClass('toggle-open');
$(this) .next('.faq-answer, .toggle-content') .slideToggle(100);
});
$('.toggle-block .box-title-style-1, .toggle-block .box-title-style-2') .click(function() {
$(this) .next('.toggle-block .box-text') .slideToggle(100);
});
$('.toggle-block .box-title-style-1, .toggle-block .box-title-style-2') .hover(function() {
$(this) .prev('span.handle') .css('display', 'block');
}, function() {
$(this) .prev('span.handle') .css('display', 'none');
});
});
// Zoom, paly, read, flickr icons //
$(function() {
$('a.zoom-img') .hover(function() {
$(this) .find('span.zoom-wrap') .css('display', 'block');
$(this) .find('span.zoom-wrap') .hide() .slideDown(250);
}, function() {
$(this) .find('span.zoom-wrap') .slideUp(200);
});
$('a.play-img') .hover(function() {
$(this) .find('span.play-wrap') .css('display', 'block');
$(this) .find('span.play-wrap') .hide() .slideDown(250);
}, function() {
$(this) .find('span.play-wrap') .slideUp(200);
});
$('a.read-img') .hover(function() {
$(this) .find('span.read-wrap') .css('display', 'block');
$(this) .find('span.read-wrap') .hide() .slideDown(250);
}, function() {
$(this) .find('span.read-wrap') .slideUp(200);
});
$('.video-lightbox') .hover(function() {
$(this) .find('span.play-lightbox-wrap') .css('opacity', '0.8');
}, function() {
$(this) .find('span.play-lightbox-wrap') .css('opacity', '0.6');
});
});
// FOOTER //
$(function() {
var footer1Length = $('.col-option1 .footer-column') .length;
var footer2Length = $('.col-option2 .footer-column') .length;
var footer3Length = $('.col-option3 .footer-column') .length;
var footer4Length = $('.col-option4 .footer-column') .length;
var footer5Length = $('.col-option5 .footer-column') .length;
i1footer = 0;
i2footer = 1;
i3footer = 2;
i4footer = 3;
i5footer = 4;
if (footer1Length > 1) {
while (i1footer < footer1Length) {
$(".col-option1 .footer-column:eq("+i1footer+")") .after('
');
i1footer = i1footer + 1;
};
};
if (footer2Length > 2) {
while (i2footer < footer2Length) {
$(".col-option2 .footer-column:eq("+i2footer+")") .after('
');
i2footer = i2footer + 2;
};
};
if (footer3Length > 3) {
while (i3footer < footer3Length) {
$(".col-option3 .footer-column:eq("+i3footer+")") .after('
');
i3footer = i3footer + 3;
};
};
if (footer4Length > 4) {
while (i4footer < footer4Length) {
$(".col-option4 .footer-column:eq("+i4footer+")") .after('
');
i4footer = i4footer + 4;
};
};
if (footer5Length > 5) {
while (i5footer < footer5Length) {
$(".col-option5 .footer-column:eq("+i5footer+")") .after('
');
i5footer = i5footer + 5;
};
};
$('.col-option5-4 .footer-column:eq(3)') .css('width', '354');
$('.col-option54- .footer-column:eq(0)') .css('width', '354');
$('.col-option4-3 .footer-column:eq(2)') .css('width', '440');
$('.col-option43- .footer-column:eq(0)') .css('width', '440');
});
// Contact Form //
$(function() {
var templatePath = $('.contact-form') .attr('title');
$.each($('.contact-form'), function() {
$(this) .attr('title', '');
});
$('.submitemail') .click(function(visitoremail) {
var $this = $(this) .parent() .parent();
var visitorname = $this .find('input.visitorname') .val();
var visitoremail = $this .find('input.visitoremail') .val();
var visitormessage = $this .find('textarea.visitormessage') .val();
var thedawnfield = $this .find('input.theDawnfield') .val();
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
var validEmail = emailPattern.test(visitoremail);
if (visitorname.length < 2 || visitorname == 'Name') {
$this .find('input.visitorname') .effect('shake', { times:2, distance:10 }, 100);
$this .find('input.visitorname') .animate({'borderColor' : '#cc0f16'}, 500, function() {
$this .find('input.visitorname') .delay(1000) .animate({'borderColor' : '#e1e4e9'}, 500);
});
var nameValid = 'NO';
} else if (visitoremail == '' || validEmail == false) {
$this .find('input.visitoremail') .effect('shake', { times:2, distance:10 }, 100);
$this .find('input.visitoremail') .animate({'borderColor' : '#cc0f16'}, 500, function() {
$this .find('input.visitoremail') .delay(1000) .animate({'borderColor' : '#e1e4e9'}, 500);
});
var emailValid = 'NO';
} else if (visitormessage.length < 2) {
$this .find('textarea.visitormessage') .effect('shake', { times:2, distance:10 }, 100);
$this .find('textarea.visitormessage') .animate({'borderColor' : '#cc0f16'}, 500, function() {
$this .find('textarea.visitormessage') .delay(1000) .animate({'borderColor' : '#e1e4e9'}, 500);
});
var messageValid = 'NO';
}
if ( nameValid != 'NO' && emailValid != 'NO' && messageValid != 'NO' && thedawnfield == '' ) {
$this .find('.contact-form-loader') .show();
$.ajax({
type: 'POST',
url: templatePath+'/lib/scripts/sendEmail.php',
data: {'visitorname':visitorname, 'visitoremail':visitoremail,'visitormessage':visitormessage},
success: function(contactResults) {
$this .find('div.response') .html(contactResults) .slideDown();
$this .find('.contact-form-loader') .hide();
}
});
}
});
});
// Twitter Widget //
(function($){
$.fn.twitterwidget = function(options) {
var defaults = {
twitterUser: 'pimetic',
tweetsCount: 3
},
settings = $.extend({}, defaults, options);
if ($('.recent-tweets') .length != 0) {
//triggerTwitter();
}
function triggerTwitter() {
$('.recent-tweets') .empty();
$('.recent-tweets') .parent() .find('h4') .css('position', 'relative');
$('.recent-tweets') .parent() .find('h4') .append('');
var numofTweets = settings.tweetsCount;
numofTweets = numofTweets -1;
$(window).load(function () {
jQuery.getJSON( 'https://api.twitter.com/1/statuses/user_timeline.json?callback=?&include_entities=true&include_rts=true&screen_name='+settings.twitterUser+'&count=10',
function(data) {
$.each(data, function(i) {
var tweet = data[i].text;
tweet = tweet.replace(/(http:\/\/\S+)/g, '$1');
tweet = tweet.replace(/(@\S+)/g, '$1');
tweet = tweet.replace('@', '');
var tweetDate = data[i].created_at;
tweetDate = tweetDate.split(' ');
var tweetFullDate = tweetDate[3] +' - '+tweetDate[0] +' '+ tweetDate[1] +' '+ tweetDate[2] +', '+ tweetDate[5];
tweetDate = tweetDate[1] +' '+ tweetDate[2];
var tweetID = data[i].id;
var tweetStatus = 'http://twitter.com/'+settings.twitterUser+'/status/'+tweetID;
$('#sidebar-content .recent-tweets, #big-footer .recent-tweets') .append('
Please set a flickr user!
'); } else { $(window).load(function () { $.getJSON( 'http://api.flickr.com/services/feeds/'+pool_public+'.gne?id='+flickrId+'&lang=en-us&format=json&jsoncallback=?', function(data) { $.each(data.items, function(i, item) { var photoTitle = item.title; var photoSrc = (item.media.m).replace("_m.jpg", "_s.jpg"); var photoURL = item.link; $('#sidebar-content .flickr-photos, #big-footer .flickr-photos') .append('