﻿/* Create Menu Shadows */
jQuery(function (a) { a("#mainNav div.subNavShadow").each(function () { var e = a(this), b = e.children("ul"), d = b.css("marginTop"), c = b.height() + (d ? d.replace("px", "") - 0 : 0); e.css({ height: c + "px" }); e.children("div.subNavShadowBottom").css({ top: c }) }) });

/* IE font-face ClearType fix - V0.1
* Authord by Michael Strand of Allcreatives.net
* Usage, changes, FAQ etc. see - http://allcreatives.net/2009/12/05/jquery-plugin-ie-font-face-cleartype-fix/
* The IE font-face ClearType fix plugin is dual licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) and 
* [GPL](http://www.opensource.org/licenses/gpl-license.php) licenses.
*/
(function ($) {
    $.fn.ieffembedfix = function () {
        /* CONFIGURE THE PATH TO YOUR 1BY1 PNG HERE, RELATIVE TO THE LOCATION OF THIS JS FILE.*/
        var pngimgurl = "/Content/images/hIEfix.png";
        return this.each(function () {
            
            //check for IE7+
            if (!(!/*@cc_on@if(@_jscript_version>=5)!@end@*/0)) {
                $(this).css({
                    filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + pngimgurl + "',sizingMethod=crop)",
                    zoom: '1'
                });
            }
        });
    }
})(jQuery);

/*
 * isFontFaceSupported - I now recommend a different technique.. It's from Diego Perini.. The code is below: 
 * http://paulirish.com/2009/font-face-feature-detection/
 */
var isFontFaceSupported=(function(){var d,f=document,c=f.head||f.getElementsByTagName("head")[0]||docElement,e=f.createElement("style"),a=f.implementation||{hasFeature:function(){return false}};e.type="text/css";c.insertBefore(e,c.firstChild);d=e.sheet||e.styleSheet;var b=a.hasFeature("CSS2","")?function(i){if(!(d&&i)){return false}var g=false;try{d.insertRule(i,0);g=!(/unknown/i).test(d.cssRules[0].cssText);d.deleteRule(d.cssRules.length-1)}catch(h){}return g}:function(g){if(!(d&&g)){return false}d.cssText=g;return d.cssText.length!==0&&!(/unknown/i).test(d.cssText)&&d.cssText.replace(/\r+|\n+/g,"").indexOf(g.split(" ")[0])===0};return b('@font-face { font-family: "font"; src: "font.ttf"; }')})();

/* fontAvailable jQuery Plugin, v1.1
 *
 * Copyright (c) 2009, Howard Rauscher
 * Licensed under the MIT License
 */
(function(b){var a;b.fontAvailable=function(e){var d,c;if(!a){a=b(document.createElement("span")).css("visibility","hidden").css("position","absolute").css("top","-10000px").css("left","-10000px").html("abcdefghijklmnopqrstuvwxyz").appendTo(document.body)}d=a.css("font-family","__FAKEFONT__").width();c=a.height();a.css("font-family",e);return d!==a.width()||c!==a.height()}})(jQuery);

/* Font loading for the ActiTrainer website
* Developed December 2009-2011 by Derek Gates
*/
(function () {
    /*http://paulirish.com/2009/fighting-the-font-face-fout/*/
    if (!isFontFaceSupported) { loadCufon(); };

    var selector = '#content h1,h2,h3,h4,.museo, .interior .subscriptionbox';
    if (/*@cc_on!@*/0) /* IE conditional: disable ClearType for smooth fonts... */
        (function () {
            var opacity = jQuery.cssHooks.opacity;
            // override the css opacity hook
            if (opacity.set) {
                // save the default set() function so we can call it later
                var defaultSet = opacity.set;

                // make a new set function
                opacity.set = function (elem,value) {

                    // call our default function
                    defaultSet(elem,value);

                    if ('undefined' !== typeof Cufon) Cufon.refresh();
                    $(selector).ieffembedfix();
                }
            }
        })();

        jQuery(function ($) { $(selector).ieffembedfix() });

    function loadCufon() {
        require(['/Scripts/jquery/font-fallback.js'],function () {
            var c = Cufon;
            c.replace(selector);
            /* subscription page: */
            var boxSelector = '.interior .subscriptionbox';
            if (/*@cc_on!@*/0) /* IE conditional */
                c.replace(boxSelector + ' :not(.title)',{ hover: true,hoverables: { em: true} });
            else
                c.replace(boxSelector + ' :not(em)');
        });
    };
})();
