var centerDivWidth;var centerDivsHeight;var resizeTimer;var toTop;var gallery;var ROIselected = false;var mobileDevice = 0;function getCenterDivWidth(){centerDivWidth = parseFloat($("html").css('min-width'));}function toggleMobileMenu(){if ($('#floating-menu2').is(":visible")){$('#floating-menu2').hide();} else {$('#floating-menu2').show();}}function osDetect(s){var os = navigator.platform.toLowerCase();return os.indexOf(s)> -1;}function html5Detect(f){if (document.createElement("detect").style.textShadow !== ""){f();return false;}return true;}function keepHeaderInCenter(){var w = ($(window).width()- centerDivWidth)/ 2;if (w > 0){$('#floating-menu').css('width', '100%');$('#headerO').width(w + 8);$('#headerO').show();} else {$('#headerO').width('8px');$('#floating-menu').width($(document).width());}}function onRotate(f){var supportsOrientationChange = "onorientationchange" in window;var orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";window.addEventListener(orientationEvent, function(){f();}, false);}function divResize(){var offset = 0;var scnWid, scnHei, match;var regxp = new RegExp('^sec| sec | sec$');if (self.innerHeight){scnHei = self.innerHeight;} else if (document.documentElement && document.documentElement.clientHeight){scnHei = document.documentElement.clientHeight;} else if (document.body){scnHei = document.body.clientHeight;}centerDivsHeight = scnHei - offset;var elements = document.getElementsByTagName('div');for ( i = 0; i < elements.length; i++){match = regxp.exec(elements[i].className);if (match != null){elements[i].style.height = centerDivsHeight + "px";}}}function smoothScrool(){$('a[href^="#"]').bind('click.smoothscroll', function(e){e.preventDefault();var target = this.hash, $target;if (target){$target = $(target);} else {$target = $("html, body");}$('html, body').stop().animate({'scrollTop' : $target.offset().top}, 600, 'swing', function(){window.location.hash = target;});});}function resizeOnHover(dest, mpl, animSpeed1, animSpeed2, resizeFont){var fontSizeMin;var widthMax;var heightMax;var fontSizeMax;var hoverificLeft;var hoverificTop;var regxp = new RegExp('[^0-9]{1,}$');$(dest).hover(function(){if (!$(this).data('fontSizeMin')){$(this).data('fontSizeMin', $(this).css('font-size'));}fontSizeP = regxp.exec($(this).data('fontSizeMin'));fontSizeMin = parseInt($(this).data('fontSizeMin'));if (resizeFont === true){fontSizeMax = mpl * fontSizeMin;}if (!$(this).data('widthMin')){$(this).data('widthMin', parseFloat($(this).width()));}if (!$(this).data('heightMin')){$(this).data('heightMin', parseFloat($(this).height()));}widthMin = $(this).data('widthMin');heightMin = $(this).data('heightMin');widthMax = mpl * widthMin;heightMax = mpl * heightMin;if (!$(this).data('hoverificLeft')){$(this).data('hoverificLeft', parseFloat($(this).css('left')));}if (!$(this).data('hoverificTop')){$(this).data('hoverificTop', parseFloat($(this).css('top')));}hoverificLeft = $(this).data('hoverificLeft');hoverificTop = $(this).data('hoverificTop');var offsetLeft = hoverificLeft - ((widthMax - widthMin)/ 2);var offsetTop = hoverificTop - ((heightMax - heightMin)/ 2);$(this).css('z-index', 999);$(this).stop().animate({width : widthMax,height : heightMax,fontSize : fontSizeMax + fontSizeP,left : offsetLeft + 'px',top : offsetTop + 'px'}, animSpeed1, 'swing', function(){});}, function(){$(this).stop().animate({width : widthMin,height : heightMin,fontSize : fontSizeMin + fontSizeP,left : hoverificLeft + 'px',top : hoverificTop + 'px'}, animSpeed2, 'linear', function(){$(this).css('z-index', 0);});});}function navShow(){$('#main-nav').css({opacity : 0.0,visibility : "visible"}).animate({opacity : 1.0});}function fontResize(els){var wh = 1353;els.each(function(){getSizes(this);});function getSizes(o){var regxp = new RegExp('[^0-9]{1,}$');$(o).data('fontSize', parseFloat($(o).css('font-size')));$(o).data('fontSizeP', regxp.exec($(o).css('font-size')));$(o).data('lineHeight', parseFloat($(o).css('line-height')));$(o).data('lineHeightP', regxp.exec($(o).css('line-height')));$(o).data('Height', parseFloat($(o).css('height')));$(o).data('HeightP', regxp.exec($(o).css('height')));$(o).data('Width', parseFloat($(o).css('width')));$(o).data('WidthP', regxp.exec($(o).css('width')));}this.resize = function(){var wheight = $(document).width();var newSize, newHeight, newH, newW;els.each(function(){newSize = ($(this).data('fontSize')* wheight)/ wh + $(this).data('fontSizeP');newHeight = ($(this).data('lineHeight')* wheight)/ wh + $(this).data('lineHeightP');newH = ($(this).data('Height')* wheight)/ wh + $(this).data('HeightP');newW = ($(this).data('Width')* wheight)/ wh + $(this).data('WidthP');$(this).css({'font-size' : newSize,'line-height' : newHeight,'height' : newH,'width' : newW,'display' : 'block'});});};}function mySkinGallery(){var galleryPageActiv;var galleryPageChanging;var galleryLoop;var interval = 5000;var resizeThis = $('div.gallery-text, div.gallery-text h1, div.gallery-head, div.gallery-link, div.gallery-link a, div.gallery-text button');var galleryFont = new fontResize(resizeThis);galleryFont.resize();$('#gallery .active, #dots, #arrow-g').animate({'opacity' : 1});function gallerySwapMedia(){if (!$('#gallery').length){return;}galleryPageChanging = true;var activDot, v;var active = $('#gallery .active');activDot = $('#dots .dot-a');if (active.children().prop("tagName").toLowerCase()== 'video'){active.children().get(0).pause();}if (galleryPageActiv != null){selectedDot = $('#dots').children().eq(galleryPageActiv);selectedMedia = $('#gallery').children().eq(galleryPageActiv);if (activDot.index()< galleryPageActiv){activDot.insertAfter(selectedDot);} else {activDot.insertBefore(selectedDot);}change(active, selectedMedia);if (selectedMedia.children().prop("tagName").toLowerCase()== 'video'){}} else {if (activDot.next().length > 0){activDot.insertAfter(activDot.next());} else {activDot.insertBefore($('#dots a:first'));}var next = ($('#gallery .active').next().length > 0)? $('#gallery .active').next(): $('#gallery div:first');change(active, next);}}function change(active, next){active.fadeOut(function(){active.removeClass('active');next.css({'display' : 'block','opacity' : 0});next.animate({'opacity' : 1}, function(){galleryPageChanging = false;}).addClass('active');});}var galleryStop = this.galleryStop = function(){window.clearInterval(galleryLoop);};this.fontSize = function(){galleryFont.resize();};this.select = function(el){if (galleryPageChanging){return;}var num = $(el).parent().children().index(el);galleryStop();galleryPageActiv = num;gallerySwapMedia();};galleryLoop = setInterval(gallerySwapMedia, interval);}function mySkinGalleryInit(){gallery = new mySkinGallery();}function toTopButton(){var toTop = $('#go-to-top');var triggerHeight;var toTopShowed = true;toTop.click(function(){scrollToTop();});var toggle = this.toggle = function(s){if (!s){getTriggerHeight();}var top = $(window).scrollTop();if (top > triggerHeight){upButton();} else {downButton();}};function downButton(){toTop.removeClass("top");toTop.addClass("down");toTopShowed = false;}function upButton(){toTop.removeClass("down");toTop.addClass("top");toTopShowed = true;}function scrollToTop(){target = $("html, body");if (toTopShowed === true){target.stop().animate({'scrollTop' : target.offset().top}, 600, 'swing', function(){});} else {target.stop().animate({'scrollTop' : $("#wrapper").children().eq(2).offset().top - 140}, 600, 'swing', function(){});}}function getTriggerHeight(){triggerHeight = getFirstSlajfnaHeight()- 1;}function getFirstSlajfnaHeight(){var wrapperDivs = $("#wrapper").children('div');return wrapperDivs.eq(1).height();}toggle();}function scrollFloatingMenu(){var flMenu = $('#floating-menu');var flwrap = $('#float-wrap');var scrlPosHor = $(window).scrollLeft();var scrlPosTop = 1;var offset = 0;var menuHeight = 100;if (scrlPosHor){offset = -scrlPosHor;}flMenu.css('left', offset + 'px');resize();function resize(){if (scrlPosTop){flwrap.stop().animate({'padding-top' : '0px','height' : '60px'}, 250, 'linear');$('#under').stop().animate({'height' : '60px'}, 250, 'linear');} else {flwrap.stop().animate({'padding-top' : '40px','height' : '60px'}, 300, 'linear');$('#under').stop().animate({'height' : '140px'}, 300, 'linear');}}}function loadHeaderFooter(){var hfDiv = "#hf";var url = "/hf?md=" + mobileDevice;if ($(hfDiv).length){$.ajax({url : url,async : false,dataType : "html",success : function(data){$(hfDiv).html(data);}});}}function getShopifyInfo(){var orderTab = "#mb_order-shopify";var url = "/js/Getshopify/";if ($(orderTab).length){$.ajax({url : url,async : true,dataType : "json",success : function(data){var out = 'OKU BATCH #' + data.batch + ' @ ' + data.prct + '%';$(orderTab).html(out);var barWidth = $('#mb_order-c').outerWidth();$('#mb_order-shopify-bar').width(barWidth + 'px');var barProgressWidth = (barWidth / 100)* data.prct;$('#mb_order-shopify-bar-progress').width(barProgressWidth + 'px');$('#mb_order-shopify-bar').fadeIn();}});}}function checkResize(){resizeTimer = setTimeout(clearResizeTimer, 10);return false;}function clearResizeTimer(){clearTimeout(resizeTimer);resizeTimer = null;}function fadeInOnLoad(){$('div.fadeIn').fadeIn();}function menuItemSelected(){var href = $(location).attr('href');var match = href.match(/\/\/[^\/]{1,}\/([^\/]{1,})/);if (match){page = match[1];$('nav ul li a').each(function(){if (page == 'roi'){if ($.trim($(this).html())== 'ROI for spas'){$(this).addClass('selected');ROIselected = true;return;}}if ($.trim($(this).html())== page){$(this).addClass('selected');}});}}function pinterestCheck(){$("body").append('');}function facebookCheck(){$("body").append('');}function onLoad(){loadHeaderFooter();scrollFloatingMenu();fadeInOnLoad();getCenterDivWidth();keepHeaderInCenter();navShow();menuItemSelected();if ( typeof homeLoad == 'function'){homeLoad();}if ( typeof techLoad == 'function'){techLoad();}if ( typeof partnerupLoad == 'function'){partnerupLoad();}if ( typeof earlyLoad == 'function'){earlyLoad();}pinterestCheck();facebookCheck();}function onResize(){scrollFloatingMenu();if (checkResize()){return;}keepHeaderInCenter();if (gallery){gallery.fontSize();}if ( typeof aboutResize == 'function'){aboutResize();}}function onScroll(){scrollFloatingMenu();if ( typeof homeScroll == 'function'){homeScroll();}if ( typeof techScroll == 'function'){techScroll();}}window.onload = onLoad;window.onresize = onResize;window.onscroll = onScroll;