MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/stevencheroskedesign.com/rw_common/themes/Cardinal/scripts/
File Upload :
Current < : /hermes/bosweb/b1705/stevencheroskedesign.com/rw_common/themes/Cardinal/scripts/function.js

/**
* Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* @author Ariel Flesler
* @version 1.4.3
*/
; (function ($) { var h = $.scrollTo = function (a, b, c) { $(window).scrollTo(a, b, c) }; h.defaults = { axis: 'xy', duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1, limit: true }; h.window = function (a) { return $(window)._scrollable() }; $.fn._scrollable = function () { return this.map(function () { var a = this, isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!isWin) return a; var b = (a.contentWindow || a).document || a.ownerDocument || a; return /webkit/i.test(navigator.userAgent) || b.compatMode == 'BackCompat' ? b.body : b.documentElement }) }; $.fn.scrollTo = function (e, f, g) { if (typeof f == 'object') { g = f; f = 0 } if (typeof g == 'function') g = { onAfter: g }; if (e == 'max') e = 9e9; g = $.extend({}, h.defaults, g); f = f || g.duration; g.queue = g.queue && g.axis.length > 1; if (g.queue) f /= 2; g.offset = both(g.offset); g.over = both(g.over); return this._scrollable().each(function () { if (!e) return; var d = this, $elem = $(d), targ = e, toff, attr = {}, win = $elem.is('html,body'); switch (typeof targ) { case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)) { targ = both(targ); break } targ = $(targ, this); if (!targ.length) return; case 'object': if (targ.is || targ.style) toff = (targ = $(targ)).offset() } $.each(g.axis.split(''), function (i, a) { var b = a == 'x' ? 'Left' : 'Top', pos = b.toLowerCase(), key = 'scroll' + b, old = d[key], max = h.max(d, a); if (toff) { attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]); if (g.margin) { attr[key] -= parseInt(targ.css('margin' + b)) || 0; attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0 } attr[key] += g.offset[pos] || 0; if (g.over[pos]) attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos] } else { var c = targ[pos]; attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c } if (g.limit && /^\d+$/.test(attr[key])) attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); if (!i && g.queue) { if (old != attr[key]) animate(g.onAfterFirst); delete attr[key] } }); animate(g.onAfter); function animate(a) { $elem.animate(attr, f, g.easing, a && function () { a.call(this, e, g) }) } }).end() }; h.max = function (a, b) { var c = b == 'x' ? 'Width' : 'Height', scroll = 'scroll' + c; if (!$(a).is('html,body')) return a[scroll] - $(a)[c.toLowerCase()](); var d = 'client' + c, html = a.ownerDocument.documentElement, body = a.ownerDocument.body; return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d]) }; function both(a) { return typeof a == 'object' ? a : { top: a, left: a} } })(jQuery);

var originalHeaderWidth=null;
var originalSocialIconsParent = null;
var resized = false;
var jQuery = $.noConflict();

jQuery(document).ready(function ($) {
	
	LoadTitleLogo();
	
    /* Background-image to img src */
    var D3 = 'hid', a3 = 'bg', Q2 = "addClass", A3 = '>', k3 = '<img id="featureImg" src=', H2 = "prepend", T3 = ')', Y3 = "ac", e3 = "l", B3 = "p", S2 = "e", c3 = "r", M2 = '', z2 = '(', m3 = 'rl', R2 = "ce", L2 = "a", G2 = "repl", y2 = 'ge', i2 = 'ma', j3 = 'i', O2 = '-', J2 = 'nd', u3 = 'ou', W3 = 'gr', p2 = 'ack', h2 = 'b', C2 = "css", K3 = 'e', v3 = 'r', F2 = 'u', r3 = 't', d2 = 'ea', X2 = 'f', n3 = '#', bg = jQuery((n3 + X2 + d2 + r3 + F2 + v3 + K3))[(C2)]((h2 + p2 + W3 + u3 + J2 + O2 + j3 + i2 + y2))[(G2 + L2 + R2)]((F2 + m3 + z2), M2)[(c3 + S2 + B3 + e3 + Y3 + S2)](T3, M2); jQuery((n3 + X2 + d2 + r3 + F2 + v3 + K3))[H2](k3 + bg + A3)[Q2]((a3 + D3 + K3));

    var extraContent = (function () {
        var ecValue = 11;
        for (i = 1; i <= ecValue; i++) {
            jQuery('#myExtraContent' + i + ' script').remove();
            jQuery('#myExtraContent' + i).appendTo('#extraContainer' + i);
			if(jQuery('#extraContainer' + i).is(":empty"))
			{
				jQuery('#extraContainer' + i).remove();
			}
			else
			{
				jQuery('#extraContainer' + i).addClass("zoomable");
			}
        }
    })();
	
	/* Remove Empty Content */
	if(jQuery('.album-title').is(":empty"))
	{
		jQuery('.album-title').remove();
	}
	
	if(jQuery('.album-description').is(":empty"))
	{
		jQuery('.album-description').remove();
	}

	/*look for contactImage*/
	if(jQuery("#contactimg").length > 0)
	{
		jQuery("section #padding").prepend(jQuery("#contactimg"));
	}

	/* logo in nav */
	if(jQuery("#logo").css("font-family") == "Verdana")
	{
		jQuery("#logo").prependTo("#nwrap");
	}
	
	/* title slogan below banner */
	if(jQuery("#themeOptions").css("position") == "absolute")
	{
		jQuery(".banner").after(jQuery("#container #titlelogo"));
	}
	
    /*zoom code*/
    var zoom = false;
	
	/*lets figure out zoom percentage */
	var zoomPerent = getZoomPercentage();

    if(jQuery("#themeOptions").css("width")=="10px"){
        zoom=true;
        $('.zoomable').panzoom({
		  disablePan: true,
          minScale: zoomPerent,
          duration: 400,
		  zoomOut: $("#mwrap"),
		  reset: $(".close-thick")
	  });
    }

	
    //code for nav on mobile
    jQuery('nav li a').on("touchstart", function (e) {
        'use strict'; //satisfy code inspectors
        var link = jQuery(this); //preselect the link

        if (link.hasClass('hover') || link.parent().find('ul:first').length == 0) {
            return true;
        } else {
            link.addClass('hover');
            if (link.parent().parent().parent().is("nav")) {
                jQuery('nav li a').not(this).removeClass('hover');
            }

            //first close any that may be open
            jQuery("nav li a:not(.hover)").parent().find("ul").hide();
            //then open the selected sub menu
            link.parent().find('ul:first').stop('true', 'true').animate({ height: 'toggle' }, 250);
			
			setTimeout(function() {
			if(jQuery('header').hasScrollBar()){
					 jQuery("#socialicons").css("position","relative");
				}
				else
				{
					jQuery("#socialicons").css("position","fixed");
				}
			}, 300);

            e.preventDefault();
            return false; //extra, and to make sure the function has consistent return points
        }
    });
	
	$('nav li').hoverIntent(function () {
		jQuery(this).find('ul:first').stop('true', 'true').animate({ height: 'toggle' }, 275);
		
		setTimeout(function() {
		if(jQuery('header').hasScrollBar()){
				 jQuery("#socialicons").css("position","relative");
			}
			else
			{
				jQuery("#socialicons").css("position","fixed");
			}
		}, 300);
	});
	
	// Move social icons
	if(jQuery('a.symbol').length > 0){
		jQuery('a.symbol').each(function(index){
			if(index == 0)
			{
				originalSocialIconsParent = jQuery(this).prevAll("p, div, h1, h2, h3,h4, h5, h6, a").first();
				if(originalSocialIconsParent == null || originalSocialIconsParent.length == 0){
					originalSocialIconsParent= jQuery(this).parent();
				}
			}
			var selector = '#socialicons ul';
			 if(selector != ""){
				jQuery(selector).append(jQuery("<li>").append(jQuery(this)));
			 }
		});
		
		jQuery("header").append(jQuery("#socialicons"));
	}
	else {
		originalSocialIconsParent= jQuery("aside");
		jQuery('#socialicons').remove();
	}
	
	/* sidebar social icons */
	if(jQuery("#themeOptions").css("background-repeat") == "repeat-x")
	{
		var socialCopy = jQuery("#socialicons ul").clone();
		if(originalSocialIconsParent.attr("id") == "sidecontent"){
			originalSocialIconsParent.prepend("<div id='sidesocialicons'></div>")
		}
		else
		{
			originalSocialIconsParent.append("<div id='sidesocialicons'></div>")
		}
		jQuery("#sidesocialicons").append(socialCopy);
	}


	originalHeaderWidth  = jQuery("header").css("width");

	if($('header').hasScrollBar())
	{
		 jQuery("#socialicons").css("position","relative");
	}
	else
	{
		jQuery("#socialicons").css("position","fixed");
	}
	
	setContinerMargins();
	
    jQuery("#mwrap, .close-thick").click(function(e){
		
		if(jQuery("header").hasClass("open"))
		{
			if(jQuery(".mwrap").is(":visible")){
					originalHeaderWidth = 0;			   
			}
			
			jQuery("nav").fadeOut("fast");
			if(jQuery("#logo").css("font-family") == "Verdana")
			{
				jQuery(".open #logo").fadeOut("fast");
			}
			
			jQuery("header").removeClass("open");
			jQuery("header").animate({width :originalHeaderWidth},350);
			jQuery('#overlay').fadeOut();
			jQuery("#socialicons").hide();
			jQuery("#socialicons").css("position","fixed");
			jQuery(".close-thick").fadeOut();
			
			setTimeout(function() {
				 jQuery("#mwrap").fadeIn();
				 jQuery("#socialicons").fadeIn("fast");
				 if(jQuery(".mwrap").is(":visible"))
				 {
					 jQuery("#socialicons").hide();
				 }
			}, 300);
			
			if(zoom == true){
				jQuery(".zoomable").panzoom("reset");
			}
			
			
		}
		else
		{
			jQuery("header").addClass("open");
			jQuery("#socialicons").hide();
			jQuery("header").animate({width:'250px'},350);
			jQuery('#overlay').fadeIn();
			
			jQuery("#mwrap").fadeOut();
			setTimeout(function() {
				  jQuery(".close-thick").fadeIn();
				  jQuery("#socialicons").fadeIn("fast");
			}, 300);

			jQuery("nav").fadeIn("slow");
			if(jQuery("#logo").css("font-family") == "Verdana")
			{		
				jQuery(".open #logo").fadeIn("slow");
			}
            
			if(zoom == true){
             jQuery(".zoomable").panzoom("zoom",true);
            }
			
			setTimeout(function() {
			if(jQuery('header').hasScrollBar()){
					 jQuery("#socialicons").css("position","relative");
				}
				else
				{
					jQuery("#socialicons").css("position","fixed");
				}
			}, 300);
			
			resizeNav();
		}

		 e.preventDefault();
         return false;
		
	});
	
	jQuery(".mwrap").click(function(e){
				
			jQuery("header").show();
			jQuery("header").addClass("open");
			jQuery("#socialicons").hide();
			jQuery("header").animate({width:'250px'},350);
			jQuery('#overlay').fadeIn();
			
			jQuery("#mwrap").hide();
			setTimeout(function() {
				  jQuery(".close-thick").fadeIn();
				  jQuery("#socialicons").fadeIn("fast");
			}, 300);

			jQuery("nav").fadeIn("slow");
			if(jQuery("#logo").css("font-family") == "Verdana")
			{		
				jQuery(".open #logo").fadeIn("slow");
			}
            
			if(zoom == true){
             jQuery(".zoomable").panzoom("zoom",true);
            }
			
			setTimeout(function() {
			if(jQuery('header').hasScrollBar()){
					 jQuery("#socialicons").css("position","relative");
				}
				else
				{
					jQuery("#socialicons").css("position","fixed");
				}
			}, 300);
		
		resizeNav();
		 e.preventDefault();
         return false;
		
	});
	
	/* blog image position */
	if(jQuery("#themeOptions").css("font-size") == "1px")
	{
		jQuery(".blog-entry img").each(function(item){
			var parentBlog=	jQuery(this).closest(".blog-entry");
			jQuery(this).prependTo(parentBlog);
		});
	}
	
	jQuery("#wrapper, #ec2wrap,#ec3wrap,#ec4wrap,#ec5wrap,#ec6wrap,#ec7wrap").css("position","static");
	
	/* scroll up arrow */
	if(jQuery("#themeOptions").css("text-indent") != "99px")
	{
		$(window).scroll(function () {
			if (jQuery(this).scrollTop() > 100) {
				jQuery('.scrollup').fadeIn();
			} else {
				jQuery('.scrollup').fadeOut();
			}
    	});
		
		jQuery('.scrollup').click(function () {
			jQuery("html, body").animate({ scrollTop: 0 }, 600);
			return false;
		});
	}

    jQuery(window).load(function () {
        if ($('.flexslider').css("z-index") != 1337) {
			//set options based on stylesheets
			var animationType = "slide"; //default to slide
			var slideshowSpeed = 7000; //default
			animationType = jQuery("#themeOptions").css("font-family");
			slideshowSpeed = jQuery("#themeOptions").css("z-index");
			
            $('.flexslider').flexslider({
                animation: animationType,
                controlsContainer: ".flex-container",
				slideshowSpeed: slideshowSpeed
            });
        }
    });
	
	jQuery( window ).resize(function() {
		resized = true;
		if(!jQuery("header").hasClass("open")){
			jQuery("header").css("width", "");
			jQuery("header").css("height", "");
			originalHeaderWidth = jQuery("header").css("width");
			
			if(jQuery("#mobilemenu").is(":visible"))
			{
				jQuery("header").hide();
			}
			else
			{
				jQuery("header").show();
			}
		}
		setContinerMargins();
		resizeNav();
	});
	
     
	$("section").fitVids();
    $("#extraContainer11").fitVids();
	
	
	jQuery("#extraContainer2", "#extraContainer3", "#extraContainer4", "#extraContainer5", "#extraContainer6", "#extraContainer7")
		.css("-webkit-transform"," none!important")
		.css("-webkit-backface-visibility","visible!important")
		.css("-webkit-font-smoothing","antialiased!important")
		.css("-webkit-perspective","none!important")
		.css("-webkit-transform","none!important")
		.css("-webkit-transition-delay","none!important")
		.css("-webkit-transition-duration","none!important")
		.css("-webkit-transition-property","none!important")
		.css("-webkit-transition-timing-function","none!important")
		.css("backface-visibility","visible!important");
	
	
	
});

function resizeNav()
{
	var menuHeight = jQuery("nav").outerHeight(true);
	var windowHeight = jQuery(window).height();
	var navMarginTop = (( windowHeight- menuHeight)/2)-75;
	
	if(menuHeight > windowHeight)
	{
		navMarginTop = -1;
	}
	
	if(jQuery("#logo").css("font-family") == "Verdana")
	{
		navMarginTop -= jQuery("#logo").height();
	}
	
	if(navMarginTop < 0){ navMarginTop = 55;}
	
	jQuery("nav").css("margin-top", navMarginTop);		
}


function LoadTitleLogo()
{
	jQuery("#titlelogo").clone().appendTo("#mobilemenu");
}

function setContinerMargins(){
	setTimeout(function() {
	if(jQuery("#mobilemenu").is(":visible"))
	{
		jQuery("#container").css("margin-top", jQuery("#mobilemenu").height() + "px");
	}
	else
	{
		jQuery("#container").css("margin-top", "auto");	
	}
	}, 400 );
}


function getBaseUrl() {
	var re = new RegExp(/^.*\//);
	return re.exec(window.location.href);
}

function stripTrailingSlash(str) {
    if(str.substr(-1) == '/') {
        return str.substr(0, str.length - 1);
    }
    return str;
}

function matchHeights(selector, selector2){
    var maxHeight=0;
	var height1 = false;
	
    jQuery(selector).each(function(){
        var height = jQuery(this).outerHeight(true);
        if (height > maxHeight){
            maxHeight = height;
			height1 = true;
        }
    });
	
	jQuery(selector2).each(function(){
        var height = jQuery(this).height();
        if (height > maxHeight){
            maxHeight = height;
			height1 = false;
        }
    });
	
	if(height1 == true){
     jQuery(selector2).height(maxHeight);
	}
	else
	{
	jQuery(selector).height(maxHeight);		
	}
	 
};

function matchColHeightsMin(selector){
    var maxHeight=0;
    jQuery(selector).each(function(){
        var height = jQuery(this).height();
        if (height > maxHeight){
            maxHeight = height;
        }
    });
    jQuery(selector).css("min-height",maxHeight);
};

function getZoomPercentage()
{
	var zoomPerent = 0.95;
	return zoomPerent;
}


function stylesheetExists(name) {
    var exists = false;
    jQuery("link[rel='stylesheet']").each(function () {

        if (jQuery(this).attr("href").indexOf(name) > -1) {
            exists = true;
        }
    });

    return exists;
}

(function(jQuery) {
  jQuery.fn.retina = function(options) {
    var settings = { 
      "retina-background" : false,
      "retina-suffix" : "@2x"
    };
    if (options) {
      jQuery.extend(settings, options);
    }
    var preload = function(path, callback) {
      var img = new Image();
      img.onload = function() { callback(img) };
      img.src = path;
    };

    if (window.devicePixelRatio > 1) {
      this.each(function() {
        var element = jQuery(this);
        if (this.tagName.toLowerCase() == "img" && element.attr("src")) {
          var src = element.attr("src");
		  var fileNameIndex = src.lastIndexOf("/") + 1;
	      var filename = src.substr(fileNameIndex);
		  var path = rootUrl + "/resources/" + filename.replace(/\.(?!.*\.)/, settings["retina-suffix"] +".");
          preload(path, function(img) {
            element.attr("src", img.src);
            var imgHtml = jQuery("<div>").append(element.clone()).remove().html();
            if (!(/(width|height)=["']\d+["']/.test(imgHtml))) {
              element.attr("width", img.width / 2);
            }
          });
        }
        if (settings["retina-background"]) {
          var backgroundImageUrl = element.css("background-image");
          if (/^url\(.*\)jQuery/.test(backgroundImageUrl)) {
   			var src= backgroundImageUrl.substring(4, backgroundImageUrl.length - 1);
			
		  var fileNameIndex = src.lastIndexOf("/") + 1;
	      var filename = src.substr(fileNameIndex);
		  var path = rootUrl + "/resources/" + filename.replace(/\.(?!.*\.)/, settings["retina-suffix"] +".");
            var path = src.replace(/\.(?!.*\.)/, settings["retina-suffix"] +".");
            preload(path, function(img) {
              element.css("background-image", "url(" + img.src + ")");
              if (element.css("background-size") == "auto auto") {
                element.css("background-size", (img.width / 2) + "px auto");
              }
            });
          }
        }
      });
    }
  };
})(jQuery);

(function(jQuery) {
    jQuery.fn.hasScrollBar = function() {
        return jQuery(this)[0].scrollHeight > jQuery(this).height();
    }
})(jQuery);