HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/KLeeuwen/samenbouwen.in/wwwroot/wp-content/themes/dlight/js/main.js
(function($){
"use strict";

window.darkoneHorisontalTabsFlag = [];
var $root = $('html, body');
var stickyFlag = false;
var headHeig;
var winScr = 0;
var marginTop = 0;
var menuWrap = 0;
var adminbar = 0;
var fullHeadHeig = 0;
var navActive = false;
var divTouchOptimizedStart;
var GridSliderStorage = [];
var GridResponsiveStorage = [];
var gridSliderResizeTimer;
var divSliderPosiitonMark, divSliderPosiitonMarkNew;
var numberOfSlides = [];
var numberOfSlidesFormated = [];
var resizeTimer;
var swipeboxInstance;
var entranceId = [], $divPortItem;

var pointerEventToXY = function(e){
	var out = {x:0, y:0};
	if(e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel'){
		var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
		out.x = touch.pageX;
		out.y = touch.pageY;
	} else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover'|| e.type=='mouseout' || e.type=='mouseenter' || e.type=='mouseleave') {
		out.x = e.pageX;
		out.y = e.pageY;
	} else if ( e.type == 'MSPointerDown' || e.type == 'MSPointerMove' || e.type == 'MSPointerUp') { 
		var touch = e.originalEvent; 
		out.x = touch.pageX; 
		out.y = touch.pageY;
	}
	return out;
};

var focusedElIndex;
var focusedElIndexOld;

function scrollingMenu() {
	var focusedElIndex = 0;
	
	$('#darkone_div_header_menu a[href^=#]:not([href=#])').each(function(ind){
		var current = ( $(this.hash).attr('id') === undefined ? 0 : $(this.hash).offset().top );
		if ( current !== 0 ) {
			if(current-adminbar <= $(document).scrollTop() ) {
				focusedElIndex = ind;
			}
		}
	});

	if (focusedElIndex != focusedElIndexOld) {
		$('#darkone_div_header_menu a[href^=#]').removeClass('darkone_focused darkone_theme_color').eq(focusedElIndex).addClass('darkone_focused darkone_theme_color');
		focusedElIndexOld = focusedElIndex;
	}
}

function directionCalc($el,coordinates,mod) {
	var offset = $el.offset();
	if(mod) {
		var refOffset = $('.darkone_div_portfolio_slider .darkone_hover.current-in').offset(),
			left = refOffset.left - offset.left,
			top = refOffset.top - offset.top,
			vert = (Math.abs(top) >= Math.abs(left)) ? true : false;
			output = vert ? ((top >=0) ? 'bottom' : 'top') : ((left >=0) ? 'right' : 'left');
	} else {
		var w = $el.outerWidth(),
			h = $el.outerHeight(),
			x = (coordinates.x - offset.left - ( w/2 )) * ( w > h ? ( h/w ) : 1),
			y = (coordinates.y - offset.top - ( h/2 )) * ( h > w ? ( w/h ) : 1),
			direction = Math.round( ( ( ( Math.atan2(y, x) * (180 / Math.PI) ) + 180 ) / 90 ) + 3 ) % 4,
			output;
		switch(direction) {
			case 0: output = 'top'; break;
			case 1: output = 'right'; break;
			case 2: output = 'bottom'; break;
			case 3: output = 'left'; break;
		};
	}
	return output;
}

function divPortFlipDefaulting($el, direction) {
	var origin, rot;
	if(direction == 'left') {rot = 'rotate3d(1,0,0,110deg)'; origin= '0% 0% 0';}
	if(direction == 'top') {rot = 'rotate3d(-1,0,0,110deg)'; origin= ' 0% 0% 0';}
	if(direction == 'right') {rot = 'rotate3d(0,-1,0,110deg)'; origin= ' 100% 0% 0';}
	if(direction == 'bottom') {rot = 'rotate3d(0,1,0,110deg)'; origin= ' 0% 100% 0';}
	$el.find('.darkone_hover_over').css({'transform' : rot, '-ms-transform' : rot, '-webkit-transform' : rot});
}



$(document).ready(function(){

	if ( $('body').hasClass('page-template-template-onepage-php') ) {
		$('#darkone_div_header_menu > ul > li:first-child > a').addClass('darkone_focused darkone_theme_color');
	}

	$(document).on('click', 'a#darkone_div_rtrigger', function(e){
		e.preventDefault();
		var $this = $(this);
		if($(this).hasClass('responsive-open')){
			$('#darkone_div_header_menu').stop(true,true).slideUp(300);
			$this.removeClass('responsive-open');
		}
		else{
			$this.addClass('responsive-open');
			$('#darkone_div_header_menu').stop(true,true).slideDown(300);
		}
	});

	/*  Hover effect animation  */
	var animationSpeed = 300;
	$(document).on('mouseenter', '.darkone_hover', function(){
		$(this).find('.darkone_hover_over').stop(true).animate({opacity : 1}, 99, function(){
			$(this).find('.darkone_portfolio_meta > *').each(function(index){
				$(this).stop(true).delay(animationSpeed*$(this).index()).animate({opacity : 1}, animationSpeed);
			});
		});
	});
	$(document).on('mouseleave', '.darkone_hover', function(){
		$(this).find('.darkone_hover_over, .darkone_portfolio_meta > *').stop(true).animate({opacity : 0}, animationSpeed);
	}); 


	$(document).on('click', '#darkone_port_close', function(){
		var currentPort = $(this).closest('.darkone_portfolio_single_loader');
			TweenLite.to(currentPort, 0.3, {height:0, opacity:0});
		return false;
	});



	$(document).on('mouseleave', '.darkone_div_portfolio_slider .darkone_div_portfolio_slides', function(e){
		var divPortModExit = directionCalc($(this), pointerEventToXY(e), false);
		$(this).find('.darkone_hover.current-in').removeClass('in-left in-right in-bottom in-top').addClass('out-'+divPortModExit).removeClass('current-in');
	});

	if(window.navigator.userAgent.indexOf('MSIE') >=0 || window.navigator.userAgent.indexOf('Opera') >=0) {
			$('.darkone_div_portfolio_slider').addClass('fallback');
	} 
		$(document).on('mouseenter', '.darkone_div_portfolio_slider .darkone_hover', function(e){	
			var $this = $(this);
			if(window.navigator.userAgent.indexOf('MSIE') >=0 || window.navigator.userAgent.indexOf('Opera') >=0) {
				$this.find('.darkone_hover_over').stop(true).animate({opacity : 1}, 300);
			} else {
				entranceId[$this.index()] = directionCalc($this, pointerEventToXY(e), $this.hasClass('current-in'));
				divPortFlipDefaulting($this, entranceId[$this.index()]);
				var inverse = entranceId[$this.index()] != 'top' ? (entranceId[$this.index()] != 'left' ? (entranceId[$this.index()] != 'right' ? 'top' : 'left') : 'right') : 'bottom';
				$('.darkone_div_portfolio_slider .darkone_hover.current-in').removeClass('in-left in-right in-bottom in-top').addClass('out-'+inverse).removeClass('current-in');
				$this.removeClass('out-left out-right out-bottom out-top');
				$this.addClass('current-in in-'+entranceId[$this.index()]);	
			}
		});
		
		
		$(document).on('mouseleave', '.darkone_div_portfolio_slider .darkone_hover', function(){
			var $this = $(this);
			if(window.navigator.userAgent.indexOf('MSIE') >=0 || window.navigator.userAgent.indexOf('Opera') >=0) {
				$this.find('.darkone_hover_over').stop(true).animate({opacity : 0}, 300);
			}
		});

//	}


	if ( darkone.video_bg != 'none' ) {
		var atts = {
			mute : ( darkone.video_mute == 1 ? true : false ),
			loop : ( darkone.video_loop == 1 ? true : false ),
			hd : ( darkone.video_hd == 1 ? true : false )
		};
		fbuilderYoutube( "darkone_page_bg_inner", darkone.video_bg, atts );
	}

	$("a[rel^='prettyPhoto']").click(function() { return false; });
	$("a[rel^='prettyPhoto']").off('click');
	$("a[rel^='prettyPhoto']").on('click.mynamespace', function() {});
	$("a[rel^='prettyPhoto']").off('click.mynamespace');

	$("a[rel^='frbprettyphoto']").attr('rel', 'lightbox');
	$("a[rel^='prettyPhoto']").attr('rel', 'lightbox');
	
	$('.blog_content iframe').each(function(){
		var url = $(this).attr("src");
		$(this).attr("src",url+"?wmode=transparent");
	});


	winScr = ($(document).scrollTop());
	if($('#wpadminbar').length > 0) { adminbar = $('#wpadminbar').outerHeight(); }
	headHeig = $('.header_wrapper').outerHeight();
	menuWrap = $('nav.menu_wrapper').outerHeight();
	fullHeadHeig = $('.header_wrapper').outerHeight() + adminbar;
	darkoneHeader();


});


$(window).scroll(function(){
	if ( $('body').hasClass('page-template-template-onepage-php') ) {
		scrollingMenu();
	}

	winScr = ($(document).scrollTop());
	if ( $(window).width() < 961 ) {
		if ( $('.header_wrapper').hasClass('sticky-header') ) {
			$('.header_wrapper').css('padding-top', 0).removeClass('sticky-header');
		}
		return;
	}
	

	if(winScr > fullHeadHeig) {
		stickyFlag = true;
		if ( $('#widgets-trigger a').hasClass('widgets-open') == true ) {
			$('.header_wrapper .darkone_top:not(.element-to-be-hidden)').css('display', 'block');
		}
		else {
			$('.header_wrapper .darkone_top').removeAttr('style');
		}
	}
	else {
		stickyFlag = false;
	}
	darkoneHeader();

});

function darkoneHeader(){
	if(stickyFlag === true){
		if(!$('.header_wrapper').hasClass('sticky-header')){
			$('.header_wrapper').css({top : -menuWrap}).addClass('sticky-header');

			$('.header_wrapper').children('div').each(function(){
				if($(this).is(':visible')){
					$(this).addClass('element-to-be-hidden');
				}
			});

			if ( $('body').hasClass('page-template-template-onepage-php') == false ) {
				$('#darkone_wrapper').css({paddingTop : headHeig});
			}

			darkoneAnimate();
		}
	}
	else {
		if($('.header_wrapper').hasClass('sticky-header')){
			if ( $('body').hasClass('page-template-template-onepage-php') == false ) {
				$('#darkone_wrapper').css({paddingTop : 0});
			}

			$('.header_wrapper').children('div').each(function(){
				$(this).removeClass('element-to-be-hidden');
			});

			$('.header_wrapper').css({top : 0}).removeClass('sticky-header');
		}
	}
}




function darkoneAnimate(){
	if($('.header_wrapper').hasClass('sticky-header')){
		$('.header_wrapper').stop(true).animate({top : adminbar}, 300);
	}
}

$(document).on('click', '#search-trigger a', function(){
	var $this = $(this);
	if($(this).hasClass('search-open')){
		$('.darkone_search').stop(true,true).fadeOut(200);
		$this.removeClass('search-open');
	}
	else{
		var searchPos = $this.position().left + $this.outerWidth()/2-260+21;
		$this.addClass('search-open');
		$('.darkone_search').css({left: searchPos}).stop(true,true).fadeIn(200);
	}
	return false;
});


//			Grid Position Measurement
	

$(document).on('touchstart', '.darkone_div_touch_optimized', function(e){
	divTouchOptimizedStart = pointerEventToXY(e).x;
});


$(document).on('touchend', '.darkone_div_touch_optimized', function(e){
	var curr = pointerEventToXY(e).x;
	var res = divTouchOptimizedStart-curr;
	if(Math.abs(res) > 50 && res>0) {
		$(this).find('.blog_top_pagination .next').trigger('click');
	} else if (Math.abs(res) > 30 && res<0) {
		$(this).find('.blog_top_pagination .previous').trigger('click');
	}
});

var gridSlider = new Array();
var darkoneSlider = new Array();
var darkoneSliderWidthReference = new Array();

$(document).ready(function(){
	
	
	$(window).resize(function(){

		if ( $(window).width() < 961 ) {
			if ( $('.header_wrapper').hasClass('sticky-header') ) {
				$('.header_wrapper').css('top', 0).removeClass('sticky-header');
			}
			$('body').addClass('darkone_div_responsive');
		}
		else {
			if ( $('body').hasClass('darkone_div_responsive') ) {
				$('body').removeClass('darkone_div_responsive');
				$('#darkone_div_header_menu').removeAttr('style');
			}
		}

		fullHeadHeig = $('.header_wrapper').outerHeight() + adminbar;
		clearTimeout(gridSliderResizeTimer);
		gridSliderResizeTimer = setTimeout(function(){
		
			$('.darkone_grid.grid_content').each(function(ind) {
				var $this = $(this);
				var h = ($(window).width() > 800*window.devicePixelRatio) ? ($this.width()/2 - $this.width()/200) : ($this.width()*3/4);
				$this.height(h).find('.grid_slides, .grid_slide').height(h);
				
				 if($(window).width() > 800*window.devicePixelRatio) {
					$this.not('.darkone_div_grid_responsive').removeClass('darkone_div_dis_none');
					$this.not('.darkone_div_grid_notresponsive').addClass('darkone_div_dis_none');
					gridSlider[ind].reInit();
				} else {
					$this.not('.darkone_div_grid_responsive').addClass('darkone_div_dis_none');
					$this.not('.darkone_div_grid_notresponsive').removeClass('darkone_div_dis_none');
					gridSlider[ind].reInit();
				}
			});
			

	}, 200);
	
		headHeig = $('.header_wrapper').outerHeight();
		menuWrap = $('nav.menu_wrapper').outerHeight();

	});



//			darkone slider
	$('.darkone_slider_wrapper').each( function(ind) {
		var $this = $(this);
		$this.addClass('darkone_slider_'+ind).children('.darkone_slider_content').addClass('darkone_slider_content_'+ind).children('.separate-slider-column').addClass('separate-slider-column_'+ind);
		numberOfSlides[ind] = parseInt($this.attr('data-slides'));

		darkoneSliderWidthReference[ind] = 280;
	
		
		$(document).on('mousedown', '.darkone_slider_wrapper a.darkone_div_slider_img', function(e){
			divSliderPosiitonMark = pointerEventToXY(e);
		});
		$(document).on('mousemove', '.darkone_slider_wrapper a.darkone_div_slider_img', function(e){
			divSliderPosiitonMarkNew = pointerEventToXY(e);
		});
		
		$(document).on('click', '.darkone_slider_wrapper a.darkone_div_slider_img', function(e){
			if(Math.abs(divSliderPosiitonMark.x - divSliderPosiitonMarkNew.x) >= 50 || Math.abs(divSliderPosiitonMark.y - divSliderPosiitonMarkNew.y) >= 50){
				console.log('bleh');
				e.preventDefault();
			}
		});
		
		numberOfSlidesFormated[ind] = ( numberOfSlides[ind] < Math.floor($this.width()/(darkoneSliderWidthReference[ind])) ) ? numberOfSlides[ind] : Math.floor($this.width()/(darkoneSliderWidthReference[ind]));
		var wrapSel = 'darkone_slider_content_'+ind;
		var slideSel = 'separate-slider-column_'+ind;
		var itemHeight = ($this.width()/numberOfSlidesFormated[ind])/1.6;
		$this.height(itemHeight).find('.darkone_slider_content, .separate-slider-column').height(itemHeight);
		
		darkoneSlider[ind] = $('.darkone_slider_'+ind).swiper({
		    createPagination : false,
		    wrapperClass : wrapSel,
		    slideClass : slideSel,
		    loop:true,
		    grabCursor: true,
		    loopedSlides : 6,
		    slidesPerView : numberOfSlidesFormated[ind]
		  });
	});
	

	
	$(window).resize(function(){
		clearTimeout(resizeTimer);
		resizeTimer = setTimeout(function(){
			$('.darkone_slider_wrapper').each( function(ind) {
				var $this = $(this);
				numberOfSlidesFormated[ind] = ( numberOfSlides[ind] < Math.floor($this.width()/(darkoneSliderWidthReference[ind])) ) ? numberOfSlides[ind] : Math.floor($this.width()/(darkoneSliderWidthReference[ind]));
				var itemHeight = ($this.width()/numberOfSlidesFormated[ind])/1.6;
				var wrapSel = 'darkone_slider_content_'+ind;
				var slideSel = 'separate-slider-column_'+ind;
				$this.height(itemHeight).find('.darkone_slider_content, .separate-slider-column').height(itemHeight);
				darkoneSlider[ind].params.slidesPerView = numberOfSlidesFormated[ind];
				darkoneSlider[ind].reInit();
				darkoneSlider[ind].swipeTo(0, 500);
			});
		}, 200);
	});


$(window).load(function(){

	swipeboxInstance = $('a[rel="lightbox"]').addClass('swipebox').swipebox();

//			darkone slider
	$('.darkone_slider_wrapper').each( function(ind) {
		var $this = $(this);
		$this.addClass('darkone_slider_'+ind).children('.darkone_slider_content').addClass('darkone_slider_content_'+ind).children('.separate-slider-column').addClass('separate-slider-column_'+ind);
		numberOfSlides[ind] = parseInt($this.attr('data-slides'));

		darkoneSliderWidthReference[ind] = 280;
	
		
		numberOfSlidesFormated[ind] = ( numberOfSlides[ind] < Math.floor($this.width()/(darkoneSliderWidthReference[ind])) ) ? numberOfSlides[ind] : Math.floor($this.width()/(darkoneSliderWidthReference[ind]));
		var wrapSel = 'darkone_slider_content_'+ind;
		var slideSel = 'separate-slider-column_'+ind;
		var itemHeight = ($this.width()/numberOfSlidesFormated[ind])/1.6;
		$this.height(itemHeight).find('.darkone_slider_content, .separate-slider-column').height(itemHeight);
		
		darkoneSlider[ind] = $('.darkone_slider_'+ind).swiper({
		    createPagination : false,
		    wrapperClass : wrapSel,
		    slideClass : slideSel,
		    loop:true,
		    grabCursor: true,
		    loopedSlides : 6,
		    slidesPerView : numberOfSlidesFormated[ind]
		  });
		  
	});
});




/*					Add 'has_children' class to menus					*/

	$.each($('#darkone_div_header_menu > ul > li, li.menu-item').has('ul.sub-menu'), function() {
		$(this).addClass('has_children');
	});


});



$(document).ready(function(){
	var is_safari = navigator.userAgent.indexOf("Safari") > -1;
		setTimeout(function() {
			if (location.hash) {
				window.scrollTo(0, 0);
				var offset = $(location.hash).offset().top-adminbar+parseInt($(location.hash).css('padding-top'))-90;
				var top = $(document).scrollTop();
				var offseted = Math.abs(top-offset);
				var speed = ((1/offseted)*(1.25*offseted));
				if(is_safari){$('html, body').stop(true).animate({'scrollTop': offset}, offseted*3/5, 'easeInOutQuart');}
				else{TweenLite.to(window, speed, {scrollTo:{y: offset, x:0}, ease:Quint.easeInOut});}
			}
		}, 1);
	
		$(document).on('focus', 'select[name="contactEmailSend"]', function() {
			$(this).parent().addClass('darkone_tc_border');
		});
		$(document).on('blur', 'select[name="contactEmailSend"]', function() {
			$(this).parent().removeClass('darkone_tc_border');
		});

		$(document).on('click', '.darkone_menu a[href^=#]:not([href=#])', function() {
			var target = $(this).attr('href');
			var current = $($(this).attr('href'));
			if (current.attr('id') === undefined) {
				window.location.href = darkone.siteurl+target;
			}
			else {
				var offset = ( target == '#darkone_wrapper' || target == '#' ? 0 : current.offset().top-adminbar+parseInt(current.css('padding-top'))-90 );
				var top = $(document).scrollTop();
				var offseted = Math.abs(top-offset);
				var speed = ((1/offseted)*(1.25*offseted));
				if(is_safari){$('html, body').stop(true).animate({'scrollTop': offset}, offseted*3/5, 'easeInOutQuart');}
				else{TweenLite.to(window, speed, {scrollTo:{y: offset, x:0}, ease:Quint.easeInOut});}
			}
			return false;
		});

			$('#darkone_div_header_menu > ul.darkone_menu').append('<li id="search-trigger"><a href="#"><i class="br0 br0-search"></i></a></li>');


		//			Header Menu Solid Hover

			$(document).on('click', '.darkone_div_responsive #darkone_div_header_menu li.has_children a', function(e){
				if ( e.pageX - $(this).offset().left > $(this).parent().width() - 36 ) {
					$(this).next().slideToggle(200);
					return false;
				}
			});

			if ( $(window).width() > 961 ) {
				navActive = true;
			} else {
				$('body').addClass('darkone_div_responsive');
			}

			$(document).on('mouseover', '#darkone_div_header_menu li', function(){
				$(this).addClass('hovered');
			});

			$(document).on('mouseout', '#darkone_div_header_menu li', function(){
				$(this).delay(100).removeClass('hovered');
			});

//	Input Field Clear

	
		$('input.input_field').focus(function(){
			if (!$(this).hasClass('collected')) {
			$(this).attr('data-val', $(this).val());
			$(this).addClass('collected');
			$(this).val('');
			} else {
				if ($(this).val() === $(this).attr('data-val')) {
				$(this).val('');
				}
			}

		});
		$('input.input_field').focusout(function(){
			if ($(this).val() === '') {
				$(this).val($(this).attr('data-val'));
			}
		
		});


//	Textarea Field Clear

		$('textarea.textarea_field').focus(function(){
			if (!$(this).hasClass('collected')) {
				$(this).attr('data-val', $(this).html());
				$(this).addClass('collected');
				$(this).html('');
				} else {
					if ($(this).html() === $(this).attr('data-val')) {
						$(this).html('');
					}
				}
		});
		$('textarea.textarea_field').focusout(function() {
				if ($(this).html() === '') {
					$(this).html($(this).attr('data-val'));
					}	
			

		});

//			team member module

	$(document).on('mouseenter', '.team_member_module .img_wrapper', function(){
		$(this).find('.hover_element').show().stop(true).animate({opacity : 1}, 300);
		$(this).find('.hover_element').find('.socials li a').each(function(index){
			$(this).stop(true).delay(index*50).animate({opacity : 1}, 200);
			});
	}); 
	$(document).on('mouseleave', '.team_member_module .img_wrapper', function(){
		$(this).find('.hover_element').show().stop(true).animate({opacity : 0}, 300, function(){$(this).hide();}).find('.socials li a').stop(true).animate({opacity : 0}, 300);
	});
	



//		portfolio columns

$(document).ready(function(){
	var newItem = $('.portfolio_content, .darkone_div_portfolio_slider');
	var prel = newItem.find('.darkone_div_ajax_col .darkone_hover').width();
	newItem.find('.darkone_div_ajax_col .darkone_hover').each(function(){
		$(this).css('min-height', prel);

	});
	
	portfolioColumnsInit(newItem);

});

	
$(document).on('click', '.darkone_div_top_nav_cat li a', function(){
	$(this).closest('.darkone_div_top_nav_cat').find('.darkone_div_ajax_port_selected').removeClass('darkone_div_ajax_port_selected');
	$(this).parent().addClass('darkone_div_ajax_port_selected');
});

//				Fbuilder fixed

$(document).on('refresh','.fbuilder_module', function(){
	
	
//	portfolio columns

//portfolioColumnsInit($(this).find('.portfolio_content, .darkone_div_portfolio_slider'));
	
//		grid slider
	
	
		
	
});
	
		
		
});   // document.ready END


})(jQuery);


//		portfolio columns entry anim

var portColInitDReady = true;	
function portfolioColumnsInit(newItem){
	var colNumb = parseInt(newItem.attr('data-columns'));
	newItem.find('.darkone_div_ajax_col').css({'display' : 'none', 'opacity' : 0});
	
	newItem.css({'display' : 'none'});
	for(i=1;i<=Math.floor(newItem.find('.darkone_div_ajax_col').length/colNumb);i++) {
		if(newItem.find('.darkone_div_ajax_col').eq(i*colNumb-1).next().attr('style') !== 'clear:both'){
			jQuery('<div style="clear:both"></div>').insertAfter(newItem.find('.darkone_div_ajax_col').eq(i*colNumb-1));
		}
	}
	if(newItem.find('.darkone_div_top_nav_cat').hasClass('darkone_anim_fade')) {
		newItem.show().find('.darkone_div_ajax_col').each(function(ind){
			jQuery(this).show().delay(ind*150).animate({opacity : 1},300);
		});
	} else if (newItem.find('.darkone_div_top_nav_cat').hasClass('darkone_anim_snake')) {
		var mainCount = 0, dirIden = 1;
		for( var i=0;i<newItem.find('.darkone_div_ajax_col').length;i++) {
			for(var j=0;j<colNumb;j++){
				var delaySet = (dirIden >0) ? mainCount : (mainCount+colNumb-1-2*j);
				newItem.show().find('.darkone_div_ajax_col').eq(mainCount).show().delay(delaySet*200).animate({opacity : 1},300);	
				if(j == colNumb-1){dirIden= dirIden*(-1);}
				mainCount++;	
			}
		}
	}
}

	// Ajax Load
	var ajaxLoading = false;
	function darkone_ajaxload(currentItem) {
		if ( ajaxLoading ) {
			return;
		}
		ajaxLoading = true;
		"use strict";
		var nav = currentItem.parents().eq(2);
		var oldItem = nav.next();


		oldItem.parent().parent().css({'overflow': 'hidden'});
		var string = oldItem.attr('data-string');
		var shortData = oldItem.attr('data-shortcode').split('|');
		var stringClass = oldItem.attr('class');
		var direction = currentItem.attr('class');

		if ( stringClass.indexOf('blog_content') >= 0 ) { var stringClassType = stringClass.replace('blog_content ', ''); var actionSend = 'darkone_ajaxload_send'; }

		var ajaxPage = currentItem.children('.darkone_page').text();

		var data = { 
			action: actionSend,
			page: ajaxPage,
			type: stringClassType,
			data: string,
			ajax: 'yes',
			excerpt: shortData[0],
			bot_margin: shortData[1],
			title: shortData[2]
		};

		jQuery.post(darkone.ajaxurl, data, function(response) {
			if (response) {

				var content = response.split('@@@!SPLIT!@@@');
				var margin = oldItem.find('.fbuilder_column').css('border-left-width');
				margin = margin.replace('px','');
				var width = oldItem.width() + 2*parseInt(margin, 10);
				var fromTop = nav.find('.darkone_blog_top_page_header').height()+72;
				nav.remove();
				oldItem.before(content[0]);
				oldItem.after(content[1]);
				var newItem = oldItem.next();
				if ( direction.indexOf('next') >= 0 ) {
					newItem.css({'position': 'absolute', 'width': 'inherit', 'left': width.toString()+'px', 'top': fromTop });
						newItem.show();
						TweenLite.to(oldItem, 0.5, {left: '-='+width.toString(), onComplete: function(){
							oldItem.remove();
						}});

						TweenLite.to(newItem, 0.5, {left: '-='+width.toString(), onComplete: function(){
							newItem.css({'position': 'relative', 'left': '0', 'top': '0'});
							ajaxLoading = false;
							//TweenLite.to(window, 200, {scrollTo:{y: newItem.offset().top, x:0}, ease:Sine.easeIn});

						}});

				}
				else {
					newItem.css({'position': 'absolute', 'width': 'inherit', 'left': '-'+width.toString()+'px', 'top': fromTop });
						newItem.show();
						TweenLite.to(oldItem, 0.5, {left: width.toString(), onComplete: function(){
							oldItem.remove();
						}});
						TweenLite.to(newItem, 0.5, {left: 0, onComplete: function(){
							newItem.css({'position': 'relative', 'left': '0', 'top': '0'});
							ajaxLoading = false;
							//TweenLite.to(window, 200, {scrollTo:{y: newItem.offset().top, x:0}, ease:Sine.easeIn});
						}});

				}
				
				//		swipebox
				newItem.find("a[rel^='prettyPhoto']").attr('rel', 'lightbox');
				var newItemMod = newItem.find('.fbuilder_module');
				newItemMod.trigger('refresh');
				swipeboxInstance = newItem.find('a[rel="lightbox"]').addClass('swipebox').swipebox();
			
			} else { 
				alert('fail');
			}
		});
	}

	// Ajax Load
	var ajaxLoading = false;
	function darkone_ajaxload_portfolio(currentItem) {

		if ( ajaxLoading ) {
			return;
		}
		ajaxLoading = true;
		"use strict";
		var data_cat = currentItem.attr('data-cat');

		if ( data_cat === undefined ) {
			var oldItem = currentItem.parents().eq(3);
		}
		else {
			var oldItem = currentItem.parents().eq(3);
		}

		var string = oldItem.attr('data-string');

		var shortData = oldItem.attr('data-shortcode').split('|');

		if ( data_cat !== undefined ) {
			string = string.substring(0, string.indexOf("&cat="));
			if ( data_cat == '-1' ) {
				string = string+'&cat='+shortData[1];
			}
			else {
				string = string+'&cat='+data_cat;
			}
		}
		else {
			data_cat = shortData[1];
		}

		var stringClass = oldItem.attr('class');

		var stringClassType = stringClass.replace('portfolio_content ', '');
		var actionSend = 'darkone_ajaxload_send_portfolio';


		var ajaxPage = currentItem.children('.darkone_page').text();

		var data = {
			action: actionSend,
			page: ajaxPage,
			type: stringClassType,
			data: string,
			ajax: 'yes',
			margin: shortData[0],
			category: shortData[1],
			top_pagination: shortData[2],
			top_align: shortData[3],
			trans_effect: shortData[4],
			data_cat: data_cat,
			pagination: shortData[5]
		};

		jQuery.post(darkone.ajaxurl, data, function(response) {
			if (response) {
				oldItem.after(response);
				var newItem = oldItem.next();
				var colNumb = parseInt(newItem.attr('data-columns'));
				newItem.find('.darkone_div_ajax_col').css({'display' : 'none', 'opacity' : 0});
				newItem.css({'display' : 'none'});
				oldItem.children(':not(.darkone_div_top_nav_wrap)').fadeOut(function() {
					portfolioColumnsInit(newItem);
					//TweenLite.to(window, 600, {scrollTo:{y: oldItem.offset().top, x:0}, ease:Sine.easeIn});
					oldItem.remove();
					
				});
			ajaxLoading = false;
			//		swipebox
			swipeboxInstance = newItem.find('a[rel="lightbox"]').swipebox();
			} else { 
				alert('fail');
			}
		});

	}
	
var contentBlockHeight = 0;

var AjaxLoadTime = 0.3;

	// Ajax Load  - click on image
	var ajaxLoading = false;
	function darkone_ajaxload_portfolio_single(currentItem, postID) {

		if ( ajaxLoading ) {
			return;
		}
		ajaxLoading = true;
		"use strict";

		var dataShortcode = currentItem.closest('.portfolio_content').attr('data-shortcode');
		dataShortcode = dataShortcode.split("|");

		var oldItem = currentItem.parents().eq(3).prev();
		var dataShortcodeCat = currentItem.parents().eq(3).find('.darkone_div_top_nav_wrap ul li.darkone_div_ajax_port_selected a').attr('data-cat');


		if(oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader').height() === 0) contentBlockHeight = 800;
		else contentBlockHeight = oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader').height();

		oldItem.addClass('darkone_loading');

		TweenLite.to(jQuery('html, body'), AjaxLoadTime, {'scrollTop' : oldItem.offset().top-150, onComplete: function(){
			TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader'), AjaxLoadTime, {height: contentBlockHeight});
			oldItem.append('<div id="circleG"><div id="circleG_1" class="circleG"></div><div id="circleG_2" class="circleG"></div><div id="circleG_3" class="circleG"></div></div>');
			TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity : 0});
		}});

		TweenLite.to(oldItem.find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity : 0, onComplete: function(){
			var data = {
				action: 'darkone_ajaxload_send_portfolio_single',
				post_id: postID,
				data_cat: dataShortcode[1],
				current_cat: dataShortcodeCat
			};
			jQuery.post(darkone.ajaxurl, data, function(response) {
				if (response) {
					oldItem.html(response);
					if ( oldItem.find('#fbuilder_content').length > 0 ) {
						oldItem.find('#fbuilder_content').unwrap().unwrap().attr('id', 'fbuilder_content_loaded');
					}

					
					var $img = oldItem.find('#fbuilder_content_loaded');
					var imgNum = oldItem.find('#fbuilder_content_loaded').length;

						if(!--imgNum){
							TweenLite.to(jQuery('html, body'), AjaxLoadTime, {'scrollTop' : oldItem.offset().top-150, onComplete: function(){
								var new_h = oldItem.find('div.darkone_single_portfolio_content:first').outerHeight() + 128;
									TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader'), AjaxLoadTime,{height : new_h, opacity : 1, onComplete: function(){
										oldItem.find('#circleG').remove();
										TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity :1});
									}});
							}});
							oldItem.find("a[rel^='prettyPhoto']").attr('rel', 'lightbox');
							var oldItemMod = oldItem.find('div.darkone_single_portfolio_content .fbuilder_module');
							oldItemMod.trigger('refresh');
							swipeboxInstance = oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader a[rel="lightbox"]').addClass('swipebox').swipebox();
							oldItem.removeClass('darkone_loading');
						}
					ajaxLoading = false;
				} else { 
					alert('fail');
				}
			});
		}});
	}
	
	
	// Ajax Load - click on arrows
	var ajaxLoading = false;
	function darkone_ajaxload_portfolio_single_inner(currentItem, postID) {

		if ( ajaxLoading ) {
			return;
		}
		ajaxLoading = true;
		"use strict";
		var dataShortcode = currentItem.closest('.darkone_nav_element').attr('data-categories');
		
		var oldItem = currentItem.parents().eq(3);
		var dataShortcodeCat = currentItem.parents().eq(3).next().find('.darkone_div_top_nav_wrap ul li.darkone_div_ajax_port_selected a').attr('data-cat');
		oldItem.addClass('darkone_loading');

		TweenLite.to(jQuery('html, body'), AjaxLoadTime, {'scrollTop' : oldItem.offset().top-150, onComplete: function(){
			TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader'), AjaxLoadTime, {height: contentBlockHeight});
			TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity : 0});
		}});
		oldItem.append('<div id="circleG"><div id="circleG_1" class="circleG"></div><div id="circleG_2" class="circleG"></div><div id="circleG_3" class="circleG"></div></div>');

		TweenLite.to(oldItem.find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity : 0, onComplete: function(){
			var data = {
				action: 'darkone_ajaxload_send_portfolio_single',
				post_id: postID,
				data_cat: dataShortcode,
				current_cat: dataShortcodeCat
			};
			jQuery.post(darkone.ajaxurl, data, function(response) {
				if (response) {
					oldItem.html(response);
					if ( oldItem.find('#fbuilder_content').length > 0 ) {
						oldItem.find('#fbuilder_content').unwrap().unwrap().attr('id', 'fbuilder_content_loaded');
					}
					var $img = oldItem.find('#fbuilder_content_loaded');
					var imgNum = oldItem.find('#fbuilder_content_loaded').length;

					if(!--imgNum){
						TweenLite.to(jQuery('html, body'), AjaxLoadTime, {'scrollTop' : oldItem.offset().top-150, onComplete: function(){
							var new_h = oldItem.find('div.darkone_single_portfolio_content:first').outerHeight() + 128;
							TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader'), AjaxLoadTime,{height : new_h, opacity : 1, onComplete: function(){
								TweenLite.to(oldItem.closest('.fbuilder_module').find('.darkone_single_portfolio_content'), AjaxLoadTime, {opacity :1});
								oldItem.closest('#circleG').remove();

							}});
							
						}});

						oldItem.find("a[rel^='prettyPhoto']").attr('rel', 'lightbox');
						var oldItemMod = oldItem.find('div.darkone_single_portfolio_content .fbuilder_module');
						oldItemMod.trigger('refresh');
						swipeboxInstance = oldItem.closest('.fbuilder_module').find('.darkone_portfolio_single_loader a[rel="lightbox"]').addClass('swipebox').swipebox();
						oldItem.removeClass('darkone_loading');
					}

					ajaxLoading = false;
				} else { 
					alert('fail');
				}
			});
		}});

	}