// function is needed to create scope - do not want to muck up the global namespace
(function() {
    function setClickFix(flashObject){
        var flashElement = flashObject.getFlashElement();
        var navLinkHref = flashElement.parentNode.href;
        location.href=navLinkHref;
    }
    
    var interstateExtraLight = {
        src: '/westin/sIFR/interstateExtraLight.swf'
    };

    var interstateLight = {
        src: '/westin/sIFR/interstateLight.swf'
    };

    sIFR.activate(interstateExtraLight, interstateLight);

    if (location.href.indexOf("/careers/") != -1) {
        sIFR.replace(interstateLight, {
            selector: 'a.secondaryFeaturedLinkCareers',
            forceSingleLine: false,
            fitExactly :false,
            offsetTop :0,
            tuneHeight :-8,
            transparent: true,
            sharpness: 10,
            forceWidth:true,
            css: ['.sIFR-root {color: #858379;}']
        });
    }

    //sIFR.debug.ratios(interstateExtraLight, {
    if (location.href.indexOf("/property/") == -1 && location.href.indexOf("/westin/index") == -1) {
        sIFR.replace(interstateExtraLight, {
            selector: 'h1',
            ratios:[6, 1.72, 8, 1.54, 9, 1.38, 10, 1.32, 12, 1.29, 16, 1.21, 22, 1.16, 23, 1.15, 33, 1.14, 36, 1.13, 56, 1.12, 58, 1.11, 62, 1.12, 95, 1.11, 96, 1.1, 100, 1.11, 101, 1.1, 102, 1.11, 106, 1.1, 109, 1.11, 117, 1.1, 118, 1.11, 1.1],
            forceSingleLine: false,
            fitExactly :false,
            transparent: true,
            thickness: -100,
            offsetLeft: -2,
            sharpness: 10,
            css: ['.sIFR-root {color: #827668; text-transform: lowercase; leading: -9; letter-spacing: -1;}']
        });
    }

    //sIFR.debug.ratios(interstateExtraLight, {
    sIFR.replace(interstateExtraLight, {
        selector: '#primaryHeader h2',
        ratios:[6, 1.72, 8, 1.54, 9, 1.38, 10, 1.32, 12, 1.29, 16, 1.21, 22, 1.16, 23, 1.15, 33, 1.14, 36, 1.13, 56, 1.12, 58, 1.11, 62, 1.12, 95, 1.11, 96, 1.1, 100, 1.11, 101, 1.1, 102, 1.11, 106, 1.1, 109, 1.11, 117, 1.1, 118, 1.11, 1.1],
        forceSingleLine: false,
        fitExactly :false,
        transparent: true,
        sharpness: 10,
        css: ['.sIFR-root {color: #827668; text-transform: lowercase;}']
    });

    //sIFR.debug.ratios(interstateExtraLight, {
    sIFR.replace(interstateExtraLight, {
        selector: '#standardView h2',
        ratios:[6, 1.72, 8, 1.54, 9, 1.38, 10, 1.32, 12, 1.29, 16, 1.21, 22, 1.16, 23, 1.15, 33, 1.14, 36, 1.13, 56, 1.12, 58, 1.11, 62, 1.12, 95, 1.11, 96, 1.1, 100, 1.11, 101, 1.1, 102, 1.11, 106, 1.1, 109, 1.11, 117, 1.1, 118, 1.11, 1.1],
        forceSingleLine: false,
        fitExactly :false,
        transparent: true,
        sharpness: 10,
        css: ['.sIFR-root {color: #827668; text-transform: lowercase;}']
    });

    sIFR.replace(interstateLight, {
        ratio:[8, 1.3, 9, 1.22, 10, 1.25, 15, 1.22, 20, 1.17, 28, 1.16, 31, 1.15, 41, 1.14, 46, 1.13, 47, 1.14, 68, 1.13, 74, 1.12, 75, 1.13, 1.12],
        selector: '#globalNav li a.navLink',
        forceSingleLine: true,
        fitExactly :true,
        transparent: true,
        sharpness: -100,
        thickness: 125,
        onRelease : setClickFix,
        css: ['.sIFR-root {color: #827668; text-transform: lowercase; letter-spacing:.5; cursor: pointer;}']
    });

    if (location.href.indexOf("/programs/") != -1) {
        sIFR.replace(interstateExtraLight, {
            selector: '#enrollNowContainer h2',
            transparent: true,
            sharpness: 10,
            thickness: 80,
            css: ['.sIFR-root { color: #827668; text-transform: lowercase; letter-spacing:.5;}']
        });
    }

    if (location.href.indexOf("/westin/index") != -1) {
        sIFR.replace(interstateLight, {
            selector: '#findAndBookFormContainer h3',
            transparent: true,
            forceSingleLine: true,
            sharpness: 10,
            css: ['.sIFR-root {color: #827668; text-transform: lowercase;}']
        });
        sIFR.replace(interstateLight, {
            selector: '#headerWelcomeMessage h3',
            transparent: true,
            forceSingleLine: true,
            sharpness: 10,
            css: ['.sIFR-root {color: #827668; text-transform: lowercase;}']
        });
    }
})();

