// source --> https://dmlegalservices.in/wp-content/plugins/popup-builder/public/js/PopupBuilder.js?ver=4.4.3 
function sgAddEvent(element, eventName, fn)
{
	if (element.addEventListener)
		element.addEventListener(eventName, fn, false);
	else if (element.attachEvent)
		element.attachEvent('on' + eventName, fn);
}
/*Popup order count*/
window.SGPB_ORDER = 0;

function SGPBPopup()
{
	this.id = null;
	this.eventName = '';
	this.popupData = null;
	this.additionalPopupData = {};
	this.popupConfig = {};
	this.popupObj = null;
	this.onceListener();
	this.initialsListeners();
	this.countPopupOpen = true;
	this.closeButtonDefaultPositions = {};
	this.closeButtonDefaultPositions[1] = {
		'left': 9,
		'right': 9,
		'bottom': 9
	};
	this.closeButtonDefaultPositions[2] = {
		'left': 0,
		'right': 0,
		'top': parseInt('-20'),
		'bottom': parseInt('-20')
	};
	this.closeButtonDefaultPositions[3] = {
		'right': 4,
		'bottom': 4,
		'left': 4,
		'top': 4
	};
	this.closeButtonDefaultPositions[4] = {
		'left': 12,
		'right': 12,
		'bottom': 9
	};
	this.closeButtonDefaultPositions[5] = {
		'left': 8,
		'right': 8,
		'bottom': 8
	};
	this.closeButtonDefaultPositions[6] = {
		'left': parseInt('-18.5'),
		'right': parseInt('-18.5'),
		'bottom': parseInt('-18.5'),
		'top': parseInt('-18.5')
	};
}

SGPBPopup.htmlCustomButton = function()
{
	var buttons = jQuery('.sgpb-html-custom-button');
	var buttonActionBehaviors = function(button, settings)
	{
		button.bind('click', function() {
			var behavior = settings['sgpb-custom-button'];

			if (behavior === 'redirectToURL') {
				if (settings['sgpb-custom-button-redirect-new-tab']) {
					window.open(settings['sgpb-custom-button-redirect-URL']);
				}
				else {
					window.location.href = settings['sgpb-custom-button-redirect-URL'];
				}
			}
			if (behavior === 'hidePopup') {
				SGPBPopup.closePopup();
			}
			if (behavior === 'copyToClipBoard') {
				var tempInputId = 1;
				var value = settings['sgpb-custom-button-copy-to-clipboard-text'];
				var tempInput = document.createElement("input");
				tempInput.id = tempInputId;
				tempInput.value = value;
				tempInput.style = 'position: absolute; right: -10000px';
				if (!document.getElementById(tempInputId)) {
					document.body.appendChild(tempInput);
				}
				tempInput.select();
				document.execCommand("copy");

				if (settings['sgpb-copy-to-clipboard-close-popup']) {
					SGPBPopup.closePopup();
				}

				if (settings['sgpb-custom-button-copy-to-clipboard-alert']) {
					alert(settings['sgpb-custom-button-copy-to-clipboard-message']);
				}
			}
		});
	};

	buttons.each(function() {
		var settings = jQuery.parseJSON(decodeURIComponent(jQuery(this).attr('data-options')));
		buttonActionBehaviors(jQuery(this), settings);
	});
};

SGPBPopup.listeners = function () {
	var that = this;

	sgAddEvent(window, 'sgpbPopupBuilderAdditionalDimensionSettings', function(e) {
		SGPBPopup.mobileSafariAdditionalSettings(e);
	});

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		/*for mobile landscape issue*/
		if (typeof (Event) === 'function') {
			var event = new CustomEvent('resize', {
				bubbles: true,
				cancelable: true
			});
		}
		else {
			if (SGPBPopup.isIE()) {
				var event = document.createEvent('Event');
				event.initEvent('resize', true, true);
			}
			else {
				var event = new CustomEvent('resize', {
					bubbles: true,
					cancelable: true
				});
			}
		}
		window.dispatchEvent(event);

		SGPBPopup.mobileSafariAdditionalSettings(e);
		var args = e.detail;
		var popupOptions = args.popupData;

		var obj = e.detail.currentObj.sgpbPopupObj;

		/* if no analytics extension */
		if (typeof SGPB_ANALYTICS_PARAMS === 'undefined') {
			if (obj.getCountPopupOpen()) {
				obj.addToCounter(popupOptions);
			}
		}

		if (popupOptions['sgpb-show-popup-same-user']) {
			obj.setPopupLimitationCookie(popupOptions);
		}
		SGPBPopup.htmlCustomButton();
	});

	setInterval(function() {
		var openedPopups = window.sgpbOpenedPopup || {};
		if (!Object.keys(openedPopups).length) {
			return false;
		}
		var params = {};
		params.popupsIdCollection = window.sgpbOpenedPopup;

		var data = {
			action: 'sgpb_send_to_open_counter',
			nonce: SGPB_JS_PARAMS.nonce,
			params: params
		};


		window.sgpbOpenedPopup = {};
		jQuery.post(SGPB_JS_PARAMS.ajaxUrl, data, function(res) {

		});
	}, 600);
};

SGPBPopup.mobileSafariAdditionalSettings = function(e)
{
	if (typeof e === 'undefined') {
		var args = SGPBPopup.prototype.getAdditionalPopupData();
		if (typeof args === 'undefined') {
			return false;
		}
		var popupOptions = args.popupData;
		var popupId = parseInt(args.popupId);
	}
	else {
		var args = e.detail;
		var alreadySavedArgs = SGPBPopup.prototype.getAdditionalPopupData();
		if (jQuery.isEmptyObject(alreadySavedArgs)) {
			SGPBPopup.prototype.setAdditionalPopupData(args);
		}
		var popupOptions = args.popupData;
		var popupId = parseInt(args.popupId);
	}
	var userAgent = window.navigator.userAgent;
	if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
		if (typeof popupOptions['sgpb-popup-dimension-mode'] !== 'undefined' && popupOptions['sgpb-popup-dimension-mode'] === 'responsiveMode') {
			var openedPopupWidth = parseInt(window.innerHeight-100);
			if (e.detail.popupData['sgpb-type'] === 'iframe' || e.detail.popupData['sgpb-type'] === 'video') {
				if (jQuery('.sgpb-popup-builder-content-'+popupId +' iframe').length) {
					jQuery('.sgpb-popup-builder-content-'+popupId).attr('style', 'height:'+openedPopupWidth+'px !important;');
				}
			}
		}
	}
};

SGPBPopup.prototype.setAdditionalPopupData = function(additionalPopupData)
{
	this.additionalPopupData = additionalPopupData;
};

SGPBPopup.prototype.getAdditionalPopupData = function()
{
	return this.additionalPopupData;
};

SGPBPopup.prototype.setCountPopupOpen = function(countPopupOpen)
{
	this.countPopupOpen = countPopupOpen;
};

SGPBPopup.prototype.getCountPopupOpen = function()
{
	return this.countPopupOpen;
};

SGPBPopup.playMusic = function(e) {
	var args = e.detail;
	var popupId = parseInt(args.popupId);
	var options = SGPBPopup.getPopupOptionsById(popupId);
	var soundUrl = options['sgpb-sound-url'];
	var soundStatus = options['sgpb-open-sound'];	
	if (soundStatus && soundUrl ) {
		var audio = new Audio(soundUrl);		
		audio.play();		
		window.SGPB_SOUND[popupId] = audio;
	}
};

SGPBPopup.floatingButton = function (e) {
	SGPBPopup.showFloatingButton(e);

	jQuery(window).on('sgpbFormSuccess', function (e){
		SGPBPopup.hideFloatingButton();
	});
};

SGPBPopup.showFloatingButton = function (e) {
	var popupObj = e || {};
	var popupId = 0;
	var shouldShowFloatingButton = true;

	/* if argument e is event reference the popup object is wrapped inside e.detail.currentObj.sgpbPopupObj  */
	if (e.hasOwnProperty('sgpbPopupObj')) {
		popupObj = e.detail.currentObj.sgpbPopupObj;
	}

	if (popupObj instanceof SGPBPopup) {
		popupId = parseInt(popupObj.id);
		shouldShowFloatingButton = popupObj.forceCheckCurrentPopupType(popupObj);
	}

	/* If there is no cookie which will prevent popup opening we will show floating button */
	if (shouldShowFloatingButton) {
		/* if we have popup id we detect exact button */
		if (popupId) {
			jQuery('.sgpb-floating-button.sg-popup-id-' + popupId).show();
		} else {
			jQuery('.sgpb-floating-button').show();
		}
	}
};

SGPBPopup.hideFloatingButton = function (popupId) {
	/* if we have popup id we detect exact button */
	if (popupId) {
		jQuery('.sgpb-floating-button.sg-popup-id-' + popupId).fadeOut();
	} else {
		jQuery('.sgpb-floating-button').fadeOut();
	}
};

SGPBPopup.prototype.initialsListeners = function()
{
	/* one time calling events (sgpbDidOpen, sgpbDidClose ...) */
	var that = this;
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		jQuery('.sg-popup-close').unbind('click').bind('click',function(){
			var currentPopupId = jQuery(this).parents('.sg-popup-builder-content').attr('data-id');
			SGPBPopup.closePopupById(currentPopupId);
		});
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var popupId = parseInt(args.popupId);
		that.htmlIframeFilterForOpen(popupId, 'close');
	});
};

SGPBPopup.prototype.onceListener = function()
{
	var that = this;

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		document.onkeydown = function(e) {
			e = e || window.event;

			if (e.keyCode === 27) { /*esc pressed*/
				var currentPopup = that.getPopupIdForNextEsc();
				if (!currentPopup) {
					return false;
				}
				var lastPopupId = parseInt(currentPopup['popupId']);
				SGPBPopup.closePopupById(lastPopupId);
			}
		};
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		if (window.sgPopupBuilder.length !== 0) {
			var popups = [].concat(window.sgPopupBuilder).reverse();
			for (var i in popups) {
				var nextIndex = ++i;
				var nextObj = popups[nextIndex];

				if (typeof nextObj === 'undefined') {
					jQuery('html').removeClass('sgpb-overflow-hidden');
					jQuery('body').removeClass('sgpb-overflow-hidden-body');
					break;
				}

				if (nextObj.isOpen === false) {
					continue;
				}
				var options = SGPBPopup.getPopupOptionsById(nextObj.popupId);
				if (typeof options['sgpb-disable-page-scrolling'] === 'undefined') {
					jQuery('html').removeClass('sgpb-overflow-hidden');
					jQuery('body').removeClass('sgpb-overflow-hidden-body');
				}
				else {
					jQuery('html').addClass('sgpb-overflow-hidden');
					jQuery('body').addClass('sgpb-overflow-hidden-body');
				}
				break;
			}
		}
		else {
			jQuery('html').addClass('sgpb-overflow-hidden');
			jQuery('body').addClass('sgpb-overflow-hidden-body');
		}
	});
};

SGPBPopup.prototype.getPopupIdForNextEsc = function()
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (!popups.length) {
		return popup;
	}

	var searchPopups = [].concat(popups).reverse();

	for (var i in searchPopups) {
		var popupData = searchPopups[i];

		if (popupData.isOpen) {
			var popupId = parseInt(popupData['popupId']);
			var popupOptions = SGPBPopup.getPopupOptionsById(popupId);

			if (!popupOptions['sgpb-disable-popup-closing'] && popupOptions['sgpb-esc-key']) {
				popup = popupData;
				break;
			}
		}
	}

	return popup;
};

SGPBPopup.prototype.setPopupId = function(popupId)
{
	this.id = parseInt(popupId);
};

SGPBPopup.prototype.getPopupId = function()
{
	return this.id;
};

SGPBPopup.prototype.setPopupObj = function(popupObj)
{
	this.popupObj = popupObj;
};

SGPBPopup.prototype.getPopupObj = function()
{
	return this.popupObj;
};

SGPBPopup.prototype.setPopupData = function(popupData)
{
	if (typeof popupData == 'string') {
		var popupData = SGPBPopup.JSONParse(popupData);
	}

	this.popupData = popupData;
};

SGPBPopup.prototype.getPopupData = function()
{
	return this.popupData;
};

SGPBPopup.prototype.setPopupConfig = function(config)
{
	this.popupConfig = config;
};

SGPBPopup.prototype.getPopupConfig = function()
{
	return this.popupConfig;
};

SGPBPopup.prototype.setUpPopupConfig = function()
{
	var popupConfig = new PopupConfig();
	this.setPopupConfig(popupConfig);
};

SGPBPopup.createPopupObjById = function(popupId)
{
	var options = SGPBPopup.getPopupOptionsById(popupId);

	if (!options) {
		return false;
	}
	var popupObj = new SGPBPopup();
	popupObj.setPopupId(popupId);
	popupObj.setPopupData(options);

	return popupObj;
};


SGPBPopup.getPopupOptionsById = function(popupId)
{
	var popupDataDiv = jQuery('#sg-popup-content-wrapper-'+popupId);

	if (!popupDataDiv.length) {
		return false;
	}
	var options = popupDataDiv.attr('data-options');

	return SGPBPopup.JSONParse(options);
};

SGPBPopup.prototype.getCompatibleZiIndex = function(popupZIndex)
{
	/*2147483647 it's maximal z index value*/
	if (popupZIndex > 2147483647) {
		return 2147483627;
	}

	return popupZIndex;
};

SGPBPopup.prototype.prepareOpen = function()
{
	var popupId = this.getPopupId();
	var popupData = this.getPopupData();
	var popupZIndex = this.getCompatibleZiIndex(popupData['sgpb-popup-z-index']);
	var popupType = this.popupData['sgpb-type'];
	this.setUpPopupConfig();
	var that = this;
	var popupConfig = this.getPopupConfig();

	function decodeEntities(encodedString)
	{
		if (typeof encodedString == 'undefined') {
			return '';
		}
		var suspiciousStrings = ['document.createElement', 'createElement', 'String.fromCharCode', 'fromCharCode'];
		for (var i in suspiciousStrings) {
			if (encodedString.indexOf(suspiciousStrings[i]) > 0) {
				return '';
			}
		}
		var textArea = document.createElement('textarea');
		textArea.innerHTML = encodedString;

		return textArea.value;
	}

	popupConfig.customShouldOpen = function()
	{
		var instructions = popupData['sgpb-ShouldOpen'];
		instructions = decodeEntities(instructions);
		var F = new Function (instructions);

		return(F());
	};

	popupConfig.customShouldClose = function()
	{
		var instructions = popupData['sgpb-ShouldClose'];
		instructions = decodeEntities(instructions);
		var F = new Function (instructions);

		return(F());
	};

	this.setPopupDimensions();

	if (popupData['sgpb-disable-popup-closing'] == 'on') {
		popupData['sgpb-enable-close-button'] = '';
		popupData['sgpb-esc-key'] = '';
		popupData['sgpb-overlay-click'] = '';
	}
	/*used in the analytics*/
	popupData['eventName'] = this.eventName;

	if (SGPBPopup.varToBool(popupData['sgpb-enable-close-button'])) {
		popupConfig.magicCall('setCloseButtonDelay', parseInt(popupData['sgpb-close-button-delay']));
	}

	popupConfig.magicCall('setShowButton', SGPBPopup.varToBool(popupData['sgpb-enable-close-button']));
	/* Convert seconds to micro seconds */
	var openAnimationSpeed = parseFloat(popupData['sgpb-open-animation-speed'])*1000;
	var closeAnimationSpeed = parseFloat(popupData['sgpb-close-animation-speed'])*1000;
	popupConfig.magicCall('setOpenAnimationEffect', popupData['sgpb-open-animation-effect']);
	popupConfig.magicCall('setCloseAnimationEffect', popupData['sgpb-close-animation-effect']);
	popupConfig.magicCall('setOpenAnimationSpeed', openAnimationSpeed);
	popupConfig.magicCall('setCloseAnimationSpeed', closeAnimationSpeed);
	popupConfig.magicCall('setOpenAnimationStatus', popupData['sgpb-open-animation']);
	popupConfig.magicCall('setCloseAnimationStatus', popupData['sgpb-close-animation']);
	popupConfig.magicCall('setContentPadding', popupData['sgpb-content-padding']);
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			/* set max z index for recent sales popup */
			popupZIndex = 2147483647;
			popupConfig.magicCall('setCloseAnimationEffect', 'fade');
			popupConfig.magicCall('setCloseAnimationSpeed', 1000);
			popupConfig.magicCall('setCloseAnimationStatus', 'on');
		}
	}

	popupConfig.magicCall('setZIndex', popupZIndex);
	popupConfig.magicCall('setCloseButtonWidth', popupData['sgpb-button-image-width']);
	popupConfig.magicCall('setCloseButtonHeight', popupData['sgpb-button-image-height']);
	popupConfig.magicCall('setPopupId', popupId);
	popupConfig.magicCall('setPopupData', popupData);
	popupConfig.magicCall('setAllowed', !SGPBPopup.varToBool(popupData['sgpb-disable-popup-closing']));
	if (popupData['sgpb-type'] == SGPB_POPUP_PARAMS.popupTypeAgeRestriction) {
		popupConfig.magicCall('setAllowed', false);
	}
	popupConfig.magicCall('setEscShouldClose', SGPBPopup.varToBool(popupData['sgpb-esc-key']));
	popupConfig.magicCall('setOverlayShouldClose', SGPBPopup.varToBool(popupData['sgpb-overlay-click']));

	popupConfig.magicCall('setScrollingEnabled', SGPBPopup.varToBool(popupData['sgpb-enable-content-scrolling']));

	if (SGPBPopup.varToBool(popupData['sgpb-content-click'])) {
		this.contentCloseBehavior();
	}
	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
			return false;
		}
		/* triggering any popup content click (analytics) */
		that.popupContentClick(e);
	});
	if (SGPBPopup.varToBool(popupData['sgpb-popup-fixed'])) {
		this.addFixedPosition();
	}
	/*ThemeCreator*/
	this.themeCreator();
	this.themeCustomizations();

	popupConfig.magicCall('setContents', document.getElementById('sg-popup-content-wrapper-'+popupId));
	popupConfig.magicCall('setPopupType', popupType);
	this.setPopupConfig(popupConfig);
	this.popupTriggeringListeners();

	/* check popup type, then check if popup can be opened by popup type */
	var allowToOpen = this.checkCurrentPopupType();
	if (allowToOpen) {
		this.open();
	}
};

SGPBPopup.prototype.popupContentClick = function(e)
{
	var args = e.detail;
	var popupId = parseInt(args['popupId']);
	jQuery('.sgpb-content-' + popupId).on('click', function(event) {
		var settings = {
			popupId: popupId,
			eventName: 'sgpbPopupContentclick'
		};
		jQuery(window).trigger('sgpbPopupContentclick', settings);
	});
};

SGPBPopup.prototype.forceCheckCurrentPopupType = function(popupObj)
{
	var allowToOpen = true;
	var popupConfig = new PopupConfig();
	var className = popupObj.popupData['sgpb-type'];
	if (typeof className == 'undefined' || className == 'undefined') {
		return false;
	}

	if (typeof SGPB_POPUP_PARAMS.conditionalJsClasses != 'undefined' && SGPB_POPUP_PARAMS.conditionalJsClasses.length) {
		var isAllowConditions = this.forceIsAllowJsConditions(popupObj);

		if (!isAllowConditions) {
			return false;
		}
	}

	var popupConfig = new PopupConfig();
	var className = this.popupData['sgpb-type'];
	/* make the first letter of a string uppercase, then concat prefix (uppercase all prefix string) */
	className = popupConfig.prefix.toUpperCase() + PopupConfig.firstToUpperCase(className);
	/* hasOwnProperty returns boolean value */
	if (window.hasOwnProperty(className)) {
		className = eval(className);
		/* create current popup type object */
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			allowToOpen = obj.allowToOpen(this.id);
			if (!allowToOpen) {
				isAllow = allowToOpen;
			}
		}
	}

	var allowToOpen = this.checkCurrentPopupType();
	if (!allowToOpen) {
		return false;
	}

	return allowToOpen;
};

SGPBPopup.prototype.checkCurrentPopupType = function()
{
	var allowToOpen = true;
	var popupConfig = new PopupConfig();

	var isPreview = parseInt(this.popupData['sgpb-is-preview']);
	if (!isNaN(isPreview) && isPreview == 1) {
		return allowToOpen;
	}

	var popupHasLimit = this.isSatistfyForShowingLimitation(this.popupData);
	if (!popupHasLimit) {
		return false;
	}

	var dontShowPopupCookieName = 'sgDontShowPopup' + this.popupData['sgpb-post-id'];
	var dontShowPopup = SGPopup.getCookie(dontShowPopupCookieName);
	if (dontShowPopup != '') {
		return false;
	}

	var className = this.popupData['sgpb-type'];
	if (typeof className == 'undefined' || className == 'undefined') {
		return false;
	}

	if (typeof SGPB_POPUP_PARAMS.conditionalJsClasses != 'undefined' && SGPB_POPUP_PARAMS.conditionalJsClasses.length) {
		var isAllowConditions = this.isAllowJsConditions();

		if (!isAllowConditions) {
			return false;
		}
	}

	/* make the first letter of a string uppercase, then concat prefix (uppercase all prefix string) */
	className = popupConfig.prefix.toUpperCase() + PopupConfig.firstToUpperCase(className);
	/* hasOwnProperty returns boolean value */
	if (window.hasOwnProperty(className)) {
		className = eval(className);
		/* create current popup type object */
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			allowToOpen = obj.allowToOpen(this.id);
		}
	}

	return allowToOpen;
};

SGPBPopup.prototype.forceIsAllowJsConditions = function(popupObj) {
	var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;

	var isAllow = true;

	for (var i in conditions) {
		if (!conditions.hasOwnProperty(i)) {
			break;
		}

		try {
			var className = eval(conditions[i]);
		}
		catch (e) {
			continue;
		}
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.forceAllowToOpen === 'function') {
			var popupData = this.getPopupData();
			var allowToOpen = obj.forceAllowToOpen(popupObj.id, popupObj);

			if (!allowToOpen) {
				isAllow = allowToOpen;
				break;
			}
		}
	}

	return isAllow;
};

SGPBPopup.prototype.isAllowJsConditions = function() {
	var conditions = SGPB_POPUP_PARAMS.conditionalJsClasses;
	var isAllow = true;

	for (var i in conditions) {
		if (!conditions.hasOwnProperty(i)) {
			break;
		}

		try {
			var className = eval(conditions[i]);
		}
		catch (e) {
			continue;
		}
		var obj = new className;
		/* call allowToOpen function if exists */
		if (typeof obj.allowToOpen === 'function') {
			var allowToOpen = obj.allowToOpen(this.id, this);
			if (!allowToOpen) {
				isAllow = allowToOpen;
				break;
			}
		}
	}

	return isAllow;
};

SGPBPopup.prototype.setPopupLimitationCookie = function(popupData)
{
	var cookieData = this.getPopupShowLimitationCookie(popupData);
	var cookie = cookieData.cookie || {};
	var openingCount = cookie.openingCount || 0;
	var currentUrl = window.location.href;

	if (!popupData['sgpb-show-popup-same-user-page-level']) {
		currentUrl = '';
	}
	cookie.openingCount = openingCount + 1;
	cookie.openingPage = currentUrl;
	var popupShowingLimitExpiry = parseInt(popupData['sgpb-show-popup-same-user-expiry']);

	SGPBPopup.setCookie(cookieData.cookieName, JSON.stringify(cookie), popupShowingLimitExpiry, currentUrl);
};

SGPBPopup.prototype.isSatistfyForShowingLimitation = function(popupData)
{
	/*enable||disable*/
	var popupLimitation = popupData['sgpb-show-popup-same-user'];

	/*if this option unchecked popup must be show*/
	if (!popupLimitation) {
		return true;
	}
	var cookieData = this.getPopupShowLimitationCookie(popupData);

	/*when there is not*/
	if (!cookieData.cookie) {
		return true;
	}

	return popupData['sgpb-show-popup-same-user-count'] > cookieData.cookie.openingCount;
};

SGPBPopup.prototype.getPopupShowLimitationCookie = function(popupData)
{
	var savedCookie = this.getPopupShowLimitationCookieDetails(popupData);
	var savedCookie = this.filterPopupLimitationCookie(savedCookie);

	return savedCookie;
};

SGPBPopup.prototype.filterPopupLimitationCookie = function(cookie)
{
	var result = {};
	result.cookie = '';
	if (cookie.isPageLevel) {

		result.cookieName = cookie.pageLevelCookieName;
		if (cookie.pageLevelCookie) {
			result.cookie = jQuery.parseJSON(cookie.pageLevelCookie);
		}

		SGPBPopup.deleteCookie(cookie.domainLevelCookieName);

		return result;
	}
	result.cookieName = cookie.domainLevelCookieName;
	if (cookie.domainLevelCookie) {
		result.cookie = jQuery.parseJSON(cookie.domainLevelCookie);
	}
	var currentUrl = window.location.href;

	SGPBPopup.deleteCookie(cookie.pageLevelCookieName, currentUrl);

	return result;
};

SGPBPopup.prototype.getPopupShowLimitationCookieDetails = function(popupData)
{
	var result = false;
	var currentUrl = window.location.href;
	var currentPopupId = popupData['sgpb-post-id'];

	/*Cookie names*/
	var popupLimitationCookieHomePageLevelName = 'SGPBShowingLimitationHomePage' + currentPopupId;
	var popupLimitationCookiePageLevelName = 'SGPBShowingLimitationPage' + currentPopupId;
	var popupLimitationCookieDomainName = 'SGPBShowingLimitationDomain' + currentPopupId;

	var pageLevelCookie = popupData['sgpb-show-popup-same-user-page-level'] || false;

	/*check if current url is home page*/
	if (currentUrl == SGPB_POPUP_PARAMS.homePageUrl) {
		popupLimitationCookiePageLevelName = popupLimitationCookieHomePageLevelName;
	}
	var popupLimitationPageLevelCookie = SGPopup.getCookie(popupLimitationCookiePageLevelName);
	var popupLimitationDomainCookie = SGPopup.getCookie(popupLimitationCookieDomainName);

	result = {
		'pageLevelCookieName': popupLimitationCookiePageLevelName,
		'domainLevelCookieName': popupLimitationCookieDomainName,
		'pageLevelCookie': popupLimitationPageLevelCookie,
		'domainLevelCookie': popupLimitationDomainCookie,
		'isPageLevel': pageLevelCookie
	};

	return result;
};

SGPBPopup.prototype.themeCreator = function()
{
	var noPositionSelected = false;
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var popupConfig = this.getPopupConfig();
	var forceRtlClass = '';
	var forceRtl = SGPBPopup.varToBool(popupData['sgpb-force-rtl']);
	var popupTheme = popupData['sgpb-popup-themes'];
	var popupType = popupData['sgpb-type'];
	var closeButtonWidth = popupData['sgpb-button-image-width'];
	var closeButtonHeight = popupData['sgpb-button-image-height'];
	var contentPadding = parseInt(popupData['sgpb-content-padding']);
	/* close button position */
	var top = parseInt(popupData['sgpb-button-position-top']);
	var right = parseInt(popupData['sgpb-button-position-right']);
	var bottom = parseInt(popupData['sgpb-button-position-bottom']);
	var left = parseInt(popupData['sgpb-button-position-left']);

	var contentClass = popupData['sgpb-content-custom-class'];
	/* for the 2-nd and 3-rd themes only */
	var popupBorder = SGPBPopup.varToBool(popupData['sgpb-disable-border']);
	var closeButtonImage = popupConfig.closeButtonImage;
	var themeNumber = 1;
	var backgroundColor = 'black';
	var borderColor = 'inherit';
	var recentSalesPopup = false;
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			recentSalesPopup = true;
			popupTheme = 'sgpb-theme-2';
			closeButtonPosition = 'topRight';
			backgroundColor = 'white';
			borderColor = '#ececec';
			top = '-10';
			right = '-10';
			popupConfig.magicCall('setShadowSpread', 1);
			popupConfig.magicCall('setContentShadowBlur', 5);
			popupConfig.magicCall('setOverlayVisible', false);
			popupConfig.magicCall('setContentShadowColor', '#000000b3');
			popupConfig.magicCall('setContentBorderRadius', '5px');
		}
	}
	var themeIndexNum = popupTheme[popupTheme.length -1];

	if (isNaN(top)) {
		top = this.closeButtonDefaultPositions[themeIndexNum].top;
	}
	if (isNaN(right)) {
		right = this.closeButtonDefaultPositions[themeIndexNum].right;
	}
	if (isNaN(bottom)) {
		bottom = this.closeButtonDefaultPositions[themeIndexNum].bottom;
	}
	if (isNaN(left)) {
		left = this.closeButtonDefaultPositions[themeIndexNum].left;
	}
	if (forceRtl) {
		forceRtlClass = ' sgpb-popup-content-direction-right';
	}
	if (popupData['sgpb-type'] == 'countdown') {
		popupConfig.magicCall('setMinWidth', 300);
	}
	popupConfig.magicCall('setContentPadding', contentPadding);
	popupConfig.magicCall('setOverlayAddClass', popupTheme+'-overlay sgpb-popup-overlay-' + popupId);
	popupConfig.magicCall('setContentAddClass', 'sgpb-content sgpb-content-'+popupId+' ' + popupTheme+'-content ' + contentClass + forceRtlClass);

	if (typeof popupData['sgpb-close-button-position'] == 'undefined' || popupData['sgpb-close-button-position'] == '') {
		/*
		 * in the old version we don't have close button position option
		 * and if noPositionSelected is true, the popup was not edited
		 */
		var noPositionSelected = true;
	}
	else {
		var closeButtonPosition = popupData['sgpb-close-button-position'];
		popupConfig.magicCall('setButtonPosition', closeButtonPosition);
	}

	if (popupTheme == 'sgpb-theme-1') {
		themeNumber = 1;
		popupConfig.magicCall('setShadowSpread', 14);
		/* 9px theme default close button position for all cases */
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-2') {
		themeNumber = 2;
		popupConfig.magicCall('setButtonInside', false);
		popupConfig.magicCall('setContentBorderWidth', 1);
		popupConfig.magicCall('setContentBackgroundColor', backgroundColor);
		popupConfig.magicCall('setContentBorderColor', borderColor);
		popupConfig.magicCall('setOverlayColor', 'white');
		var rightPosition = '0';
		var topPosition = '-' + closeButtonHeight + 'px';
		if (recentSalesPopup) {
			rightPosition = '-' + (closeButtonWidth / 2) + 'px';
			topPosition = '-' + (closeButtonHeight / 2) + 'px';
			themeNumber = 6;
		}
		if (noPositionSelected || closeButtonPosition == 'topRight') {
			/* this theme has 1px border */
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
		}

		if (popupBorder) {
			popupConfig.magicCall('setContentBorderWidth', 0);
		}
	}
	else if (popupTheme == 'sgpb-theme-3') {
		themeNumber = 3;
		popupConfig.magicCall('setContentBorderWidth', 5);
		popupConfig.magicCall('setContentBorderRadius', popupData['sgpb-border-radius']);
		popupConfig.magicCall('setContentBorderRadiusType', popupData['sgpb-border-radius-type']);
		popupConfig.magicCall('setContentBorderColor', popupData['sgpb-border-color']);
		var closeButtonPositionPx = '4px';
		if (popupBorder) {
			popupConfig.magicCall('setContentBorderWidth', 0);
			closeButtonPositionPx = '0px';
		}
		if (noPositionSelected) {
			popupConfig.magicCall('setCloseButtonWidth', 38);
			popupConfig.magicCall('setCloseButtonHeight', 19);
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (closeButtonPosition == 'topRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionLeft', right+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
			}
		}
	}
	else if (popupTheme == 'sgpb-theme-4') {
		/* in theme-4 close button type is button,not image,
		 * then set type to button, default is image and
		 * set text
		 */
		themeNumber = 4;
		popupConfig.magicCall('setButtonImage', popupData['sgpb-button-text']);
		popupConfig.magicCall('setCloseButtonType', 'button');
		popupConfig.magicCall('setCloseButtonText', popupData['sgpb-button-text']);
		popupConfig.magicCall('setContentBorderWidth', 0);
		popupConfig.magicCall('setContentBackgroundColor', 'white');
		popupConfig.magicCall('setContentBorderColor', 'white');
		popupConfig.magicCall('setOverlayColor', 'white');
		popupConfig.magicCall('setShadowSpread', 4);
		popupConfig.magicCall('setContentShadowBlur', 8);
		/* 8px/12px theme default close button position for all cases */
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-5') {
		themeNumber = 5;
		popupConfig.magicCall('setBoxBorderWidth', 10);
		popupConfig.magicCall('setContentBorderColor', '#4B4B4B');
		if (noPositionSelected || closeButtonPosition == 'bottomRight') {
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
		else {
			popupConfig.magicCall('setCloseButtonPositionLeft', left+'px');
			popupConfig.magicCall('setCloseButtonPositionBottom', bottom+'px');
		}
	}
	else if (popupTheme == 'sgpb-theme-6') {
		themeNumber = 6;
		popupConfig.magicCall('setButtonInside', false);
		popupConfig.magicCall('setContentBorderRadius', 7);
		popupConfig.magicCall('setContentBorderRadiusType', 'px');
		if (noPositionSelected) {
			popupConfig.magicCall('setCloseButtonWidth', 37);
			popupConfig.magicCall('setCloseButtonHeight', 37);
			popupConfig.magicCall('setCloseButtonPositionRight', right+'px');
			popupConfig.magicCall('setCloseButtonPositionTop', top+'px');
		}
		else {
			if (typeof popupData['sgpb-button-position-right'] == 'undefined') {
				right = '-' + (closeButtonWidth / 2);
				top = '-' + (closeButtonHeight / 2);
				left = '-' + (closeButtonWidth / 2);
				bottom = '-' + (closeButtonHeight / 2);
			}
			if (closeButtonPosition == 'topRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right + 'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top + 'px');
			}
			else if (closeButtonPosition == 'topLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left + 'px');
				popupConfig.magicCall('setCloseButtonPositionTop', top + 'px');
			}
			else if (closeButtonPosition == 'bottomRight') {
				popupConfig.magicCall('setCloseButtonPositionRight', right + 'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom + 'px');
			}
			else if (closeButtonPosition == 'bottomLeft') {
				popupConfig.magicCall('setCloseButtonPositionLeft', left + 'px');
				popupConfig.magicCall('setCloseButtonPositionBottom', bottom + 'px');
			}
		}
	}

	popupConfig.magicCall('setPopupTheme', themeNumber);
	if (!popupData['sgpb-button-image']) {
		closeButtonImage = SGPB_POPUP_PARAMS.defaultThemeImages[themeNumber];
		if (typeof closeButtonImage  != 'undefined') {
			popupConfig.magicCall('setButtonImage', closeButtonImage);
		}
	}
	else {
		popupConfig.magicCall('setButtonImage', 'data:image/png;base64,'+popupData['sgpb-button-image-data']);
		if (popupData['sgpb-button-image-data'] == '' || popupData['sgpb-button-image-data'].indexOf('http') != -1) {
			popupConfig.magicCall('setButtonImage', popupData['sgpb-button-image']);
		}
	}

};

SGPBPopup.prototype.themeCustomizations = function()
{
	var popupId = this.getPopupId();
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();

	var contentOpacity = popupData['sgpb-content-opacity'];
	var contentBgColor = popupData['sgpb-background-color'];
	if (popupData['sgpb-background-image-data']) {
		var contentBgImage = 'data:image/png;base64,'+popupData['sgpb-background-image-data'];
	}
	else {
		var contentBgImage = popupData['sgpb-background-image'];
	}
	var showContentBackground = popupData['sgpb-show-background'];
	var contentBgImageMode = popupData['sgpb-background-image-mode'];
	var overlayColor = popupData['sgpb-overlay-color'];
	var popupTheme = popupData['sgpb-popup-themes'];
	var popupType = popupData['sgpb-type'];
	if (typeof popupData['sgpb-overlay-custom-class'] == 'undefined') {
		popupData['sgpb-overlay-custom-class'] = 'sgpb-popup-overlay';
	}
	if (typeof popupData['sgpb-popup-themes'] == 'undefined') {
		popupTheme = 'sgpb-theme-2';
	}

	if (typeof showContentBackground == 'undefined') {
		contentBgColor = '';
		contentBgImage = '';
		contentBgImageMode = '';
	}
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupType == SgpbRecentSalesPopupType) {
			showContentBackground = 'on';
			contentBgColor = popupData['sgpb-background-color'];
			contentOpacity = popupData['sgpb-content-opacity'];
		}
	}

	if (contentOpacity) {
		popupConfig.magicCall('setContentBackgroundOpacity', contentOpacity);
	}
	if (contentBgImageMode) {
		popupConfig.magicCall('setContentBackgroundMode', contentBgImageMode);
	}
	if (contentBgImage) {
		popupConfig.magicCall('setContentBackgroundImage', contentBgImage);
	}
	if (contentBgColor) {
		contentBgColor = SGPBPopup.hexToRgba(contentBgColor, contentOpacity);
		popupConfig.magicCall('setContentBackgroundColor', contentBgColor);
	}
	if (overlayColor) {
		popupConfig.magicCall('setOverlayColor', overlayColor);
	}

	var overlayClasses = popupTheme+'-overlay sgpb-popup-overlay-'+popupId;
	if (SGPB_JS_PACKAGES.extensions['advanced-closing']) {
		if (typeof popupData['sgpb-enable-popup-overlay'] != 'undefined' && popupData['sgpb-enable-popup-overlay'] == 'on') {
			popupData['sgpb-enable-popup-overlay'] = true;
		}
		else if (typeof popupData['sgpb-enable-popup-overlay'] == 'undefined') {
			popupData['sgpb-enable-popup-overlay'] = false;
		}
	}
	else {
		popupData['sgpb-enable-popup-overlay'] = true;
	}

	popupConfig.magicCall('setOverlayVisible', SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay']));
	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		popupConfig.magicCall('setOverlayVisible', false);
	}
	if (SGPBPopup.varToBool(popupData['sgpb-enable-popup-overlay'])) {
		popupConfig.magicCall('setOverlayAddClass', overlayClasses + ' ' + popupData['sgpb-overlay-custom-class']);
		var overlayOpacity = popupData['sgpb-overlay-opacity'] || 0.8;
		popupConfig.magicCall('setOverlayOpacity', overlayOpacity * 100);
	}
};

SGPBPopup.prototype.formSubmissionDetection = function(args)
{
	if (args.length) {
		return false;
	}
	var popupId = args.popupId;
	var options = SGPBPopup.getPopupOptionsById(popupId);

	if (!options['sgpb-reopen-after-form-submission']) {
		return false;
	}

	jQuery('.sgpb-popup-builder-content-' + popupId + ' form').submit(function() {
		SGPBPopup.setCookie('SGPBSubmissionReloadPopup', popupId);
	});
};

SGPBPopup.prototype.htmlIframeFilterForOpen = function(popupId, popupEventName)
{
	var popupContent = jQuery('.sgpb-content-' + popupId);

	if (!popupContent.length) {
		return false;
	}

	popupContent.find('iframe').each(function() {

		if (popupEventName != 'open') {
			/* for do not affect facebook type buttons iframe only */
			if (jQuery(this).closest('.fb_iframe_widget').length) {
				return true;
			}

			/*close*/
			if (typeof jQuery(this).attr('data-attr-src') == 'undefined') {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
					jQuery(this).attr('src', '');
				}
				return true;
			}
			else {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
					jQuery(this).attr('src', '');
				}
				return true;
			}
		}
		else {
			/*open*/
			if (typeof jQuery(this).attr('data-attr-src') == 'undefined') {
				var src = jQuery(this).attr('src');
				if (src != '') {
					jQuery(this).attr('data-attr-src', src);
				}

				return true;
			}
			else {
				var src = jQuery(this).attr('data-attr-src');
				if (src != '') {
					jQuery(this).attr('src', src);
					jQuery(this).attr('data-attr-src', src);
				}
				return true;
			}
		}
	});
};

SGPBPopup.prototype.iframeSizesInHtml = function(args)
{
	var popupId = args['popupId'];
	var popupOptions = args.popupData;
	var popupContent = jQuery('.sgpb-content-' + popupId);

	if (!popupContent.length) {
		return false;
	}
	popupContent.find('iframe').each(function() {
		if (typeof jQuery(this) == 'undefined') {
			return false;
		}
		if (popupOptions['sgpb-popup-dimension-mode'] == 'customMode') {
			if (typeof jQuery(this).attr('width') == 'undefined' && typeof popupContent.attr('height') == 'undefined') {
				jQuery(this).css({'width': popupOptions['sgpb-width'], 'height': popupOptions['sgpb-height']});
			}
		}
	});
};

SGPBPopup.prototype.getSearchDataFromContent = function(content)
{
	var pattern = /\[(\[?)(pbvariable)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]\*+(?:\[(?!\/\2\])[^\[]\*+)\*+)\[\/\2\])?)(\]?)/gi;
	var match;
	var collectedData = [];

	while (match = pattern.exec(content)) {
		var currentSearchData = [];
		var attributes;
		var attributesKeyValue = [];
		var parseAttributes = /\s(\w+?)="(.+?)"/g;
		currentSearchData['replaceString'] = this.htmlDecode(match[0]);

		while (attributes = parseAttributes.exec(match[3])) {
			attributesKeyValue[attributes[1]] = this.htmlDecode(attributes[2]);
		}

		currentSearchData['searchData'] = attributesKeyValue;
		collectedData.push(currentSearchData);
	}

	return collectedData;
};

SGPBPopup.prototype.replaceWithCustomShortcode = function(popupId)
{
	var currentHtmlContent = jQuery('.sgpb-content-'+popupId).html();
	var searchData = this.getSearchDataFromContent(currentHtmlContent);
	var that = this;

	if (!searchData.length) {
		return false;
	}

	for (var index in searchData) {
		var currentSearchData = searchData[index];
		var searchAttributes = currentSearchData['searchData'];

		if (typeof searchAttributes['selector'] == 'undefined' || typeof searchAttributes['attribute'] == 'undefined') {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		try {
			if (!jQuery(searchAttributes['selector']).length) {
				that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
				continue;
			}
		}
		catch (e) {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		if (searchAttributes['attribute'] == 'text') {
			var replaceName = jQuery(searchAttributes['selector']).text();
		}
		else {
			var replaceName = jQuery(searchAttributes['selector']).attr(searchAttributes['attribute']);
		}

		if (typeof replaceName == 'undefined') {
			that.replaceShortCode(currentSearchData['replaceString'], '', popupId);
			continue;
		}

		that.replaceShortCode(currentSearchData['replaceString'], replaceName, popupId);
	}
};

SGPBPopup.prototype.replaceShortCode = function(shortCode, replaceText, popupId)
{
	var popupId = parseInt(popupId);

	if (!popupId) {
		return false;
	}

	var popupContentWrapper = jQuery('.sgpb-content-' + popupId);

	if (!popupContentWrapper.length) {
		return false;
	}

	popupContentWrapper.find('div').each(function() {
		var currentHtmlContent = jQuery(this).contents();

		if (!currentHtmlContent.length) {
			return false;
		}

		currentHtmlContent.html(function(i, v) {
			if (typeof v != 'undefined') {
				return v.replace(shortCode, replaceText);
			}
		});
	});

	return true;
};

SGPBPopup.prototype.popupTriggeringListeners = function()
{
	var that = this;
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();

	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		that.iframeSizesInHtml(args);
		that.formSubmissionDetection(args);
		var popupOptions = args.popupData;

		var closeButtonDelay = parseInt(popupOptions['sgpb-close-button-delay']);
		if (closeButtonDelay) {
			that.closeButtonDisplay(popupOptions['sgpb-post-id'], 'show', closeButtonDelay);
		}
		var disablePageScrolling = popupOptions['sgpb-disable-page-scrolling'];
		if (popupOptions['sgpb-overlay-color']) {
			jQuery('.sgpb-theme-1-overlay').css({'background-image': 'none'});
		}
		if (SGPBPopup.varToBool(disablePageScrolling)) {
			jQuery('html').addClass('sgpb-overflow-hidden');
			jQuery('body').addClass('sgpb-overflow-hidden-body');
		}
	});

	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		var args = e.detail;
		var popupId = parseInt(args['popupId']);
		that.htmlIframeFilterForOpen(args.popupId, 'open');
		that.replaceWithCustomShortcode(popupId);
		that.sgpbDontShowPopup(popupId);

		var closeButtonDelay = parseInt(popupData['sgpb-close-button-delay']);
		if (closeButtonDelay) {
			that.closeButtonDisplay(popupData['sgpb-post-id'], 'hide');
		}
		/* extra checker for analytics */
		var settings = {
			popupId: popupData['sgpb-post-id'],
			disabledAnalytics: popupData['sgpb-popup-counting-disabled'],
			disabledInGeneral: SGPB_POPUP_PARAMS.disableAnalyticsGeneral
		};
		jQuery(window).trigger('sgpbDisableAnalytics', settings);
	});

	sgAddEvent(window, 'sgpbShouldClose', function(e) {

	});

	sgAddEvent(window, 'sgpbWillClose', function(e) {
		var args = e.detail;
		SGPBPopup.offPopup(e.detail.currentObj);
	});
};

SGPBPopup.prototype.sgpbDontShowPopup = function(popupId)
{
	var dontShowPopup = jQuery('.sgpb-content-' + popupId).parent().find('[class*="sg-popup-dont-show"]');
	if (!dontShowPopup.length) {
		return false;
	}

	dontShowPopup.each(function() {
		jQuery(this).bind('click', function(e) {
			e.preventDefault();
			var expireTime = SGPB_POPUP_PARAMS.dontShowPopupExpireTime;
			var cookieName = 'sgDontShowPopup' + popupId;
			var classNameSearch = jQuery(this).attr('class').match(/sg-popup-dont-show/);
			var className = classNameSearch['input'];
			var customExpireTime = className.match(/sg-popup-dont-show-(\d+$)/);

			if (customExpireTime) {
				expireTime = parseInt(customExpireTime[1]);
			}

			SGPBPopup.setCookie(cookieName, expireTime, expireTime);
			SGPBPopup.closePopupById(popupId);
		});
	});
};

SGPBPopup.prototype.addToCounter = function(popupOptions)
{
	if (SGPB_POPUP_PARAMS.isPreview || (typeof popupOptions['sgpb-popup-counting-disabled'] != 'undefined')) {
		return false;
	}
	var that = this;
	var openedPopups = window.sgpbOpenedPopup || {};


	var popupId = parseInt(popupOptions['sgpb-post-id']);

	if (typeof openedPopups[popupId] == 'undefined') {
		openedPopups[popupId] = 1;
	}
	else {
		openedPopups[popupId] += 1;
	}
	window.sgpbOpenedPopup = openedPopups;
};

/*
 * closeButtonDisplay()
 * close or hide close button
 * @param popupId
 * @param display
 * @param delay
 */

SGPBPopup.prototype.closeButtonDisplay = function(popupId, display, delay)
{
	if (display == 'show') {
		setTimeout(function() {
				jQuery('.sgpb-content-' + popupId).prev().show();
			},
			delay * 1000 /* received values covert to milliseconds */
		);
	}
	else if (display == 'hide') {
		jQuery('.sgpb-content-' + popupId).prev().hide();
	}
};

SGPBPopup.prototype.open = function(args)
{
	var customEvent = this.customEvent;
	var config = this.getPopupConfig();
	var popupId = this.getPopupId();
	var eventName = this.eventName;

	if (typeof window.sgPopupBuilder == 'undefined') {
		window.sgPopupBuilder = [];
	}
	var popupData = SGPBPopup.getPopupWindowDataById(popupId);

	if (!popupData) {
		window.SGPB_ORDER += 1;
		var currentObj = {
			'eventName': eventName,
			'popupId': popupId,
			'order': window.SGPB_ORDER,
			'isOpen': true,
			'sgpbPopupObj': this
		};
		config.currentObj = currentObj;
		var popupConfig = config.combineConfigObj();
		var popup = new SGPopup(popupConfig);
		currentObj.popup = popup;
		window.sgPopupBuilder.push(currentObj);
	}
	else {
		popup = popupData['popup'];
		popupData['isOpen'] = true;
	}

	if (typeof args != 'undefined' && !args['countPopupOpen']) {
		/* don't allow to count popup opening */
		this.setCountPopupOpen(false);
	}
	popup.customEvent = customEvent;
	popup.open();
	this.setPopupObj(popup);

	/* contact form 7 form submission
	 * TODO: this must be moved to a better place in the future
	 * I'm leaving it here for now, since sgpbDidOpen() gets called way too much!
	 */
	var options = SGPBPopup.getPopupOptionsById(popupId);
	SgpbEventListener.CF7EventListener(popupId, options);
	if (typeof options['sgpb-behavior-after-special-events'] != 'undefined') {
		if (options['sgpb-behavior-after-special-events'].length) {
			options = options['sgpb-behavior-after-special-events'][0][0];
			if (options['param'] == 'contact-form-7') {
				SgpbEventListener.processCF7MailSent(popupId, options);
			}
		}
	}
};

SGPBPopup.varToBool = function(optionName)
{
	var returnValue = optionName ? true : false;

	return returnValue;
};

SGPBPopup.hexToRgba = function(hex, opacity)
{
	var c;
	if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
		c = hex.substring(1).split('');

		if (c.length == 3){
			c= [c[0], c[0], c[1], c[1], c[2], c[2]];
		}
		c = '0x'+c.join('');
		return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+','+opacity+')';
	}
	throw new Error('Bad Hex');
};

SGPBPopup.prototype.contentCopyToClick = function()
{
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();

	var tempInputId = 'content-copy-to-click-'+popupId;
	var value = this.htmlDecode(popupData['sgpb-copy-to-clipboard-text']);
	var tempInput = document.createElement("input");
	tempInput.id = tempInputId;
	tempInput.value = value;
	tempInput.style = 'position: absolute; right: -10000px';
	if (!document.getElementById(tempInputId)) {
		document.body.appendChild(tempInput);
	}
	tempInput.select();
	document.execCommand("copy");
	document.body.removeChild(tempInput);
};

SGPBPopup.prototype.htmlDecode = function(value)
{
	return jQuery('<textarea/>').html(value).text();
};

SGPBPopup.prototype.findTargetInsideExceptionsList = function(targetName, exceptionList)
{
	var status = false;
	var popupContentMainDiv = document.getElementById('sgpb-popup-dialog-main-div');

	while (targetName.parentNode) {
		targetName = targetName.parentNode;
		if (typeof targetName.tagName == 'undefined') {
			continue;
		}
		var tagName = targetName.tagName.toLowerCase();
		if (targetName === popupContentMainDiv) {
			break;
		}
		if (exceptionList.indexOf(tagName) != -1) {
			status =  true;
			break;
		}
	}

	return status;
};

SGPBPopup.prototype.contentCloseBehavior = function()
{
	var that = this;
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var redirectUrl = popupData['sgpb-click-redirect-to-url'];
	var contentClickBehavior = popupData['sgpb-content-click-behavior'];
	var redirectToNewTab = SGPBPopup.varToBool(popupData['sgpb-redirect-to-new-tab']);
	var closePopupAfterCopy = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-close-popup']);
	var clipboardAlert = SGPBPopup.varToBool(popupData['sgpb-copy-to-clipboard-alert']);

	var separators = ['&amp;', '/&/g'];
	for (var i in separators) {
		redirectUrl = redirectUrl.split(separators[i]).join('&');
	}

	sgAddEvent(window, 'sgpbDidOpen', function(e) {

	});
	sgAddEvent(window, 'sgpbWillOpen', function(e) {
		if (popupId != e.detail.popupId || e.detail.popupData['sgpb-content-click'] == 'undefined') {
			return false;
		}
		if (contentClickBehavior == 'redirect') {
			jQuery('.sgpb-content-'+popupId).addClass('sgpb-cursor-pointer');
		}
		jQuery('.sgpb-content-'+e.detail.popupId).on('click', function(event) {
			/* we need this settings in analytics */
			var settings = {
				popupId: popupId,
				eventName: 'sgpbPopupContentClick'
			};
			jQuery(window).trigger('sgpbPopupContentClick', settings);

			if (contentClickBehavior == 'redirect') {
				if (redirectToNewTab) {
					window.open(redirectUrl);
					SGPBPopup.closePopupById(that.getPopupId());
					return;
				}
				window.location = redirectUrl;
				SGPBPopup.closePopupById(that.getPopupId());
			}
			else if (contentClickBehavior == 'copy') {
				var exceptionList = ['input', 'textarea', 'select', 'button', 'a'];
				var targetName = event.target.tagName.toLowerCase();
				var parentTagName = event.target.parentNode.tagName.toLowerCase();
				var parentsIsInExceptionsList = that.findTargetInsideExceptionsList(event.target, exceptionList);

				/*for do not copy when user click to any input element*/
				if (exceptionList.indexOf(targetName) == -1 && !parentsIsInExceptionsList) {
					that.contentCopyToClick();

					if (closePopupAfterCopy) {
						SGPBPopup.closePopupById(that.getPopupId());
					}
					if (clipboardAlert) {
						alert(popupData['sgpb-copy-to-clipboard-message'])
					}
				}
			}
			else if (popupData['sgpb-disable-popup-closing'] != 'on') {
				SGPBPopup.closePopupById(that.getPopupId());
			}
		});
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {

	});
};

SGPBPopup.prototype.addFixedPosition = function()
{
	var popupData = this.getPopupData();
	var popupId = this.getPopupId();
	var popupConfig = this.getPopupConfig();

	var fixedPosition = popupData['sgpb-popup-fixed-position'];
	var positionRight = '';
	var positionTop = '';
	var positionBottom = '';
	var positionLeft = '';

	if (fixedPosition == 1) {
		positionTop = 40;
		positionLeft = 20;
	}
	else if (fixedPosition == 2) {
		positionLeft = 'center';
		positionTop = 40;
	}
	else if (fixedPosition == 3) {
		positionTop = 40;
		positionRight = 20;
	}
	else if (fixedPosition == 4) {
		positionTop = 'center';
		positionLeft = 20;
	}
	else if (fixedPosition == 6) {
		positionTop = 'center';
		positionRight = 20;
	}
	else if (fixedPosition == 7) {
		positionLeft = 20;
		positionBottom = 2;
	}
	else if (fixedPosition == 8) {
		positionLeft = 'center';
		positionBottom = 2;
	}
	else if (fixedPosition == 9) {
		positionRight = 20;
		positionBottom = 2;
	}

	if (typeof SgpbRecentSalesPopupType != 'undefined') {
		if (popupData['sgpb-type'] == SgpbRecentSalesPopupType) {
			if (positionTop != '') {
				positionTop = parseInt(positionTop+10);
			}
			else if (positionBottom != '') {
				positionBottom = parseInt(positionBottom+10);
			}
		}
	}
	popupConfig.magicCall('setPositionTop', positionTop);
	popupConfig.magicCall('setPositionRight', positionRight);
	popupConfig.magicCall('setPositionBottom', positionBottom);
	popupConfig.magicCall('setPositionLeft', positionLeft);
};

SGPBPopup.prototype.setPopupDimensions = function()
{
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();
	var popupId = this.getPopupId();
	var dimensionData = popupData['sgpb-popup-dimension-mode'];
	var maxWidth = popupData['sgpb-max-width'];
	var maxHeight = popupData['sgpb-max-height'];
	var minWidth = popupData['sgpb-min-width'];
	var minHeight = popupData['sgpb-min-height'];
	var contentPadding = popupData['sgpb-content-padding'];
	var popupType = popupData['sgpb-type'];

	popupConfig.magicCall('setMaxWidth', maxWidth);
	popupConfig.magicCall('setMaxHeight', maxHeight);
	popupConfig.magicCall('setMinWidth', minWidth);
	popupConfig.magicCall('setMinHeight', minHeight);

	if (popupType == 'image') {
		popupConfig.magicCall('setContentBackgroundImage', popupData['sgpb-image-url']);
		popupConfig.magicCall('setContentBackgroundMode', 'contain');
		if (dimensionData == 'customMode') {
			popupConfig.magicCall('setContentBackgroundPosition', 'center center');
		}
	}
	if (dimensionData == 'responsiveMode') {
		var dimensionMeasure = popupData['sgpb-responsive-dimension-measure'];
		/* for image popup type and responsive mode, set background image to fit */
		if (popupType == 'image' && dimensionMeasure != 'fullScreen') {
			popupConfig.magicCall('setContentBackgroundMode', 'fit');
			this.setMaxWidthForResponsiveImage();
		}

		var popupConfig = this.getPopupConfig();
		if (dimensionMeasure != 'auto') {
			popupConfig.magicCall('setWidth', dimensionMeasure+'%');

			popupConfig.magicCall('setContentBackgroundPosition', 'center');
		}
		else {
			var widthToSet = jQuery('.sgpb-popup-builder-content-'+popupId).width() + (contentPadding*2);

			if (isNaN(widthToSet)) {
				widthToSet = 'auto';
			}
			else {
				popupConfig.magicCall('setContentBackgroundPosition', 'center center');
				widthToSet += 'px';
			}

			popupConfig.magicCall('setWidth', widthToSet);
			if (dimensionMeasure == 'fullScreen') {
				popupConfig.magicCall('setHeight', widthToSet);
			}
		}

		return popupConfig;
	}

	var popupWidth = popupData['sgpb-width'];
	var popupHeight = popupData['sgpb-height'];

	popupConfig.magicCall('setWidth', popupWidth);
	popupConfig.magicCall('setHeight', popupHeight);

	return popupConfig;
};

SGPBPopup.prototype.setMaxWidthForResponsiveImage = function()
{
	var popupData = this.getPopupData();
	var popupConfig = this.getPopupConfig();
	var dimensionMeasure = popupData['sgpb-responsive-dimension-measure'];

	if (dimensionMeasure != 'auto') {
		var maxWidth = popupData['sgpb-max-width'];
		if (maxWidth == '') {
			popupConfig.magicCall('setMaxWidth', dimensionMeasure+'%');
			return true;
		}
		popupConfig.magicCall('setMaxWidth', dimensionMeasure+'%');
		if (maxWidth.indexOf('%') != '-1') {
			if (parseInt(maxWidth) < dimensionMeasure) {
				popupConfig.magicCall('setMaxWidth', maxWidth);
			}
		}
		else {
			var responsiveMeasureInPx = (dimensionMeasure*window.innerWidth)/100;
			if (maxWidth < responsiveMeasureInPx) {
				popupConfig.magicCall('setMaxWidth', maxWidth);
			}
		}
	}
};
SGPBPopup.JSONParse = function(data){
	return JSON.parse(atob(data, true));
};

// unused function!
SGPBPopup.b64DecodeUnicode = function(str)
{
	var Base64 = {

		/* private property */
		_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

		/* public method for decoding */
		decode : function (input) {
			var output = "";
			var chr1, chr2, chr3;
			var enc1, enc2, enc3, enc4;
			var i = 0;

			input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

			while (i < input.length) {
				enc1 = this._keyStr.indexOf(input.charAt(i++));
				enc2 = this._keyStr.indexOf(input.charAt(i++));
				enc3 = this._keyStr.indexOf(input.charAt(i++));
				enc4 = this._keyStr.indexOf(input.charAt(i++));

				chr1 = (enc1 << 2) | (enc2 >> 4);
				chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
				chr3 = ((enc3 & 3) << 6) | enc4;

				output += String.fromCharCode(chr1);

				if (enc3 != 64) {
					output += String.fromCharCode(chr2);
				}
				if (enc4 != 64) {
					output += String.fromCharCode(chr3);
				}

			}

			output = Base64._utf8_decode(output);

			return output;

		},

		/* private method for UTF-8 decoding */
		_utf8_decode : function (utftext) {
			var string = "";
			var i = 0;
			var c = c1 = c2 = 0;

			while (i < utftext.length) {

				c = utftext.charCodeAt(i);

				if (c < 128) {
					string += String.fromCharCode(c);
					i++;
				}
				else if ((c > 191) && (c < 224)) {
					c2 = utftext.charCodeAt(i+1);
					string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
					i += 2;
				}
				else {
					c2 = utftext.charCodeAt(i+1);
					c3 = utftext.charCodeAt(i+2);
					string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
					i += 3;
				}
			}

			return string;
		}
	};

	return Base64.decode(str);
};

// unused function!
SGPBPopup.unserialize_old = function(data)
{
	data = SGPBPopup.b64DecodeUnicode(data);

	var $global = (typeof window !== 'undefined' ? window : global);

	var utf8Overhead = function(str) {
		var s = str.length;
		for (var i = str.length - 1; i >= 0; i--) {
			var code = str.charCodeAt(i);
			if (code > 0x7f && code <= 0x7ff) {
				s++;
			}
			else if (code > 0x7ff && code <= 0xffff) {
				s += 2;
			}
			/* trail surrogate */
			if (code >= 0xDC00 && code <= 0xDFFF) {
				i--;
			}
		}
		return s - 1;
	};

	var error = function(type, msg, filename, line) {
		throw new $global[type](msg, filename, line);
	};
	var readUntil = function(data, offset, stopchr) {
		var i = 2;
		var buf = [];
		var chr = data.slice(offset, offset + 1);

		while (chr !== stopchr) {
			if ((i + offset) > data.length) {
				error('Error', 'Invalid');
			}
			buf.push(chr);
			chr = data.slice(offset + (i - 1), offset + i);
			i += 1;
		}
		return [buf.length, buf.join('')];
	};
	var readChrs = function(data, offset, length) {
		var i, chr, buf;

		buf = [];
		for (i = 0; i < length; i++) {
			chr = data.slice(offset + (i - 1), offset + i);
			buf.push(chr);
			length -= utf8Overhead(chr);
		}
		return [buf.length, buf.join('')];
	};
	function _unserialize(data, offset) {
		var dtype;
		var dataoffset;
		var keyandchrs;
		var keys;
		var contig;
		var length;
		var array;
		var readdata;
		var readData;
		var ccount;
		var stringlength;
		var i;
		var key;
		var kprops;
		var kchrs;
		var vprops;
		var vchrs;
		var value;
		var chrs = 0;
		var typeconvert = function(x) {
			return x
		};

		if (!offset) {
			offset = 0
		}
		dtype = (data.slice(offset, offset + 1)).toLowerCase();

		dataoffset = offset + 2;

		switch (dtype) {
			case 'i':
				typeconvert = function(x) {
					return parseInt(x, 10);
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'b':
				typeconvert = function(x) {
					return parseInt(x, 10) !== 0;
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'd':
				typeconvert = function(x) {
					return parseFloat(x);
				};
				readData = readUntil(data, dataoffset, ';');
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 1;
				break;
			case 'n':
				readdata = null;
				break;
			case 's':
				ccount = readUntil(data, dataoffset, ':');
				chrs = ccount[0];
				stringlength = ccount[1];
				dataoffset += chrs + 2;

				readData = readChrs(data, dataoffset + 1, parseInt(stringlength, 10));
				chrs = readData[0];
				readdata = readData[1];
				dataoffset += chrs + 2;
				if (chrs !== parseInt(stringlength, 10) && chrs !== readdata.length) {
					error('SyntaxError', 'String length mismatch')
				}
				break;
			case 'a':
				readdata = {};

				keyandchrs = readUntil(data, dataoffset, ':');
				chrs = keyandchrs[0];
				keys = keyandchrs[1];
				dataoffset += chrs + 2;

				length = parseInt(keys, 10);
				contig = true;

				for (i = 0; i < length; i++) {
					kprops = _unserialize(data, dataoffset);
					kchrs = kprops[1];
					key = kprops[2];
					dataoffset += kchrs;

					vprops = _unserialize(data, dataoffset);
					vchrs = vprops[1];
					value = vprops[2];
					dataoffset += vchrs;

					if (key !== i) {
						contig = false;
					}

					readdata[key] = value;
				}

				if (contig) {
					array = new Array(length);
					for (i = 0; i < length; i++) {
						array[i] = readdata[i];
					}
					readdata = array;
				}

				dataoffset += 1;
				break;
			default:
				error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype);
				break;
		}

		return [dtype, dataoffset - offset, typeconvert(readdata)]
	}

	return _unserialize((data + ''), 0)[2];
};

SGPBPopup.closePopup = function()
{
	var popupObjs = window.sgPopupBuilder;
	var lastPopupObj = this.getLastPopup();

	if (typeof lastPopupObj == 'undefined') {
		return false;
	}

	var popupId = lastPopupObj.popupId;

	SGPBPopup.closePopupById(popupId);
};

SGPBPopup.closePopupById = function(popupId)
{
	var popupObjs = window.sgPopupBuilder;
	if (!popupObjs.length) {
		return;
	}

	for (var i in popupObjs) {

		var currentObj = popupObjs[i];

		if (currentObj.popupId == popupId) {
			var popupObj = popupObjs[i]['popup'];
			if (popupObj) {
				/*Send true argument to don’t count disable popup option*/
				popupObj.close(true);
			}
		}
	}
};

SGPBPopup.getPopupWindowDataById = function(popupId)
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (typeof popups == 'undefined' || !popups.length) {
		return popup;
	}

	for (var i in popups) {
		var popupData = popups[i];

		if (popupData.popupId == popupId) {
			popup = popupData;
			break;
		}
	}

	return popup;
};

SGPBPopup.findPopupObjById = function(popupId)
{
	var popup = false;
	var popupData = SGPBPopup.getPopupWindowDataById(popupId);

	if (popupData) {
		popup = popupData['popup'];
	}

	return popup;
};

SGPBPopup.getLastPopup = function()
{
	var popups = window.sgPopupBuilder;
	var popup = false;

	if (!popups.length) {
		return popup;
	}

	var searchPopups = [].concat(popups);

	for (var i in searchPopups) {
		var popupData = searchPopups[i];

		if (popupData.isOpen) {
			popup = popupData;
			break;
		}
	}

	return popup;
};

SGPBPopup.offPopup = function(currentPopup)
{
	var popups = window.sgPopupBuilder;

	if (!popups.length) {
		return false;
	}

	for (var i in popups) {
		var popupData = popups[i];

		if (popupData.order == currentPopup.order && popupData.eventName == currentPopup.eventName) {
			popups[i]['isOpen'] = false;
			break;
		}
	}

	return true;
};

SGPBPopup.capitalizeFirstLetter = function(string)
{
	return string.charAt(0).toUpperCase() + string.slice(1);
};

SGPBPopup.getParamFromUrl = function(param)
{
	var url = window.location.href;
	param = param.replace(/[\[\]]/g, "\\$&");
	var regex = new RegExp("[?&]" + param + "(=([^&#]*)|&|#|$)"),
		results = regex.exec(url);
	if (!results) {
		return null;
	}
	if (!results[2]) {
		return '';
	}
	return decodeURIComponent(results[2].replace(/\+/g, " "));
};

/*
 *
 * SGPBPopup Cookies' settings
 *
 */
SGPBPopup.setCookie = function(cName, cValue, exDays, cPageLevel)
{
	var sameSite = 'Lax';
	var isPreview = SGPBPopup.getParamFromUrl('preview');
	if (isPreview) {
		return false;
	}
	var expirationDate = new Date();
	var cookiePageLevel = '';
	var cookieExpirationData = 1;
	if (!exDays || isNaN(exDays)) {
		if (!exDays && exDays === 0) {
			exDays = 'session';
		}
		else {
			exDays = 365*50;
		}
	}

	if (!Boolean(cPageLevel)) {
		cookiePageLevel = 'path=/;';
	}

	if (exDays == 'session') {
		cookieExpirationData = 0;
	}
	else {
		expirationDate.setDate(parseInt(expirationDate.getDate() + parseInt(exDays)));
		cookieExpirationData = expirationDate.toUTCString();
	}
	var expires = 'expires='+cookieExpirationData;
	if (exDays == -1) {
		expires = '';
	}

	if (!cookieExpirationData) {
		expires = '';
	}

	/* in IE there is no need to specify the path */
	if (SGPBPopup.isIE()) {
		cookiePageLevel = '';
	}

	var value = cValue+((exDays == null) ? ';' : '; '+expires+';'+cookiePageLevel+'; SameSite=' + sameSite);
	document.cookie = cName + '=' + value;
};

SGPBPopup.isIE = function()
{
	ua = navigator.userAgent;
	/* MSIE used to detect old browsers and Trident used to newer ones*/
	var isIe = ua.indexOf('MSIE ') > -1 || ua.indexOf('Trident/') > -1;

	return isIe;
};

SGPBPopup.getCookie = function(cName)
{
	var name = cName + '=';
	var ca = document.cookie.split(';');
	for (var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ') {
			c = c.substring(1);
		}
		if (c.indexOf(name) == 0) {
			return c.substring(name.length, c.length);
		}
	}

	return '';
};

/*
 *
 * Delete the cookie by expiring it
 *
 */

SGPBPopup.deleteCookie = function(cName, cPath)
{
	if (!cPath) {
		cPath = 'path=/;';
	}

	document.cookie = cName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;' + cPath;
};

/**
 *
 * @SgpbEventListener listen Events and call corresponding events
 *
 */

function SgpbEventListener()
{
	this.evenets = null;
	this.popupObj = {};
}

SgpbEventListener.inactivityIdicator = 0;

SgpbEventListener.prototype.setEvents = function(events)
{
	this.evenets = events;
};

SgpbEventListener.prototype.getEvents = function()
{
	return this.evenets;
};

SgpbEventListener.prototype.setPopupObj = function(popupObj)
{
	this.popupObj = popupObj;
};

SgpbEventListener.prototype.getPopupObj = function()
{
	return this.popupObj;
};

SgpbEventListener.eventsListenerAfterDocumentReady = function()
{
	window.SGPB_SOUND = [];

	sgAddEvent(window, 'sgpbDidOpen', function(e) {

		//Modern browsers block autoplay with sound unless the user has interacted with the page
		//SGPBPopup.playMusic(e);

		const pbsgsoundnotification = document.querySelector("#pbsgsoundnotification");
		if (pbsgsoundnotification) {
	       pbsgsoundnotification.addEventListener("click", () => {
	            SGPBPopup.playMusic(e);
	            pbsgsoundnotification.classList.add("fade");
	        });
	    }
	});

	

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var popupId = parseInt(args.popupId);
		if (typeof window.SGPB_SOUND[popupId] && window.SGPB_SOUND[popupId]) {
			window.SGPB_SOUND[popupId].pause();
			delete window.SGPB_SOUND[popupId];
		}
	});
};

SgpbEventListener.init = function()
{
	SgpbEventListener.eventsListenerAfterDocumentReady();
	var popupsData = jQuery('.sg-popup-builder-content');

	if (!popupsData) {
		return '';
	}

	var that = this;

	popupsData.each(function() {
		var popupObj = that.popupObjCreator(jQuery(this));
		SGPBPopup.floatingButton(popupObj);
	});
};

SgpbEventListener.popupObjCreator = function(currentData)
{
	var popupId = currentData.data('id');
	var popupData = currentData.data('options');

	var events = currentData.attr('data-events');
	events = jQuery.parseJSON(events);

	SgpbEventListener.reopenAfterFormSubmission(popupData);

	var popupObj = new SGPBPopup();
	popupObj.setPopupId(popupId);
	popupObj.setPopupData(popupData);

	for (var i in events) {
		var obj = new this;
		obj.setPopupObj(popupObj);
		obj.eventListener(events[i]);
	}

	return popupObj;
};

SgpbEventListener.prototype.eventListener = function(eventData)
{
	if (eventData == null) {
		return '';
	}
	var event = '';
	if (typeof eventData == 'string') {
		event = eventData;
	}
	else if (typeof eventData.param != 'undefined') {
		event = eventData.param;
	}

	if (!event) {
		return false;
	}

	var popupObj = this.getPopupObj();
	var popupData = popupObj.getPopupData();

	if (eventData.value == '') {
		eventData.value = popupData['sgpb-popup-delay'];
	}

	var eventName = SGPBPopup.capitalizeFirstLetter(event);

	eventName = 'sgpb'+eventName;
	popupObj.eventName = eventName;

	var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);

	if (!allowToOpen) {
		return false;
	}
	try {
		eval('this.'+eventName)(this, eventData);
	}
	catch (err) {
		console.log(err)
	}

};

SgpbEventListener.reopenAfterFormSubmission = function(eventData)
{
	var popupId = SGPBPopup.getCookie('SGPBSubmissionReloadPopup');
	popupId = parseInt(popupId);

	if (!popupId) {
		return false;
	}
	var popupObj = SGPBPopup.createPopupObjById(popupId);
	if (!popupObj) {
		return false;
	}
	var options = popupObj.getPopupData();

	if (!options['sgpb-reopen-after-form-submission']) {
		return false;
	}

	popupObj.prepareOpen();
	SGPBPopup.deleteCookie('SGPBSubmissionReloadPopup');
};

SgpbEventListener.prototype.sgpbLoad = function(listenerObj, eventData)
{
	var timeout = parseInt(eventData.value);
	var popupObj = listenerObj.getPopupObj();
	var popupOptions = popupObj.getPopupData();
	timeout *= 1000;
	var timerId,
		repetitiveTimeout = null;


	/* same as checkCurrentPopupType(), but it fires ignoring any delay (etc. onload delay) */
	popupObj.forceCheckCurrentPopupType(popupObj);


	var openOnLoadPopup = function() {
		setTimeout(function() {
			jQuery(window).trigger('sgpbLoadEvent', popupOptions);
			popupObj.prepareOpen();
		}, timeout);
	};
	sgAddEvent(window, 'load', openOnLoadPopup(timeout, popupObj));
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		clearInterval(repetitiveTimeout);
	});

	sgAddEvent(window, 'sgpbDidClose', function(e) {
		var args = e.detail;
		var options = popupObj.getPopupData();
		if (SGPBPopup.varToBool(eventData['repetitive'])) {
			var intervalTime = parseInt(eventData['value'])*1000;
			repetitiveTimeout = setInterval(function() {
				popupObj.prepareOpen();
			}, intervalTime);
		}
	});
};

SgpbEventListener.prototype.timerIncrement = function(listenerObj , idleInterval)
{
	var lastActivity = SgpbEventListener.inactivityIdicator;

	if (lastActivity == 0) {
		clearInterval(idleInterval);
		listenerObj.getPopupObj().prepareOpen();
	}
	SgpbEventListener.inactivityIdicator = 0;
};

SgpbEventListener.prototype.sgpbInsideclick = function(listenerObj, eventData)
{
	sgAddEvent(window, 'sgpbDidOpen', function(e) {
		var args = e.detail;
		var that = listenerObj;
		var popupObj = that.getPopupObj();
		var popupId = parseInt(popupObj.id);
		var targetClick = jQuery('.sgpb-content .sgpb-popup-id-'+popupId);

		if (!targetClick.length) {
			return false;
		}

		targetClick.each(function() {
			jQuery(this).unbind('click').bind('click', function() {
				var dontCloseCurrentPopup = jQuery(this).attr('dontCloseCurrentPopup');
				if (typeof dontCloseCurrentPopup == 'undefined' || dontCloseCurrentPopup != 'on') {
					SGPBPopup.closePopup();
				}
				popupObj.prepareOpen();
			});
		});
	});
};

SgpbEventListener.prototype.sgpbClick = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupIds = [];
	var popupObj = that.getPopupObj();
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	popupIds.push(mapId);
	if (jQuery.inArray(mapId, popupIds) === -1) {
		popupIds.push(mapId);
	}

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}
		var targetClick = jQuery('a[href*="#sg-popup-id-' + popupId + '"], .sg-popup-id-' + popupId + ', .sgpb-popup-id-' + popupId);

		if (typeof eventData.operator != 'undefined' && eventData.operator == 'clickActionCustomClass') {
			targetClick = jQuery('a[href*="#sg-popup-id-' + popupId + '"], .sg-popup-id-' + popupId + ', .sgpb-popup-id-' + popupId+', .'+eventData.value);
		}
		if (!targetClick.length) {
			continue;
		}
		var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
		var clickCount = 1;
		targetClick.each(function() {

			if (!jQuery(this).attr('data-popup-id')) {
				jQuery(this).attr('data-popup-id', popupId);
			}
			var currentTarget = jQuery(this);
			currentTarget.bind('swipe', function(e) {
				return false;
			});
			currentTarget.bind('click', function(e) {
				if (clickCount > 1) {
					return true;
				}

				var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);
				if (!allowToOpen) {
					return true;
				}
				++clickCount;
				jQuery(window).trigger('sgpbClickEvent', popupOptions);
				var popupId = jQuery(this).data('popup-id');
				setTimeout(function() {

					var popupObj = SGPBPopup.createPopupObjById(popupId);
					if (!popupObj) {
						var mapId = listenerObj.filterPopupId(popupId);
						popupObj = SGPBPopup.createPopupObjById(mapId);
					}
					popupObj.customEvent = 'Click';
					popupObj.prepareOpen();
					clickCount = 1;
				}, delay);

				return false;
			});
		});
	}
};

SgpbEventListener.prototype.sgpbHover = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();

	if (!popupObj) {
		return false;
	}
	var popupIds = [];
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	if (jQuery.inArray(mapId, popupIds) === -1) {
		popupIds.push(mapId);
	}

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}

		var hoverSelector = jQuery('.sg-popup-hover-' + popupId + ', .sgpb-popup-id-' + popupId + '[data-popup-event="hover"]');

		if (typeof eventData.operator != 'undefined' && eventData.operator == 'hoverActionCustomClass') {
			hoverSelector = jQuery('.sg-popup-hover-' + popupId + ', .sgpb-popup-id-' + popupId + '[data-popup-event="hover"]'+', .'+eventData.value);
		}

		if (!hoverSelector) {
			return false;
		}
		var hoverCount = 1;
		var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;

		hoverSelector.each(function () {
			if (!jQuery(this).attr('data-popup-id')) {
				jQuery(this).attr('data-popup-id', popupId);
			}
			jQuery(this).bind('mouseenter', function() {
				if (hoverCount > 1) {
					return false;
				}
				++hoverCount;
				var popupId = jQuery(this).data('popup-id');
				jQuery(window).trigger('sgpbHoverEvent', popupOptions);
				setTimeout(function() {
					var popupObj = SGPBPopup.createPopupObjById(popupId);
					if (!popupObj) {
						var mapId = listenerObj.filterPopupId(popupId);
						popupObj = SGPBPopup.createPopupObjById(mapId);
					}
					popupObj.customEvent = 'Hover';
					popupObj.prepareOpen();
					hoverCount = 1;
				}, delay);
			});
		});
	}
};

SgpbEventListener.prototype.sgpbConfirm = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();

	if (!popupObj) {
		return false;
	}
	var popupIds = [];
	var popupOptions = popupObj.getPopupData();
	var popupId = parseInt(popupObj.id);
	popupIds.push(popupId);
	var mapId = listenerObj.filterPopupId(popupId);
	popupIds.push(mapId);

	for(var key in popupIds) {
		var popupId = popupIds[key];
		if (!popupIds.hasOwnProperty(key)) {
			return false;
		}

		var confirmSelector = jQuery('.sg-confirm-popup-' + popupId);

		if (!confirmSelector) {
			return false;
		}
		var confirmCount = 1;

		confirmSelector.bind('click', function(e) {
			if (confirmCount > 1) {
				return false;
			}
			++confirmCount;
			var allowToOpen = popupObj.forceCheckCurrentPopupType(popupObj);

			if (!allowToOpen) {
				return true;
			}
			jQuery(window).trigger('sgpbConfirmEvent', popupOptions);
			var target = jQuery(this).attr('target');

			if (typeof target == 'undefined') {
				target = 'self';
			}
			var href = jQuery(this).attr('href');
			var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
			setTimeout(function() {
				if (typeof href != 'undefined') {
					popupOptions['sgpb-confirm-' + popupId] = {'target' : target, 'href' : href};
					popupObj.setPopupData(popupOptions);
				}
				popupObj.prepareOpen();
				confirmCount = 1;
			}, delay);

			return false;
		});

		sgAddEvent(window, 'sgpbDidClose', function(e) {
			var args = e.detail;
			var popupId = parseInt(args.popupId);
			var popupOptions = args.popupData;

			if (typeof popupOptions['sgpb-confirm-' + popupId] != 'undefined') {
				var confirmAgrs = popupOptions['sgpb-confirm-' + popupId];

				if (confirmAgrs['target'] == '_blank') {
					window.open(confirmAgrs['href']);
				}
				else {
					window.location.href = confirmAgrs['href'];
				}

				delete popupOptions['sgpb-confirm-' + popupId];
				popupObj.setPopupData(popupOptions);
			}
		});
	}
};

SgpbEventListener.prototype.sgpbAttronload = function(listenerObj, eventData)
{
	var that = listenerObj;
	var popupObj = that.getPopupObj();
	var popupId = parseInt(popupObj.id);
	popupId = listenerObj.filterPopupId(popupId);
	var popupOptions = popupObj.getPopupData();
	var delay = parseInt(popupOptions['sgpb-popup-delay']) * 1000;
	jQuery(window).trigger('sgpbAttronloadEvent', popupOptions);

	setTimeout(function() {
		popupObj.prepareOpen();
	}, delay);
};

/*for the old popups*/
SgpbEventListener.prototype.filterPopupId = function(popupId)
{
	var convertedIds = SGPB_POPUP_PARAMS.convertedIdsReverse;
	var popupNewId = popupId;
	if (convertedIds[popupId]) {
		return convertedIds[popupId];
	}
	else {
		for(var i in convertedIds) {
			if (popupId == convertedIds[i]) {
				popupNewId = parseInt(i);
				break;
			}
		}
	}

	return popupNewId;
};

SgpbEventListener.findCF7InPopup = function(popupId)
{
	return document.querySelector('#sg-popup-content-wrapper-'+popupId+' .wpcf7');
};

SgpbEventListener.CF7EventListener = function(popupId, options)
{
	var wpcf7Elm = SgpbEventListener.findCF7InPopup(popupId);

	if (wpcf7Elm) {
		wpcf7Elm.addEventListener('wpcf7mailsent', function(event) {
			var settings = {
				popupId: popupId,
				eventName: 'sgpbCF7Success'
			};
			jQuery(window).trigger('sgpbCF7Success', settings);
		});
	}
};

SgpbEventListener.processCF7MailSent = function(popupId, options)
{
	var wpcf7Elm = SgpbEventListener.findCF7InPopup(popupId);

	if (wpcf7Elm) {
		wpcf7Elm.addEventListener('wpcf7mailsent', function(event) {
			if (typeof options['operator'] == 'undefined') {
				return;
			}
			if (options['operator'] == 'close-popup') {
				setTimeout(function() {
					SGPBPopup.closePopupById(popupId);
				}, parseInt(options['value'])*1000);
			}
			else if (options['operator'] == 'redirect-url') {
				window.location.href = options['value'];
			}
			else if (options['operator'] == 'open-popup') {
				SGPBPopup.closePopupById(popupId);
				var popupObj = SGPBPopup.createPopupObjById(Object.keys(options['value'])[0]);
				popupObj.prepareOpen();
			}
		}, false);
	}
};

jQuery(document).ready(function(e) {
	setTimeout(function(){
		SgpbEventListener.init();
		SGPBPopup.listeners();
	}, 1);
});
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/complete.js?ver=1 
jQuery(document).ready(function() {
	jQuery(".header-search-toggle").click(function() {
	   jQuery(".header-search-form").toggle();
	   jQuery(".header-search-form .search-field").focus();
	 });
});

jQuery(document).ready(function( jQuery ) {
        jQuery('.skt-builder-column-numbers').counterUp({
            delay: 100,
            time: 2000
        });
});

function getMobileOperatingSystem() {
    var e = navigator.userAgent || navigator.vendor || window.opera;
    return e.match(/iPad/i) || e.match(/iPhone/i) || e.match(/iPod/i) ? "iOS" : void 0
}
jQuery(window).ready(function() {
    function e() {
        return "ontouchstart" in window || navigator.MaxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
    }
    e() && jQuery("body").addClass("touchon"), jQuery(window).width() > 1023 && (jQuery("#topmenu ul > li").not("#topmenu ul > li.mega-menu-item").hoverIntent(function() {
        jQuery(this).find(".sub-menu, ul.children").not(".sub-menu .sub-menu, ul.children ul.children").removeClass("").addClass("menushow")
    }, function() {
        jQuery(this).find(".sub-menu, ul.children").not(".sub-menu .sub-menu, ul.children ul.children").addClass("").delay(0).queue(function(e) {
            jQuery(this).removeClass("menushow"), e()
        })
    }), jQuery("#topmenu ul li ul li").not("#topmenu ul li.mega-menu-item ul.mega-sub-menu li").hoverIntent(function() {
        jQuery(this).find(".sub-menu, ul.children").removeClass("").addClass("menushow")
    }, function() {
        jQuery(this).find(".sub-menu, ul.children").addClass("").delay(0).queue(function(e) {
            jQuery(this).removeClass("menushow"), e()
        })
    }), jQuery("#topmenu ul li").not("#topmenu ul li.mega-menu-item, #topmenu ul li ul li").hover(function() {
        jQuery(this).addClass("menu_hover")
    }, function() {
        jQuery(this).removeClass("menu_hover")
    }), jQuery("#topmenu li").has("ul").addClass("zn_parent_menu"), jQuery(".zn_parent_menu > a").append('<span class="menu_arrow"><i class="fa-angle-down"></i></span>')), jQuery(".midrow_blocks_wrap").each(function(e, t) {
        jQuery(this).waitForImages(function() {
            jQuery(this).find(".midrow_block").matchHeight({
                property: "min-height"
            })
        })
    }), jQuery(".lay1").each(function(e, t) {
        for (var r = jQuery(this).find(".hentry"), i = 0; i < r.length; i += 3) r.slice(i, i + 3).wrapAll("<div class='ast_row'></div>");
        if (jQuery(window).width() < 1200) {
            var a = jQuery(this).find(".hentry").width();
            jQuery(this).find(".post_image").css({
                maxHeight: 66 * a / 100
            })
        }
    }), jQuery(".lay1 .postitle a:empty").closest("h2").addClass("no_title"), jQuery(".no_title").css({
        padding: "0"
    }), jQuery(".lay1 h2.postitle a").each(function() {
        jQuery(this).height() > 80 && jQuery(this).parent().parent().parent().addClass("lowreadmo")
    }), jQuery(".lts_layout1 .listing-item h2").each(function() {
        jQuery(this).outerHeight() > 76 && jQuery(this).parent().addClass("lowreadmo")
    }), jQuery(window).bind("scroll", function() {
        jQuery(this).scrollTop() > 800 ? jQuery(".to_top").fadeIn("slow") : jQuery(".to_top").fadeOut("fast")
    }), jQuery(".to_top").click(function() {
        return jQuery("html, body").animate({
            scrollTop: 0
        }, "slow"), !1
    }), jQuery(window).width() > 480 && (jQuery(".home #zn_nivo, .home #accordion").waitForImages(function() {
        var e = jQuery(".home #zn_nivo, .home #accordion").height();
        jQuery(".home #zn_nivo, .home #accordion").waypoint(function() {
            jQuery(".is-sticky .header").addClass("headcolor")
        }, {
            offset: "-" + e / 2 + "px"
        }), jQuery(".home #zn_nivo, .home #accordion").waypoint(function() {
            jQuery(".is-sticky .header").removeClass("headcolor")
        }, {
            offset: "-90px"
        })
    }), jQuery(".block_type2 .midrow_blocks .midrow_block").css({
        opacity: "0"
    }), jQuery(".block_type1 .midrow_blocks").waypoint(function() {
        jQuery(this).addClass("animated bounceIn")
    }, {
        offset: "90%"
    }), jQuery(".block_type2 .midrow_blocks .midrow_block").waypoint(function() {
        jQuery(this).addClass("animated fadeInUp")
    }, {
        offset: "90%"
    }), jQuery(".welcmblock .text_block_wrap").css({
        opacity: "0"
    }), jQuery(".welcmblock .text_block_wrap").waypoint(function() {
        jQuery(this).addClass("animated fadeIn")
    }, {
        offset: "90%"
    }), jQuery(".home .postsblck .center").css({
        opacity: "0"
    }), jQuery(".home .postsblck .center").waypoint(function() {
        jQuery(this).addClass("animated fadeInUp")
    }, {
        offset: "85%"
    }));
    var t = jQuery(".ast-next > a").attr("href");
    jQuery(".right_arro").attr("href", t);
    var t = jQuery(".ast-prev > a").attr("href");
    jQuery(".left_arro").attr("href", t), jQuery("#sidebar .widget_pages ul li a, #sidebar .widget_meta ul li a, #sidebar .widget_nav_menu ul li a, #sidebar .widget_categories ul li a, #sidebar .widget_recent_entries ul li a, #sidebar .widget_recent_comments ul li, #sidebar .widget_archive ul li, #sidebar .widget_rss ul li").prepend('<i class="fa-double-angle-right"></i> '), jQuery("#sidebar .fa-double-angle-right").css({
        opacity: "0.5"
    });
    var r = jQuery("#simple-menu").html();
    jQuery("#simple-menu").sidr({
        name: "sidr-main",
        source: "#topmenu",
        side: "right"
    }), jQuery(".sidr").prepend("<div class='pad_menutitle'>" + r + "<span><i class='fa-times'></i></span></div>"), jQuery(".pad_menutitle span").click(function() {
        jQuery.sidr("close", "sidr-main")
    }), jQuery(window).width() < 1023 && 0 == jQuery("#topmenu:has(ul)").length && jQuery("#simple-menu").addClass("hide_mob_menu"), jQuery(window).width() < 480 && jQuery(".nivo-control").text(""), jQuery(function() {
        var e = 0,
            t = jQuery(".slider-wrapper .sldimg"),
            r = 100 / t.length,
            i = jQuery("#astbar");
        $progrssn = jQuery(".progrssn"), t.load(function() {
            e += r, $progrssn.css({
                bottom: e + "%"
            });
            var t = parseFloat(e).toFixed(0);
            i.text(t + "%")
        })
    }), jQuery(".slider-wrapper").waitForImages(function() {
        jQuery("#zn_nivo, .nivo-controlNav, #slide_acord, .nivoinner").css({
            display: "block"
        }), jQuery(".pbar_wrap").fadeOut()
    }), jQuery("#slidera").has("#stat_img").addClass("selected_stat"), jQuery("#slidera").has(".slide_wrap").addClass("selected_slide"), jQuery(window).width() < 1025 && jQuery(".dlthref").removeAttr("href"), jQuery("#sidebar .widget .widgettitle, .related_h3, h3#comments, #reply-title").after("<span class='widget_border' />"), jQuery(".comm_wrap").insertAfter(".comment-form-comment"), jQuery(".comm_wrap input").placeholder(), jQuery("body").has(".error_msg").addClass("error404"), jQuery(".nav-box.ast-prev, .nav-box.ast-next").not(":has(img)").addClass("navbox-noimg"); jQuery(".lay1.optimposts, .lay4.optimposts").each(function(e, t) {
        jQuery(this).waitForImages(function() {
            jQuery(this).find(".type-product").matchHeight({
                property: "min-height"
            })
        })
    }), jQuery(".lay1.optimposts .type-product").each(function(e, t) {
        jQuery(window).width() >= 960 && jQuery(this).find(".button.add_to_cart_button").prependTo(jQuery(this).find(".imgwrap")), jQuery(this).find("span.price").prependTo(jQuery(this).find(".post_image "))
    })
}), jQuery(window).on("load scroll", function() {
    var e = jQuery(this).scrollTop(),
        t = jQuery(".header").height() + jQuery(".admin-bar #wpadminbar").height() + jQuery("#customizer_topbar").height();
    e ? (jQuery("body:not(.has_trans_header) .stat_bg img").css({
        top: "0px"
    }), jQuery("body:not(.has_trans_header) .stat_bg").css({
        "background-position-y": "0px"
    })) : (jQuery("body:not(.has_trans_header) .stat_bg img").css({
        top: t + "px"
    }), jQuery("body:not(.has_trans_header) .stat_bg").css({
        "background-position-y": t + "px"
    }))
});
var isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/);
"iOS" == getMobileOperatingSystem() ? jQuery("body").addClass("is-ios") : jQuery("body").addClass("not-ios"), 1 == isSafari && jQuery("body").addClass("is_safari"), jQuery(document).ready(function() {
    jQuery(".cols2").each(function(e) {
        (e + 1) % 2 == 0 && jQuery(this).after('<div class="clear"></div>')
    }), jQuery(".cols3").each(function(e) {
        (e + 1) % 3 == 0 && jQuery(this).after('<div class="clear"></div>')
    }), jQuery(".cols4").each(function(e) {
        (e + 1) % 4 == 0 && jQuery(this).after('<div class="clear"></div>')
    }), jQuery(".tstcols2").each(function(e) {
        (e + 1) % 2 == 0 && jQuery(this).after('<div class="clear"></div>')
    }), jQuery(".tstcols3").each(function(e) {
        (e + 1) % 3 == 0 && jQuery(this).after('<div class="clear"></div>')
    }), jQuery(".tstcols4").each(function(e) {
        (e + 1) % 4 == 0 && jQuery(this).after('<div class="clear"></div>')
    })
}), jQuery(document).ready(function() {jQuery(".clientbox").wrapAll('<div class="clientarea" />'),jQuery(".blocksbox").wrapAll('<div class="servicerow" />'),jQuery(".thumb").wrapAll('<div class="servicerow" />'),jQuery(".perfectbox").wrapAll('<div class="perfrow" />')
}),
jQuery(document).ready(function() {
    jQuery('.bxsliderproj').show().bxSlider({
        slideWidth: 1000,
		prevText: '<i class="fa fa-angle-left" aria-hidden="true"></i>',   
		nextText: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
        minSlides: 1,
        maxSlides: 1,
		moveSlides: 1,
        slideMargin: 28,
		speed: 2000,
        controls: 0,
		auto: false,
	    pager: true
    })
}),
jQuery.noConflict();
jQuery(document).ready(function() { 
	jQuery('.testimonials').owlCarousel({
		loop: true,
		autoplay:true, 
		autoHeight:false,
		autoplayTimeout:5000,
		autoplayHoverPause:true,
		margin:1,
		nav: false,
		paginationNumbers: true,
		rtl: true,
		navText:["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"],
		dots: true,
		responsiveClass:true,
		responsive: {
		  0: { items: 1 },
		  480: { items: 1 },
		  768: { items: 1 },
		  1000: { items: 1 }
		}
  })   
});
 jQuery(document).ready(function() {
    jQuery(".galcarosel").bxSlider({
        slideWidth: 275,
        minSlides: 2,
        maxSlides: 4,
        slideMargin: 20,
        pager: !1
    }), jQuery(".skillbar").each(function() {
        jQuery(this).find(".skillbar-bar").animate({
            width: jQuery(this).attr("data-percent")
        }, 6e3)
    })
});

// poster frame click event
jQuery(document).on("click", ".js-videoPoster", function(ev) {
  ev.preventDefault();
  var jQueryposter = jQuery(this);
  var jQuerywrapper = jQueryposter.closest(".js-videoWrapper");
  videoPlay(jQuerywrapper);
});

// play the targeted video (and hide the poster frame)
function videoPlay(jQuerywrapper) {
  var jQueryiframe = jQuerywrapper.find(".js-videoIframe");
  var src = jQueryiframe.data("src");
  // hide poster
  jQuerywrapper.addClass("videoWrapperActive");
  // add iframe src in, starting the video
  jQueryiframe.attr("src", src);
}

jQuery(document).ready(function() {
        jQuery('.skt-builder-home-section1-block .skt-builder-block-title h2, .skt-builder-home-section2-block .skt-builder-block-title h2, .skt-builder-home-section5-block .skt-builder-block-title h2, .skt-builder-home-section6-block .skt-builder-block-title h2, .skt-builder-home-section7-block .skt-builder-block-title h2, .skt-builder-home-section8-block .skt-builder-block-title h2').each(function(index, element) {
            var heading = jQuery(element);
            var word_array, last_word, first_part;
            word_array = heading.html().split(/\s+/); // split on spaces
            last_word = word_array.pop();             // pop the last word
            first_part = word_array.join(' ');        // rejoin the first words together
            heading.html([first_part, ' <span>', last_word, '</span>'].join(''));
        });
});	


jQuery(document).ready(function(){
            var submitIcon = jQuery('.searchbox i');
            var inputBox = jQuery('.searchbox-input');
            var searchBox = jQuery('.searchbox');
            var isOpen = false;
            submitIcon.click(function(){
                if(isOpen == false){
                    searchBox.addClass('searchbox-open');
                    inputBox.focus();
                    isOpen = true;
                } else {
                    searchBox.removeClass('searchbox-open');
                    inputBox.focusout();
                    isOpen = false;
                }
            });  
             submitIcon.mouseup(function(){
                    return false;
                });
            searchBox.mouseup(function(){
                    return false;
                });
            jQuery(document).mouseup(function(){
                    if(isOpen == true){
                        jQuery('.searchbox i').css('display','block');
                        submitIcon.click();
                    }
                });
        });
            function buttonUp(){
                var inputVal = jQuery('.searchbox-input').val();
                inputVal = jQuery.trim(inputVal).length;
                if( inputVal !== 0){
                    jQuery('.searchbox i').css('display','none');
                } else {
                    jQuery('.searchbox-input').val('');
                    jQuery('.searchbox i').css('display','block');
                }
};
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/other.js?ver=1 
jQuery.easing.jswing = jQuery.easing.swing;
jQuery.extend(jQuery.easing, {
    def: "easeOutQuad",
    swing: function(e, f, a, h, g) {
        return jQuery.easing[jQuery.easing.def](e, f, a, h, g)
    },
    easeInQuad: function(e, f, a, h, g) {
        return h * (f /= g) * f + a
    },
    easeOutQuad: function(e, f, a, h, g) {
        return -h * (f /= g) * (f - 2) + a
    },
    easeInOutQuad: function(e, f, a, h, g) {
        if ((f /= g / 2) < 1) {
            return h / 2 * f * f + a
        }
        return -h / 2 * ((--f) * (f - 2) - 1) + a
    },
    easeInCubic: function(e, f, a, h, g) {
        return h * (f /= g) * f * f + a
    },
    easeOutCubic: function(e, f, a, h, g) {
        return h * ((f = f / g - 1) * f * f + 1) + a
    },
    easeInOutCubic: function(e, f, a, h, g) {
        if ((f /= g / 2) < 1) {
            return h / 2 * f * f * f + a
        }
        return h / 2 * ((f -= 2) * f * f + 2) + a
    },
    easeInQuart: function(e, f, a, h, g) {
        return h * (f /= g) * f * f * f + a
    },
    easeOutQuart: function(e, f, a, h, g) {
        return -h * ((f = f / g - 1) * f * f * f - 1) + a
    },
    easeInOutQuart: function(e, f, a, h, g) {
        if ((f /= g / 2) < 1) {
            return h / 2 * f * f * f * f + a
        }
        return -h / 2 * ((f -= 2) * f * f * f - 2) + a
    },
    easeInQuint: function(e, f, a, h, g) {
        return h * (f /= g) * f * f * f * f + a
    },
    easeOutQuint: function(e, f, a, h, g) {
        return h * ((f = f / g - 1) * f * f * f * f + 1) + a
    },
    easeInOutQuint: function(e, f, a, h, g) {
        if ((f /= g / 2) < 1) {
            return h / 2 * f * f * f * f * f + a
        }
        return h / 2 * ((f -= 2) * f * f * f * f + 2) + a
    },
    easeInSine: function(e, f, a, h, g) {
        return -h * Math.cos(f / g * (Math.PI / 2)) + h + a
    },
    easeOutSine: function(e, f, a, h, g) {
        return h * Math.sin(f / g * (Math.PI / 2)) + a
    },
    easeInOutSine: function(e, f, a, h, g) {
        return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a
    },
    easeInExpo: function(e, f, a, h, g) {
        return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a
    },
    easeOutExpo: function(e, f, a, h, g) {
        return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a
    },
    easeInOutExpo: function(e, f, a, h, g) {
        if (f == 0) {
            return a
        }
        if (f == g) {
            return a + h
        }
        if ((f /= g / 2) < 1) {
            return h / 2 * Math.pow(2, 10 * (f - 1)) + a
        }
        return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a
    },
    easeInCirc: function(e, f, a, h, g) {
        return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a
    },
    easeOutCirc: function(e, f, a, h, g) {
        return h * Math.sqrt(1 - (f = f / g - 1) * f) + a
    },
    easeInOutCirc: function(e, f, a, h, g) {
        if ((f /= g / 2) < 1) {
            return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a
        }
        return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a
    },
    easeInElastic: function(f, h, e, l, k) {
        var i = 1.70158;
        var j = 0;
        var g = l;
        if (h == 0) {
            return e
        }
        if ((h /= k) == 1) {
            return e + l
        }
        if (!j) {
            j = k * 0.3
        }
        if (g < Math.abs(l)) {
            g = l;
            var i = j / 4
        } else {
            var i = j / (2 * Math.PI) * Math.asin(l / g)
        }
        return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e
    },
    easeOutElastic: function(f, h, e, l, k) {
        var i = 1.70158;
        var j = 0;
        var g = l;
        if (h == 0) {
            return e
        }
        if ((h /= k) == 1) {
            return e + l
        }
        if (!j) {
            j = k * 0.3
        }
        if (g < Math.abs(l)) {
            g = l;
            var i = j / 4
        } else {
            var i = j / (2 * Math.PI) * Math.asin(l / g)
        }
        return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e
    },
    easeInOutElastic: function(f, h, e, l, k) {
        var i = 1.70158;
        var j = 0;
        var g = l;
        if (h == 0) {
            return e
        }
        if ((h /= k / 2) == 2) {
            return e + l
        }
        if (!j) {
            j = k * (0.3 * 1.5)
        }
        if (g < Math.abs(l)) {
            g = l;
            var i = j / 4
        } else {
            var i = j / (2 * Math.PI) * Math.asin(l / g)
        }
        if (h < 1) {
            return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e
        }
        return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e
    },
    easeInBack: function(e, f, a, i, h, g) {
        if (g == undefined) {
            g = 1.70158
        }
        return i * (f /= h) * f * ((g + 1) * f - g) + a
    },
    easeOutBack: function(e, f, a, i, h, g) {
        if (g == undefined) {
            g = 1.70158
        }
        return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a
    },
    easeInOutBack: function(e, f, a, i, h, g) {
        if (g == undefined) {
            g = 1.70158
        }
        if ((f /= h / 2) < 1) {
            return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a
        }
        return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a
    },
    easeInBounce: function(e, f, a, h, g) {
        return h - jQuery.easing.easeOutBounce(e, g - f, 0, h, g) + a
    },
    easeOutBounce: function(e, f, a, h, g) {
        if ((f /= g) < (1 / 2.75)) {
            return h * (7.5625 * f * f) + a
        } else {
            if (f < (2 / 2.75)) {
                return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a
            } else {
                if (f < (2.5 / 2.75)) {
                    return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a
                } else {
                    return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a
                }
            }
        }
    },
    easeInOutBounce: function(e, f, a, h, g) {
        if (f < g / 2) {
            return jQuery.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a
        }
        return jQuery.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a
    }
});
(function() {
    var t = [].indexOf || function(t) {
            for (var e = 0, n = this.length; e < n; e++) {
                if (e in this && this[e] === t) return e
            }
            return -1
        },
        e = [].slice;
    (function(t, e) {
        if (typeof define === "function" && define.amd) {
            return define("waypoints", ["jquery"], function(n) {
                return e(n, t)
            })
        } else {
            return e(t.jQuery, t)
        }
    })(window, function(n, r) {
        var i, o, l, s, f, u, c, a, h, d, p, y, v, w, g, m;
        i = n(r);
        a = t.call(r, "ontouchstart") >= 0;
        s = {
            horizontal: {},
            vertical: {}
        };
        f = 1;
        c = {};
        u = "waypoints-context-id";
        p = "resize.waypoints";
        y = "scroll.waypoints";
        v = 1;
        w = "waypoints-waypoint-ids";
        g = "waypoint";
        m = "waypoints";
        o = function() {
            function t(t) {
                var e = this;
                this.$element = t;
                this.element = t[0];
                this.didResize = false;
                this.didScroll = false;
                this.id = "context" + f++;
                this.oldScroll = {
                    x: t.scrollLeft(),
                    y: t.scrollTop()
                };
                this.waypoints = {
                    horizontal: {},
                    vertical: {}
                };
                this.element[u] = this.id;
                c[this.id] = this;
                t.bind(y, function() {
                    var t;
                    if (!(e.didScroll || a)) {
                        e.didScroll = true;
                        t = function() {
                            e.doScroll();
                            return e.didScroll = false
                        };
                        return r.setTimeout(t, n[m].settings.scrollThrottle)
                    }
                });
                t.bind(p, function() {
                    var t;
                    if (!e.didResize) {
                        e.didResize = true;
                        t = function() {
                            n[m]("refresh");
                            return e.didResize = false
                        };
                        return r.setTimeout(t, n[m].settings.resizeThrottle)
                    }
                })
            }
            t.prototype.doScroll = function() {
                var t, e = this;
                t = {
                    horizontal: {
                        newScroll: this.$element.scrollLeft(),
                        oldScroll: this.oldScroll.x,
                        forward: "right",
                        backward: "left"
                    },
                    vertical: {
                        newScroll: this.$element.scrollTop(),
                        oldScroll: this.oldScroll.y,
                        forward: "down",
                        backward: "up"
                    }
                };
                if (a && (!t.vertical.oldScroll || !t.vertical.newScroll)) {
                    n[m]("refresh")
                }
                n.each(t, function(t, r) {
                    var i, o, l;
                    l = [];
                    o = r.newScroll > r.oldScroll;
                    i = o ? r.forward : r.backward;
                    n.each(e.waypoints[t], function(t, e) {
                        var n, i;
                        if (r.oldScroll < (n = e.offset) && n <= r.newScroll) {
                            return l.push(e)
                        } else if (r.newScroll < (i = e.offset) && i <= r.oldScroll) {
                            return l.push(e)
                        }
                    });
                    l.sort(function(t, e) {
                        return t.offset - e.offset
                    });
                    if (!o) {
                        l.reverse()
                    }
                    return n.each(l, function(t, e) {
                        if (e.options.continuous || t === l.length - 1) {
                            return e.trigger([i])
                        }
                    })
                });
                return this.oldScroll = {
                    x: t.horizontal.newScroll,
                    y: t.vertical.newScroll
                }
            };
            t.prototype.refresh = function() {
                var t, e, r, i = this;
                r = n.isWindow(this.element);
                e = this.$element.offset();
                this.doScroll();
                t = {
                    horizontal: {
                        contextOffset: r ? 0 : e.left,
                        contextScroll: r ? 0 : this.oldScroll.x,
                        contextDimension: this.$element.width(),
                        oldScroll: this.oldScroll.x,
                        forward: "right",
                        backward: "left",
                        offsetProp: "left"
                    },
                    vertical: {
                        contextOffset: r ? 0 : e.top,
                        contextScroll: r ? 0 : this.oldScroll.y,
                        contextDimension: r ? n[m]("viewportHeight") : this.$element.height(),
                        oldScroll: this.oldScroll.y,
                        forward: "down",
                        backward: "up",
                        offsetProp: "top"
                    }
                };
                return n.each(t, function(t, e) {
                    return n.each(i.waypoints[t], function(t, r) {
                        var i, o, l, s, f;
                        i = r.options.offset;
                        l = r.offset;
                        o = n.isWindow(r.element) ? 0 : r.$element.offset()[e.offsetProp];
                        if (n.isFunction(i)) {
                            i = i.apply(r.element)
                        } else if (typeof i === "string") {
                            i = parseFloat(i);
                            if (r.options.offset.indexOf("%") > -1) {
                                i = Math.ceil(e.contextDimension * i / 100)
                            }
                        }
                        r.offset = o - e.contextOffset + e.contextScroll - i;
                        if (r.options.onlyOnScroll && l != null || !r.enabled) {
                            return
                        }
                        if (l !== null && l < (s = e.oldScroll) && s <= r.offset) {
                            return r.trigger([e.backward])
                        } else if (l !== null && l > (f = e.oldScroll) && f >= r.offset) {
                            return r.trigger([e.forward])
                        } else if (l === null && e.oldScroll >= r.offset) {
                            return r.trigger([e.forward])
                        }
                    })
                })
            };
            t.prototype.checkEmpty = function() {
                if (n.isEmptyObject(this.waypoints.horizontal) && n.isEmptyObject(this.waypoints.vertical)) {
                    this.$element.unbind([p, y].join(" "));
                    return delete c[this.id]
                }
            };
            return t
        }();
        l = function() {
            function t(t, e, r) {
                var i, o;
                if (r.offset === "bottom-in-view") {
                    r.offset = function() {
                        var t;
                        t = n[m]("viewportHeight");
                        if (!n.isWindow(e.element)) {
                            t = e.$element.height()
                        }
                        return t - n(this).outerHeight()
                    }
                }
                this.$element = t;
                this.element = t[0];
                this.axis = r.horizontal ? "horizontal" : "vertical";
                this.callback = r.handler;
                this.context = e;
                this.enabled = r.enabled;
                this.id = "waypoints" + v++;
                this.offset = null;
                this.options = r;
                e.waypoints[this.axis][this.id] = this;
                s[this.axis][this.id] = this;
                i = (o = this.element[w]) != null ? o : [];
                i.push(this.id);
                this.element[w] = i
            }
            t.prototype.trigger = function(t) {
                if (!this.enabled) {
                    return
                }
                if (this.callback != null) {
                    this.callback.apply(this.element, t)
                }
                if (this.options.triggerOnce) {
                    return this.destroy()
                }
            };
            t.prototype.disable = function() {
                return this.enabled = false
            };
            t.prototype.enable = function() {
                this.context.refresh();
                return this.enabled = true
            };
            t.prototype.destroy = function() {
                delete s[this.axis][this.id];
                delete this.context.waypoints[this.axis][this.id];
                return this.context.checkEmpty()
            };
            t.getWaypointsByElement = function(t) {
                var e, r;
                r = t[w];
                if (!r) {
                    return []
                }
                e = n.extend({}, s.horizontal, s.vertical);
                return n.map(r, function(t) {
                    return e[t]
                })
            };
            return t
        }();
        d = {
            init: function(t, e) {
                var r;
                e = n.extend({}, n.fn[g].defaults, e);
                if ((r = e.handler) == null) {
                    e.handler = t
                }
                this.each(function() {
                    var t, r, i, s;
                    t = n(this);
                    i = (s = e.context) != null ? s : n.fn[g].defaults.context;
                    if (!n.isWindow(i)) {
                        i = t.closest(i)
                    }
                    i = n(i);
                    r = c[i[0][u]];
                    if (!r) {
                        r = new o(i)
                    }
                    return new l(t, r, e)
                });
                n[m]("refresh");
                return this
            },
            disable: function() {
                return d._invoke.call(this, "disable")
            },
            enable: function() {
                return d._invoke.call(this, "enable")
            },
            destroy: function() {
                return d._invoke.call(this, "destroy")
            },
            prev: function(t, e) {
                return d._traverse.call(this, t, e, function(t, e, n) {
                    if (e > 0) {
                        return t.push(n[e - 1])
                    }
                })
            },
            next: function(t, e) {
                return d._traverse.call(this, t, e, function(t, e, n) {
                    if (e < n.length - 1) {
                        return t.push(n[e + 1])
                    }
                })
            },
            _traverse: function(t, e, i) {
                var o, l;
                if (t == null) {
                    t = "vertical"
                }
                if (e == null) {
                    e = r
                }
                l = h.aggregate(e);
                o = [];
                this.each(function() {
                    var e;
                    e = n.inArray(this, l[t]);
                    return i(o, e, l[t])
                });
                return this.pushStack(o)
            },
            _invoke: function(t) {
                this.each(function() {
                    var e;
                    e = l.getWaypointsByElement(this);
                    return n.each(e, function(e, n) {
                        n[t]();
                        return true
                    })
                });
                return this
            }
        };
        n.fn[g] = function() {
            var t, r;
            r = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
            if (d[r]) {
                return d[r].apply(this, t)
            } else if (n.isFunction(r)) {
                return d.init.apply(this, arguments)
            } else if (n.isPlainObject(r)) {
                return d.init.apply(this, [null, r])
            } else if (!r) {
                return n.error("jQuery Waypoints needs a callback function or handler option.")
            } else {
                return n.error("The " + r + " method does not exist in jQuery Waypoints.")
            }
        };
        n.fn[g].defaults = {
            context: r,
            continuous: true,
            enabled: true,
            horizontal: false,
            offset: 0,
            triggerOnce: false
        };
        h = {
            refresh: function() {
                return n.each(c, function(t, e) {
                    return e.refresh()
                })
            },
            viewportHeight: function() {
                var t;
                return (t = r.innerHeight) != null ? t : i.height()
            },
            aggregate: function(t) {
                var e, r, i;
                e = s;
                if (t) {
                    e = (i = c[n(t)[0][u]]) != null ? i.waypoints : void 0
                }
                if (!e) {
                    return []
                }
                r = {
                    horizontal: [],
                    vertical: []
                };
                n.each(r, function(t, i) {
                    n.each(e[t], function(t, e) {
                        return i.push(e)
                    });
                    i.sort(function(t, e) {
                        return t.offset - e.offset
                    });
                    r[t] = n.map(i, function(t) {
                        return t.element
                    });
                    return r[t] = n.unique(r[t])
                });
                return r
            },
            above: function(t) {
                if (t == null) {
                    t = r
                }
                return h._filter(t, "vertical", function(t, e) {
                    return e.offset <= t.oldScroll.y
                })
            },
            below: function(t) {
                if (t == null) {
                    t = r
                }
                return h._filter(t, "vertical", function(t, e) {
                    return e.offset > t.oldScroll.y
                })
            },
            left: function(t) {
                if (t == null) {
                    t = r
                }
                return h._filter(t, "horizontal", function(t, e) {
                    return e.offset <= t.oldScroll.x
                })
            },
            right: function(t) {
                if (t == null) {
                    t = r
                }
                return h._filter(t, "horizontal", function(t, e) {
                    return e.offset > t.oldScroll.x
                })
            },
            enable: function() {
                return h._invoke("enable")
            },
            disable: function() {
                return h._invoke("disable")
            },
            destroy: function() {
                return h._invoke("destroy")
            },
            extendFn: function(t, e) {
                return d[t] = e
            },
            _invoke: function(t) {
                var e;
                e = n.extend({}, s.vertical, s.horizontal);
                return n.each(e, function(e, n) {
                    n[t]();
                    return true
                })
            },
            _filter: function(t, e, r) {
                var i, o;
                i = c[n(t)[0][u]];
                if (!i) {
                    return []
                }
                o = [];
                n.each(i.waypoints[e], function(t, e) {
                    if (r(i, e)) {
                        return o.push(e)
                    }
                });
                o.sort(function(t, e) {
                    return t.offset - e.offset
                });
                return n.map(o, function(t) {
                    return t.element
                })
            }
        };
        n[m] = function() {
            var t, n;
            n = arguments[0], t = 2 <= arguments.length ? e.call(arguments, 1) : [];
            if (h[n]) {
                return h[n].apply(null, t)
            } else {
                return h.aggregate.call(null, n)
            }
        };
        n[m].settings = {
            resizeThrottle: 100,
            scrollThrottle: 30
        };
        return i.on("load.waypoints", function() {
            return n[m]("refresh")
        })
    })
}).call(this);
! function(a) {
    "use strict";
    "function" == typeof define && define.amd ? define(["jquery"], a) : a(jQuery)
}(function(a) {
    "use strict";

    function b(a) {
        if (a instanceof Date) return a;
        if (String(a).match(h)) return String(a).match(/^[0-9]*$/) && (a = Number(a)), String(a).match(/\-/) && (a = String(a).replace(/\-/g, "/")), new Date(a);
        throw new Error("Couldn't cast `" + a + "` to a date object.")
    }

    function c(a) {
        var b = a.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
        return new RegExp(b)
    }

    function d(a) {
        return function(b) {
            var d = b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
            if (d)
                for (var f = 0, g = d.length; g > f; ++f) {
                    var h = d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),
                        j = c(h[0]),
                        k = h[1] || "",
                        l = h[3] || "",
                        m = null;
                    h = h[2], i.hasOwnProperty(h) && (m = i[h], m = Number(a[m])), null !== m && ("!" === k && (m = e(l, m)), "" === k && 10 > m && (m = "0" + m.toString()), b = b.replace(j, m.toString()))
                }
            return b = b.replace(/%%/, "%")
        }
    }

    function e(a, b) {
        var c = "s",
            d = "";
        return a && (a = a.replace(/(:|;|\s)/gi, "").split(/\,/), 1 === a.length ? c = a[0] : (d = a[0], c = a[1])), 1 === Math.abs(b) ? d : c
    }
    var f = 100,
        g = [],
        h = [];
    h.push(/^[0-9]*$/.source), h.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source), h.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source), h = new RegExp(h.join("|"));
    var i = {
            Y: "years",
            m: "months",
            w: "weeks",
            d: "days",
            D: "totalDays",
            H: "hours",
            M: "minutes",
            S: "seconds"
        },
        j = function(b, c, d) {
            this.el = b, this.$el = a(b), this.interval = null, this.offset = {}, this.instanceNumber = g.length, g.push(this), this.$el.data("countdown-instance", this.instanceNumber), d && (this.$el.on("update.countdown", d), this.$el.on("stoped.countdown", d), this.$el.on("finish.countdown", d)), this.setFinalDate(c), this.start()
        };
    a.extend(j.prototype, {
        start: function() {
            null !== this.interval && clearInterval(this.interval);
            var a = this;
            this.update(), this.interval = setInterval(function() {
                a.update.call(a)
            }, f)
        },
        stop: function() {
            clearInterval(this.interval), this.interval = null, this.dispatchEvent("stoped")
        },
        toggle: function() {
            this.interval ? this.stop() : this.start()
        },
        pause: function() {
            this.stop()
        },
        resume: function() {
            this.start()
        },
        remove: function() {
            this.stop.call(this), g[this.instanceNumber] = null, delete this.$el.data().countdownInstance
        },
        setFinalDate: function(a) {
            this.finalDate = b(a)
        },
        update: function() {
            return 0 === this.$el.closest("html").length ? void this.remove() : (this.totalSecsLeft = this.finalDate.getTime() - (new Date).getTime(), this.totalSecsLeft = Math.ceil(this.totalSecsLeft / 1e3), this.totalSecsLeft = this.totalSecsLeft < 0 ? 0 : this.totalSecsLeft, this.offset = {
                seconds: this.totalSecsLeft % 60,
                minutes: Math.floor(this.totalSecsLeft / 60) % 60,
                hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24,
                days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
                totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24),
                weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
                months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30),
                years: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 365)
            }, void(0 === this.totalSecsLeft ? (this.stop(), this.dispatchEvent("finish")) : this.dispatchEvent("update")))
        },
        dispatchEvent: function(b) {
            var c = a.Event(b + ".countdown");
            c.finalDate = this.finalDate, c.offset = a.extend({}, this.offset), c.strftime = d(this.offset), this.$el.trigger(c)
        }
    }), a.fn.countdown = function() {
        var b = Array.prototype.slice.call(arguments, 0);
        return this.each(function() {
            var c = a(this).data("countdown-instance");
            if (void 0 !== c) {
                var d = g[c],
                    e = b[0];
                j.prototype.hasOwnProperty(e) ? d[e].apply(d, b.slice(1)) : null === String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i) ? (d.setFinalDate.call(d, e), d.start()) : a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, e))
            } else new j(this, b[0], b[1])
        })
    }
});
(function(c) {
    var n = -1,
        f = -1,
        g = function(a) {
            return parseFloat(a) || 0
        },
        r = function(a) {
            var b = null,
                d = [];
            c(a).each(function() {
                var a = c(this),
                    k = a.offset().top - g(a.css("margin-top")),
                    l = 0 < d.length ? d[d.length - 1] : null;
                null === l ? d.push(a) : 1 >= Math.floor(Math.abs(b - k)) ? d[d.length - 1] = l.add(a) : d.push(a);
                b = k
            });
            return d
        },
        p = function(a) {
            var b = {
                byRow: !0,
                property: "height",
                target: null,
                remove: !1
            };
            if ("object" === typeof a) return c.extend(b, a);
            "boolean" === typeof a ? b.byRow = a : "remove" === a && (b.remove = !0);
            return b
        },
        b = c.fn.matchHeight = function(a) {
            a = p(a);
            if (a.remove) {
                var e = this;
                this.css(a.property, "");
                c.each(b._groups, function(a, b) {
                    b.elements = b.elements.not(e)
                });
                return this
            }
            if (1 >= this.length && !a.target) return this;
            b._groups.push({
                elements: this,
                options: a
            });
            b._apply(this, a);
            return this
        };
    b._groups = [];
    b._throttle = 80;
    b._maintainScroll = !1;
    b._beforeUpdate = null;
    b._afterUpdate = null;
    b._apply = function(a, e) {
        var d = p(e),
            h = c(a),
            k = [h],
            l = c(window).scrollTop(),
            f = c("html").outerHeight(!0),
            m = h.parents().filter(":hidden");
        m.each(function() {
            var a = c(this);
            a.data("style-cache", a.attr("style"))
        });
        m.css("display", "block");
        d.byRow && !d.target && (h.each(function() {
            var a = c(this),
                b = "inline-block" === a.css("display") ? "inline-block" : "block";
            a.data("style-cache", a.attr("style"));
            a.css({
                display: b,
                "padding-top": "0",
                "padding-bottom": "0",
                "margin-top": "0",
                "margin-bottom": "0",
                "border-top-width": "0",
                "border-bottom-width": "0",
                height: "100px"
            })
        }), k = r(h), h.each(function() {
            var a = c(this);
            a.attr("style", a.data("style-cache") || "")
        }));
        c.each(k, function(a, b) {
            var e = c(b),
                f = 0;
            if (d.target) f = d.target.outerHeight(!1);
            else {
                if (d.byRow && 1 >= e.length) {
                    e.css(d.property, "");
                    return
                }
                e.each(function() {
                    var a = c(this),
                        b = {
                            display: "inline-block" === a.css("display") ? "inline-block" : "block"
                        };
                    b[d.property] = "";
                    a.css(b);
                    a.outerHeight(!1) > f && (f = a.outerHeight(!1));
                    a.css("display", "")
                })
            }
            e.each(function() {
                var a = c(this),
                    b = 0;
                d.target && a.is(d.target) || ("border-box" !== a.css("box-sizing") && (b += g(a.css("border-top-width")) + g(a.css("border-bottom-width")), b += g(a.css("padding-top")) + g(a.css("padding-bottom"))), a.css(d.property, f - b))
            })
        });
        m.each(function() {
            var a = c(this);
            a.attr("style", a.data("style-cache") || null)
        });
        b._maintainScroll && c(window).scrollTop(l / f * c("html").outerHeight(!0));
        return this
    };
    b._applyDataApi = function() {
        var a = {};
        c("[data-match-height], [data-mh]").each(function() {
            var b = c(this),
                d = b.attr("data-mh") || b.attr("data-match-height");
            a[d] = d in a ? a[d].add(b) : b
        });
        c.each(a, function() {
            this.matchHeight(!0)
        })
    };
    var q = function(a) {
        b._beforeUpdate && b._beforeUpdate(a, b._groups);
        c.each(b._groups, function() {
            b._apply(this.elements, this.options)
        });
        b._afterUpdate && b._afterUpdate(a, b._groups)
    };
    b._update = function(a, e) {
        if (e && "resize" === e.type) {
            var d = c(window).width();
            if (d === n) return;
            n = d
        }
        a ? -1 === f && (f = setTimeout(function() {
            q(e);
            f = -1
        }, b._throttle)) : q(e)
    };
    c(b._applyDataApi);
    c(window).bind("load", function(a) {
        b._update(!1, a)
    });
    c(window).bind("resize orientationchange", function(a) {
        b._update(!0, a)
    })
})(jQuery);
! function(e) {
    var t = !1,
        i = !1,
        n = {
            isUrl: function(e) {
                var t = new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$", "i");
                return t.test(e) ? !0 : !1
            },
            loadContent: function(e, t) {
                e.html(t)
            },
            addPrefix: function(e) {
                var t = e.attr("id"),
                    i = e.attr("class");
                "string" == typeof t && "" !== t && e.attr("id", t.replace(/([A-Za-z0-9_.\-]+)/g, "sidr-id-$1")), "string" == typeof i && "" !== i && "sidr-inner" !== i && e.attr("class", i.replace(/([A-Za-z0-9_.\-]+)/g, "sidr-class-$1")), e.removeAttr("style")
            },
            execute: function(n, s, a) {
                "function" == typeof s ? (a = s, s = "sidr") : s || (s = "sidr");
                var r, d, l, c = e("#" + s),
                    u = e(c.data("body")),
                    f = e("html"),
                    p = c.outerWidth(!0),
                    g = c.data("speed"),
                    h = c.data("side"),
                    m = c.data("displace"),
                    v = c.data("onOpen"),
                    y = c.data("onClose"),
                    x = "sidr" === s ? "sidr-open" : "sidr-open " + s + "-open";
                if ("open" === n || "toggle" === n && !c.is(":visible")) {
                    if (c.is(":visible") || t) return;
                    if (i !== !1) return void o.close(i, function() {
                        o.open(s)
                    });
                    t = !0, "left" === h ? (r = {
                        left: p + "px"
                    }, d = {
                        left: "0px"
                    }) : (r = {
                        right: p + "px"
                    }, d = {
                        right: "0px"
                    }), u.is("body") && (l = f.scrollTop(), f.css("overflow-x", "hidden").scrollTop(l)), m ? u.addClass("sidr-animating").css({
                        width: u.width(),

                        position: "absolute"
                    }).animate(r, g, function() {
                        e(this).addClass(x)
                    }) : setTimeout(function() {
                        e(this).addClass(x)
                    }, g), c.css("display", "block").animate(d, g, function() {
                        t = !1, i = s, "function" == typeof a && a(s), u.removeClass("sidr-animating")
                    }), v()
                } else {
                    if (!c.is(":visible") || t) return;
                    t = !0, "left" === h ? (r = {
                        left: 0
                    }, d = {
                        left: "-" + p + "px"
                    }) : (r = {
                        right: 0
                    }, d = {
                        right: "-" + p + "px"
                    }), u.is("body") && (l = f.scrollTop(), f.removeAttr("style").scrollTop(l)), u.addClass("sidr-animating").animate(r, g).removeClass(x), c.animate(d, g, function() {
                        c.removeAttr("style").hide(), u.removeAttr("style"), e("html").removeAttr("style"), t = !1, i = !1, "function" == typeof a && a(s), u.removeClass("sidr-animating")
                    }), y()
                }
            }
        },
        o = {
            open: function(e, t) {
                n.execute("open", e, t)
            },
            close: function(e, t) {
                n.execute("close", e, t)
            },
            toggle: function(e, t) {
                n.execute("toggle", e, t)
            },
            toogle: function(e, t) {
                n.execute("toggle", e, t)
            }
        };
    e.sidr = function(t) {
        return o[t] ? o[t].apply(this, Array.prototype.slice.call(arguments, 1)) : "function" != typeof t && "string" != typeof t && t ? void e.error("Method " + t + " does not exist on jQuery.sidr") : o.toggle.apply(this, arguments)
    }, e.fn.sidr = function(s) {
        var a = e.extend({
                name: "sidr",
                speed: 200,
                side: "left",
                source: null,
                renaming: !0,
                body: "body",
                displace: !0,
                onOpen: function() {},
                onClose: function() {}
            }, s),
            r = a.name,
            d = e("#" + r);
        if (0 === d.length && (d = e("<div />").attr("id", r).appendTo(e("body"))), d.addClass("sidr").addClass(a.side).data({
                speed: a.speed,
                side: a.side,
                body: a.body,
                displace: a.displace,
                onOpen: a.onOpen,
                onClose: a.onClose
            }), "function" == typeof a.source) {
            var l = a.source(r);
            n.loadContent(d, l)
        } else if ("string" == typeof a.source && n.isUrl(a.source)) e.get(a.source, function(e) {
            n.loadContent(d, e)
        });
        else if ("string" == typeof a.source) {
            var c = "",
                u = a.source.split(",");
            if (e.each(u, function(t, i) {
                    c += '<div class="sidr-inner">' + e(i).html() + "</div>"
                }), a.renaming) {
                var f = e("<div />").html(c);
                f.find("*").each(function(t, i) {
                    var o = e(i);
                    n.addPrefix(o)
                }), c = f.html()
            }
            n.loadContent(d, c)
        } else null !== a.source && e.error("Invalid Sidr Source");
        return e("#" + r).find("a").each(function() {
            e(this).click(function() {
                o.toggle(r)
            })
        }), e(window).on("resize", function() {
            e.sidr("close", r)
        }), this.each(function() {
            var n = e(this),
                s = n.data("sidr");
            s || (i = !1, t = !1, n.data("sidr", r), "ontouchstart" in document.documentElement && (n.bind("touchstart", function(e) {
                e.originalEvent.touches[0];
                this.touched = e.timeStamp
            }), n.bind("touchend", function(e) {
                var t = Math.abs(e.timeStamp - this.touched);
                200 > t && (e.preventDefault(), o.toggle(r))
            })), n.click(function(e) {
                e.preventDefault(), o.toggle(r)
            }))
        })
    }
}(jQuery);
! function(a) {
    var b = "waitForImages";
    a.waitForImages = {
        hasImageProperties: ["backgroundImage", "listStyleImage", "borderImage", "borderCornerImage", "cursor"]
    }, a.expr[":"].uncached = function(b) {
        if (!a(b).is('img[src!=""]')) return !1;
        var c = new Image;
        return c.src = b.src, !c.complete
    }, a.fn.waitForImages = function(c, d, e) {
        var f = 0,
            g = 0;
        if (a.isPlainObject(arguments[0]) && (e = arguments[0].waitForAll, d = arguments[0].each, c = arguments[0].finished), c = c || a.noop, d = d || a.noop, e = !!e, !a.isFunction(c) || !a.isFunction(d)) throw new TypeError("An invalid callback was supplied.");
        return this.each(function() {
            var h = a(this),
                i = [],
                j = a.waitForImages.hasImageProperties || [],
                k = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
            e ? h.find("*").addBack().each(function() {
                var b = a(this);
                b.is("img:uncached") && i.push({
                    src: b.attr("src"),
                    element: b[0]
                }), a.each(j, function(a, c) {
                    var d, e = b.css(c);
                    if (!e) return !0;
                    for (; d = k.exec(e);) i.push({
                        src: d[2],
                        element: b[0]
                    })
                })
            }) : h.find("img:uncached").each(function() {
                i.push({
                    src: this.src,
                    element: this
                })
            }), f = i.length, g = 0, 0 === f && c.call(h[0]), a.each(i, function(e, i) {
                var j = new Image;
                a(j).on("load." + b + " error." + b, function(a) {
                    return g++, d.call(i.element, g, f, "load" == a.type), g == f ? (c.call(h[0]), !1) : void 0
                }), j.src = i.src
            })
        })
    }
}(jQuery);
(function() {
    var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X = [].slice,
        Y = {}.hasOwnProperty,
        Z = function(a, b) {
            function c() {
                this.constructor = a
            }
            for (var d in b) Y.call(b, d) && (a[d] = b[d]);
            return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a
        },
        $ = [].indexOf || function(a) {
            for (var b = 0, c = this.length; c > b; b++)
                if (b in this && this[b] === a) return b;
            return -1
        };
    for (u = {
            catchupTime: 100,
            initialRate: .03,
            minTime: 250,
            ghostTime: 100,
            maxProgressPerFrame: 20,
            easeFactor: 1.25,
            startOnPageLoad: !0,
            restartOnPushState: !0,
            restartOnRequestAfter: 500,
            target: "body",
            elements: {
                checkInterval: 100,
                selectors: ["body"]
            },
            eventLag: {
                minSamples: 10,
                sampleCount: 3,
                lagThreshold: 3
            },
            ajax: {
                trackMethods: ["GET"],
                trackWebSockets: !0,
                ignoreURLs: []
            }
        }, C = function() {
            var a;
            return null != (a = "undefined" != typeof performance && null !== performance && "function" == typeof performance.now ? performance.now() : void 0) ? a : +new Date
        }, E = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame, t = window.cancelAnimationFrame || window.mozCancelAnimationFrame, null == E && (E = function(a) {
            return setTimeout(a, 50)
        }, t = function(a) {
            return clearTimeout(a)
        }), G = function(a) {
            var b, c;
            return b = C(), (c = function() {
                var d;
                return d = C() - b, d >= 33 ? (b = C(), a(d, function() {
                    return E(c)
                })) : setTimeout(c, 33 - d)
            })()
        }, F = function() {
            var a, b, c;
            return c = arguments[0], b = arguments[1], a = 3 <= arguments.length ? X.call(arguments, 2) : [], "function" == typeof c[b] ? c[b].apply(c, a) : c[b]
        }, v = function() {
            var a, b, c, d, e, f, g;
            for (b = arguments[0], d = 2 <= arguments.length ? X.call(arguments, 1) : [], f = 0, g = d.length; g > f; f++)
                if (c = d[f])
                    for (a in c) Y.call(c, a) && (e = c[a], null != b[a] && "object" == typeof b[a] && null != e && "object" == typeof e ? v(b[a], e) : b[a] = e);
            return b
        }, q = function(a) {
            var b, c, d, e, f;
            for (c = b = 0, e = 0, f = a.length; f > e; e++) d = a[e], c += Math.abs(d), b++;
            return c / b
        }, x = function(a, b) {
            var c, d, e;
            if (null == a && (a = "options"), null == b && (b = !0), e = document.querySelector("[data-pace-" + a + "]")) {
                if (c = e.getAttribute("data-pace-" + a), !b) return c;
                try {
                    return JSON.parse(c)
                } catch (f) {
                    return d = f, "undefined" != typeof console && null !== console ? console.error("Error parsing inline pace options", d) : void 0
                }
            }
        }, g = function() {
            function a() {}
            return a.prototype.on = function(a, b, c, d) {
                var e;
                return null == d && (d = !1), null == this.bindings && (this.bindings = {}), null == (e = this.bindings)[a] && (e[a] = []), this.bindings[a].push({
                    handler: b,
                    ctx: c,
                    once: d
                })
            }, a.prototype.once = function(a, b, c) {
                return this.on(a, b, c, !0)
            }, a.prototype.off = function(a, b) {
                var c, d, e;
                if (null != (null != (d = this.bindings) ? d[a] : void 0)) {
                    if (null == b) return delete this.bindings[a];
                    for (c = 0, e = []; c < this.bindings[a].length;) e.push(this.bindings[a][c].handler === b ? this.bindings[a].splice(c, 1) : c++);
                    return e
                }
            }, a.prototype.trigger = function() {
                var a, b, c, d, e, f, g, h, i;
                if (c = arguments[0], a = 2 <= arguments.length ? X.call(arguments, 1) : [], null != (g = this.bindings) ? g[c] : void 0) {
                    for (e = 0, i = []; e < this.bindings[c].length;) h = this.bindings[c][e], d = h.handler, b = h.ctx, f = h.once, d.apply(null != b ? b : this, a), i.push(f ? this.bindings[c].splice(e, 1) : e++);
                    return i
                }
            }, a
        }(), j = window.Pace || {}, window.Pace = j, v(j, g.prototype), D = j.options = v({}, u, window.paceOptions, x()), U = ["ajax", "document", "eventLag", "elements"], Q = 0, S = U.length; S > Q; Q++) K = U[Q], D[K] === !0 && (D[K] = u[K]);
    i = function(a) {
        function b() {
            return V = b.__super__.constructor.apply(this, arguments)
        }
        return Z(b, a), b
    }(Error), b = function() {
        function a() {
            this.progress = 0
        }
        return a.prototype.getElement = function() {
            var a;
            if (null == this.el) {
                if (a = document.querySelector(D.target), !a) throw new i;
                this.el = document.createElement("div"), this.el.className = "pace pace-active", document.body.className = document.body.className.replace(/pace-done/g, ""), document.body.className += " pace-running", this.el.innerHTML = '<div class="pace-progress">\n  <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>', null != a.firstChild ? a.insertBefore(this.el, a.firstChild) : a.appendChild(this.el)
            }
            return this.el
        }, a.prototype.finish = function() {
            var a;
            return a = this.getElement(), a.className = a.className.replace("pace-active", ""), a.className += " pace-inactive", document.body.className = document.body.className.replace("pace-running", ""), document.body.className += " pace-done"
        }, a.prototype.update = function(a) {
            return this.progress = a, this.render()
        }, a.prototype.destroy = function() {
            try {
                this.getElement().parentNode.removeChild(this.getElement())
            } catch (a) {
                i = a
            }
            return this.el = void 0
        }, a.prototype.render = function() {
            var a, b, c, d, e, f, g;
            if (null == document.querySelector(D.target)) return !1;
            for (a = this.getElement(), d = "translate3d(" + this.progress + "%, 0, 0)", g = ["webkitTransform", "msTransform", "transform"], e = 0, f = g.length; f > e; e++) b = g[e], a.children[0].style[b] = d;
            return (!this.lastRenderedProgress || this.lastRenderedProgress | 0 !== this.progress | 0) && (a.children[0].setAttribute("data-progress-text", "" + (0 | this.progress) + "%"), this.progress >= 100 ? c = "99" : (c = this.progress < 10 ? "0" : "", c += 0 | this.progress), a.children[0].setAttribute("data-progress", "" + c)), this.lastRenderedProgress = this.progress
        }, a.prototype.done = function() {
            return this.progress >= 100
        }, a
    }(), h = function() {
        function a() {
            this.bindings = {}
        }
        return a.prototype.trigger = function(a, b) {
            var c, d, e, f, g;
            if (null != this.bindings[a]) {
                for (f = this.bindings[a], g = [], d = 0, e = f.length; e > d; d++) c = f[d], g.push(c.call(this, b));
                return g
            }
        }, a.prototype.on = function(a, b) {
            var c;
            return null == (c = this.bindings)[a] && (c[a] = []), this.bindings[a].push(b)
        }, a
    }(), P = window.XMLHttpRequest, O = window.XDomainRequest, N = window.WebSocket, w = function(a, b) {
        var c, d, e;
        e = [];
        for (d in b.prototype) try {
            e.push(null == a[d] && "function" != typeof b[d] ? "function" == typeof Object.defineProperty ? Object.defineProperty(a, d, {
                get: function() {
                    return b.prototype[d]
                },
                configurable: !0,
                enumerable: !0
            }) : a[d] = b.prototype[d] : void 0)
        } catch (f) {
            c = f
        }
        return e
    }, A = [], j.ignore = function() {
        var a, b, c;
        return b = arguments[0], a = 2 <= arguments.length ? X.call(arguments, 1) : [], A.unshift("ignore"), c = b.apply(null, a), A.shift(), c
    }, j.track = function() {
        var a, b, c;
        return b = arguments[0], a = 2 <= arguments.length ? X.call(arguments, 1) : [], A.unshift("track"), c = b.apply(null, a), A.shift(), c
    }, J = function(a) {
        var b;
        if (null == a && (a = "GET"), "track" === A[0]) return "force";
        if (!A.length && D.ajax) {
            if ("socket" === a && D.ajax.trackWebSockets) return !0;
            if (b = a.toUpperCase(), $.call(D.ajax.trackMethods, b) >= 0) return !0
        }
        return !1
    }, k = function(a) {
        function b() {
            var a, c = this;
            b.__super__.constructor.apply(this, arguments), a = function(a) {
                var b;
                return b = a.open, a.open = function(d, e) {
                    return J(d) && c.trigger("request", {
                        type: d,
                        url: e,
                        request: a
                    }), b.apply(a, arguments)
                }
            }, window.XMLHttpRequest = function(b) {
                var c;
                return c = new P(b), a(c), c
            };
            try {
                w(window.XMLHttpRequest, P)
            } catch (d) {}
            if (null != O) {
                window.XDomainRequest = function() {
                    var b;
                    return b = new O, a(b), b
                };
                try {
                    w(window.XDomainRequest, O)
                } catch (d) {}
            }
            if (null != N && D.ajax.trackWebSockets) {
                window.WebSocket = function(a, b) {
                    var d;
                    return d = null != b ? new N(a, b) : new N(a), J("socket") && c.trigger("request", {
                        type: "socket",
                        url: a,
                        protocols: b,
                        request: d
                    }), d
                };
                try {
                    w(window.WebSocket, N)
                } catch (d) {}
            }
        }
        return Z(b, a), b
    }(h), R = null, y = function() {
        return null == R && (R = new k), R
    }, I = function(a) {
        var b, c, d, e;
        for (e = D.ajax.ignoreURLs, c = 0, d = e.length; d > c; c++)
            if (b = e[c], "string" == typeof b) {
                if (-1 !== a.indexOf(b)) return !0
            } else if (b.test(a)) return !0;
        return !1
    }, y().on("request", function(b) {
        var c, d, e, f, g;
        return f = b.type, e = b.request, g = b.url, I(g) ? void 0 : j.running || D.restartOnRequestAfter === !1 && "force" !== J(f) ? void 0 : (d = arguments, c = D.restartOnRequestAfter || 0, "boolean" == typeof c && (c = 0), setTimeout(function() {
            var b, c, g, h, i, k;
            if (b = "socket" === f ? e.readyState < 2 : 0 < (h = e.readyState) && 4 > h) {
                for (j.restart(), i = j.sources, k = [], c = 0, g = i.length; g > c; c++) {
                    if (K = i[c], K instanceof a) {
                        K.watch.apply(K, d);
                        break
                    }
                    k.push(void 0)
                }
                return k
            }
        }, c))
    }), a = function() {
        function a() {
            var a = this;
            this.elements = [], y().on("request", function() {
                return a.watch.apply(a, arguments)
            })
        }
        return a.prototype.watch = function(a) {
            var b, c, d, e;
            return d = a.type, b = a.request, e = a.url, I(e) ? void 0 : (c = "socket" === d ? new n(b) : new o(b), this.elements.push(c))
        }, a
    }(), o = function() {
        function a(a) {
            var b, c, d, e, f, g, h = this;
            if (this.progress = 0, null != window.ProgressEvent)
                for (c = null, a.addEventListener("progress", function(a) {
                        return h.progress = a.lengthComputable ? 100 * a.loaded / a.total : h.progress + (100 - h.progress) / 2
                    }, !1), g = ["load", "abort", "timeout", "error"], d = 0, e = g.length; e > d; d++) b = g[d], a.addEventListener(b, function() {
                    return h.progress = 100
                }, !1);
            else f = a.onreadystatechange, a.onreadystatechange = function() {
                var b;
                return 0 === (b = a.readyState) || 4 === b ? h.progress = 100 : 3 === a.readyState && (h.progress = 50), "function" == typeof f ? f.apply(null, arguments) : void 0
            }
        }
        return a
    }(), n = function() {
        function a(a) {
            var b, c, d, e, f = this;
            for (this.progress = 0, e = ["error", "open"], c = 0, d = e.length; d > c; c++) b = e[c], a.addEventListener(b, function() {
                return f.progress = 100
            }, !1)
        }
        return a
    }(), d = function() {
        function a(a) {
            var b, c, d, f;
            for (null == a && (a = {}), this.elements = [], null == a.selectors && (a.selectors = []), f = a.selectors, c = 0, d = f.length; d > c; c++) b = f[c], this.elements.push(new e(b))
        }
        return a
    }(), e = function() {
        function a(a) {
            this.selector = a, this.progress = 0, this.check()
        }
        return a.prototype.check = function() {
            var a = this;
            return document.querySelector(this.selector) ? this.done() : setTimeout(function() {
                return a.check()
            }, D.elements.checkInterval)
        }, a.prototype.done = function() {
            return this.progress = 100
        }, a
    }(), c = function() {
        function a() {
            var a, b, c = this;
            this.progress = null != (b = this.states[document.readyState]) ? b : 100, a = document.onreadystatechange, document.onreadystatechange = function() {
                return null != c.states[document.readyState] && (c.progress = c.states[document.readyState]), "function" == typeof a ? a.apply(null, arguments) : void 0
            }
        }
        return a.prototype.states = {
            loading: 0,
            interactive: 50,
            complete: 100
        }, a
    }(), f = function() {
        function a() {
            var a, b, c, d, e, f = this;
            this.progress = 0, a = 0, e = [], d = 0, c = C(), b = setInterval(function() {
                var g;
                return g = C() - c - 50, c = C(), e.push(g), e.length > D.eventLag.sampleCount && e.shift(), a = q(e), ++d >= D.eventLag.minSamples && a < D.eventLag.lagThreshold ? (f.progress = 100, clearInterval(b)) : f.progress = 100 * (3 / (a + 3))
            }, 50)
        }
        return a
    }(), m = function() {
        function a(a) {
            this.source = a, this.last = this.sinceLastUpdate = 0, this.rate = D.initialRate, this.catchup = 0, this.progress = this.lastProgress = 0, null != this.source && (this.progress = F(this.source, "progress"))
        }
        return a.prototype.tick = function(a, b) {
            var c;
            return null == b && (b = F(this.source, "progress")), b >= 100 && (this.done = !0), b === this.last ? this.sinceLastUpdate += a : (this.sinceLastUpdate && (this.rate = (b - this.last) / this.sinceLastUpdate), this.catchup = (b - this.progress) / D.catchupTime, this.sinceLastUpdate = 0, this.last = b), b > this.progress && (this.progress += this.catchup * a), c = 1 - Math.pow(this.progress / 100, D.easeFactor), this.progress += c * this.rate * a, this.progress = Math.min(this.lastProgress + D.maxProgressPerFrame, this.progress), this.progress = Math.max(0, this.progress), this.progress = Math.min(100, this.progress), this.lastProgress = this.progress, this.progress
        }, a
    }(), L = null, H = null, r = null, M = null, p = null, s = null, j.running = !1, z = function() {
        return D.restartOnPushState ? j.restart() : void 0
    }, null != window.history.pushState && (T = window.history.pushState, window.history.pushState = function() {
        return z(), T.apply(window.history, arguments)
    }), null != window.history.replaceState && (W = window.history.replaceState, window.history.replaceState = function() {
        return z(), W.apply(window.history, arguments)
    }), l = {
        ajax: a,
        elements: d,
        document: c,
        eventLag: f
    }, (B = function() {
        var a, c, d, e, f, g, h, i;
        for (j.sources = L = [], g = ["ajax", "elements", "document", "eventLag"], c = 0, e = g.length; e > c; c++) a = g[c], D[a] !== !1 && L.push(new l[a](D[a]));
        for (i = null != (h = D.extraSources) ? h : [], d = 0, f = i.length; f > d; d++) K = i[d], L.push(new K(D));
        return j.bar = r = new b, H = [], M = new m
    })(), j.stop = function() {
        return j.trigger("stop"), j.running = !1, r.destroy(), s = !0, null != p && ("function" == typeof t && t(p), p = null), B()
    }, j.restart = function() {
        return j.trigger("restart"), j.stop(), j.start()
    }, j.go = function() {
        var a;
        return j.running = !0, r.render(), a = C(), s = !1, p = G(function(b, c) {
            var d, e, f, g, h, i, k, l, n, o, p, q, t, u, v, w;
            for (l = 100 - r.progress, e = p = 0, f = !0, i = q = 0, u = L.length; u > q; i = ++q)
                for (K = L[i], o = null != H[i] ? H[i] : H[i] = [], h = null != (w = K.elements) ? w : [K], k = t = 0, v = h.length; v > t; k = ++t) g = h[k], n = null != o[k] ? o[k] : o[k] = new m(g), f &= n.done, n.done || (e++, p += n.tick(b));
            return d = p / e, r.update(M.tick(b, d)), r.done() || f || s ? (r.update(100), j.trigger("done"), setTimeout(function() {
                return r.finish(), j.running = !1, j.trigger("hide")
            }, Math.max(D.ghostTime, Math.max(D.minTime - (C() - a), 0)))) : c()
        })
    }, j.start = function(a) {
        v(D, a), j.running = !0;
        try {
            r.render()
        } catch (b) {
            i = b
        }
        return document.querySelector(".pace") ? (j.trigger("start"), j.go()) : setTimeout(j.start, 50)
    }, "function" == typeof define && define.amd ? define(["pace"], function() {
        return j
    }) : "object" == typeof exports ? module.exports = j : D.startOnPageLoad && j.start()
}).call(this);
(function() {
    function c() {
        var e = false;
        if (e) {
            N("keydown", y)
        }
        if (t.keyboardSupport && !e) {
            T("keydown", y)
        }
    }

    function h() {
        if (!document.body) return;
        var e = document.body;
        var i = document.documentElement;
        var a = window.innerHeight;
        var f = e.scrollHeight;
        o = document.compatMode.indexOf("CSS") >= 0 ? i : e;
        u = e;
        c();
        s = true;
        if (top != self) {
            r = true
        } else if (f > a && (e.offsetHeight <= a || i.offsetHeight <= a)) {
            var l = false;
            var h = function() {
                if (!l && i.scrollHeight != document.height) {
                    l = true;
                    setTimeout(function() {
                        i.style.height = document.height + "px";
                        l = false
                    }, 500)
                }
            };
            i.style.height = "auto";
            setTimeout(h, 10);
            if (o.offsetHeight <= a) {
                var p = document.createElement("div");
                p.style.clear = "both";
                e.appendChild(p)
            }
        }
        if (!t.fixedBackground && !n) {
            e.style.backgroundAttachment = "scroll";
            i.style.backgroundAttachment = "scroll"
        }
    }

    function m(e, n, r, i) {
        i || (i = 1e3);
        k(n, r);
        if (t.accelerationMax != 1) {
            var s = +(new Date);
            var o = s - v;
            if (o < t.accelerationDelta) {
                var u = (1 + 30 / o) / 2;
                if (u > 1) {
                    u = Math.min(u, t.accelerationMax);
                    n *= u;
                    r *= u
                }
            }
            v = +(new Date)
        }
        p.push({
            x: n,
            y: r,
            lastX: n < 0 ? .99 : -.99,
            lastY: r < 0 ? .99 : -.99,
            start: +(new Date)
        });
        if (d) {
            return
        }
        var a = e === document.body;
        var f = function(s) {
            var o = +(new Date);
            var u = 0;
            var l = 0;
            for (var c = 0; c < p.length; c++) {
                var h = p[c];
                var v = o - h.start;
                var m = v >= t.animationTime;
                var g = m ? 1 : v / t.animationTime;
                if (t.pulseAlgorithm) {
                    g = D(g)
                }
                var y = h.x * g - h.lastX >> 0;
                var b = h.y * g - h.lastY >> 0;
                u += y;
                l += b;
                h.lastX += y;
                h.lastY += b;
                if (m) {
                    p.splice(c, 1);
                    c--
                }
            }
            if (a) {
                window.scrollBy(u, l)
            } else {
                if (u) e.scrollLeft += u;
                if (l) e.scrollTop += l
            }
            if (!n && !r) {
                p = []
            }
            if (p.length) {
                M(f, e, i / t.frameRate + 1)
            } else {
                d = false
            }
        };
        M(f, e, 0);
        d = true
    }

    function g(e) {
        if (!s) {
            h()
        }
        var n = e.target;
        var r = x(n);
        if (!r || e.defaultPrevented || C(u, "embed") || C(n, "embed") && /\.pdf/i.test(n.src)) {
            return true
        }
        var i = e.wheelDeltaX || 0;
        var o = e.wheelDeltaY || 0;
        if (!i && !o) {
            o = e.wheelDelta || 0
        }
        if (!t.touchpadSupport && A(o)) {
            return true
        }
        if (Math.abs(i) > 1.2) {
            i *= t.stepSize / 120
        }
        if (Math.abs(o) > 1.2) {
            o *= t.stepSize / 120
        }
        m(r, -i, -o);
         	return false;
    }

    function y(e) {
        var n = e.target;
        var r = e.ctrlKey || e.altKey || e.metaKey || e.shiftKey && e.keyCode !== l.spacebar;
        if (/input|textarea|select|embed/i.test(n.nodeName) || n.isContentEditable || e.defaultPrevented || r) {
            return true
        }
        if (C(n, "button") && e.keyCode === l.spacebar) {
            return true
        }
        var i, s = 0,
            o = 0;
        var a = x(u);
        var f = a.clientHeight;
        if (a == document.body) {
            f = window.innerHeight
        }
        switch (e.keyCode) {
            case l.up:
                o = -t.arrowScroll;
                break;
            case l.down:
                o = t.arrowScroll;
                break;
            case l.spacebar:
                i = e.shiftKey ? 1 : -1;
                o = -i * f * .9;
                break;
            case l.pageup:
                o = -f * .9;
                break;
            case l.pagedown:
                o = f * .9;
                break;
            case l.home:
                o = -a.scrollTop;
                break;
            case l.end:
                var c = a.scrollHeight - a.scrollTop - f;
                o = c > 0 ? c + 10 : 0;
                break;
            case l.left:
                s = -t.arrowScroll;
                break;
            case l.right:
                s = t.arrowScroll;
                break;
            default:
                return true
        }
        m(a, s, o);
        e.preventDefault()
    }

    function b(e) {
        u = e.target
    }

    function S(e, t) {
        for (var n = e.length; n--;) w[E(e[n])] = t;
        return t
    }

    function x(e) {
        var t = [];
        var n = o.scrollHeight;
        do {
            var i = w[E(e)];
            if (i) {
                return S(t, i)
            }
            t.push(e);
            if (n === e.scrollHeight) {
                if (!r || o.clientHeight + 10 < n) {
                    return S(t, document.body)
                }
            } else if (e.clientHeight + 10 < e.scrollHeight) {
                overflow = getComputedStyle(e, "").getPropertyValue("overflow-y");
                if (overflow === "scroll" || overflow === "auto") {
                    return S(t, e)
                }
            }
        } while (e = e.parentNode)
    }

    function T(e, t, n) {
        window.addEventListener(e, t, n || false)
    }

    function N(e, t, n) {
        window.removeEventListener(e, t, n || false)
    }

    function C(e, t) {
        return (e.nodeName || "").toLowerCase() === t.toLowerCase()
    }

    function k(e, t) {
        e = e > 0 ? 1 : -1;
        t = t > 0 ? 1 : -1;
        if (i.x !== e || i.y !== t) {
            i.x = e;
            i.y = t;
            p = [];
            v = 0
        }
    }

    function A(e) {
        if (!e) return;
        e = Math.abs(e);
        f.push(e);
        f.shift();
        clearTimeout(L);
        var t = O(f[0], 120) && O(f[1], 120) && O(f[2], 120);
        return !t
    }

    function O(e, t) {
        return Math.floor(e / t) == e / t
    }

    function _(e) {
        var n, r, i;
        e = e * t.pulseScale;
        if (e < 1) {
            n = e - (1 - Math.exp(-e))
        } else {
            r = Math.exp(-1);
            e -= 1;
            i = 1 - Math.exp(-e);
            n = r + i * (1 - r)
        }
        return n * t.pulseNormalize
    }

    function D(e) {
        if (e >= 1) return 1;
        if (e <= 0) return 0;
        if (t.pulseNormalize == 1) {
            t.pulseNormalize /= _(1)
        }
        return _(e)
    }
    var e = {
        frameRate: 150,
        animationTime: 800,
        stepSize: 120,
        pulseAlgorithm: true,
        pulseScale: 8,
        pulseNormalize: 1,
        accelerationDelta: 20,
        accelerationMax: 1,
        keyboardSupport: true,
        arrowScroll: 50,
        touchpadSupport: true,
        fixedBackground: true,
        excluded: ""
    };
    var t = e;
    var n = false;
    var r = false;
    var i = {
        x: 0,
        y: 0
    };
    var s = false;
    var o = document.documentElement;
    var u;
    var a;
    var f = [120, 120, 120];
    var l = {
        left: 37,
        up: 38,
        right: 39,
        down: 40,
        spacebar: 32,
        pageup: 33,
        pagedown: 34,
        end: 35,
        home: 36
    };
    var t = e;
    var p = [];
    var d = false;
    var v = +(new Date);
    var w = {};
    setInterval(function() {
        w = {}
    }, 10 * 1e3);
    var E = function() {
        var e = 0;
        return function(t) {
            return t.uniqueID || (t.uniqueID = e++)
        }
    }();
    var L;
    var M = function() {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(e, t, n) {
            window.setTimeout(e, n || 1e3 / 60)
        }
    }();
    var P = /chrome/i.test(window.navigator.userAgent);
    var H = null;
    if ("onwheel" in document.createElement("div")) H = "wheel";
    else if ("onmousewheel" in document.createElement("div")) H = "mousewheel";
    if (H && P) {
        T(H, g);
        T("mousedown", b);
        T("load", h)
    }
})();
(function(e) {
    e.fn.miniTip = function(t) {
        var n = {
                title: "",
                content: !1,
                delay: 300,
                anchor: "n",
                event: "hover",
                fadeIn: 200,
                fadeOut: 200,
                aHide: !0,
                maxW: "250px",
                offset: 5,
                stemOff: 0,
                doHide: !1
            },
            r = e.extend(n, t);
        e("#miniTip")[0] || e("body").append('<div id="miniTip"><div id="miniTip_t"></div><div id="miniTip_c"></div><div id="miniTip_a"></div></div>');
        var i = e("#miniTip"),
            s = e("#miniTip_t"),
            o = e("#miniTip_c"),
            u = e("#miniTip_a");
        return r.doHide ? (i.stop(!0, !0).fadeOut(r.fadeOut), !1) : this.each(function() {
            var t = e(this),
                n = r.content ? r.content : t.attr("title");
            if (n != "" && typeof n != "undefined") {
                window.delay = !1;
                var a = !1,
                    f = !0;
                r.content || t.removeAttr("title"), r.event == "hover" ? (t.hover(function() {
                    i.removeAttr("click"), f = !0, l.call(this)
                }, function() {
                    f = !1, c()
                }), r.aHide || i.hover(function() {
                    a = !0
                }, function() {
                    a = !1, setTimeout(function() {
                        !f && !i.attr("click") && c()
                    }, 20)
                })) : r.event == "click" && (r.aHide = !0, t.click(function() {
                    return i.attr("click", "t"), i.data("last_target") !== t ? l.call(this) : i.css("display") == "none" ? l.call(this) : c(), i.data("last_target", t), e("html").unbind("click").click(function(t) {
                        i.css("display") == "block" && !e(t.target).closest("#miniTip").length && (e("html").unbind("click"), c())
                    }), !1
                }));
                var l = function() {
                        r.show && r.show.call(this, r), r.content && r.content != "" && (n = r.content), o.html(n), r.title != "" ? s.html(r.title).show() : s.hide(), r.render && r.render(i), u.removeAttr("class"), i.hide().width("").width(i.width()).css("max-width", r.maxW);
                        var a = t.is("area");
                        if (a) {
                            var f, l = [],
                                c = [],
                                h = t.attr("coords").split(",");

                            function p(e, t) {
                                return e - t
                            }
                            for (f = 0; f < h.length; f++) l.push(h[f++]), c.push(h[f]);
                            var d = t.parent().attr("name"),
                                v = e("img[usemap=\\#" + d + "]").offset(),
                                m = parseInt(v.left, 10) + parseInt((parseInt(l.sort(p)[0], 10) + parseInt(l.sort(p)[l.length - 1], 10)) / 2, 10),
                                g = parseInt(v.top, 10) + parseInt((parseInt(c.sort(p)[0], 10) + parseInt(c.sort(p)[c.length - 1], 10)) / 2, 10)
                        } else var g = parseInt(t.offset().top, 10),
                            m = parseInt(t.offset().left, 10);
                        var y = a ? 0 : parseInt(t.outerWidth(), 10),
                            b = a ? 0 : parseInt(t.outerHeight(), 10),
                            w = i.outerWidth(),
                            E = i.outerHeight(),
                            S = Math.round(m + Math.round((y - w) / 2)),
                            x = Math.round(g + b + r.offset + 8),
                            T = Math.round(w - 16) / 2 - parseInt(i.css("borderLeftWidth"), 10),
                            N = 0,
                            C = m + y + w + r.offset + 8 > parseInt(e(window).width(), 10),
                            k = w + r.offset + 8 > m,
                            L = E + r.offset + 8 > g - e(window).scrollTop(),
                            A = g + b + E + r.offset + 8 > parseInt(e(window).height() + e(window).scrollTop(), 10),
                            O = r.anchor;
                        if (k || r.anchor == "e" && !C) {
                            if (r.anchor == "w" || r.anchor == "e") O = "e", N = Math.round(E / 2 - 8 - parseInt(i.css("borderRightWidth"), 10)), T = -8 - parseInt(i.css("borderRightWidth"), 10), S = m + y + r.offset + 8, x = Math.round(g + b / 2 - E / 2)
                        } else if (C || r.anchor == "w" && !k)
                            if (r.anchor == "w" || r.anchor == "e") O = "w", N = Math.round(E / 2 - 8 - parseInt(i.css("borderLeftWidth"), 10)), T = w - parseInt(i.css("borderLeftWidth"), 10), S = m - w - r.offset - 8, x = Math.round(g + b / 2 - E / 2);
                        if (A || r.anchor == "n" && !L) {
                            if (r.anchor == "n" || r.anchor == "s") O = "n", N = E - parseInt(i.css("borderTopWidth"), 10), x = g - (E + r.offset + 8)
                        } else if (L || r.anchor == "s" && !A)
                            if (r.anchor == "n" || r.anchor == "s") O = "s", N = -8 - parseInt(i.css("borderBottomWidth"), 10), x = g + b + r.offset + 8;
                        r.anchor == "n" || r.anchor == "s" ? w / 2 > m ? (S = S < 0 ? T + S : T, T = 0) : m + w / 2 > parseInt(e(window).width(), 10) && (S -= T, T *= 2) : L ? (x += N, N = 0) : A && (x -= N, N *= 2), u.css({
                            "margin-left": (T > 0 ? T : T + parseInt(r.stemOff, 10) / 2) + "px",
                            "margin-top": N + "px"
                        }).attr("class", O), delay && clearTimeout(delay), delay = setTimeout(function() {
                            i.css({
                                "margin-left": S + "px",
                                "margin-top": x + "px"
                            }).stop(!0, !0).fadeIn(r.fadeIn)
                        }, r.delay)
                    },
                    c = function() {
                        if (!r.aHide && !a || r.aHide) delay && clearTimeout(delay), delay = setTimeout(function() {
                            h()
                        }, r.delay)
                    },
                    h = function() {
                        !r.aHide && !a || r.aHide ? (i.stop(!0, !0).fadeOut(r.fadeOut), r.hide && r.hide.call(this)) : setTimeout(function() {
                            c()
                        }, 200)
                    }
            }
        })
    }
})(jQuery);
! function(a) {
    "function" == typeof define && define.amd ? define(["jquery"], a) : a(jQuery)
}(function(a) {
    function b(b) {
        var c = {},
            d = /^jQuery\d+$/;
        return a.each(b.attributes, function(a, b) {
            b.specified && !d.test(b.name) && (c[b.name] = b.value)
        }), c
    }

    function c(b, c) {
        var d = this,
            f = a(d);
        if (d.value == f.attr("placeholder") && f.hasClass(m.customClass))
            if (f.data("placeholder-password")) {
                if (f = f.hide().nextAll('input[type="password"]:first').show().attr("id", f.removeAttr("id").data("placeholder-id")), b === !0) return f[0].value = c;
                f.focus()
            } else d.value = "", f.removeClass(m.customClass), d == e() && d.select()
    }

    function d() {
        var d, e = this,
            f = a(e),
            g = this.id;
        if ("" === e.value) {
            if ("password" === e.type) {
                if (!f.data("placeholder-textinput")) {
                    try {
                        d = f.clone().attr({
                            type: "text"
                        })
                    } catch (h) {
                        d = a("<input>").attr(a.extend(b(this), {
                            type: "text"
                        }))
                    }
                    d.removeAttr("name").data({
                        "placeholder-password": f,
                        "placeholder-id": g
                    }).bind("focus.placeholder", c), f.data({
                        "placeholder-textinput": d,
                        "placeholder-id": g
                    }).before(d)
                }
                f = f.removeAttr("id").hide().prevAll('input[type="text"]:first').attr("id", g).show()
            }
            f.addClass(m.customClass), f[0].value = f.attr("placeholder")
        } else f.removeClass(m.customClass)
    }

    function e() {
        try {
            return document.activeElement
        } catch (a) {}
    }
    var f, g, h = "[object OperaMini]" == Object.prototype.toString.call(window.operamini),
        i = "placeholder" in document.createElement("input") && !h,
        j = "placeholder" in document.createElement("textarea") && !h,
        k = a.valHooks,
        l = a.propHooks;
    if (i && j) g = a.fn.placeholder = function() {
        return this
    }, g.input = g.textarea = !0;
    else {
        var m = {};
        g = a.fn.placeholder = function(b) {
            var e = {
                customClass: "placeholder"
            };
            m = a.extend({}, e, b);
            var f = this;
            return f.filter((i ? "textarea" : ":input") + "[placeholder]").not("." + m.customClass).bind({
                "focus.placeholder": c,
                "blur.placeholder": d
            }).data("placeholder-enabled", !0).trigger("blur.placeholder"), f
        }, g.input = i, g.textarea = j, f = {
            get: function(b) {
                var c = a(b),
                    d = c.data("placeholder-password");
                return d ? d[0].value : c.data("placeholder-enabled") && c.hasClass("placeholder") ? "" : b.value
            },
            set: function(b, f) {
                var g = a(b),
                    h = g.data("placeholder-password");
                return h ? h[0].value = f : g.data("placeholder-enabled") ? ("" === f ? (b.value = f, b != e() && d.call(b)) : g.hasClass(m.customClass) ? c.call(b, !0, f) || (b.value = f) : b.value = f, g) : b.value = f
            }
        }, i || (k.input = f, l.value = f), j || (k.textarea = f, l.value = f), a(function() {
            a(document).delegate("form", "submit.placeholder", function() {
                var b = a("." + m.customClass, this).each(c);
                setTimeout(function() {
                    b.each(d)
                }, 10)
            })
        }), a(window).bind("beforeunload.placeholder", function() {
            a("." + m.customClass).each(function() {
                this.value = ""
            })
        })
    }
});
(jQuery);
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/jquery.bxslider.min.js?ver=1 
!function(t){var e={},s={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};t.fn.bxSlider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slideWidth=parseInt(o.settings.slideWidth),o.children=r.children(o.settings.slideSelector),o.children.length<o.settings.minSlides&&(o.settings.minSlides=o.children.length),o.children.length<o.settings.maxSlides&&(o.settings.maxSlides=o.children.length),o.settings.randomStart&&(o.settings.startSlide=Math.floor(Math.random()*o.children.length)),o.active={index:o.settings.startSlide},o.carousel=o.settings.minSlides>1||o.settings.maxSlides>1,o.carousel&&(o.settings.preloadImages="all"),o.minThreshold=o.settings.minSlides*o.settings.slideWidth+(o.settings.minSlides-1)*o.settings.slideMargin,o.maxThreshold=o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin,o.working=!1,o.controls={},o.interval=null,o.animProp="vertical"==o.settings.mode?"top":"left",o.usingCSS=o.settings.useCSS&&"fade"!=o.settings.mode&&function(){var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssPrefix=e[i].replace("Perspective","").toLowerCase(),o.animProp="-"+o.cssPrefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxSlides=o.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(o.settings.slideSelector).each(function(){t(this).data("origStyle",t(this).attr("style"))}),c()},c=function(){r.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>'),o.viewport=r.parent(),o.loader=t('<div class="bx-loading" />'),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingCSS&&o.settings.easing?r.css("-"+o.cssPrefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing"),f(),o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxWidth:p()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",listStyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginRight",o.settings.slideMargin),"vertical"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginBottom",o.settings.slideMargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zIndex:0,display:"none"}),o.children.eq(o.settings.startSlide).css({zIndex:o.settings.slideZIndex,display:"block"})),o.controls.el=t('<div class="bx-controls" />'),o.settings.captions&&P(),o.active.last=o.settings.startSlide==x()-1,o.settings.video&&r.fitVids();var e=o.children.eq(o.settings.startSlide);"all"==o.settings.preloadImages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&T(),o.settings.controls&&C(),o.settings.auto&&o.settings.autoControls&&E(),(o.settings.controls||o.settings.autoControls||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return i(),void 0;var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteLoop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minSlides:o.settings.maxSlides,i=o.children.slice(0,e).clone().addClass("bx-clone"),s=o.children.slice(-e).clone().addClass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),S(),"vertical"==o.settings.mode&&(o.settings.adaptiveHeight=!0),o.viewport.height(v()),r.redrawSlider(),o.settings.onSliderLoad(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",Z),o.settings.auto&&o.settings.autoStart&&H(),o.settings.ticker&&L(),o.settings.pager&&q(o.settings.startSlide),o.settings.controls&&W(),o.settings.touchEnabled&&!o.settings.ticker&&O()},v=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveHeight)if(o.carousel){var n=1==o.settings.moveSlides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxSlides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(){e+=t(this).outerHeight()}),o.settings.slideMargin>0&&(e+=o.settings.slideMargin*(o.settings.minSlides-1))):e=Math.max.apply(Math,s.map(function(){return t(this).outerHeight(!1)}).get()),e},p=function(){var t="100%";return o.settings.slideWidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin:o.settings.slideWidth),t},u=function(){var t=o.settings.slideWidth,e=o.viewport.width();return 0==o.settings.slideWidth||o.settings.slideWidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxSlides>1&&"horizontal"==o.settings.mode&&(e>o.maxThreshold||e<o.minThreshold&&(t=(e-o.settings.slideMargin*(o.settings.minSlides-1))/o.settings.minSlides)),t},f=function(){var t=1;if("horizontal"==o.settings.mode&&o.settings.slideWidth>0)if(o.viewport.width()<o.minThreshold)t=o.settings.minSlides;else if(o.viewport.width()>o.maxThreshold)t=o.settings.maxSlides;else{var e=o.children.first().width();t=Math.floor(o.viewport.width()/e)}else"vertical"==o.settings.mode&&(t=o.settings.minSlides);return t},x=function(){var t=0;if(o.settings.moveSlides>0)if(o.settings.infiniteLoop)t=o.children.length/m();else for(var e=0,i=0;e<o.children.length;)++t,e=i+f(),i+=o.settings.moveSlides<=f()?o.settings.moveSlides:f();else t=Math.ceil(o.children.length/f());return t},m=function(){return o.settings.moveSlides>0&&o.settings.moveSlides<=f()?o.settings.moveSlides:f()},S=function(){if(o.children.length>o.settings.maxSlides&&o.active.last&&!o.settings.infiniteLoop){if("horizontal"==o.settings.mode){var t=o.children.last(),e=t.position();b(-(e.left-(o.viewport.width()-t.width())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minSlides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingCSS){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),D()})):"reset"==e?r.css(o.animProp,n):"ticker"==e&&(r.css("-"+o.cssPrefix+"-transition-timing-function","linear"),r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),b(s.resetValue,"reset",0),N()}))}else{var a={};a[o.animProp]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){D()}):"reset"==e?r.css(o.animProp,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetValue,"reset",0),N()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildPager&&t.isFunction(o.settings.buildPager)?(n=o.settings.buildPager(s),o.pagerEl.addClass("bx-custom-pager")):(n=s+1,o.pagerEl.addClass("bx-default-pager")),e+='<div class="bx-pager-item"><a href="" data-slide-index="'+s+'" class="bx-pager-link">'+n+"</a></div>"}o.pagerEl.html(e)},T=function(){o.settings.pagerCustom?o.pagerEl=t(o.settings.pagerCustom):(o.pagerEl=t('<div class="bx-pager" />'),o.settings.pagerSelector?t(o.settings.pagerSelector).html(o.pagerEl):o.controls.el.addClass("bx-has-pager").append(o.pagerEl),w()),o.pagerEl.on("click","a",I)},C=function(){o.controls.next=t('<a class="bx-next" href="">'+o.settings.nextText+"</a>"),o.controls.prev=t('<a class="bx-prev" href="">'+o.settings.prevText+"</a>"),o.controls.next.bind("click",y),o.controls.prev.bind("click",z),o.settings.nextSelector&&t(o.settings.nextSelector).append(o.controls.next),o.settings.prevSelector&&t(o.settings.prevSelector).append(o.controls.prev),o.settings.nextSelector||o.settings.prevSelector||(o.controls.directionEl=t('<div class="bx-controls-direction" />'),o.controls.directionEl.append(o.controls.prev).append(o.controls.next),o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl))},E=function(){o.controls.start=t('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+o.settings.startText+"</a></div>"),o.controls.stop=t('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+o.settings.stopText+"</a></div>"),o.controls.autoEl=t('<div class="bx-controls-auto" />'),o.controls.autoEl.on("click",".bx-start",k),o.controls.autoEl.on("click",".bx-stop",M),o.settings.autoControlsCombine?o.controls.autoEl.append(o.controls.start):o.controls.autoEl.append(o.controls.start).append(o.controls.stop),o.settings.autoControlsSelector?t(o.settings.autoControlsSelector).html(o.controls.autoEl):o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl),A(o.settings.autoStart?"stop":"start")},P=function(){o.children.each(function(){var e=t(this).find("img:first").attr("title");void 0!=e&&(""+e).length&&t(this).append('<div class="bx-caption"><span>'+e+"</span></div>")})},y=function(t){o.settings.auto&&r.stopAuto(),r.goToNextSlide(),t.preventDefault()},z=function(t){o.settings.auto&&r.stopAuto(),r.goToPrevSlide(),t.preventDefault()},k=function(t){r.startAuto(),t.preventDefault()},M=function(t){r.stopAuto(),t.preventDefault()},I=function(e){o.settings.auto&&r.stopAuto();var i=t(e.currentTarget),s=parseInt(i.attr("data-slide-index"));s!=o.active.index&&r.goToSlide(s),e.preventDefault()},q=function(e){var i=o.children.length;return"short"==o.settings.pagerType?(o.settings.maxSlides>1&&(i=Math.ceil(o.children.length/o.settings.maxSlides)),o.pagerEl.html(e+1+o.settings.pagerShortSeparator+i),void 0):(o.pagerEl.find("a").removeClass("active"),o.pagerEl.each(function(i,s){t(s).find("a").eq(e).addClass("active")}),void 0)},D=function(){if(o.settings.infiniteLoop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onSlideAfter(o.children.eq(o.active.index),o.oldIndex,o.active.index)},A=function(t){o.settings.autoControlsCombine?o.controls.autoEl.html(o.controls[t]):(o.controls.autoEl.find("a").removeClass("active"),o.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},W=function(){1==x()?(o.controls.prev.addClass("disabled"),o.controls.next.addClass("disabled")):!o.settings.infiniteLoop&&o.settings.hideControlOnEnd&&(0==o.active.index?(o.controls.prev.addClass("disabled"),o.controls.next.removeClass("disabled")):o.active.index==x()-1?(o.controls.next.addClass("disabled"),o.controls.prev.removeClass("disabled")):(o.controls.prev.removeClass("disabled"),o.controls.next.removeClass("disabled")))},H=function(){o.settings.autoDelay>0?setTimeout(r.startAuto,o.settings.autoDelay):r.startAuto(),o.settings.autoHover&&r.hover(function(){o.interval&&(r.stopAuto(!0),o.autoPaused=!0)},function(){o.autoPaused&&(r.startAuto(!0),o.autoPaused=null)})},L=function(){var e=0;if("next"==o.settings.autoDirection)r.append(o.children.clone().addClass("bx-clone"));else{r.prepend(o.children.clone().addClass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autoControls=!1,o.settings.tickerHover&&!o.usingCSS&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(){e+="horizontal"==o.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)});var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-Math.abs(parseInt(r.css(s))));N(n)}),N()},N=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autoDirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetValue:n};b(s,"ticker",speed,a)},O=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",X)},X=function(t){if(o.working)t.preventDefault();else{o.touch.originalPos=r.position();var e=t.originalEvent;o.touch.start.x=e.changedTouches[0].pageX,o.touch.start.y=e.changedTouches[0].pageY,o.viewport.bind("touchmove",Y),o.viewport.bind("touchend",V)}},Y=function(t){var e=t.originalEvent,i=Math.abs(e.changedTouches[0].pageX-o.touch.start.x),s=Math.abs(e.changedTouches[0].pageY-o.touch.start.y);if(3*i>s&&o.settings.preventDefaultSwipeX?t.preventDefault():3*s>i&&o.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!=o.settings.mode&&o.settings.oneToOneTouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedTouches[0].pageX-o.touch.start.x;n=o.touch.originalPos.left+r}else{var r=e.changedTouches[0].pageY-o.touch.start.y;n=o.touch.originalPos.top+r}b(n,"reset",0)}},V=function(t){o.viewport.unbind("touchmove",Y);var e=t.originalEvent,i=0;if(o.touch.end.x=e.changedTouches[0].pageX,o.touch.end.y=e.changedTouches[0].pageY,"fade"==o.settings.mode){var s=Math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipeThreshold&&(o.touch.start.x>o.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalPos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalPos.top),!o.settings.infiniteLoop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):Math.abs(s)>=o.settings.swipeThreshold?(0>s?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):b(i,"reset",200)}o.viewport.unbind("touchend",V)},Z=function(){var e=t(window).width(),i=t(window).height();(a!=e||l!=i)&&(a=e,l=i,r.redrawSlider(),o.settings.onSliderResize.call(r,o.active.index))};return r.goToSlide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldIndex=o.active.index,o.active.index=0>e?x()-1:e>=x()?0:e,o.settings.onSlideBefore(o.children.eq(o.active.index),o.oldIndex,o.active.index),"next"==i?o.settings.onSlideNext(o.children.eq(o.active.index),o.oldIndex,o.active.index):"prev"==i&&o.settings.onSlidePrev(o.children.eq(o.active.index),o.oldIndex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&W(),"fade"==o.settings.mode)o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed),o.children.filter(":visible").fadeOut(o.settings.speed).css({zIndex:0}),o.children.eq(o.active.index).css("zIndex",o.settings.slideZIndex+1).fadeIn(o.settings.speed,function(){t(this).css("zIndex",o.settings.slideZIndex),D()});else{o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteLoop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerWidth()}else{var l=o.children.length-o.settings.minSlides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveSlides?o.settings.maxSlides-m():(x()-1)*m()-(o.children.length-o.settings.maxSlides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxSlides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.goToNextSlide=function(){if(o.settings.infiniteLoop||!o.active.last){var t=parseInt(o.active.index)+1;r.goToSlide(t,"next")}},r.goToPrevSlide=function(){if(o.settings.infiniteLoop||0!=o.active.index){var t=parseInt(o.active.index)-1;r.goToSlide(t,"prev")}},r.startAuto=function(t){o.interval||(o.interval=setInterval(function(){"next"==o.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},o.settings.pause),o.settings.autoControls&&1!=t&&A("stop"))},r.stopAuto=function(t){o.interval&&(clearInterval(o.interval),o.interval=null,o.settings.autoControls&&1!=t&&A("start"))},r.getCurrentSlide=function(){return o.active.index},r.getCurrentSlideElement=function(){return o.children.eq(o.active.index)},r.getSlideCount=function(){return o.children.length},r.redrawSlider=function(){o.children.add(r.find(".bx-clone")).outerWidth(u()),o.viewport.css("height",v()),o.settings.ticker||S(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagerCustom&&(w(),q(o.active.index))},r.destroySlider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!=t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerEl&&o.settings.controls&&o.pagerEl.remove(),t(".bx-caption",this).remove(),o.controls.autoEl&&o.controls.autoEl.remove(),clearInterval(o.interval),o.settings.responsive&&t(window).unbind("resize",Z))},r.reloadSlider=function(t){void 0!=t&&(n=t),r.destroySlider(),d()},d(),this}}(jQuery);
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/index.js?ver=1 
/**
 * jQuery Expanding Grid plugin.
 *
 * By Dan Boulet - https://danboulet.com
 */
(function ($, window, document) {

// Enable strict mode
"use strict";

/**
 * Return the last element in the current row of a grid layout.
 */
var getLastSiblingInRow = function (element) {
	var candidate = element,
			elementTop = element.offsetTop;

	// Loop through the element’s next siblings and look for the first one which
	// is positioned further down the page.
	while (candidate.nextElementSibling !== null) {
		if (candidate.nextElementSibling.offsetTop > elementTop) {
			return candidate;
		}
		candidate = candidate.nextElementSibling;
	}
	return candidate;
};

/**
 * Calculate the distance that we need to scroll the page to bring a
 * section, defined as the area between the top and bottom, into view.
 */
var calculatePageScrollDistance = function (top, bottom) {
	var windowScrollDistance = $(window).scrollTop(),
			windowHeight = $(window).height(),
			scrollDistanceToTop,
			scrollDistanceToBottom;

	// Scroll to the top of the section if the we are already scrolled past it.
	if (windowScrollDistance >= top) {
		return top - windowScrollDistance;
	}
	// Do nothing if there is enough space to show the section without having to scroll.
	else if ((windowScrollDistance + windowHeight) >= bottom) {
		return 0;
	}
	else {
		// Find the maximum distance we can scroll without passing the top of the section.
		scrollDistanceToTop = top - windowScrollDistance;
		// Find the distance we need to scroll to reveal the entire section.
		scrollDistanceToBottom = bottom - (windowScrollDistance + windowHeight);

		return Math.min(scrollDistanceToTop, scrollDistanceToBottom);
	}
};

/**
 * Create the expanding preview grid.
 */
var expandingGrid = function (context, options) {
	var defaults = {
		animationDuration: 250,
		linksSelector: '.links a',
		expandingAreaSelector: '.expanding-container',
		closeButtonMarkup: '<a href="#" class="close-button">Close</a>',
		spacerMarkup: '<span class="spacer" aria-hidden="true"/>',
		elementActiveClass: 'active',
		elementExpandedClass: 'expanded',
		onExpandBefore: false,
		onExpandAfter: false
	};

	var settings = $.extend({}, defaults, options);

	var isExpanded = false;
	var activeLink = false;
	var activeExpandedArea = false;
	var activeExpandedAreaTop = false;
	var activeExpandedAreaHeight = false;
	var lastItemInActiveRow = false;
	var activeRowChanged = false;
	var checkExpandedAreaResize = false;
	var $links = $(settings.linksSelector, context);
	var $expandingAreas = $(settings.expandingAreaSelector, context);
	var $closeButton = $(settings.closeButtonMarkup);
	var $spacer = $(settings.spacerMarkup);
	var $secondarySpacer = $spacer.clone();

	/**
	 * Scroll a section of the page into view, using animation.
	 */
	var scrollSectionIntoView = function (top, bottom, duration, callback) {
		var animate;
		var scroll = 0;
		var distance = calculatePageScrollDistance(top, bottom);
		var windowScrollDistance = $(window).scrollTop();
		var timeLeft;

		// Set default duration.
		duration = (typeof duration === 'undefined') ? settings.animationDuration : duration;
		timeLeft = duration;

		var start = new Date().getTime();
		var last = start;
		var tick = function() {
			timeLeft = Math.max(duration - (new Date() - start), 0);

			var x = (timeLeft === 0 || distance === 0) ? 0 : ((new Date() - last) / timeLeft * distance);
			var diff = (distance > 0 ? Math.min(x, distance) : Math.max(x, distance));
			distance = distance - diff;
			scroll += diff;
			window.scrollTo(0, windowScrollDistance + scroll);

			last = new Date().getTime();

			if (last - start <= duration) {
				animate = (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
			}
			else {
				if (typeof callback === 'function') {
					callback();
				}
			}
		};

		tick();
	};

	// Process the links.
	$links.each(function () {
		var $this = $(this);
		var targetId = $this.attr('href').match(/#([^\?]+)/)[1];
		var target = document.getElementById(targetId);

		if (target) {
			$this.click(function (event) {
				var clickedLink = this;
				var scrollTargetOffset;
				var closeButtonAnimationDelay;

				event.preventDefault();

				// Is this link already expanded?
				if (isExpanded && activeLink === clickedLink) {
					// Close it.
					$closeButton.click();
				}
				// Otherwise, expand it.
				else {
					$links.removeClass(settings.elementActiveClass).filter($this).addClass(settings.elementActiveClass).parent('li').each(function () {
						var lastSibling = getLastSiblingInRow(this);
						activeRowChanged = lastSibling !== lastItemInActiveRow;
						if (activeRowChanged) {
							lastItemInActiveRow = lastSibling;
						}
						// If we are changing rows, replace spacer with secondary spacer.
						if (isExpanded && activeRowChanged) {
							$secondarySpacer.height($spacer.height());
							$spacer.height(0).replaceWith($secondarySpacer);
						}
						$(lastItemInActiveRow).after($spacer);
					});
					if (isExpanded && activeRowChanged) {
						$secondarySpacer.animate({height: 0}, settings.animationDuration, function () {
							$(this).detach();
						});
						$closeButton.removeClass(settings.elementActiveClass).hide();
					}
					scrollTargetOffset = ($secondarySpacer.position().top < $spacer.position().top ? $secondarySpacer.height() : 0);
					activeExpandedAreaTop = ($spacer.position().top - scrollTargetOffset);
					$expandingAreas.removeClass(settings.elementExpandedClass).hide().filter(target).each(function () {
							var $this = $(this);
							var autoHeight = $this.height();
							var autoOuterHeight = $this.outerHeight();
							var initialHeight = (isExpanded && activeExpandedAreaHeight && (activeRowChanged === false)) ? activeExpandedAreaHeight : 0;

							stopExpandedAreaMonitor();

							$spacer.animate({height: autoHeight + 'px'}, settings.animationDuration);

							$this.css({
								height: initialHeight + 'px',
								position: 'absolute',
								left: 0,
								top: $spacer.position().top + 'px'
							}).show(0, function () {
								// Callback.
								if (typeof settings.onExpandBefore === 'function') {
									settings.onExpandBefore.call(this);
								}
							}).animate({
								height: autoHeight + 'px',
								top: activeExpandedAreaTop + 'px'
							}, settings.animationDuration, function () {
								$this.css({height: 'auto'}).addClass(settings.elementExpandedClass);

								// Set a timer to monitor changes to expanded area’s height.
								activeExpandedAreaHeight = $this.height();
								checkExpandedAreaResize = setInterval(function () {
									var activeExpandedAreaNewHeight = $this.height();
									if (activeExpandedAreaNewHeight !== activeExpandedAreaHeight) {
										activeExpandedAreaHeight = activeExpandedAreaNewHeight;
										syncExpandedAreaWithSpacer();
									}
								}, 1000);

								// Callback.
								if (typeof settings.onExpandAfter === 'function') {
									settings.onExpandAfter.call(this);
								}
							});

							// Scroll the page to bring the active link and preview into view.
							var scrollTargetTop = $(clickedLink).offset().top - scrollTargetOffset;
							var scrollTargetBottom = $this.offset().top + autoOuterHeight + 20 - scrollTargetOffset;
							scrollSectionIntoView(scrollTargetTop, scrollTargetBottom);
						});

					// Activate close button.
					closeButtonAnimationDelay = (isExpanded && activeRowChanged && ($this.parent().index() > $(activeLink).parent().index())) ? settings.animationDuration : (settings.animationDuration / 4);
					$closeButton.css({
							position: 'absolute',
							right: 0,
							top: activeExpandedAreaTop + 'px'
						}).delay(closeButtonAnimationDelay).fadeIn(settings.animationDuration, function () {
							$(this).addClass(settings.elementActiveClass);
						});

					// Set global variables.
					activeLink = this;
					activeExpandedArea = target;
					isExpanded = true;
				}
			});
		}
	});

	// Process the close button.
	$closeButton.appendTo(context).hide().click(function (event) {
		var $activeLink = $(activeLink);
		var activeLinkTopOffset = $activeLink.offset().top;
		var activeLinkBottomOffset = activeLinkTopOffset + $activeLink.outerHeight();

		event.preventDefault();

		// DOM manipulation and animations.
		$links.removeClass(settings.elementActiveClass);
		$expandingAreas.slideUp(settings.animationDuration).removeClass(settings.elementExpandedClass);
		$closeButton.removeClass('active').hide();
		$spacer.animate({height: 0}, settings.animationDuration, function () {
			$spacer.detach();
		});

		// Scroll the page to bring the active link into view.
		scrollSectionIntoView(activeLinkTopOffset, activeLinkBottomOffset);

		stopExpandedAreaMonitor();

		// Reset global variables.
		isExpanded = false;
		activeLink = false;
		activeExpandedArea = false;
	});

	/**
	 * Stop monitoring size of expanded area.
	 */
	var stopExpandedAreaMonitor = function () {
		if (checkExpandedAreaResize) {
			clearInterval(checkExpandedAreaResize);
		}
	};

	/**
	 * Match preview and spacer in height and position.
	 */
	var syncExpandedAreaWithSpacer = function () {
		if (activeExpandedArea && isExpanded) {
			$spacer.height($(activeExpandedArea).height());
			activeExpandedAreaTop = $spacer.position().top;
			$closeButton.add(activeExpandedArea).css({top: activeExpandedAreaTop + 'px'});
		}
	};

	/**
	 * Place spacer in proper position within grid.
	 */
	var positionSpacer = function () {
		var lastSibling;
		if (activeLink && lastItemInActiveRow && isExpanded) {
			// Remove spacer.
			$spacer.detach();
			lastSibling = getLastSiblingInRow($(activeLink).parent()[0]);
			// Reposition spacer, if necessary.
			if (lastItemInActiveRow !== lastSibling) {
				console.log(lastSibling);
				lastItemInActiveRow = lastSibling;
			}
			// Restore spacer.
			$(lastItemInActiveRow).after($spacer);
		}
	};

	// React to window resize.
	$(window).resize(function () {
		if (isExpanded) {
			positionSpacer();
			syncExpandedAreaWithSpacer();
		}
	});
};

// Create the jQuery plugin.
$.fn.expandingGrid = function (options) {
	return this.each(function () {
		expandingGrid(this, options);
	});
};

})(jQuery, window, document);

jQuery(document).ready(function () {
	jQuery('.expanding-grid').expandingGrid();
});
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/jquery.quicksand.js?ver=1 
/*

Quicksand 1.6.0

Reorder and filter items with a nice shuffling animation.

Copyright (c) 2010 Jacek Galanciak (razorjack.net)
Big thanks for Piotr Petrus (riddle.pl) for deep code review and wonderful docs & demos.

Dual licensed under the MIT and GPL version 2 licenses.
https://raw.githubusercontent.com/razorjack/quicksand/master/MIT-LICENSE.txt
https://raw.githubusercontent.com/razorjack/quicksand/master/GPL-LICENSE.txt

Project site: https://razorjack.net/quicksand
Github site: https://github.com/razorjack/quicksand

 */

// Uses CommonJS, AMD or browser globals to create a jQuery plugin.
(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jquery'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // Node/CommonJS
    module.exports = function( root, jQuery ) {
      if ( jQuery === undefined ) {
        // require('jQuery') returns a factory that requires window to
        // build a jQuery instance, we normalize how we use modules
        // that require this pattern but the window provided is a noop
        // if it's defined (how jquery works)
        if ( typeof window !== 'undefined' ) {
          jQuery = require('jquery');
        }
        else {
          jQuery = require('jquery')(root);
        }
      }
      factory(jQuery);
      return jQuery;
    };
  } else {
    // Browser globals
    factory(jQuery);
  }
}(function ($) {
  var cloneWithCanvases = function(jqueryObject) {
    var clonedJqueryObject =  jqueryObject.clone(true, true);
    var canvases = jqueryObject.find('canvas');
    if (canvases.length) {
      var clonedCanvases = clonedJqueryObject.find('canvas');
      clonedCanvases.each(function(index) {
        var context = this.getContext('2d');
        context.drawImage(canvases.get(index), 0, 0);
      });
    }
    return clonedJqueryObject;
  };

  $.fn.quicksand = function(collection, customOptions) {
    var options = {
      duration : 750,
      easing : 'swing',
      attribute : 'data-id',        // attribute to recognize same items within source and dest
      adjustHeight : 'call',        // 'dynamic' animates height during shuffling (slow), 'call' adjusts it
                                    // before or after the animation, false leaves height alone, 'auto' sets it to auto
      adjustWidth : false,          // 'dynamic' animates width during shuffling (slow),
                                    // 'call' adjusts it before or after the animation, false leaves the width alone, 'auto' sets it to auto
      useScaling : false,           // enable it if you're using scaling effect
      enhancement : function(c) {}, // Visual enhacement (eg. font replacement) function for cloned elements
      selector : '> *',
      atomic : false,
      dx : 0,
      dy : 0,
      maxWidth : 0,
      retainExisting : true         // disable if you want the collection of items to be replaced completely by incoming items.
    };

    $.extend(options, customOptions);

    if ((typeof ($.transform) == 'undefined')) {
      options.useScaling = false;
    }

    var callbackFunction;
    if (typeof (arguments[1]) == 'function') {
      callbackFunction = arguments[1];
    } else if (typeof (arguments[2] == 'function')) {
      callbackFunction = arguments[2];
    }

    var that = this;
    return this.each(function(i) {
      var val;
      var animationQueue = []; // used to store all the animation params before starting the animation;
      // solves initial animation slowdowns
      var $collection;
      if (typeof(options.attribute) == 'function') {
        $collection = $(collection);
      } else {
        $collection = cloneWithCanvases($(collection).filter('[' + options.attribute + ']')); // destination (target) collection
      }
      var $sourceParent = $(this); // source, the visible container of source collection
      var sourceHeight = $(this).css('height'); // used to keep height and document flow during the animation
      var sourceWidth = $(this).css('width'); // used to keep  width and document flow during the animation
      var destHeight, destWidth;
      var adjustHeightOnCallback = false;
      var adjustWidthOnCallback = false;
      var offset = $($sourceParent).offset(); // offset of visible container, used in animation calculations
      var offsets = []; // coordinates of every source collection item
      var $source = $(this).find(options.selector); // source collection items
      var width = $($source).innerWidth(); // need for the responsive design

      // Replace the collection and quit if IE6
      if (navigator.userAgent.match(/msie [6]/i)) {
        $sourceParent.html('').append($collection);
        return;
      }

      // Gets called when any animation is finished
      var postCallbackPerformed = 0; // prevents the function from being called more than one time
      var postCallback = function() {
        $(this).css('margin', '').css('position', '').css('top', '').css('left', '').css('opacity', '');
        if (!postCallbackPerformed) {
          postCallbackPerformed = 1;

          if (!options.atomic) {
            // hack: used to be: $sourceParent.html($dest.html());
            // put target HTML into visible source container
            // but new webkit builds cause flickering when replacing the collections
            var $toDelete = $sourceParent.find(options.selector);
            if (!options.retainExisting) {
              $sourceParent.prepend($dest.find(options.selector));
              $toDelete.remove();
            } else {
              // Avoid replacing elements because we may have already altered items in significant
              // ways and it would be bad to have to do it again. (i.e. lazy load images)
              // But $dest holds the correct ordering. So we must re-sequence items in $sourceParent to match.
              var $keepElements = $([]);
              $dest.find(options.selector).each(function(i) {
                var $matchedElement = $([]);
                if (typeof (options.attribute) == 'function') {
                  var val = options.attribute($(this));
                  $toDelete.each(function() {
                    if (options.attribute(this) == val) {
                      $matchedElement = $(this);
                      return false;
                    }
                  });
                } else {
                  $matchedElement = $toDelete.filter(
                    '[' + options.attribute + '="'+
                    $(this).attr(options.attribute) + '"]');
                }
                if ($matchedElement.length > 0) {
                  // There is a matching element in the $toDelete list and in $dest
                  // list, so make sure it is in the right location within $sourceParent
                  // and put it in the list of elements we need to not delete.
                  $keepElements = $keepElements.add($matchedElement);
                  if (i === 0) {
                    $sourceParent.prepend($matchedElement);
                  } else {
                    $matchedElement.insertAfter($sourceParent.find(options.selector).get(i - 1));
                  }
                }
              });
              // Remove whatever is remaining from the DOM
              $toDelete.not($keepElements).remove();
            }

            if (adjustHeightOnCallback) {
              $sourceParent.css('height', destHeight);
            }
            if (adjustWidthOnCallback) {
              $sourceParent.css('width', sourceWidth);
            }
          }
          options.enhancement($sourceParent); // Perform custom visual enhancements on a newly replaced collection
          if (typeof callbackFunction == 'function') {
            callbackFunction.call(that);
          }
        }

        if ('auto' === options.adjustHeight) {
          $sourceParent.css('height', 'auto');
        }

        if ('auto' === options.adjustWidth) {
          $sourceParent.css('width', 'auto');
        }
      };

      // Position: relative situations
      var $correctionParent = $sourceParent.offsetParent();
      var correctionOffset = $correctionParent.offset();
      if ($correctionParent.css('position') == 'relative') {
        if ($correctionParent.get(0).nodeName.toLowerCase() != 'body') {
          correctionOffset.top += (parseFloat($correctionParent.css('border-top-width')) || 0);
          correctionOffset.left += (parseFloat($correctionParent.css('border-left-width')) || 0);
        }
      } else {
        correctionOffset.top -= (parseFloat($correctionParent.css('border-top-width')) || 0);
        correctionOffset.left -= (parseFloat($correctionParent.css('border-left-width')) || 0);
        correctionOffset.top -= (parseFloat($correctionParent.css('margin-top')) || 0);
        correctionOffset.left -= (parseFloat($correctionParent.css('margin-left')) || 0);
      }

      // perform custom corrections from options (use when Quicksand fails to detect proper correction)
      if (isNaN(correctionOffset.left)) {
        correctionOffset.left = 0;
      }
      if (isNaN(correctionOffset.top)) {
        correctionOffset.top = 0;
      }

      correctionOffset.left -= options.dx;
      correctionOffset.top -= options.dy;

      // keeps nodes after source container, holding their position
      if (options.adjustHeight !== false) {
        $sourceParent.css('height', $(this).height());
      }
      if (options.adjustWidth !== false) {
        $sourceParent.css('width', $(this).width());
      }

      // get positions of source collections
      $source.each(function(i) {
        offsets[i] = $(this).offset();
      });

      // stops previous animations on source container
      $(this).stop();
      var dx = 0;
      var dy = 0;
      $source.each(function(i) {
        $(this).stop(); // stop animation of collection items
        var rawObj = $(this).get(0);
        if (rawObj.style.position == 'absolute') {
          dx = -options.dx;
          dy = -options.dy;
        } else {
          dx = options.dx;
          dy = options.dy;
        }

        rawObj.style.position = 'absolute';
        rawObj.style.margin = '0';

        if (!options.adjustWidth) {
          rawObj.style.width = (width + 'px'); // sets the width to the current element
          // with even if it has been changed
          // by a responsive design
        }

        rawObj.style.top = (offsets[i].top- parseFloat(rawObj.style.marginTop) - correctionOffset.top + dy) + 'px';
        rawObj.style.left = (offsets[i].left- parseFloat(rawObj.style.marginLeft) - correctionOffset.left + dx) + 'px';

        if (options.maxWidth > 0 && offsets[i].left > options.maxWidth) {
          rawObj.style.display = 'none';
        }
      });

      // create temporary container with destination collection
      var $dest = cloneWithCanvases($($sourceParent));
      var rawDest = $dest.get(0);
      rawDest.innerHTML = '';
      rawDest.setAttribute('id', '');
      rawDest.style.height = 'auto';
      rawDest.style.width = $sourceParent.width() + 'px';
      $dest.append($collection);
      // Inserts node into HTML. Note that the node is under visible source container in the exactly same position
      // The browser render all the items without showing them (opacity: 0.0) No offset calculations are needed,
      // the browser just extracts position from underlayered destination items and sets animation to destination positions.
      $dest.insertBefore($sourceParent);
      $dest.css('opacity', 0.0);
      rawDest.style.zIndex = -1;

      rawDest.style.margin = '0';
      rawDest.style.position = 'absolute';
      rawDest.style.top = offset.top - correctionOffset.top + 'px';
      rawDest.style.left = offset.left - correctionOffset.left + 'px';

      if (options.adjustHeight === 'dynamic') {
        // If destination container has different height than source container the height can be animated,
        // adjusting it to destination height
        $sourceParent.animate({ height : $dest.height() }, options.duration, options.easing);
      } else if (options.adjustHeight === 'call') {
        destHeight = $dest.height();
        if (parseFloat(sourceHeight) < parseFloat(destHeight)) {
          // Adjust the height now so that the items don't move out of the container
          $sourceParent.css('height', destHeight);
        } else {
          // Adjust later, on callback
          adjustHeightOnCallback = true;
        }
      }

      if (options.adjustWidth === 'dynamic') {
        // If destination container has different width than source container the width can be animated,
        // adjusting it to destination width
        $sourceParent.animate({ width : $dest.width() }, options.duration, options.easing);
      } else if (options.adjustWidth === 'call') {
        destWidth = $dest.width();
        if (parseFloat(sourceWidth) < parseFloat(destWidth)) {
          // Adjust the height now so that the items don't move out of the container
          $sourceParent.css('width', destWidth);
        } else {
          // Adjust later, on callback
          adjustWidthOnCallback = true;
        }
      }

      // Now it's time to do shuffling animation. First of all, we need to identify same elements within
      // source and destination collections
      $source.each(function(i) {
        var destElement = [];
        if (typeof (options.attribute) == 'function') {
          val = options.attribute($(this));
          $collection.each(function() {
            if (options.attribute(this) == val) {
              destElement = $(this);
              return false;
            }
          });
        } else {
          destElement = $collection.filter('[' + options.attribute + '="' + $(this).attr(options.attribute) + '"]');
        }
        if (destElement.length) {
          // The item is both in source and destination collections. It it's under different position, let's move it
          if (!options.useScaling) {
            animationQueue.push({
              element : $(this), dest : destElement,
              style : {
                top : $(this).offset().top,
                left : $(this).offset().left,
                opacity : ""
              },
              animation : {
                top : destElement.offset().top - correctionOffset.top,
                left : destElement.offset().left - correctionOffset.left,
                opacity : 1.0
              }
            });
          } else {
            animationQueue.push({
              element : $(this), dest : destElement,
              style : {
                top : $(this).offset().top,
                left : $(this).offset().left,
                opacity : ""
              },
              animation : {
                top : destElement.offset().top - correctionOffset.top,
                left : destElement.offset().left - correctionOffset.left,
                opacity : 1.0,
                transform : 'scale(1.0)'
              }
            });
          }
        } else {
          // The item from source collection is not present in destination collections.  Let's remove it
          if (!options.useScaling) {
            animationQueue.push({
              element : $(this),
              style : {
                top : $(this).offset().top,
                left : $(this).offset().left,
                opacity : ""
              },
              animation : {
                opacity : '0.0'
              }
            });
          } else {
            animationQueue.push({
              element : $(this),
              style : {
                top : $(this).offset().top,
                left : $(this).offset().left,
                opacity : ""
              },
              animation : {
                opacity : '0.0',
                transform : 'scale(0.0)'
              }
            });
          }
        }
      });

      $collection.each(function(i) {
        // Grab all items from target collection not present in visible source collection
        var sourceElement = [];
        var destElement = [];
        if (typeof (options.attribute) == 'function') {
          val = options.attribute($(this));
          $source.each(function() {
            if (options.attribute(this) == val) {
              sourceElement = $(this);
              return false;
            }
          });

          $collection.each(function() {
            if (options.attribute(this) == val) {
              destElement = $(this);
              return false;
            }
          });
        } else {
          sourceElement = $source.filter('[' + options.attribute + '="' + $(this).attr(options.attribute) + '"]');
          destElement = $collection.filter('[' + options.attribute + '="' + $(this).attr(options.attribute) + '"]');
        }

        var animationOptions;
        if (sourceElement.length === 0 && destElement.length > 0) {

          // No such element in source collection...
          if (!options.useScaling) {
            animationOptions = {opacity : '1.0'};
          } else {
            animationOptions = {opacity : '1.0', transform : 'scale(1.0)'};
          }

          // Let's create it
          var d = cloneWithCanvases(destElement);
          var rawDestElement = d.get(0);
          rawDestElement.style.position = 'absolute';
          rawDestElement.style.margin = '0';

          if (!options.adjustWidth) {
            // sets the width to the current element with even if it has been changed by a responsive design
            rawDestElement.style.width = width + 'px';
          }

          rawDestElement.style.top = destElement.offset().top - correctionOffset.top + 'px';
          rawDestElement.style.left = destElement.offset().left - correctionOffset.left + 'px';

          d.css('opacity', 0.0); // IE

          if (options.useScaling) {
            d.css("transform", "scale(0.0)");
          }
          d.appendTo($sourceParent);

          if (options.maxWidth === 0 || destElement.offset().left < options.maxWidth) {
            animationQueue.push({element : $(d), dest : destElement,animation : animationOptions});
          }
        }
      });

      $dest.remove();
      if (!options.atomic) {
        options.enhancement($sourceParent); // Perform custom visual enhancements during the animation
        for (i = 0; i < animationQueue.length; i++) {
          animationQueue[i].element.animate(animationQueue[i].animation, options.duration, options.easing, postCallback);
        }
      } else {
        $toDelete = $sourceParent.find(options.selector);
        $sourceParent.prepend($dest.find(options.selector));
        for (i = 0; i < animationQueue.length; i++) {
          if (animationQueue[i].dest && animationQueue[i].style) {
            var destElement = animationQueue[i].dest;
            var destOffset = destElement.offset();

            destElement.css({
              position : 'relative',
              top : (animationQueue[i].style.top - destOffset.top),
              left : (animationQueue[i].style.left - destOffset.left)
            });

            destElement.animate({top : "0", left : "0"},
                                options.duration,
                                options.easing,
                                postCallback);
          } else {
            animationQueue[i].element.animate(animationQueue[i].animation,
                                              options.duration,
                                              options.easing,
                                              postCallback);
          }
        }
        $toDelete.remove();
      }
    });
  };
}));
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/script.js?ver=1 
jQuery.noConflict();jQuery(document).ready(function($){function lightboxPhoto(){jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_square',animation_speed:'fast',slideshow:5000,show_title:false,overlay_gallery:false,autoplay:true,keyboard_shortcuts:true,allow_resize:true,allow_expand:true,modal:true});}
if(jQuery().prettyPhoto){lightboxPhoto();}
if(jQuery().quicksand){var $data=jQuery(".portfolio-area").clone();jQuery('.portfolio-categ li').click(function(e){jQuery(".filter li").removeClass("active");var filterClass=jQuery(this).attr('class').split(' ').slice(-1)[0];if(filterClass=='all'){var $filteredData=$data.find('.portfolio-item2');}else{var $filteredData=$data.find('.portfolio-item2[data-type='+filterClass+']');}
jQuery(".portfolio-area").quicksand($filteredData,{duration:1000,},function(){lightboxPhoto();});jQuery(this).addClass("active");return false;});}});
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/counterup.min.js?ver=1 
/*!
* jquery.counterup.js 1.0
*
* Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
* Released under the GPL v2 License
*
* Date: Nov 26, 2013
*/(function(e){"use strict";e.fn.counterUp=function(t){var n=e.extend({time:400,delay:10},t);return this.each(function(){var t=e(this),r=n,i=function(){var e=[],n=r.time/r.delay,i=t.text(),s=/[0-9]+,[0-9]+/.test(i);i=i.replace(/,/g,"");var o=/^[0-9]+$/.test(i),u=/^[0-9]+\.[0-9]+$/.test(i),a=u?(i.split(".")[1]||[]).length:0;for(var f=n;f>=1;f--){var l=parseInt(i/n*f);u&&(l=parseFloat(i/n*f).toFixed(a));if(s)while(/(\d+)(\d{3})/.test(l.toString()))l=l.toString().replace(/(\d+)(\d{3})/,"$1,$2");e.unshift(l)}t.data("counterup-nums",e);t.text("0");var c=function(){t.text(t.data("counterup-nums").shift());if(t.data("counterup-nums").length)setTimeout(t.data("counterup-func"),r.delay);else{delete t.data("counterup-nums");t.data("counterup-nums",null);t.data("counterup-func",null)}};t.data("counterup-func",c);setTimeout(t.data("counterup-func"),r.delay)};t.waypoint(i,{offset:"100%",triggerOnce:!0})})}})(jQuery);
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/verticalslider.js?ver=1 
(function($){
$.fn.verticalSlider=function(options){
'use strict';

	var slider=this,
	inner=$('.vertical-inner'),
	height=0,
	length=inner.find('.slide').length,
	innerTop=0,
	totalHeight=0,
	winWidth=$(window).width();


	var defaults={

		index:1,		
		itemDistance:15, // each item distance between them as padding.
		animateTime:300,
		animateType:'linear',
		slideTop:'.vertical-top',
		slideBottom:'.vertical-bottom',

	};


		options=$.extend(defaults,options);



		inner.find('.slide').css({

			paddingTop:options.itemDistance,
			paddingBottom:options.itemDistance

		});



		inner.find('.slide').each(function(){

			totalHeight+=$(this).outerHeight();

		});		




		function add_class(opt){

			inner.find('.slide').removeClass('active-vertical');

			inner.find('.slide').eq(opt).addClass('active-vertical');

		}

		add_class(options.index);



		function activeHeight(opt){

			height=inner.find('.slide').eq(opt).outerHeight();

			slider.height(height);

		}

		activeHeight(options.index);




		function innerPosition(opt){

			innerTop=0;

			$('.slide').eq(opt).prevAll('.slide').each(function(){			

				innerTop=$(this).outerHeight()+innerTop;
				
				inner.css('marginTop',-innerTop+'px');				

			});

		}

		innerPosition(options.index);



		function setSlide(opt){

			var innerTop=0;

			inner.find('.slide').eq(opt).prevAll('.slide').each(function(){					

				innerTop=$(this).outerHeight()+innerTop;

			});				

			inner.animate({

				marginTop:-innerTop

			},options.animateTime,options.animateType);

		}		

		


		$(window).resize(function(){			

			activeHeight(options.index);
		
			innerPosition(options.index);	

		});
		


		$(options.slideBottom).click(function(){

			if(options.index<length-1){

				options.index++;

				setSlide(options.index);

				activeHeight(options.index);

				add_class(options.index);								

			}

		});



		$(options.slideTop).click(function(){

			if(options.index>0){

				options.index--;				

				setSlide(options.index);

				activeHeight(options.index);

				add_class(options.index);

			}

		});
	
}



})(jQuery);
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/jquery.prettyPhoto.js?ver=1 
!(function (e) {
    function t() {
        var e = location.href;
        return (hashtag = -1 !== e.indexOf("#prettyPhoto") ? decodeURI(e.substring(e.indexOf("#prettyPhoto") + 1, e.length)) : !1), hashtag && (hashtag = hashtag.replace(/<|>/g, "")), hashtag;
    }
    function i() {
        "undefined" != typeof theRel && (location.hash = theRel + "/" + rel_index + "/");
    }
    function p() {
        -1 !== location.href.indexOf("#prettyPhoto") && (location.hash = "prettyPhoto");
    }
    function o(e, t) {
        e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var i = "[\\?&]" + e + "=([^&#]*)",
            p = new RegExp(i),
            o = p.exec(t);
        return null == o ? "" : o[1];
    }
    (e.prettyPhoto = { version: "3.1.6" }),
        (e.fn.prettyPhoto = function (a) {
            function s() {
                e(".pp_loaderIcon").hide(),
                    (projectedTop = scroll_pos.scrollTop + (I / 2 - f.containerHeight / 2)),
                    projectedTop < 0 && (projectedTop = 0),
                    $ppt.fadeTo(settings.animation_speed, 1),
                    $pp_pic_holder.find(".pp_content").animate({ height: f.contentHeight, width: f.contentWidth }, settings.animation_speed),
                    $pp_pic_holder.animate({ top: projectedTop, left: j / 2 - f.containerWidth / 2 < 0 ? 0 : j / 2 - f.containerWidth / 2, width: f.containerWidth }, settings.animation_speed, function () {
                        $pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(f.height).width(f.width),
                            $pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed),
                            isSet && "image" == h(pp_images[set_position]) ? $pp_pic_holder.find(".pp_hoverContainer").show() : $pp_pic_holder.find(".pp_hoverContainer").hide(),
                            settings.allow_expand && (f.resized ? e("a.pp_expand,a.pp_contract").show() : e("a.pp_expand").hide()),
                            !settings.autoplay_slideshow || P || v || e.prettyPhoto.startSlideshow(),
                            settings.changepicturecallback(),
                            (v = !0);
                    }),
                    m(),
                    a.ajaxcallback();
            }
            function n(t) {
                $pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility", "hidden"),
                    $pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed, function () {
                        e(".pp_loaderIcon").show(), t();
                    });
            }
            function r(t) {
                t > 1 ? e(".pp_nav").show() : e(".pp_nav").hide();
            }
            function l(e, t) {
                if (((resized = !1), d(e, t), (imageWidth = e), (imageHeight = t), (k > j || b > I) && doresize && settings.allow_resize && !$)) {
                    for (resized = !0, fitting = !1; !fitting; )
                        k > j ? ((imageWidth = j - 200), (imageHeight = (t / e) * imageWidth)) : b > I ? ((imageHeight = I - 200), (imageWidth = (e / t) * imageHeight)) : (fitting = !0), (b = imageHeight), (k = imageWidth);
                    (k > j || b > I) && l(k, b), d(imageWidth, imageHeight);
                }
                return {
                    width: Math.floor(imageWidth),
                    height: Math.floor(imageHeight),
                    containerHeight: Math.floor(b),
                    containerWidth: Math.floor(k) + 2 * settings.horizontal_padding,
                    contentHeight: Math.floor(y),
                    contentWidth: Math.floor(w),
                    resized: resized,
                };
            }
            function d(t, i) {
                (t = parseFloat(t)),
                    (i = parseFloat(i)),
                    ($pp_details = $pp_pic_holder.find(".pp_details")),
                    $pp_details.width(t),
                    (detailsHeight = parseFloat($pp_details.css("marginTop")) + parseFloat($pp_details.css("marginBottom"))),
                    ($pp_details = $pp_details.clone().addClass(settings.theme).width(t).appendTo(e("body")).css({ position: "absolute", top: -1e4 })),
                    (detailsHeight += $pp_details.height()),
                    (detailsHeight = detailsHeight <= 34 ? 36 : detailsHeight),
                    $pp_details.remove(),
                    ($pp_title = $pp_pic_holder.find(".ppt")),
                    $pp_title.width(t),
                    (titleHeight = parseFloat($pp_title.css("marginTop")) + parseFloat($pp_title.css("marginBottom"))),
                    ($pp_title = $pp_title.clone().appendTo(e("body")).css({ position: "absolute", top: -1e4 })),
                    (titleHeight += $pp_title.height()),
                    $pp_title.remove(),
                    (y = i + detailsHeight),
                    (w = t),
                    (b = y + titleHeight + $pp_pic_holder.find(".pp_top").height() + $pp_pic_holder.find(".pp_bottom").height()),
                    (k = t);
            }
            function h(e) {
                return e.match(/youtube\.com\/watch/i) || e.match(/youtu\.be/i)
                    ? "youtube"
                    : e.match(/vimeo\.com/i)
                    ? "vimeo"
                    : e.match(/\b.mov\b/i)
                    ? "quicktime"
                    : e.match(/\b.swf\b/i)
                    ? "flash"
                    : e.match(/\biframe=true\b/i)
                    ? "iframe"
                    : e.match(/\bajax=true\b/i)
                    ? "ajax"
                    : e.match(/\bcustom=true\b/i)
                    ? "custom"
                    : "#" == e.substr(0, 1)
                    ? "inline"
                    : "image";
            }
            function c() {
                if (doresize && "undefined" != typeof $pp_pic_holder) {
                    if (
                        ((scroll_pos = _()),
                        (contentHeight = $pp_pic_holder.height()),
                        (contentwidth = $pp_pic_holder.width()),
                        (projectedTop = I / 2 + scroll_pos.scrollTop - contentHeight / 2),
                        projectedTop < 0 && (projectedTop = 0),
                        contentHeight > I)
                    )
                        return;
                    $pp_pic_holder.css({ top: projectedTop, left: j / 2 + scroll_pos.scrollLeft - contentwidth / 2 });
                }
            }
            function _() {
                return self.pageYOffset
                    ? { scrollTop: self.pageYOffset, scrollLeft: self.pageXOffset }
                    : document.documentElement && document.documentElement.scrollTop
                    ? { scrollTop: document.documentElement.scrollTop, scrollLeft: document.documentElement.scrollLeft }
                    : document.body
                    ? { scrollTop: document.body.scrollTop, scrollLeft: document.body.scrollLeft }
                    : void 0;
            }
            function g() {
                (I = e(window).height()), (j = e(window).width()), "undefined" != typeof $pp_overlay && $pp_overlay.height(e(document).height()).width(j);
            }
            function m() {
                isSet && settings.overlay_gallery && "image" == h(pp_images[set_position])
                    ? ((itemWidth = 57),
                      (navWidth = "facebook" == settings.theme || "pp_default" == settings.theme ? 50 : 30),
                      (itemsPerPage = Math.floor((f.containerWidth - 100 - navWidth) / itemWidth)),
                      (itemsPerPage = itemsPerPage < pp_images.length ? itemsPerPage : pp_images.length),
                      (totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1),
                      0 == totalPage ? ((navWidth = 0), $pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").hide()) : $pp_gallery.find(".pp_arrow_next,.pp_arrow_previous").show(),
                      (galleryWidth = itemsPerPage * itemWidth),
                      (fullGalleryWidth = pp_images.length * itemWidth),
                      $pp_gallery
                          .css("margin-left", -(galleryWidth / 2 + navWidth / 2))
                          .find("div:first")
                          .width(galleryWidth + 5)
                          .find("ul")
                          .width(fullGalleryWidth)
                          .find("li.selected")
                          .removeClass("selected"),
                      (goToPage = Math.floor(set_position / itemsPerPage) < totalPage ? Math.floor(set_position / itemsPerPage) : totalPage),
                      e.prettyPhoto.changeGalleryPage(goToPage),
                      $pp_gallery_li.filter(":eq(" + set_position + ")").addClass("selected"))
                    : $pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave");
            }
            function u() {
                if (
                    (settings.social_tools && (facebook_like_link = settings.social_tools.replace("{location_href}", encodeURIComponent(location.href))),
                    (settings.markup = settings.markup.replace("{pp_social}", "")),
                    e("body").append(settings.markup),
                    ($pp_pic_holder = e(".pp_pic_holder")),
                    ($ppt = e(".ppt")),
                    ($pp_overlay = e("div.pp_overlay")),
                    isSet && settings.overlay_gallery)
                ) {
                    (currentGalleryPage = 0), (toInject = "");
                    for (var t = 0; t < pp_images.length; t++)
                        pp_images[t].match(/\b(jpg|jpeg|png|gif)\b/gi) ? ((classname = ""), (img_src = pp_images[t])) : ((classname = "default"), (img_src = "")),
                            (toInject += "<li class='" + classname + "'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>");
                    (toInject = settings.gallery_markup.replace(/{gallery}/g, toInject)),
                        $pp_pic_holder.find("#pp_full_res").after(toInject),
                        ($pp_gallery = e(".pp_pic_holder .pp_gallery")),
                        ($pp_gallery_li = $pp_gallery.find("li")),
                        $pp_gallery.find(".pp_arrow_next").click(function () {
                            return e.prettyPhoto.changeGalleryPage("next"), e.prettyPhoto.stopSlideshow(), !1;
                        }),
                        $pp_gallery.find(".pp_arrow_previous").click(function () {
                            return e.prettyPhoto.changeGalleryPage("previous"), e.prettyPhoto.stopSlideshow(), !1;
                        }),
                        $pp_pic_holder.find(".pp_content").hover(
                            function () {
                                $pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn();
                            },
                            function () {
                                $pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut();
                            }
                        ),
                        (itemWidth = 57),
                        $pp_gallery_li.each(function (t) {
                            e(this)
                                .find("a")
                                .click(function () {
                                    return e.prettyPhoto.changePage(t), e.prettyPhoto.stopSlideshow(), !1;
                                });
                        });
                }
                settings.slideshow &&
                    ($pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>'),
                    $pp_pic_holder.find(".pp_nav .pp_play").click(function () {
                        return e.prettyPhoto.startSlideshow(), !1;
                    })),
                    $pp_pic_holder.attr("class", "pp_pic_holder " + settings.theme),
                    $pp_overlay.css({ opacity: 0, height: e(document).height(), width: e(window).width() }).bind("click", function () {
                        settings.modal || e.prettyPhoto.close();
                    }),
                    e("a.pp_close").bind("click", function () {
                        return e.prettyPhoto.close(), !1;
                    }),
                    settings.allow_expand &&
                        e("a.pp_expand").bind("click", function () {
                            return (
                                e(this).hasClass("pp_expand") ? (e(this).removeClass("pp_expand").addClass("pp_contract"), (doresize = !1)) : (e(this).removeClass("pp_contract").addClass("pp_expand"), (doresize = !0)),
                                n(function () {
                                    e.prettyPhoto.open();
                                }),
                                !1
                            );
                        }),
                    $pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click", function () {
                        return e.prettyPhoto.changePage("previous"), e.prettyPhoto.stopSlideshow(), !1;
                    }),
                    $pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click", function () {
                        return e.prettyPhoto.changePage("next"), e.prettyPhoto.stopSlideshow(), !1;
                    }),
                    c();
            }
            a = jQuery.extend(
                {
                    hook: "rel",
                    animation_speed: "fast",
                    ajaxcallback: function () {},
                    slideshow: 5e3,
                    autoplay_slideshow: !1,
                    opacity: 0.8,
                    show_title: !0,
                    allow_resize: !0,
                    allow_expand: !0,
                    default_width: 500,
                    default_height: 344,
                    counter_separator_label: "/",
                    theme: "pp_default",
                    horizontal_padding: 20,
                    hideflash: !1,
                    wmode: "opaque",
                    autoplay: !0,
                    modal: !1,
                    deeplinking: !0,
                    overlay_gallery: !0,
                    overlay_gallery_max: 30,
                    keyboard_shortcuts: !0,
                    changepicturecallback: function () {},
                    callback: function () {},
                    ie6_fallback: !0,
                    markup:
                        '<div class="pp_pic_holder"> 						<div class="ppt">&nbsp;</div> 						<div class="pp_top"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 						<div class="pp_content_container"> 							<div class="pp_left"> 							<div class="pp_right"> 								<div class="pp_content"> 									<div class="pp_loaderIcon"></div> 									<div class="pp_fade"> 										<a href="#" class="pp_expand" title="Expand the image">Expand</a> 										<div class="pp_hoverContainer"> 											<a class="pp_next" href="#">next</a> 											<a class="pp_previous" href="#">previous</a> 										</div> 										<div id="pp_full_res"></div> 										<div class="pp_details"> 											<div class="pp_nav"> 												<a href="#" class="pp_arrow_previous">Previous</a> 												<p class="currentTextHolder">0/0</p> 												<a href="#" class="pp_arrow_next">Next</a> 											</div> 											<p class="pp_description"></p> 											<div class="pp_social">{pp_social}</div> 											<a class="pp_close" href="#">Close</a> 										</div> 									</div> 								</div> 							</div> 							</div> 						</div> 						<div class="pp_bottom"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 					</div> 					<div class="pp_overlay"></div>',
                    gallery_markup: '<div class="pp_gallery"> 								<a href="#" class="pp_arrow_previous">Previous</a> 								<div> 									<ul> 										{gallery} 									</ul> 								</div> 								<a href="#" class="pp_arrow_next">Next</a> 							</div>',
                    image_markup: '<img id="fullResImage" src="{path}" />',
                    flash_markup:
                        '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
                    quicktime_markup:
                        '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="https://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="https://www.apple.com/quicktime/download/"></embed></object>',
                    iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
                    inline_markup: '<div class="pp_inline">{content}</div>',
                    custom_markup: "",
                },
                a
            );
            var f,
                v,
                y,
                w,
                b,
                k,
                P,
                x = this,
                $ = !1,
                I = e(window).height(),
                j = e(window).width();
            return (
                (doresize = !0),
                (scroll_pos = _()),
                e(window)
                    .unbind("resize.prettyphoto")
                    .bind("resize.prettyphoto", function () {
                        c(), g();
                    }),
                a.keyboard_shortcuts &&
                    e(document)
                        .unbind("keydown.prettyphoto")
                        .bind("keydown.prettyphoto", function (t) {
                            if ("undefined" != typeof $pp_pic_holder && $pp_pic_holder.is(":visible"))
                                switch (t.keyCode) {
                                    case 37:
                                        e.prettyPhoto.changePage("previous"), t.preventDefault();
                                        break;
                                    case 39:
                                        e.prettyPhoto.changePage("next"), t.preventDefault();
                                        break;
                                    case 27:
                                        settings.modal || e.prettyPhoto.close(), t.preventDefault();
                                }
                        }),
                (e.prettyPhoto.initialize = function () {
                    return (
                        (settings = a),
                        "pp_default" == settings.theme && (settings.horizontal_padding = 16),
                        (theRel = e(this).attr(settings.hook)),
                        (galleryRegExp = /\[(?:.*)\]/),
                        (isSet = galleryRegExp.exec(theRel) ? !0 : !1),
                        (pp_images = isSet
                            ? jQuery.map(x, function (t) {
                                  return -1 != e(t).attr(settings.hook).indexOf(theRel) ? e(t).attr("href") : void 0;
                              })
                            : e.makeArray(e(this).attr("href"))),
                        (pp_titles = isSet
                            ? jQuery.map(x, function (t) {
                                  return -1 != e(t).attr(settings.hook).indexOf(theRel) ? (e(t).find("img").attr("alt") ? e(t).find("img").attr("alt") : "") : void 0;
                              })
                            : e.makeArray(e(this).find("img").attr("alt"))),
                        (pp_descriptions = isSet
                            ? jQuery.map(x, function (t) {
                                  return -1 != e(t).attr(settings.hook).indexOf(theRel) ? (e(t).attr("title") ? e(t).attr("title") : "") : void 0;
                              })
                            : e.makeArray(e(this).attr("title"))),
                        pp_images.length > settings.overlay_gallery_max && (settings.overlay_gallery = !1),
                        (set_position = jQuery.inArray(e(this).attr("href"), pp_images)),
                        (rel_index = isSet ? set_position : e("a[" + settings.hook + "^='" + theRel + "']").index(e(this))),
                        u(this),
                        settings.allow_resize &&
                            e(window).bind("scroll.prettyphoto", function () {
                                c();
                            }),
                        e.prettyPhoto.open(),
                        !1
                    );
                }),
                (e.prettyPhoto.open = function (t) {
                    return (
                        "undefined" == typeof settings &&
                            ((settings = a),
                            (pp_images = e.makeArray(arguments[0])),
                            (pp_titles = e.makeArray(arguments[1] ? arguments[1] : "")),
                            (pp_descriptions = e.makeArray(arguments[2] ? arguments[2] : "")),
                            (isSet = pp_images.length > 1 ? !0 : !1),
                            (set_position = arguments[3] ? arguments[3] : 0),
                            u(t.target)),
                        settings.hideflash && e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility", "hidden"),
                        r(e(pp_images).size()),
                        e(".pp_loaderIcon").show(),
                        settings.deeplinking && i(),
                        settings.social_tools && ((facebook_like_link = settings.social_tools.replace("{location_href}", encodeURIComponent(location.href))), $pp_pic_holder.find(".pp_social").html(facebook_like_link)),
                        $ppt.is(":hidden") && $ppt.css("opacity", 0).show(),
                        $pp_overlay.show().fadeTo(settings.animation_speed, settings.opacity),
                        $pp_pic_holder.find(".currentTextHolder").text(set_position + 1 + settings.counter_separator_label + e(pp_images).size()),
                        "undefined" != typeof pp_descriptions[set_position] && "" != pp_descriptions[set_position]
                            ? $pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position]))
                            : $pp_pic_holder.find(".pp_description").hide(),
                        (movie_width = parseFloat(o("width", pp_images[set_position])) ? o("width", pp_images[set_position]) : settings.default_width.toString()),
                        (movie_height = parseFloat(o("height", pp_images[set_position])) ? o("height", pp_images[set_position]) : settings.default_height.toString()),
                        ($ = !1),
                        -1 != movie_height.indexOf("%") && ((movie_height = parseFloat((e(window).height() * parseFloat(movie_height)) / 100 - 150)), ($ = !0)),
                        -1 != movie_width.indexOf("%") && ((movie_width = parseFloat((e(window).width() * parseFloat(movie_width)) / 100 - 150)), ($ = !0)),
                        $pp_pic_holder.fadeIn(function () {
                            switch (
                                ($ppt.html(settings.show_title && "" != pp_titles[set_position] && "undefined" != typeof pp_titles[set_position] ? unescape(pp_titles[set_position]) : "&nbsp;"),
                                (imgPreloader = ""),
                                (skipInjection = !1),
                                h(pp_images[set_position]))
                            ) {
                                case "image":
                                    (imgPreloader = new Image()),
                                        (nextImage = new Image()),
                                        isSet && set_position < e(pp_images).size() - 1 && (nextImage.src = pp_images[set_position + 1]),
                                        (prevImage = new Image()),
                                        isSet && pp_images[set_position - 1] && (prevImage.src = pp_images[set_position - 1]),
                                        ($pp_pic_holder.find("#pp_full_res")[0].innerHTML = settings.image_markup.replace(/{path}/g, pp_images[set_position])),
                                        (imgPreloader.onload = function () {
                                            (f = l(imgPreloader.width, imgPreloader.height)), s();
                                        }),
                                        (imgPreloader.onerror = function () {
                                            alert("Image cannot be loaded. Make sure the path is correct and image exist."), e.prettyPhoto.close();
                                        }),
                                        (imgPreloader.src = pp_images[set_position]);
                                    break;
                                case "youtube":
                                    (f = l(movie_width, movie_height)),
                                        (movie_id = o("v", pp_images[set_position])),
                                        "" == movie_id &&
                                            ((movie_id = pp_images[set_position].split("youtu.be/")),
                                            (movie_id = movie_id[1]),
                                            movie_id.indexOf("?") > 0 && (movie_id = movie_id.substr(0, movie_id.indexOf("?"))),
                                            movie_id.indexOf("&") > 0 && (movie_id = movie_id.substr(0, movie_id.indexOf("&")))),
                                        (movie = "https://www.youtube.com/embed/" + movie_id),
                                        (movie += o("rel", pp_images[set_position]) ? "?rel=" + o("rel", pp_images[set_position]) : "?rel=1"),
                                        settings.autoplay && (movie += "&autoplay=1"),
                                        (toInject = settings.iframe_markup
                                            .replace(/{width}/g, f.width)
                                            .replace(/{height}/g, f.height)
                                            .replace(/{wmode}/g, settings.wmode)
                                            .replace(/{path}/g, movie));
                                    break;
                                case "vimeo":
                                    (f = l(movie_width, movie_height)), (movie_id = pp_images[set_position]);
                                    var t = /http(s?):\/\/(www\.)?vimeo.com\/(\d+)/,
                                        i = movie_id.match(t);
                                    (movie = "https://player.vimeo.com/video/" + i[3] + "?title=0&byline=0&portrait=0"),
                                        settings.autoplay && (movie += "&autoplay=1;"),
                                        (vimeo_width = f.width + "/embed/?moog_width=" + f.width),
                                        (toInject = settings.iframe_markup
                                            .replace(/{width}/g, vimeo_width)
                                            .replace(/{height}/g, f.height)
                                            .replace(/{path}/g, movie));
                                    break;
                                case "quicktime":
                                    (f = l(movie_width, movie_height)),
                                        (f.height += 15),
                                        (f.contentHeight += 15),
                                        (f.containerHeight += 15),
                                        (toInject = settings.quicktime_markup
                                            .replace(/{width}/g, f.width)
                                            .replace(/{height}/g, f.height)
                                            .replace(/{wmode}/g, settings.wmode)
                                            .replace(/{path}/g, pp_images[set_position])
                                            .replace(/{autoplay}/g, settings.autoplay));
                                    break;
                                case "flash":
                                    (f = l(movie_width, movie_height)),
                                        (flash_vars = pp_images[set_position]),
                                        (flash_vars = flash_vars.substring(pp_images[set_position].indexOf("flashvars") + 10, pp_images[set_position].length)),
                                        (filename = pp_images[set_position]),
                                        (filename = filename.substring(0, filename.indexOf("?"))),
                                        (toInject = settings.flash_markup
                                            .replace(/{width}/g, f.width)
                                            .replace(/{height}/g, f.height)
                                            .replace(/{wmode}/g, settings.wmode)
                                            .replace(/{path}/g, filename + "?" + flash_vars));
                                    break;
                                case "iframe":
                                    (f = l(movie_width, movie_height)),
                                        (frame_url = pp_images[set_position]),
                                        (frame_url = frame_url.substr(0, frame_url.indexOf("iframe") - 1)),
                                        (toInject = settings.iframe_markup
                                            .replace(/{width}/g, f.width)
                                            .replace(/{height}/g, f.height)
                                            .replace(/{path}/g, frame_url));
                                    break;
                                case "ajax":
                                    (doresize = !1),
                                        (f = l(movie_width, movie_height)),
                                        (doresize = !0),
                                        (skipInjection = !0),
                                        e.get(pp_images[set_position], function (e) {
                                            (toInject = settings.inline_markup.replace(/{content}/g, e)), ($pp_pic_holder.find("#pp_full_res")[0].innerHTML = toInject), s();
                                        });
                                    break;
                                case "custom":
                                    (f = l(movie_width, movie_height)), (toInject = settings.custom_markup);
                                    break;
                                case "inline":
                                    (myClone = e(pp_images[set_position])
                                        .clone()
                                        .append('<br clear="all" />')
                                        .css({ width: settings.default_width })
                                        .wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>')
                                        .appendTo(e("body"))
                                        .show()),
                                        (doresize = !1),
                                        (f = l(e(myClone).width(), e(myClone).height())),
                                        (doresize = !0),
                                        e(myClone).remove(),
                                        (toInject = settings.inline_markup.replace(/{content}/g, e(pp_images[set_position]).html()));
                            }
                            imgPreloader || skipInjection || (($pp_pic_holder.find("#pp_full_res")[0].innerHTML = toInject), s());
                        }),
                        !1
                    );
                }),
                (e.prettyPhoto.changePage = function (t) {
                    (currentGalleryPage = 0),
                        "previous" == t ? (set_position--, set_position < 0 && (set_position = e(pp_images).size() - 1)) : "next" == t ? (set_position++, set_position > e(pp_images).size() - 1 && (set_position = 0)) : (set_position = t),
                        (rel_index = set_position),
                        doresize || (doresize = !0),
                        settings.allow_expand && e(".pp_contract").removeClass("pp_contract").addClass("pp_expand"),
                        n(function () {
                            e.prettyPhoto.open();
                        });
                }),
                (e.prettyPhoto.changeGalleryPage = function (e) {
                    "next" == e
                        ? (currentGalleryPage++, currentGalleryPage > totalPage && (currentGalleryPage = 0))
                        : "previous" == e
                        ? (currentGalleryPage--, currentGalleryPage < 0 && (currentGalleryPage = totalPage))
                        : (currentGalleryPage = e),
                        (slide_speed = "next" == e || "previous" == e ? settings.animation_speed : 0),
                        (slide_to = currentGalleryPage * itemsPerPage * itemWidth),
                        $pp_gallery.find("ul").animate({ left: -slide_to }, slide_speed);
                }),
                (e.prettyPhoto.startSlideshow = function () {
                    "undefined" == typeof P
                        ? ($pp_pic_holder
                              .find(".pp_play")
                              .unbind("click")
                              .removeClass("pp_play")
                              .addClass("pp_pause")
                              .click(function () {
                                  return e.prettyPhoto.stopSlideshow(), !1;
                              }),
                          (P = setInterval(e.prettyPhoto.startSlideshow, settings.slideshow)))
                        : e.prettyPhoto.changePage("next");
                }),
                (e.prettyPhoto.stopSlideshow = function () {
                    $pp_pic_holder
                        .find(".pp_pause")
                        .unbind("click")
                        .removeClass("pp_pause")
                        .addClass("pp_play")
                        .click(function () {
                            return e.prettyPhoto.startSlideshow(), !1;
                        }),
                        clearInterval(P),
                        (P = void 0);
                }),
                (e.prettyPhoto.close = function () {
                    $pp_overlay.is(":animated") ||
                        (e.prettyPhoto.stopSlideshow(),
                        $pp_pic_holder.stop().find("object,embed").css("visibility", "hidden"),
                        e("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed, function () {
                            e(this).remove();
                        }),
                        $pp_overlay.fadeOut(settings.animation_speed, function () {
                            settings.hideflash && e("object,embed,iframe[src*=youtube],iframe[src*=vimeo]").css("visibility", "visible"),
                                e(this).remove(),
                                e(window).unbind("scroll.prettyphoto"),
                                p(),
                                settings.callback(),
                                (doresize = !0),
                                (v = !1),
                                delete settings;
                        }));
                }),
                !pp_alreadyInitialized &&
                    t() &&
                    ((pp_alreadyInitialized = !0),
                    (hashIndex = t()),
                    (hashRel = hashIndex),
                    (hashIndex = hashIndex.substring(hashIndex.indexOf("/") + 1, hashIndex.length - 1)),
                    (hashRel = hashRel.substring(0, hashRel.indexOf("/"))),
                    setTimeout(function () {
                        e("a[" + a.hook + "^='" + hashRel + "']:eq(" + hashIndex + ")").trigger("click");
                    }, 50)),
                this.unbind("click.prettyphoto").bind("click.prettyphoto", e.prettyPhoto.initialize)
            );
        });
})(jQuery);
var pp_alreadyInitialized = !1;
// source --> https://dmlegalservices.in/wp-content/themes/skt-legalexpert-pro/assets/js/owl.carousel.js?ver=1 
/**
 * Owl carousel
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 * @todo Lazy Load Icon
 * @todo prevent animationend bubling
 * @todo itemsScaleUp
 * @todo Test Zepto
 * @todo stagePadding calculate wrong active classes
 */
;(function($, window, document, undefined) {

	var drag, state, e;

	/**
	 * Template for status information about drag and touch events.
	 * @private
	 */
	drag = {
		start: 0,
		startX: 0,
		startY: 0,
		current: 0,
		currentX: 0,
		currentY: 0,
		offsetX: 0,
		offsetY: 0,
		distance: null,
		startTime: 0,
		endTime: 0,
		updatedX: 0,
		targetEl: null
	};

	/**
	 * Template for some status informations.
	 * @private
	 */
	state = {
		isTouch: false,
		isScrolling: false,
		isSwiping: false,
		direction: false,
		inMotion: false
	};

	/**
	 * Event functions references.
	 * @private
	 */
	e = {
		_onDragStart: null,
		_onDragMove: null,
		_onDragEnd: null,
		_transitionEnd: null,
		_resizer: null,
		_responsiveCall: null,
		_goToLoop: null,
		_checkVisibile: null
	};

	/**
	 * Creates a carousel.
	 * @class The Owl Carousel.
	 * @public
	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
	 * @param {Object} [options] - The options
	 */
	function Owl(element, options) {

		/**
		 * Current settings for the carousel.
		 * @public
		 */
		this.settings = null;

		/**
		 * Current options set by the caller including defaults.
		 * @public
		 */
		this.options = $.extend({}, Owl.Defaults, options);

		/**
		 * Plugin element.
		 * @public
		 */
		this.$element = $(element);

		/**
		 * Caches informations about drag and touch events.
		 */
		this.drag = $.extend({}, drag);

		/**
		 * Caches some status informations.
		 * @protected
		 */
		this.state = $.extend({}, state);

		/**
		 * @protected
		 * @todo Must be documented
		 */
		this.e = $.extend({}, e);

		/**
		 * References to the running plugins of this carousel.
		 * @protected
		 */
		this._plugins = {};

		/**
		 * Currently suppressed events to prevent them from beeing retriggered.
		 * @protected
		 */
		this._supress = {};

		/**
		 * Absolute current position.
		 * @protected
		 */
		this._current = null;

		/**
		 * Animation speed in milliseconds.
		 * @protected
		 */
		this._speed = null;

		/**
		 * Coordinates of all items in pixel.
		 * @todo The name of this member is missleading.
		 * @protected
		 */
		this._coordinates = [];

		/**
		 * Current breakpoint.
		 * @todo Real media queries would be nice.
		 * @protected
		 */
		this._breakpoint = null;

		/**
		 * Current width of the plugin element.
		 */
		this._width = null;

		/**
		 * All real items.
		 * @protected
		 */
		this._items = [];

		/**
		 * All cloned items.
		 * @protected
		 */
		this._clones = [];

		/**
		 * Merge values of all items.
		 * @todo Maybe this could be part of a plugin.
		 * @protected
		 */
		this._mergers = [];

		/**
		 * Invalidated parts within the update process.
		 * @protected
		 */
		this._invalidated = {};

		/**
		 * Ordered list of workers for the update process.
		 * @protected
		 */
		this._pipe = [];

		$.each(Owl.Plugins, $.proxy(function(key, plugin) {
			this._plugins[key[0].toLowerCase() + key.slice(1)]
				= new plugin(this);
		}, this));

		$.each(Owl.Pipe, $.proxy(function(priority, worker) {
			this._pipe.push({
				'filter': worker.filter,
				'run': $.proxy(worker.run, this)
			});
		}, this));

		this.setup();
		this.initialize();
	}

	/**
	 * Default options for the carousel.
	 * @public
	 */
	Owl.Defaults = {
		items: 3,
		loop: false,
		center: false,

		mouseDrag: true,
		touchDrag: true,
		pullDrag: true,
		freeDrag: false,

		margin: 0,
		stagePadding: 0,

		merge: false,
		mergeFit: true,
		autoWidth: false,

		startPosition: 0,
		rtl: false,

		smartSpeed: 250,
		fluidSpeed: false,
		dragEndSpeed: false,

		responsive: {},
		responsiveRefreshRate: 200,
		responsiveBaseElement: window,
		responsiveClass: false,

		fallbackEasing: 'swing',

		info: false,

		nestedItemSelector: false,
		itemElement: 'div',
		stageElement: 'div',

		// Classes and Names
		themeClass: 'owl-theme',
		baseClass: 'owl-carousel',
		itemClass: 'owl-item',
		centerClass: 'center',
		activeClass: 'active'
	};

	/**
	 * Enumeration for width.
	 * @public
	 * @readonly
	 * @enum {String}
	 */
	Owl.Width = {
		Default: 'default',
		Inner: 'inner',
		Outer: 'outer'
	};

	/**
	 * Contains all registered plugins.
	 * @public
	 */
	Owl.Plugins = {};

	/**
	 * Update pipe.
	 */
	Owl.Pipe = [ {
		filter: [ 'width', 'items', 'settings' ],
		run: function(cache) {
			cache.current = this._items && this._items[this.relative(this._current)];
		}
	}, {
		filter: [ 'items', 'settings' ],
		run: function() {
			var cached = this._clones,
				clones = this.$stage.children('.cloned');

			if (clones.length !== cached.length || (!this.settings.loop && cached.length > 0)) {
				this.$stage.children('.cloned').remove();
				this._clones = [];
			}
		}
	}, {
		filter: [ 'items', 'settings' ],
		run: function() {
			var i, n,
				clones = this._clones,
				items = this._items,
				delta = this.settings.loop ? clones.length - Math.max(this.settings.items * 2, 4) : 0;

			for (i = 0, n = Math.abs(delta / 2); i < n; i++) {
				if (delta > 0) {
					this.$stage.children().eq(items.length + clones.length - 1).remove();
					clones.pop();
					this.$stage.children().eq(0).remove();
					clones.pop();
				} else {
					clones.push(clones.length / 2);
					this.$stage.append(items[clones[clones.length - 1]].clone().addClass('cloned'));
					clones.push(items.length - 1 - (clones.length - 1) / 2);
					this.$stage.prepend(items[clones[clones.length - 1]].clone().addClass('cloned'));
				}
			}
		}
	}, {
		filter: [ 'width', 'items', 'settings' ],
		run: function() {
			var rtl = (this.settings.rtl ? 1 : -1),
				width = (this.width() / this.settings.items).toFixed(3),
				coordinate = 0, merge, i, n;

			this._coordinates = [];
			for (i = 0, n = this._clones.length + this._items.length; i < n; i++) {
				merge = this._mergers[this.relative(i)];
				merge = (this.settings.mergeFit && Math.min(merge, this.settings.items)) || merge;
				coordinate += (this.settings.autoWidth ? this._items[this.relative(i)].width() + this.settings.margin : width * merge) * rtl;

				this._coordinates.push(coordinate);
			}
		}
	}, {
		filter: [ 'width', 'items', 'settings' ],
		run: function() {
			var i, n, width = (this.width() / this.settings.items).toFixed(3), css = {
				'width': Math.abs(this._coordinates[this._coordinates.length - 1]) + this.settings.stagePadding * 2,
				'padding-left': this.settings.stagePadding || '',
				'padding-right': this.settings.stagePadding || ''
			};

			this.$stage.css(css);

			css = { 'width': this.settings.autoWidth ? 'auto' : width - this.settings.margin };
			css[this.settings.rtl ? 'margin-left' : 'margin-right'] = this.settings.margin;

			if (!this.settings.autoWidth && $.grep(this._mergers, function(v) { return v > 1 }).length > 0) {
				for (i = 0, n = this._coordinates.length; i < n; i++) {
					css.width = Math.abs(this._coordinates[i]) - Math.abs(this._coordinates[i - 1] || 0) - this.settings.margin;
					this.$stage.children().eq(i).css(css);
				}
			} else {
				this.$stage.children().css(css);
			}
		}
	}, {
		filter: [ 'width', 'items', 'settings' ],
		run: function(cache) {
			cache.current && this.reset(this.$stage.children().index(cache.current));
		}
	}, {
		filter: [ 'position' ],
		run: function() {
			this.animate(this.coordinates(this._current));
		}
	}, {
		filter: [ 'width', 'position', 'items', 'settings' ],
		run: function() {
			var rtl = this.settings.rtl ? 1 : -1,
				padding = this.settings.stagePadding * 2,
				begin = this.coordinates(this.current()) + padding,
				end = begin + this.width() * rtl,
				inner, outer, matches = [], i, n;

			for (i = 0, n = this._coordinates.length; i < n; i++) {
				inner = this._coordinates[i - 1] || 0;
				outer = Math.abs(this._coordinates[i]) + padding * rtl;

				if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
					|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
					matches.push(i);
				}
			}

			this.$stage.children('.' + this.settings.activeClass).removeClass(this.settings.activeClass);
			this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass(this.settings.activeClass);

			if (this.settings.center) {
				this.$stage.children('.' + this.settings.centerClass).removeClass(this.settings.centerClass);
				this.$stage.children().eq(this.current()).addClass(this.settings.centerClass);
			}
		}
	} ];

	/**
	 * Initializes the carousel.
	 * @protected
	 */
	Owl.prototype.initialize = function() {
		this.trigger('initialize');

		this.$element
			.addClass(this.settings.baseClass)
			.addClass(this.settings.themeClass)
			.toggleClass('owl-rtl', this.settings.rtl);

		// check support
		this.browserSupport();

		if (this.settings.autoWidth && this.state.imagesLoaded !== true) {
			var imgs, nestedSelector, width;
			imgs = this.$element.find('img');
			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
			width = this.$element.children(nestedSelector).width();

			if (imgs.length && width <= 0) {
				this.preloadAutoWidthImages(imgs);
				return false;
			}
		}

		this.$element.addClass('owl-loading');

		// create stage
		this.$stage = $('<' + this.settings.stageElement + ' class="owl-stage"/>')
			.wrap('<div class="owl-stage-outer">');

		// append stage
		this.$element.append(this.$stage.parent());

		// append content
		this.replace(this.$element.children().not(this.$stage.parent()));

		// set view width
		this._width = this.$element.width();

		// update view
		this.refresh();

		this.$element.removeClass('owl-loading').addClass('owl-loaded');

		// attach generic events
		this.eventsCall();

		// attach generic events
		this.internalEvents();

		// attach custom control events
		this.addTriggerableEvents();

		this.trigger('initialized');
	};

	/**
	 * Setups the current settings.
	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
	 * @todo Support for media queries by using `matchMedia` would be nice.
	 * @public
	 */
	Owl.prototype.setup = function() {
		var viewport = this.viewport(),
			overwrites = this.options.responsive,
			match = -1,
			settings = null;

		if (!overwrites) {
			settings = $.extend({}, this.options);
		} else {
			$.each(overwrites, function(breakpoint) {
				if (breakpoint <= viewport && breakpoint > match) {
					match = Number(breakpoint);
				}
			});

			settings = $.extend({}, this.options, overwrites[match]);
			delete settings.responsive;

			// responsive class
			if (settings.responsiveClass) {
				this.$element.attr('class', function(i, c) {
					return c.replace(/\b owl-responsive-\S+/g, '');
				}).addClass('owl-responsive-' + match);
			}
		}

		if (this.settings === null || this._breakpoint !== match) {
			this.trigger('change', { property: { name: 'settings', value: settings } });
			this._breakpoint = match;
			this.settings = settings;
			this.invalidate('settings');
			this.trigger('changed', { property: { name: 'settings', value: this.settings } });
		}
	};

	/**
	 * Updates option logic if necessery.
	 * @protected
	 */
	Owl.prototype.optionsLogic = function() {
		// Toggle Center class
		this.$element.toggleClass('owl-center', this.settings.center);

		// if items number is less than in body
		if (this.settings.loop && this._items.length < this.settings.items) {
			this.settings.loop = false;
		}

		if (this.settings.autoWidth) {
			this.settings.stagePadding = false;
			this.settings.merge = false;
		}
	};

	/**
	 * Prepares an item before add.
	 * @todo Rename event parameter `content` to `item`.
	 * @protected
	 * @returns {jQuery|HTMLElement} - The item container.
	 */
	Owl.prototype.prepare = function(item) {
		var event = this.trigger('prepare', { content: item });

		if (!event.data) {
			event.data = $('<' + this.settings.itemElement + '/>')
				.addClass(this.settings.itemClass).append(item)
		}

		this.trigger('prepared', { content: event.data });

		return event.data;
	};

	/**
	 * Updates the view.
	 * @public
	 */
	Owl.prototype.update = function() {
		var i = 0,
			n = this._pipe.length,
			filter = $.proxy(function(p) { return this[p] }, this._invalidated),
			cache = {};

		while (i < n) {
			if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
				this._pipe[i].run(cache);
			}
			i++;
		}

		this._invalidated = {};
	};

	/**
	 * Gets the width of the view.
	 * @public
	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
	 * @returns {Number} - The width of the view in pixel.
	 */
	Owl.prototype.width = function(dimension) {
		dimension = dimension || Owl.Width.Default;
		switch (dimension) {
			case Owl.Width.Inner:
			case Owl.Width.Outer:
				return this._width;
			default:
				return this._width - this.settings.stagePadding * 2 + this.settings.margin;
		}
	};

	/**
	 * Refreshes the carousel primarily for adaptive purposes.
	 * @public
	 */
	Owl.prototype.refresh = function() {
		if (this._items.length === 0) {
			return false;
		}

		var start = new Date().getTime();

		this.trigger('refresh');

		this.setup();

		this.optionsLogic();

		// hide and show methods helps here to set a proper widths,
		// this prevents scrollbar to be calculated in stage width
		this.$stage.addClass('owl-refresh');

		this.update();

		this.$stage.removeClass('owl-refresh');

		this.state.orientation = window.orientation;

		this.watchVisibility();

		this.trigger('refreshed');
	};

	/**
	 * Save internal event references and add event based functions.
	 * @protected
	 */
	Owl.prototype.eventsCall = function() {
		// Save events references
		this.e._onDragStart = $.proxy(function(e) {
			this.onDragStart(e);
		}, this);
		this.e._onDragMove = $.proxy(function(e) {
			this.onDragMove(e);
		}, this);
		this.e._onDragEnd = $.proxy(function(e) {
			this.onDragEnd(e);
		}, this);
		this.e._onResize = $.proxy(function(e) {
			this.onResize(e);
		}, this);
		this.e._transitionEnd = $.proxy(function(e) {
			this.transitionEnd(e);
		}, this);
		this.e._preventClick = $.proxy(function(e) {
			this.preventClick(e);
		}, this);
	};

	/**
	 * Checks window `resize` event.
	 * @protected
	 */
	Owl.prototype.onThrottledResize = function() {
		window.clearTimeout(this.resizeTimer);
		this.resizeTimer = window.setTimeout(this.e._onResize, this.settings.responsiveRefreshRate);
	};

	/**
	 * Checks window `resize` event.
	 * @protected
	 */
	Owl.prototype.onResize = function() {
		if (!this._items.length) {
			return false;
		}

		if (this._width === this.$element.width()) {
			return false;
		}

		if (this.trigger('resize').isDefaultPrevented()) {
			return false;
		}

		this._width = this.$element.width();

		this.invalidate('width');

		this.refresh();

		this.trigger('resized');
	};

	/**
	 * Checks for touch/mouse drag event type and add run event handlers.
	 * @protected
	 */
	Owl.prototype.eventsRouter = function(event) {
		var type = event.type;

		if (type === "mousedown" || type === "touchstart") {
			this.onDragStart(event);
		} else if (type === "mousemove" || type === "touchmove") {
			this.onDragMove(event);
		} else if (type === "mouseup" || type === "touchend") {
			this.onDragEnd(event);
		} else if (type === "touchcancel") {
			this.onDragEnd(event);
		}
	};

	/**
	 * Checks for touch/mouse drag options and add necessery event handlers.
	 * @protected
	 */
	Owl.prototype.internalEvents = function() {
		var isTouch = isTouchSupport(),
			isTouchIE = isTouchSupportIE();

		if (this.settings.mouseDrag){
			this.$stage.on('mousedown', $.proxy(function(event) { this.eventsRouter(event) }, this));
			this.$stage.on('dragstart', function() { return false });
			this.$stage.get(0).onselectstart = function() { return false };
		} else {
			this.$element.addClass('owl-text-select-on');
		}

		if (this.settings.touchDrag && !isTouchIE){
			this.$stage.on('touchstart touchcancel', $.proxy(function(event) { this.eventsRouter(event) }, this));
		}

		// catch transitionEnd event
		if (this.transitionEndVendor) {
			this.on(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd, false);
		}

		// responsive
		if (this.settings.responsive !== false) {
			this.on(window, 'resize', $.proxy(this.onThrottledResize, this));
		}
	};

	/**
	 * Handles touchstart/mousedown event.
	 * @protected
	 * @param {Event} event - The event arguments.
	 */
	Owl.prototype.onDragStart = function(event) {
		var ev, isTouchEvent, pageX, pageY, animatedPos;

		ev = event.originalEvent || event || window.event;

		// prevent right click
		if (ev.which === 3 || this.state.isTouch) {
			return false;
		}

		if (ev.type === 'mousedown') {
			this.$stage.addClass('owl-grab');
		}

		this.trigger('drag');
		this.drag.startTime = new Date().getTime();
		this.speed(0);
		this.state.isTouch = true;
		this.state.isScrolling = false;
		this.state.isSwiping = false;
		this.drag.distance = 0;

		pageX = getTouches(ev).x;
		pageY = getTouches(ev).y;

		// get stage position left
		this.drag.offsetX = this.$stage.position().left;
		this.drag.offsetY = this.$stage.position().top;

		if (this.settings.rtl) {
			this.drag.offsetX = this.$stage.position().left + this.$stage.width() - this.width()
				+ this.settings.margin;
		}

		// catch position // ie to fix
		if (this.state.inMotion && this.support3d) {
			animatedPos = this.getTransformProperty();
			this.drag.offsetX = animatedPos;
			this.animate(animatedPos);
			this.state.inMotion = true;
		} else if (this.state.inMotion && !this.support3d) {
			this.state.inMotion = false;
			return false;
		}

		this.drag.startX = pageX - this.drag.offsetX;
		this.drag.startY = pageY - this.drag.offsetY;

		this.drag.start = pageX - this.drag.startX;
		this.drag.targetEl = ev.target || ev.srcElement;
		this.drag.updatedX = this.drag.start;

		// to do/check
		// prevent links and images dragging;
		if (this.drag.targetEl.tagName === "IMG" || this.drag.targetEl.tagName === "A") {
			this.drag.targetEl.draggable = false;
		}

		$(document).on('mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents', $.proxy(function(event) {this.eventsRouter(event)},this));
	};

	/**
	 * Handles the touchmove/mousemove events.
	 * @todo Simplify
	 * @protected
	 * @param {Event} event - The event arguments.
	 */
	Owl.prototype.onDragMove = function(event) {
		var ev, isTouchEvent, pageX, pageY, minValue, maxValue, pull;

		if (!this.state.isTouch) {
			return;
		}

		if (this.state.isScrolling) {
			return;
		}

		ev = event.originalEvent || event || window.event;

		pageX = getTouches(ev).x;
		pageY = getTouches(ev).y;

		// Drag Direction
		this.drag.currentX = pageX - this.drag.startX;
		this.drag.currentY = pageY - this.drag.startY;
		this.drag.distance = this.drag.currentX - this.drag.offsetX;

		// Check move direction
		if (this.drag.distance < 0) {
			this.state.direction = this.settings.rtl ? 'right' : 'left';
		} else if (this.drag.distance > 0) {
			this.state.direction = this.settings.rtl ? 'left' : 'right';
		}
		// Loop
		if (this.settings.loop) {
			if (this.op(this.drag.currentX, '>', this.coordinates(this.minimum())) && this.state.direction === 'right') {
				this.drag.currentX -= (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
			} else if (this.op(this.drag.currentX, '<', this.coordinates(this.maximum())) && this.state.direction === 'left') {
				this.drag.currentX += (this.settings.center && this.coordinates(0)) - this.coordinates(this._items.length);
			}
		} else {
			// pull
			minValue = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
			maxValue = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
			pull = this.settings.pullDrag ? this.drag.distance / 5 : 0;
			this.drag.currentX = Math.max(Math.min(this.drag.currentX, minValue + pull), maxValue + pull);
		}

		// Lock browser if swiping horizontal

		if ((this.drag.distance > 8 || this.drag.distance < -8)) {
			if (ev.preventDefault !== undefined) {
				ev.preventDefault();
			} else {
				ev.returnValue = false;
			}
			this.state.isSwiping = true;
		}

		this.drag.updatedX = this.drag.currentX;

		// Lock Owl if scrolling
		if ((this.drag.currentY > 16 || this.drag.currentY < -16) && this.state.isSwiping === false) {
			this.state.isScrolling = true;
			this.drag.updatedX = this.drag.start;
		}

		this.animate(this.drag.updatedX);
	};

	/**
	 * Handles the touchend/mouseup events.
	 * @protected
	 */
	Owl.prototype.onDragEnd = function(event) {
		var compareTimes, distanceAbs, closest;

		if (!this.state.isTouch) {
			return;
		}

		if (event.type === 'mouseup') {
			this.$stage.removeClass('owl-grab');
		}

		this.trigger('dragged');

		// prevent links and images dragging;
		this.drag.targetEl.removeAttribute("draggable");

		// remove drag event listeners

		this.state.isTouch = false;
		this.state.isScrolling = false;
		this.state.isSwiping = false;

		// to check
		if (this.drag.distance === 0 && this.state.inMotion !== true) {
			this.state.inMotion = false;
			return false;
		}

		// prevent clicks while scrolling

		this.drag.endTime = new Date().getTime();
		compareTimes = this.drag.endTime - this.drag.startTime;
		distanceAbs = Math.abs(this.drag.distance);

		// to test
		if (distanceAbs > 3 || compareTimes > 300) {
			this.removeClick(this.drag.targetEl);
		}

		closest = this.closest(this.drag.updatedX);

		this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
		this.current(closest);
		this.invalidate('position');
		this.update();

		// if pullDrag is off then fire transitionEnd event manually when stick
		// to border
		if (!this.settings.pullDrag && this.drag.updatedX === this.coordinates(closest)) {
			this.transitionEnd();
		}

		this.drag.distance = 0;

		$(document).off('.owl.dragEvents');
	};

	/**
	 * Attaches `preventClick` to disable link while swipping.
	 * @protected
	 * @param {HTMLElement} [target] - The target of the `click` event.
	 */
	Owl.prototype.removeClick = function(target) {
		this.drag.targetEl = target;
		$(target).on('click.preventClick', this.e._preventClick);
		// to make sure click is removed:
		window.setTimeout(function() {
			$(target).off('click.preventClick');
		}, 300);
	};

	/**
	 * Suppresses click event.
	 * @protected
	 * @param {Event} ev - The event arguments.
	 */
	Owl.prototype.preventClick = function(ev) {
		if (ev.preventDefault) {
			ev.preventDefault();
		} else {
			ev.returnValue = false;
		}
		if (ev.stopPropagation) {
			ev.stopPropagation();
		}
		$(ev.target).off('click.preventClick');
	};

	/**
	 * Catches stage position while animate (only CSS3).
	 * @protected
	 * @returns
	 */
	Owl.prototype.getTransformProperty = function() {
		var transform, matrix3d;

		transform = window.getComputedStyle(this.$stage.get(0), null).getPropertyValue(this.vendorName + 'transform');
		// var transform = this.$stage.css(this.vendorName + 'transform')
		transform = transform.replace(/matrix(3d)?\(|\)/g, '').split(',');
		matrix3d = transform.length === 16;

		return matrix3d !== true ? transform[4] : transform[12];
	};

	/**
	 * Gets absolute position of the closest item for a coordinate.
	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
	 * @protected
	 * @param {Number} coordinate - The coordinate in pixel.
	 * @return {Number} - The absolute position of the closest item.
	 */
	Owl.prototype.closest = function(coordinate) {
		var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates();

		if (!this.settings.freeDrag) {
			// check closest item
			$.each(coordinates, $.proxy(function(index, value) {
				if (coordinate > value - pull && coordinate < value + pull) {
					position = index;
				} else if (this.op(coordinate, '<', value)
					&& this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
					position = this.state.direction === 'left' ? index + 1 : index;
				}
				return position === -1;
			}, this));
		}

		if (!this.settings.loop) {
			// non loop boundries
			if (this.op(coordinate, '>', coordinates[this.minimum()])) {
				position = coordinate = this.minimum();
			} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
				position = coordinate = this.maximum();
			}
		}

		return position;
	};

	/**
	 * Animates the stage.
	 * @public
	 * @param {Number} coordinate - The coordinate in pixels.
	 */
	Owl.prototype.animate = function(coordinate) {
		this.trigger('translate');
		this.state.inMotion = this.speed() > 0;

		if (this.support3d) {
			this.$stage.css({
				transform: 'translate3d(' + coordinate + 'px' + ',0px, 0px)',
				transition: (this.speed() / 1000) + 's'
			});
		} else if (this.state.isTouch) {
			this.$stage.css({
				left: coordinate + 'px'
			});
		} else {
			this.$stage.animate({
				left: coordinate
			}, this.speed() / 1000, this.settings.fallbackEasing, $.proxy(function() {
				if (this.state.inMotion) {
					this.transitionEnd();
				}
			}, this));
		}
	};

	/**
	 * Sets the absolute position of the current item.
	 * @public
	 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
	 * @returns {Number} - The absolute position of the current item.
	 */
	Owl.prototype.current = function(position) {
		if (position === undefined) {
			return this._current;
		}

		if (this._items.length === 0) {
			return undefined;
		}

		position = this.normalize(position);

		if (this._current !== position) {
			var event = this.trigger('change', { property: { name: 'position', value: position } });

			if (event.data !== undefined) {
				position = this.normalize(event.data);
			}

			this._current = position;

			this.invalidate('position');

			this.trigger('changed', { property: { name: 'position', value: this._current } });
		}

		return this._current;
	};

	/**
	 * Invalidates the given part of the update routine.
	 * @param {String} part - The part to invalidate.
	 */
	Owl.prototype.invalidate = function(part) {
		this._invalidated[part] = true;
	}

	/**
	 * Resets the absolute position of the current item.
	 * @public
	 * @param {Number} position - The absolute position of the new item.
	 */
	Owl.prototype.reset = function(position) {
		position = this.normalize(position);

		if (position === undefined) {
			return;
		}

		this._speed = 0;
		this._current = position;

		this.suppress([ 'translate', 'translated' ]);

		this.animate(this.coordinates(position));

		this.release([ 'translate', 'translated' ]);
	};

	/**
	 * Normalizes an absolute or a relative position for an item.
	 * @public
	 * @param {Number} position - The absolute or relative position to normalize.
	 * @param {Boolean} [relative=false] - Whether the given position is relative or not.
	 * @returns {Number} - The normalized position.
	 */
	Owl.prototype.normalize = function(position, relative) {
		var n = (relative ? this._items.length : this._items.length + this._clones.length);

		if (!$.isNumeric(position) || n < 1) {
			return undefined;
		}

		if (this._clones.length) {
			position = ((position % n) + n) % n;
		} else {
			position = Math.max(this.minimum(relative), Math.min(this.maximum(relative), position));
		}

		return position;
	};

	/**
	 * Converts an absolute position for an item into a relative position.
	 * @public
	 * @param {Number} position - The absolute position to convert.
	 * @returns {Number} - The converted position.
	 */
	Owl.prototype.relative = function(position) {
		position = this.normalize(position);
		position = position - this._clones.length / 2;
		return this.normalize(position, true);
	};

	/**
	 * Gets the maximum position for an item.
	 * @public
	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
	 * @returns {Number}
	 */
	Owl.prototype.maximum = function(relative) {
		var maximum, width, i = 0, coordinate,
			settings = this.settings;

		if (relative) {
			return this._items.length - 1;
		}

		if (!settings.loop && settings.center) {
			maximum = this._items.length - 1;
		} else if (!settings.loop && !settings.center) {
			maximum = this._items.length - settings.items;
		} else if (settings.loop || settings.center) {
			maximum = this._items.length + settings.items;
		} else if (settings.autoWidth || settings.merge) {
			revert = settings.rtl ? 1 : -1;
			width = this.$stage.width() - this.$element.width();
			while (coordinate = this.coordinates(i)) {
				if (coordinate * revert >= width) {
					break;
				}
				maximum = ++i;
			}
		} else {
			throw 'Can not detect maximum absolute position.'
		}

		return maximum;
	};

	/**
	 * Gets the minimum position for an item.
	 * @public
	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
	 * @returns {Number}
	 */
	Owl.prototype.minimum = function(relative) {
		if (relative) {
			return 0;
		}

		return this._clones.length / 2;
	};

	/**
	 * Gets an item at the specified relative position.
	 * @public
	 * @param {Number} [position] - The relative position of the item.
	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
	 */
	Owl.prototype.items = function(position) {
		if (position === undefined) {
			return this._items.slice();
		}

		position = this.normalize(position, true);
		return this._items[position];
	};

	/**
	 * Gets an item at the specified relative position.
	 * @public
	 * @param {Number} [position] - The relative position of the item.
	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
	 */
	Owl.prototype.mergers = function(position) {
		if (position === undefined) {
			return this._mergers.slice();
		}

		position = this.normalize(position, true);
		return this._mergers[position];
	};

	/**
	 * Gets the absolute positions of clones for an item.
	 * @public
	 * @param {Number} [position] - The relative position of the item.
	 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
	 */
	Owl.prototype.clones = function(position) {
		var odd = this._clones.length / 2,
			even = odd + this._items.length,
			map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };

		if (position === undefined) {
			return $.map(this._clones, function(v, i) { return map(i) });
		}

		return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
	};

	/**
	 * Sets the current animation speed.
	 * @public
	 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
	 * @returns {Number} - The current animation speed in milliseconds.
	 */
	Owl.prototype.speed = function(speed) {
		if (speed !== undefined) {
			this._speed = speed;
		}

		return this._speed;
	};

	/**
	 * Gets the coordinate of an item.
	 * @todo The name of this method is missleanding.
	 * @public
	 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
	 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
	 */
	Owl.prototype.coordinates = function(position) {
		var coordinate = null;

		if (position === undefined) {
			return $.map(this._coordinates, $.proxy(function(coordinate, index) {
				return this.coordinates(index);
			}, this));
		}

		if (this.settings.center) {
			coordinate = this._coordinates[position];
			coordinate += (this.width() - coordinate + (this._coordinates[position - 1] || 0)) / 2 * (this.settings.rtl ? -1 : 1);
		} else {
			coordinate = this._coordinates[position - 1] || 0;
		}

		return coordinate;
	};

	/**
	 * Calculates the speed for a translation.
	 * @protected
	 * @param {Number} from - The absolute position of the start item.
	 * @param {Number} to - The absolute position of the target item.
	 * @param {Number} [factor=undefined] - The time factor in milliseconds.
	 * @returns {Number} - The time in milliseconds for the translation.
	 */
	Owl.prototype.duration = function(from, to, factor) {
		return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
	};

	/**
	 * Slides to the specified item.
	 * @public
	 * @param {Number} position - The position of the item.
	 * @param {Number} [speed] - The time in milliseconds for the transition.
	 */
	Owl.prototype.to = function(position, speed) {
		if (this.settings.loop) {
			var distance = position - this.relative(this.current()),
				revert = this.current(),
				before = this.current(),
				after = this.current() + distance,
				direction = before - after < 0 ? true : false,
				items = this._clones.length + this._items.length;

			if (after < this.settings.items && direction === false) {
				revert = before + this._items.length;
				this.reset(revert);
			} else if (after >= items - this.settings.items && direction === true) {
				revert = before - this._items.length;
				this.reset(revert);
			}
			window.clearTimeout(this.e._goToLoop);
			this.e._goToLoop = window.setTimeout($.proxy(function() {
				this.speed(this.duration(this.current(), revert + distance, speed));
				this.current(revert + distance);
				this.update();
			}, this), 30);
		} else {
			this.speed(this.duration(this.current(), position, speed));
			this.current(position);
			this.update();
		}
	};

	/**
	 * Slides to the next item.
	 * @public
	 * @param {Number} [speed] - The time in milliseconds for the transition.
	 */
	Owl.prototype.next = function(speed) {
		speed = speed || false;
		this.to(this.relative(this.current()) + 1, speed);
	};

	/**
	 * Slides to the previous item.
	 * @public
	 * @param {Number} [speed] - The time in milliseconds for the transition.
	 */
	Owl.prototype.prev = function(speed) {
		speed = speed || false;
		this.to(this.relative(this.current()) - 1, speed);
	};

	/**
	 * Handles the end of an animation.
	 * @protected
	 * @param {Event} event - The event arguments.
	 */
	Owl.prototype.transitionEnd = function(event) {

		// if css2 animation then event object is undefined
		if (event !== undefined) {
			event.stopPropagation();

			// Catch only owl-stage transitionEnd event
			if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
				return false;
			}
		}

		this.state.inMotion = false;
		this.trigger('translated');
	};

	/**
	 * Gets viewport width.
	 * @protected
	 * @return {Number} - The width in pixel.
	 */
	Owl.prototype.viewport = function() {
		var width;
		if (this.options.responsiveBaseElement !== window) {
			width = $(this.options.responsiveBaseElement).width();
		} else if (window.innerWidth) {
			width = window.innerWidth;
		} else if (document.documentElement && document.documentElement.clientWidth) {
			width = document.documentElement.clientWidth;
		} else {
			throw 'Can not detect viewport width.';
		}
		return width;
	};

	/**
	 * Replaces the current content.
	 * @public
	 * @param {HTMLElement|jQuery|String} content - The new content.
	 */
	Owl.prototype.replace = function(content) {
		this.$stage.empty();
		this._items = [];

		if (content) {
			content = (content instanceof jQuery) ? content : $(content);
		}

		if (this.settings.nestedItemSelector) {
			content = content.find('.' + this.settings.nestedItemSelector);
		}

		content.filter(function() {
			return this.nodeType === 1;
		}).each($.proxy(function(index, item) {
			item = this.prepare(item);
			this.$stage.append(item);
			this._items.push(item);
			this._mergers.push(item.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
		}, this));

		this.reset($.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);

		this.invalidate('items');
	};

	/**
	 * Adds an item.
	 * @todo Use `item` instead of `content` for the event arguments.
	 * @public
	 * @param {HTMLElement|jQuery|String} content - The item content to add.
	 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
	 */
	Owl.prototype.add = function(content, position) {
		position = position === undefined ? this._items.length : this.normalize(position, true);

		this.trigger('add', { content: content, position: position });

		if (this._items.length === 0 || position === this._items.length) {
			this.$stage.append(content);
			this._items.push(content);
			this._mergers.push(content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
		} else {
			this._items[position].before(content);
			this._items.splice(position, 0, content);
			this._mergers.splice(position, 0, content.find('[data-merge]').andSelf('[data-merge]').attr('data-merge') * 1 || 1);
		}

		this.invalidate('items');

		this.trigger('added', { content: content, position: position });
	};

	/**
	 * Removes an item by its position.
	 * @todo Use `item` instead of `content` for the event arguments.
	 * @public
	 * @param {Number} position - The relative position of the item to remove.
	 */
	Owl.prototype.remove = function(position) {
		position = this.normalize(position, true);

		if (position === undefined) {
			return;
		}

		this.trigger('remove', { content: this._items[position], position: position });

		this._items[position].remove();
		this._items.splice(position, 1);
		this._mergers.splice(position, 1);

		this.invalidate('items');

		this.trigger('removed', { content: null, position: position });
	};

	/**
	 * Adds triggerable events.
	 * @protected
	 */
	Owl.prototype.addTriggerableEvents = function() {
		var handler = $.proxy(function(callback, event) {
			return $.proxy(function(e) {
				if (e.relatedTarget !== this) {
					this.suppress([ event ]);
					callback.apply(this, [].slice.call(arguments, 1));
					this.release([ event ]);
				}
			}, this);
		}, this);

		$.each({
			'next': this.next,
			'prev': this.prev,
			'to': this.to,
			'destroy': this.destroy,
			'refresh': this.refresh,
			'replace': this.replace,
			'add': this.add,
			'remove': this.remove
		}, $.proxy(function(event, callback) {
			this.$element.on(event + '.owl.carousel', handler(callback, event + '.owl.carousel'));
		}, this));

	};

	/**
	 * Watches the visibility of the carousel element.
	 * @protected
	 */
	Owl.prototype.watchVisibility = function() {

		// test on zepto
		if (!isElVisible(this.$element.get(0))) {
			this.$element.addClass('owl-hidden');
			window.clearInterval(this.e._checkVisibile);
			this.e._checkVisibile = window.setInterval($.proxy(checkVisible, this), 500);
		}

		function isElVisible(el) {
			return el.offsetWidth > 0 && el.offsetHeight > 0;
		}

		function checkVisible() {
			if (isElVisible(this.$element.get(0))) {
				this.$element.removeClass('owl-hidden');
				this.refresh();
				window.clearInterval(this.e._checkVisibile);
			}
		}
	};

	/**
	 * Preloads images with auto width.
	 * @protected
	 * @todo Still to test
	 */
	Owl.prototype.preloadAutoWidthImages = function(imgs) {
		var loaded, that, $el, img;

		loaded = 0;
		that = this;
		imgs.each(function(i, el) {
			$el = $(el);
			img = new Image();

			img.onload = function() {
				loaded++;
				$el.attr('src', img.src);
				$el.css('opacity', 1);
				if (loaded >= imgs.length) {
					that.state.imagesLoaded = true;
					that.initialize();
				}
			};

			img.src = $el.attr('src') || $el.attr('data-src') || $el.attr('data-src-retina');
		});
	};

	/**
	 * Destroys the carousel.
	 * @public
	 */
	Owl.prototype.destroy = function() {

		if (this.$element.hasClass(this.settings.themeClass)) {
			this.$element.removeClass(this.settings.themeClass);
		}

		if (this.settings.responsive !== false) {
			$(window).off('resize.owl.carousel');
		}

		if (this.transitionEndVendor) {
			this.off(this.$stage.get(0), this.transitionEndVendor, this.e._transitionEnd);
		}

		for ( var i in this._plugins) {
			this._plugins[i].destroy();
		}

		if (this.settings.mouseDrag || this.settings.touchDrag) {
			this.$stage.off('mousedown touchstart touchcancel');
			$(document).off('.owl.dragEvents');
			this.$stage.get(0).onselectstart = function() {};
			this.$stage.off('dragstart', function() { return false });
		}

		// remove event handlers in the ".owl.carousel" namespace
		this.$element.off('.owl');

		this.$stage.children('.cloned').remove();
		this.e = null;
		this.$element.removeData('owlCarousel');

		this.$stage.children().contents().unwrap();
		this.$stage.children().unwrap();
		this.$stage.unwrap();
	};

	/**
	 * Operators to calculate right-to-left and left-to-right.
	 * @protected
	 * @param {Number} [a] - The left side operand.
	 * @param {String} [o] - The operator.
	 * @param {Number} [b] - The right side operand.
	 */
	Owl.prototype.op = function(a, o, b) {
		var rtl = this.settings.rtl;
		switch (o) {
			case '<':
				return rtl ? a > b : a < b;
			case '>':
				return rtl ? a < b : a > b;
			case '>=':
				return rtl ? a <= b : a >= b;
			case '<=':
				return rtl ? a >= b : a <= b;
			default:
				break;
		}
	};

	/**
	 * Attaches to an internal event.
	 * @protected
	 * @param {HTMLElement} element - The event source.
	 * @param {String} event - The event name.
	 * @param {Function} listener - The event handler to attach.
	 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
	 */
	Owl.prototype.on = function(element, event, listener, capture) {
		if (element.addEventListener) {
			element.addEventListener(event, listener, capture);
		} else if (element.attachEvent) {
			element.attachEvent('on' + event, listener);
		}
	};

	/**
	 * Detaches from an internal event.
	 * @protected
	 * @param {HTMLElement} element - The event source.
	 * @param {String} event - The event name.
	 * @param {Function} listener - The attached event handler to detach.
	 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
	 */
	Owl.prototype.off = function(element, event, listener, capture) {
		if (element.removeEventListener) {
			element.removeEventListener(event, listener, capture);
		} else if (element.detachEvent) {
			element.detachEvent('on' + event, listener);
		}
	};

	/**
	 * Triggers an public event.
	 * @protected
	 * @param {String} name - The event name.
	 * @param {*} [data=null] - The event data.
	 * @param {String} [namespace=.owl.carousel] - The event namespace.
	 * @returns {Event} - The event arguments.
	 */
	Owl.prototype.trigger = function(name, data, namespace) {
		var status = {
			item: { count: this._items.length, index: this.current() }
		}, handler = $.camelCase(
			$.grep([ 'on', name, namespace ], function(v) { return v })
				.join('-').toLowerCase()
		), event = $.Event(
			[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
			$.extend({ relatedTarget: this }, status, data)
		);

		if (!this._supress[name]) {
			$.each(this._plugins, function(name, plugin) {
				if (plugin.onTrigger) {
					plugin.onTrigger(event);
				}
			});

			this.$element.trigger(event);

			if (this.settings && typeof this.settings[handler] === 'function') {
				this.settings[handler].apply(this, event);
			}
		}

		return event;
	};

	/**
	 * Suppresses events.
	 * @protected
	 * @param {Array.<String>} events - The events to suppress.
	 */
	Owl.prototype.suppress = function(events) {
		$.each(events, $.proxy(function(index, event) {
			this._supress[event] = true;
		}, this));
	}

	/**
	 * Releases suppressed events.
	 * @protected
	 * @param {Array.<String>} events - The events to release.
	 */
	Owl.prototype.release = function(events) {
		$.each(events, $.proxy(function(index, event) {
			delete this._supress[event];
		}, this));
	}

	/**
	 * Checks the availability of some browser features.
	 * @protected
	 */
	Owl.prototype.browserSupport = function() {
		this.support3d = isPerspective();

		if (this.support3d) {
			this.transformVendor = isTransform();

			// take transitionend event name by detecting transition
			var endVendors = [ 'transitionend', 'webkitTransitionEnd', 'transitionend', 'oTransitionEnd' ];
			this.transitionEndVendor = endVendors[isTransition()];

			// take vendor name from transform name
			this.vendorName = this.transformVendor.replace(/Transform/i, '');
			this.vendorName = this.vendorName !== '' ? '-' + this.vendorName.toLowerCase() + '-' : '';
		}

		this.state.orientation = window.orientation;
	};

	/**
	 * Get touch/drag coordinats.
	 * @private
	 * @param {event} - mousedown/touchstart event
	 * @returns {object} - Contains X and Y of current mouse/touch position
	 */

	function getTouches(event) {
		if (event.touches !== undefined) {
			return {
				x: event.touches[0].pageX,
				y: event.touches[0].pageY
			};
		}

		if (event.touches === undefined) {
			if (event.pageX !== undefined) {
				return {
					x: event.pageX,
					y: event.pageY
				};
			}

		if (event.pageX === undefined) {
			return {
					x: event.clientX,
					y: event.clientY
				};
			}
		}
	}

	/**
	 * Checks for CSS support.
	 * @private
	 * @param {Array} array - The CSS properties to check for.
	 * @returns {Array} - Contains the supported CSS property name and its index or `false`.
	 */
	function isStyleSupported(array) {
		var p, s, fake = document.createElement('div'), list = array;
		for (p in list) {
			s = list[p];
			if (typeof fake.style[s] !== 'undefined') {
				fake = null;
				return [ s, p ];
			}
		}
		return [ false ];
	}

	/**
	 * Checks for CSS transition support.
	 * @private
	 * @todo Realy bad design
	 * @returns {Number}
	 */
	function isTransition() {
		return isStyleSupported([ 'transition', 'WebkitTransition', 'MozTransition', 'OTransition' ])[1];
	}

	/**
	 * Checks for CSS transform support.
	 * @private
	 * @returns {String} The supported property name or false.
	 */
	function isTransform() {
		return isStyleSupported([ 'transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ])[0];
	}

	/**
	 * Checks for CSS perspective support.
	 * @private
	 * @returns {String} The supported property name or false.
	 */
	function isPerspective() {
		return isStyleSupported([ 'perspective', 'webkitPerspective', 'MozPerspective', 'OPerspective', 'MsPerspective' ])[0];
	}

	/**
	 * Checks wether touch is supported or not.
	 * @private
	 * @returns {Boolean}
	 */
	function isTouchSupport() {
		return 'ontouchstart' in window || !!(navigator.msMaxTouchPoints);
	}

	/**
	 * Checks wether touch is supported or not for IE.
	 * @private
	 * @returns {Boolean}
	 */
	function isTouchSupportIE() {
		return window.navigator.msPointerEnabled;
	}

	/**
	 * The jQuery Plugin for the Owl Carousel
	 * @public
	 */
	$.fn.owlCarousel = function(options) {
		return this.each(function() {
			if (!$(this).data('owlCarousel')) {
				$(this).data('owlCarousel', new Owl(this, options));
			}
		});
	};

	/**
	 * The constructor for the jQuery Plugin
	 * @public
	 */
	$.fn.owlCarousel.Constructor = Owl;

})(window.Zepto || window.jQuery, window, document);

/**
 * Lazy Plugin
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {

	/**
	 * Creates the lazy plugin.
	 * @class The Lazy Plugin
	 * @param {Owl} carousel - The Owl Carousel
	 */
	var Lazy = function(carousel) {

		/**
		 * Reference to the core.
		 * @protected
		 * @type {Owl}
		 */
		this._core = carousel;

		/**
		 * Already loaded items.
		 * @protected
		 * @type {Array.<jQuery>}
		 */
		this._loaded = [];

		/**
		 * Event handlers.
		 * @protected
		 * @type {Object}
		 */
		this._handlers = {
			'initialized.owl.carousel change.owl.carousel': $.proxy(function(e) {
				if (!e.namespace) {
					return;
				}

				if (!this._core.settings || !this._core.settings.lazyLoad) {
					return;
				}

				if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
					var settings = this._core.settings,
						n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
						i = ((settings.center && n * -1) || 0),
						position = ((e.property && e.property.value) || this._core.current()) + i,
						clones = this._core.clones().length,
						load = $.proxy(function(i, v) { this.load(v) }, this);

					while (i++ < n) {
						this.load(clones / 2 + this._core.relative(position));
						clones && $.each(this._core.clones(this._core.relative(position++)), load);
					}
				}
			}, this)
		};

		// set the default options
		this._core.options = $.extend({}, Lazy.Defaults, this._core.options);

		// register event handler
		this._core.$element.on(this._handlers);
	}

	/**
	 * Default options.
	 * @public
	 */
	Lazy.Defaults = {
		lazyLoad: false
	}

	/**
	 * Loads all resources of an item at the specified position.
	 * @param {Number} position - The absolute position of the item.
	 * @protected
	 */
	Lazy.prototype.load = function(position) {
		var $item = this._core.$stage.children().eq(position),
			$elements = $item && $item.find('.owl-lazy');

		if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
			return;
		}

		$elements.each($.proxy(function(index, element) {
			var $element = $(element), image,
				url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src');

			this._core.trigger('load', { element: $element, url: url }, 'lazy');

			if ($element.is('img')) {
				$element.one('load.owl.lazy', $.proxy(function() {
					$element.css('opacity', 1);
					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
				}, this)).attr('src', url);
			} else {
				image = new Image();
				image.onload = $.proxy(function() {
					$element.css({
						'background-image': 'url(' + url + ')',
						'opacity': '1'
					});
					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
				}, this);
				image.src = url;
			}
		}, this));

		this._loaded.push($item.get(0));
	}

	/**
	 * Destroys the plugin.
	 * @public
	 */
	Lazy.prototype.destroy = function() {
		var handler, property;

		for (handler in this.handlers) {
			this._core.$element.off(handler, this.handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	}

	$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;

})(window.Zepto || window.jQuery, window, document);

/**
 * AutoHeight Plugin
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {

	/**
	 * Creates the auto height plugin.
	 * @class The Auto Height Plugin
	 * @param {Owl} carousel - The Owl Carousel
	 */
	var AutoHeight = function(carousel) {
		/**
		 * Reference to the core.
		 * @protected
		 * @type {Owl}
		 */
		this._core = carousel;

		/**
		 * All event handlers.
		 * @protected
		 * @type {Object}
		 */
		this._handlers = {
			'initialized.owl.carousel': $.proxy(function() {
				if (this._core.settings.autoHeight) {
					this.update();
				}
			}, this),
			'changed.owl.carousel': $.proxy(function(e) {
				if (this._core.settings.autoHeight && e.property.name == 'position'){
					this.update();
				}
			}, this),
			'loaded.owl.lazy': $.proxy(function(e) {
				if (this._core.settings.autoHeight && e.element.closest('.' + this._core.settings.itemClass)
					=== this._core.$stage.children().eq(this._core.current())) {
					this.update();
				}
			}, this)
		};

		// set default options
		this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);

		// register event handlers
		this._core.$element.on(this._handlers);
	};

	/**
	 * Default options.
	 * @public
	 */
	AutoHeight.Defaults = {
		autoHeight: false,
		autoHeightClass: 'owl-height'
	};

	/**
	 * Updates the view.
	 */
	AutoHeight.prototype.update = function() {
		this._core.$stage.parent()
			.height(this._core.$stage.children().eq(this._core.current()).height())
			.addClass(this._core.settings.autoHeightClass);
	};

	AutoHeight.prototype.destroy = function() {
		var handler, property;

		for (handler in this._handlers) {
			this._core.$element.off(handler, this._handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	};

	$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;

})(window.Zepto || window.jQuery, window, document);

/**
 * Video Plugin
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {

	/**
	 * Creates the video plugin.
	 * @class The Video Plugin
	 * @param {Owl} carousel - The Owl Carousel
	 */
	var Video = function(carousel) {
		/**
		 * Reference to the core.
		 * @protected
		 * @type {Owl}
		 */
		this._core = carousel;

		/**
		 * Cache all video URLs.
		 * @protected
		 * @type {Object}
		 */
		this._videos = {};

		/**
		 * Current playing item.
		 * @protected
		 * @type {jQuery}
		 */
		this._playing = null;

		/**
		 * Whether this is in fullscreen or not.
		 * @protected
		 * @type {Boolean}
		 */
		this._fullscreen = false;

		/**
		 * All event handlers.
		 * @protected
		 * @type {Object}
		 */
		this._handlers = {
			'resize.owl.carousel': $.proxy(function(e) {
				if (this._core.settings.video && !this.isInFullScreen()) {
					e.preventDefault();
				}
			}, this),
			'refresh.owl.carousel changed.owl.carousel': $.proxy(function(e) {
				if (this._playing) {
					this.stop();
				}
			}, this),
			'prepared.owl.carousel': $.proxy(function(e) {
				var $element = $(e.content).find('.owl-video');
				if ($element.length) {
					$element.css('display', 'none');
					this.fetch($element, $(e.content));
				}
			}, this)
		};

		// set default options
		this._core.options = $.extend({}, Video.Defaults, this._core.options);

		// register event handlers
		this._core.$element.on(this._handlers);

		this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
			this.play(e);
		}, this));
	};

	/**
	 * Default options.
	 * @public
	 */
	Video.Defaults = {
		video: false,
		videoHeight: false,
		videoWidth: false
	};

	/**
	 * Gets the video ID and the type (YouTube/Vimeo only).
	 * @protected
	 * @param {jQuery} target - The target containing the video data.
	 * @param {jQuery} item - The item containing the video.
	 */
	Video.prototype.fetch = function(target, item) {

		var type = target.attr('data-vimeo-id') ? 'vimeo' : 'youtube',
			id = target.attr('data-vimeo-id') || target.attr('data-youtube-id'),
			width = target.attr('data-width') || this._core.settings.videoWidth,
			height = target.attr('data-height') || this._core.settings.videoHeight,
			url = target.attr('href');

		if (url) {
			id = url.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);

			if (id[3].indexOf('youtu') > -1) {
				type = 'youtube';
			} else if (id[3].indexOf('vimeo') > -1) {
				type = 'vimeo';
			} else {
				throw new Error('Video URL not supported.');
			}
			id = id[6];
		} else {
			throw new Error('Missing video URL.');
		}

		this._videos[url] = {
			type: type,
			id: id,
			width: width,
			height: height
		};

		item.attr('data-video', url);

		this.thumbnail(target, this._videos[url]);
	};

	/**
	 * Creates video thumbnail.
	 * @protected
	 * @param {jQuery} target - The target containing the video data.
	 * @param {Object} info - The video info object.
	 * @see `fetch`
	 */
	Video.prototype.thumbnail = function(target, video) {

		var tnLink,
			icon,
			path,
			dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
			customTn = target.find('img'),
			srcType = 'src',
			lazyClass = '',
			settings = this._core.settings,
			create = function(path) {
				icon = '<div class="owl-video-play-icon"></div>';

				if (settings.lazyLoad) {
					tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>';
				} else {
					tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>';
				}
				target.after(tnLink);
				target.after(icon);
			};

		// wrap video content into owl-video-wrapper div
		target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>');

		if (this._core.settings.lazyLoad) {
			srcType = 'data-src';
			lazyClass = 'owl-lazy';
		}

		// custom thumbnail
		if (customTn.length) {
			create(customTn.attr(srcType));
			customTn.remove();
			return false;
		}

		if (video.type === 'youtube') {
			path = "http://img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
			create(path);
		} else if (video.type === 'vimeo') {
			$.ajax({
				type: 'GET',
				url: 'http://vimeo.com/api/v2/video/' + video.id + '.json',
				jsonp: 'callback',
				dataType: 'jsonp',
				success: function(data) {
					path = data[0].thumbnail_large;
					create(path);
				}
			});
		}
	};

	/**
	 * Stops the current video.
	 * @public
	 */
	Video.prototype.stop = function() {
		this._core.trigger('stop', null, 'video');
		this._playing.find('.owl-video-frame').remove();
		this._playing.removeClass('owl-video-playing');
		this._playing = null;
	};

	/**
	 * Starts the current video.
	 * @public
	 * @param {Event} ev - The event arguments.
	 */
	Video.prototype.play = function(ev) {
		this._core.trigger('play', null, 'video');

		if (this._playing) {
			this.stop();
		}

		var target = $(ev.target || ev.srcElement),
			item = target.closest('.' + this._core.settings.itemClass),
			video = this._videos[item.attr('data-video')],
			width = video.width || '100%',
			height = video.height || this._core.$stage.height(),
			html, wrap;

		if (video.type === 'youtube') {
			html = '<iframe width="' + width + '" height="' + height + '" src="http://www.youtube.com/embed/'
				+ video.id + '?autoplay=1&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>';
		} else if (video.type === 'vimeo') {
			html = '<iframe src="http://player.vimeo.com/video/' + video.id + '?autoplay=1" width="' + width
				+ '" height="' + height
				+ '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
		}

		item.addClass('owl-video-playing');
		this._playing = item;

		wrap = $('<div style="height:' + height + 'px; width:' + width + 'px" class="owl-video-frame">'
			+ html + '</div>');
		target.after(wrap);
	};

	/**
	 * Checks whether an video is currently in full screen mode or not.
	 * @todo Bad style because looks like a readonly method but changes members.
	 * @protected
	 * @returns {Boolean}
	 */
	Video.prototype.isInFullScreen = function() {

		// if Vimeo Fullscreen mode
		var element = document.fullscreenElement || document.mozFullScreenElement
			|| document.webkitFullscreenElement;

		if (element && $(element).parent().hasClass('owl-video-frame')) {
			this._core.speed(0);
			this._fullscreen = true;
		}

		if (element && this._fullscreen && this._playing) {
			return false;
		}

		// comming back from fullscreen
		if (this._fullscreen) {
			this._fullscreen = false;
			return false;
		}

		// check full screen mode and window orientation
		if (this._playing) {
			if (this._core.state.orientation !== window.orientation) {
				this._core.state.orientation = window.orientation;
				return false;
			}
		}

		return true;
	};

	/**
	 * Destroys the plugin.
	 */
	Video.prototype.destroy = function() {
		var handler, property;

		this._core.$element.off('click.owl.video');

		for (handler in this._handlers) {
			this._core.$element.off(handler, this._handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	};

	$.fn.owlCarousel.Constructor.Plugins.Video = Video;

})(window.Zepto || window.jQuery, window, document);

/**
 * Animate Plugin
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {

	/**
	 * Creates the animate plugin.
	 * @class The Navigation Plugin
	 * @param {Owl} scope - The Owl Carousel
	 */
	var Animate = function(scope) {
		this.core = scope;
		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
		this.swapping = true;
		this.previous = undefined;
		this.next = undefined;

		this.handlers = {
			'change.owl.carousel': $.proxy(function(e) {
				if (e.property.name == 'position') {
					this.previous = this.core.current();
					this.next = e.property.value;
				}
			}, this),
			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
				this.swapping = e.type == 'translated';
			}, this),
			'translate.owl.carousel': $.proxy(function(e) {
				if (this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
					this.swap();
				}
			}, this)
		};

		this.core.$element.on(this.handlers);
	};

	/**
	 * Default options.
	 * @public
	 */
	Animate.Defaults = {
		animateOut: false,
		animateIn: false
	};

	/**
	 * Toggles the animation classes whenever an translations starts.
	 * @protected
	 * @returns {Boolean|undefined}
	 */
	Animate.prototype.swap = function() {

		if (this.core.settings.items !== 1 || !this.core.support3d) {
			return;
		}

		this.core.speed(0);

		var left,
			clear = $.proxy(this.clear, this),
			previous = this.core.$stage.children().eq(this.previous),
			next = this.core.$stage.children().eq(this.next),
			incoming = this.core.settings.animateIn,
			outgoing = this.core.settings.animateOut;

		if (this.core.current() === this.previous) {
			return;
		}

		if (outgoing) {
			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
			previous.css( { 'left': left + 'px' } )
				.addClass('animated owl-animated-out')
				.addClass(outgoing)
				.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
		}

		if (incoming) {
			next.addClass('animated owl-animated-in')
				.addClass(incoming)
				.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', clear);
		}
	};

	Animate.prototype.clear = function(e) {
		$(e.target).css( { 'left': '' } )
			.removeClass('animated owl-animated-out owl-animated-in')
			.removeClass(this.core.settings.animateIn)
			.removeClass(this.core.settings.animateOut);
		this.core.transitionEnd();
	}

	/**
	 * Destroys the plugin.
	 * @public
	 */
	Animate.prototype.destroy = function() {
		var handler, property;

		for (handler in this.handlers) {
			this.core.$element.off(handler, this.handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	};

	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;

})(window.Zepto || window.jQuery, window, document);

/**
 * Autoplay Plugin
 * @version 2.0.0
 * @author Bartosz Wojciechowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {

	/**
	 * Creates the autoplay plugin.
	 * @class The Autoplay Plugin
	 * @param {Owl} scope - The Owl Carousel
	 */
	var Autoplay = function(scope) {
		this.core = scope;
		this.core.options = $.extend({}, Autoplay.Defaults, this.core.options);

		this.handlers = {
			'translated.owl.carousel refreshed.owl.carousel': $.proxy(function() {
				this.autoplay();
			}, this),
			'play.owl.autoplay': $.proxy(function(e, t, s) {
				this.play(t, s);
			}, this),
			'stop.owl.autoplay': $.proxy(function() {
				this.stop();
			}, this),
			'mouseover.owl.autoplay': $.proxy(function() {
				if (this.core.settings.autoplayHoverPause) {
					this.pause();
				}
			}, this),
			'mouseleave.owl.autoplay': $.proxy(function() {
				if (this.core.settings.autoplayHoverPause) {
					this.autoplay();
				}
			}, this)
		};

		this.core.$element.on(this.handlers);
	};

	/**
	 * Default options.
	 * @public
	 */
	Autoplay.Defaults = {
		autoplay: false,
		autoplayTimeout: 5000,
		autoplayHoverPause: false,
		autoplaySpeed: false
	};

	/**
	 * @protected
	 * @todo Must be documented.
	 */
	Autoplay.prototype.autoplay = function() {
		if (this.core.settings.autoplay && !this.core.state.videoPlay) {
			window.clearInterval(this.interval);

			this.interval = window.setInterval($.proxy(function() {
				this.play();
			}, this), this.core.settings.autoplayTimeout);
		} else {
			window.clearInterval(this.interval);
		}
	};

	/**
	 * Starts the autoplay.
	 * @public
	 * @param {Number} [timeout] - ...
	 * @param {Number} [speed] - ...
	 * @returns {Boolean|undefined} - ...
	 * @todo Must be documented.
	 */
	Autoplay.prototype.play = function(timeout, speed) {
		// if tab is inactive - doesnt work in <IE10
		if (document.hidden === true) {
			return;
		}

		if (this.core.state.isTouch || this.core.state.isScrolling
			|| this.core.state.isSwiping || this.core.state.inMotion) {
			return;
		}

		if (this.core.settings.autoplay === false) {
			window.clearInterval(this.interval);
			return;
		}

		this.core.next(this.core.settings.autoplaySpeed);
	};

	/**
	 * Stops the autoplay.
	 * @public
	 */
	Autoplay.prototype.stop = function() {
		window.clearInterval(this.interval);
	};

	/**
	 * Pauses the autoplay.
	 * @public
	 */
	Autoplay.prototype.pause = function() {
		window.clearInterval(this.interval);
	};

	/**
	 * Destroys the plugin.
	 */
	Autoplay.prototype.destroy = function() {
		var handler, property;

		window.clearInterval(this.interval);

		for (handler in this.handlers) {
			this.core.$element.off(handler, this.handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	};

	$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;

})(window.Zepto || window.jQuery, window, document);

/**
 * Navigation Plugin
 * @version 2.0.0
 * @author Artus Kolanowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {
	'use strict';

	/**
	 * Creates the navigation plugin.
	 * @class The Navigation Plugin
	 * @param {Owl} carousel - The Owl Carousel.
	 */
	var Navigation = function(carousel) {
		/**
		 * Reference to the core.
		 * @protected
		 * @type {Owl}
		 */
		this._core = carousel;

		/**
		 * Indicates whether the plugin is initialized or not.
		 * @protected
		 * @type {Boolean}
		 */
		this._initialized = false;

		/**
		 * The current paging indexes.
		 * @protected
		 * @type {Array}
		 */
		this._pages = [];

		/**
		 * All DOM elements of the user interface.
		 * @protected
		 * @type {Object}
		 */
		this._controls = {};

		/**
		 * Markup for an indicator.
		 * @protected
		 * @type {Array.<String>}
		 */
		this._templates = [];

		/**
		 * The carousel element.
		 * @type {jQuery}
		 */
		this.$element = this._core.$element;

		/**
		 * Overridden methods of the carousel.
		 * @protected
		 * @type {Object}
		 */
		this._overrides = {
			next: this._core.next,
			prev: this._core.prev,
			to: this._core.to
		};

		/**
		 * All event handlers.
		 * @protected
		 * @type {Object}
		 */
		this._handlers = {
			'prepared.owl.carousel': $.proxy(function(e) {
				if (this._core.settings.dotsData) {
					this._templates.push($(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
				}
			}, this),
			'add.owl.carousel': $.proxy(function(e) {
				if (this._core.settings.dotsData) {
					this._templates.splice(e.position, 0, $(e.content).find('[data-dot]').andSelf('[data-dot]').attr('data-dot'));
				}
			}, this),
			'remove.owl.carousel prepared.owl.carousel': $.proxy(function(e) {
				if (this._core.settings.dotsData) {
					this._templates.splice(e.position, 1);
				}
			}, this),
			'change.owl.carousel': $.proxy(function(e) {
				if (e.property.name == 'position') {
					if (!this._core.state.revert && !this._core.settings.loop && this._core.settings.navRewind) {
						var current = this._core.current(),
							maximum = this._core.maximum(),
							minimum = this._core.minimum();
						e.data = e.property.value > maximum
							? current >= maximum ? minimum : maximum
							: e.property.value < minimum ? maximum : e.property.value;
					}
				}
			}, this),
			'changed.owl.carousel': $.proxy(function(e) {
				if (e.property.name == 'position') {
					this.draw();
				}
			}, this),
			'refreshed.owl.carousel': $.proxy(function() {
				if (!this._initialized) {
					this.initialize();
					this._initialized = true;
				}
				this._core.trigger('refresh', null, 'navigation');
				this.update();
				this.draw();
				this._core.trigger('refreshed', null, 'navigation');
			}, this)
		};

		// set default options
		this._core.options = $.extend({}, Navigation.Defaults, this._core.options);

		// register event handlers
		this.$element.on(this._handlers);
	}

	/**
	 * Default options.
	 * @public
	 * @todo Rename `slideBy` to `navBy`
	 */
	Navigation.Defaults = {
		nav: false,
		navRewind: true,
		navText: [ 'prev', 'next' ],
		navSpeed: false,
		navElement: 'div',
		navContainer: false,
		navContainerClass: 'owl-nav',
		navClass: [ 'owl-prev', 'owl-next' ],
		slideBy: 1,
		dotClass: 'owl-dot',
		dotsClass: 'owl-dots',
		dots: true,
		dotsEach: false,
		dotData: false,
		dotsSpeed: false,
		dotsContainer: false,
		controlsClass: 'owl-controls'
	}

	/**
	 * Initializes the layout of the plugin and extends the carousel.
	 * @protected
	 */
	Navigation.prototype.initialize = function() {
		var $container, override,
			options = this._core.settings;

		// create the indicator template
		if (!options.dotsData) {
			this._templates = [ $('<div>')
				.addClass(options.dotClass)
				.append($('<span>'))
				.prop('outerHTML') ];
		}

		// create controls container if needed
		if (!options.navContainer || !options.dotsContainer) {
			this._controls.$container = $('<div>')
				.addClass(options.controlsClass)
				.appendTo(this.$element);
		}

		// create DOM structure for absolute navigation
		this._controls.$indicators = options.dotsContainer ? $(options.dotsContainer)
			: $('<div>').hide().addClass(options.dotsClass).appendTo(this._controls.$container);

		this._controls.$indicators.on('click', 'div', $.proxy(function(e) {
			var index = $(e.target).parent().is(this._controls.$indicators)
				? $(e.target).index() : $(e.target).parent().index();

			e.preventDefault();

			this.to(index, options.dotsSpeed);
		}, this));

		// create DOM structure for relative navigation
		$container = options.navContainer ? $(options.navContainer)
			: $('<div>').addClass(options.navContainerClass).prependTo(this._controls.$container);

		this._controls.$next = $('<' + options.navElement + '>');
		this._controls.$previous = this._controls.$next.clone();

		this._controls.$previous
			.addClass(options.navClass[0])
			.html(options.navText[0])
			.hide()
			.prependTo($container)
			.on('click', $.proxy(function(e) {
				this.prev(options.navSpeed);
			}, this));
		this._controls.$next
			.addClass(options.navClass[1])
			.html(options.navText[1])
			.hide()
			.appendTo($container)
			.on('click', $.proxy(function(e) {
				this.next(options.navSpeed);
			}, this));

		// override public methods of the carousel
		for (override in this._overrides) {
			this._core[override] = $.proxy(this[override], this);
		}
	}

	/**
	 * Destroys the plugin.
	 * @protected
	 */
	Navigation.prototype.destroy = function() {
		var handler, control, property, override;

		for (handler in this._handlers) {
			this.$element.off(handler, this._handlers[handler]);
		}
		for (control in this._controls) {
			this._controls[control].remove();
		}
		for (override in this.overides) {
			this._core[override] = this._overrides[override];
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	}

	/**
	 * Updates the internal state.
	 * @protected
	 */
	Navigation.prototype.update = function() {
		var i, j, k,
			options = this._core.settings,
			lower = this._core.clones().length / 2,
			upper = lower + this._core.items().length,
			size = options.center || options.autoWidth || options.dotData
				? 1 : options.dotsEach || options.items;

		if (options.slideBy !== 'page') {
			options.slideBy = Math.min(options.slideBy, options.items);
		}

		if (options.dots || options.slideBy == 'page') {
			this._pages = [];

			for (i = lower, j = 0, k = 0; i < upper; i++) {
				if (j >= size || j === 0) {
					this._pages.push({
						start: i - lower,
						end: i - lower + size - 1
					});
					j = 0, ++k;
				}
				j += this._core.mergers(this._core.relative(i));
			}
		}
	}

	/**
	 * Draws the user interface.
	 * @todo The option `dotData` wont work.
	 * @protected
	 */
	Navigation.prototype.draw = function() {
		var difference, i, html = '',
			options = this._core.settings,
			$items = this._core.$stage.children(),
			index = this._core.relative(this._core.current());

		if (options.nav && !options.loop && !options.navRewind) {
			this._controls.$previous.toggleClass('disabled', index <= 0);
			this._controls.$next.toggleClass('disabled', index >= this._core.maximum());
		}

		this._controls.$previous.toggle(options.nav);
		this._controls.$next.toggle(options.nav);

		if (options.dots) {
			difference = this._pages.length - this._controls.$indicators.children().length;

			if (options.dotData && difference !== 0) {
				for (i = 0; i < this._controls.$indicators.children().length; i++) {
					html += this._templates[this._core.relative(i)];
				}
				this._controls.$indicators.html(html);
			} else if (difference > 0) {
				html = new Array(difference + 1).join(this._templates[0]);
				this._controls.$indicators.append(html);
			} else if (difference < 0) {
				this._controls.$indicators.children().slice(difference).remove();
			}

			this._controls.$indicators.find('.active').removeClass('active');
			this._controls.$indicators.children().eq($.inArray(this.current(), this._pages)).addClass('active');
		}

		this._controls.$indicators.toggle(options.dots);
	}

	/**
	 * Extends event data.
	 * @protected
	 * @param {Event} event - The event object which gets thrown.
	 */
	Navigation.prototype.onTrigger = function(event) {
		var settings = this._core.settings;

		event.page = {
			index: $.inArray(this.current(), this._pages),
			count: this._pages.length,
			size: settings && (settings.center || settings.autoWidth || settings.dotData
				? 1 : settings.dotsEach || settings.items)
		};
	}

	/**
	 * Gets the current page position of the carousel.
	 * @protected
	 * @returns {Number}
	 */
	Navigation.prototype.current = function() {
		var index = this._core.relative(this._core.current());
		return $.grep(this._pages, function(o) {
			return o.start <= index && o.end >= index;
		}).pop();
	}

	/**
	 * Gets the current succesor/predecessor position.
	 * @protected
	 * @returns {Number}
	 */
	Navigation.prototype.getPosition = function(successor) {
		var position, length,
			options = this._core.settings;

		if (options.slideBy == 'page') {
			position = $.inArray(this.current(), this._pages);
			length = this._pages.length;
			successor ? ++position : --position;
			position = this._pages[((position % length) + length) % length].start;
		} else {
			position = this._core.relative(this._core.current());
			length = this._core.items().length;
			successor ? position += options.slideBy : position -= options.slideBy;
		}
		return position;
	}

	/**
	 * Slides to the next item or page.
	 * @public
	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
	 */
	Navigation.prototype.next = function(speed) {
		$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
	}

	/**
	 * Slides to the previous item or page.
	 * @public
	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
	 */
	Navigation.prototype.prev = function(speed) {
		$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
	}

	/**
	 * Slides to the specified item or page.
	 * @public
	 * @param {Number} position - The position of the item or page.
	 * @param {Number} [speed] - The time in milliseconds for the transition.
	 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
	 */
	Navigation.prototype.to = function(position, speed, standard) {
		var length;

		if (!standard) {
			length = this._pages.length;
			$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
		} else {
			$.proxy(this._overrides.to, this._core)(position, speed);
		}
	}

	$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;

})(window.Zepto || window.jQuery, window, document);

/**
 * Hash Plugin
 * @version 2.0.0
 * @author Artus Kolanowski
 * @license The MIT License (MIT)
 */
;(function($, window, document, undefined) {
	'use strict';

	/**
	 * Creates the hash plugin.
	 * @class The Hash Plugin
	 * @param {Owl} carousel - The Owl Carousel
	 */
	var Hash = function(carousel) {
		/**
		 * Reference to the core.
		 * @protected
		 * @type {Owl}
		 */
		this._core = carousel;

		/**
		 * Hash table for the hashes.
		 * @protected
		 * @type {Object}
		 */
		this._hashes = {};

		/**
		 * The carousel element.
		 * @type {jQuery}
		 */
		this.$element = this._core.$element;

		/**
		 * All event handlers.
		 * @protected
		 * @type {Object}
		 */
		this._handlers = {
			'initialized.owl.carousel': $.proxy(function() {
				if (this._core.settings.startPosition == 'URLHash') {
					$(window).trigger('hashchange.owl.navigation');
				}
			}, this),
			'prepared.owl.carousel': $.proxy(function(e) {
				var hash = $(e.content).find('[data-hash]').andSelf('[data-hash]').attr('data-hash');
				this._hashes[hash] = e.content;
			}, this)
		};

		// set default options
		this._core.options = $.extend({}, Hash.Defaults, this._core.options);

		// register the event handlers
		this.$element.on(this._handlers);

		// register event listener for hash navigation
		$(window).on('hashchange.owl.navigation', $.proxy(function() {
			var hash = window.location.hash.substring(1),
				items = this._core.$stage.children(),
				position = this._hashes[hash] && items.index(this._hashes[hash]) || 0;

			if (!hash) {
				return false;
			}

			this._core.to(position, false, true);
		}, this));
	}

	/**
	 * Default options.
	 * @public
	 */
	Hash.Defaults = {
		URLhashListener: false
	}

	/**
	 * Destroys the plugin.
	 * @public
	 */
	Hash.prototype.destroy = function() {
		var handler, property;

		$(window).off('hashchange.owl.navigation');

		for (handler in this._handlers) {
			this._core.$element.off(handler, this._handlers[handler]);
		}
		for (property in Object.getOwnPropertyNames(this)) {
			typeof this[property] != 'function' && (this[property] = null);
		}
	}

	$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;

})(window.Zepto || window.jQuery, window, document);