jQuery(document).ready(function()
{
    // Open external links (specified by rel= or class=) in a new browser window:    
    jQuery("a[rel*='external'],a[class*='external']").attr('target','_blank');

    if (!jQuery('body').hasClass('home')) apply_sifr(false);
    
});

/* ===========================================================================
   HELPERS */

function apply_sifr(is_modal) {

    var heading = {
      src: '/wp-content/themes/factory44/heading.swf'
    };
    sIFR.useStyleCheck = true;
    sIFR.activate(heading);
    
    if (!is_modal) {

        if (!jQuery('body').hasClass('slug-html-email-marketing')) {
            sIFR.replace(heading, {
              selector: '#content h1'
              ,ratios: [6, 1.24, 8, 1.17, 14, 1.1, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
              ,tuneHeight: -4
              ,css: [
                '.sIFR-root { color: #eb3a4d; text-transform: uppercase; }'
                ,'a { text-decoration: none; }'
                ,'a:link { color: #d23c4c; }'
                ,'a:hover { color: #d23c4c; }'
              ],
            });
        }

        sIFR.replace(heading, {
          selector: '#content h2'
          ,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,tuneHeight: -2
          ,css: [
            '.sIFR-root { color: #aae400; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #aae400; }'
            ,'a:hover { color: #7d878f; }'
          ],
        });

        sIFR.replace(heading, {
          selector: '#content h3'
          ,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,tuneHeight: -2
          ,css: [
            '.sIFR-root { color: #93cdff; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #93cdff; }'
            ,'a:hover { color: #93cdff; }'
          ],
        });

        sIFR.replace(heading, {
          selector: '#sidebar h3'
          ,ratios: [6, 1.24, 8, 1.17, 14, 1.1, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,wmode: 'transparent'
          ,tuneHeight: -4
          ,css: [
            '.sIFR-root { color: #ffffff; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #ffffff; }'
            ,'a:hover { color: #ffffff; }'
          ],
        });
        
    } else {

        sIFR.replace(heading, {
          selector: '.modal-content h1'
          ,ratios: [6, 1.24, 8, 1.17, 14, 1.1, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,tuneHeight: -4
          ,css: [
            '.sIFR-root { color: #eb3a4d; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #d23c4c; }'
            ,'a:hover { color: #d23c4c; }'
          ],
        });
        
        sIFR.replace(heading, {
          selector: '.modal-content h2'
          ,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,tuneHeight: -2
          ,css: [
            '.sIFR-root { color: #8b969f; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #8b969f; }'
            ,'a:hover { color: #aae400; }'
          ],
        });

        sIFR.replace(heading, {
          selector: '.modal-content h3'
          ,ratios: [9, 1.16, 16, 1.09, 24, 1.06, 37, 1.04, 74, 1.02, 1.01]
          ,tuneHeight: -2
          ,css: [
            '.sIFR-root { color: #93cdff; text-transform: uppercase; }'
            ,'a { text-decoration: none; }'
            ,'a:link { color: #93cdff; }'
            ,'a:hover { color: #93cdff; }'
          ],
        });

    }
}
