﻿function loadInSIFR() {

    var myriadprolight = { src: '/fonts/MyriadPRO_Light_2_center.swf' };

    //sIFR.debugMode = true;
    sIFR.delayCSS = true;

    sIFR.activate(myriadprolight);

    sIFR.replace(myriadprolight, { selector: '#Eonic_Home_Page .linebox h2.title', wmode: 'transparent', css: ['.sIFR-root {color:#440c6c;text-align: left;font-size: 35px;padding:0;}'], tuneHeight: 0, offsetTop: 0, offsetLeft: 0 });
    sIFR.replace(myriadprolight, { selector: '.module h2.title', wmode: 'transparent', css: ['.sIFR-root {color:#440c6c;text-align: left;font-size: 26px;padding:0;}'], tuneHeight: 0, offsetTop: 0, offsetLeft: 0 });
    sIFR.replace(myriadprolight, { selector: '.box h2.title', wmode: 'transparent', css: ['.sIFR-root {color:#440c6c;text-align: left;font-size: 26px;padding:0;}'], tuneHeight: 0, offsetTop: 0, offsetLeft: 0 });
    sIFR.replace(myriadprolight, { selector: '#Eonic_Home_Page .carouselbox h2.title', wmode: 'transparent', css: ['.sIFR-root {color:#440c6c;text-align: left;font-size: 28px;padding:0;}'], tuneHeight: 0, offsetTop: 0, offsetLeft: 0 });
}



$(document).ready(function () {

    //Change text on all morelinks to say read more (without &gt; arrow) and remove hidden child span.
    // WTF ROB! Fix the HTML first!!! - WH
    //$('.morelink a').text('read more').children().remove();


    /*
    $('.morelink a span.hidden').each(function() {
    $(this).html('Read More<span class="linkright">&#160;</span>');
    });

    */

    function getLoginBrief(href) {
        ajaxSelector = 'href';
        randomVar = Math.floor(Math.random() * 150);
        href = href + '?getLoginForm' + '=&forceNewRequest=' + randomVar;
        show_modal();
    }

    /**/

    $('a[rel=modal]').livequery('click', function (e) {
        e.preventDefault();
        href = $(this).attr('href');
        getLoginBrief(href);
    });





    //THE FUNCTIONS

    function close_modal() {

        //hide the mask
        $('#mask').fadeOut(500);

        //hide modal window(s)
        $('#modal_content').fadeOut(500);

    }

    function show_modal() {

        //set display to block and opacity to 0 so we can use fadeTo
        $('#mask').css({ 'display': 'block', opacity: 0 });

        //fade in the mask to opacity 0.8
        $('#mask').fadeTo(500, 0.8);

        //show the modal window
        $('#modal_content').fadeIn(500);

    }


    $('.close_modal').click(function () {

        close_modal();

    });


    // Case study project visuals functionality

    $('#picDetail a.thumb').click(function (e) {
        e.preventDefault();

        var picId = $(this).attr('id').substr(5);

        if (!$('#pic' + picId).is(':visible')) {
            // fade all detail images out
            $('#picDetail a.lightbox').each(function () {
                $(this).fadeOut();
            });
            // locate this AnswersList and open
            $('#pic' + picId).fadeIn();
        }
    });
});
