﻿$(document).ready(function() {
    /* Start the news ticker on the start page */
    $('#headlines').innerfade({
        animationtype: 'fade',
        speed: 750,
        timeout: (EPiConfig.NewsFadeDelay * 1000),
        type: 'sequence',
        pause_selector: $('#headlines')
    });


    // start the services presentation scroller
    $('#services').presentation();


    // create the modal backdrop on document load so all modal tooltips can use it
    $('<div id="qtip-blanket">')
      .css({
          position: 'absolute',
          top: $(document).scrollTop(), // use document scrollTop so it's on-screen even if the window is scrolled
          left: 0,
          height: $(document).height(), // span the full document height...
          width: '100%', // ...and full width

          opacity: 0.3, // make it slightly transparent
          backgroundColor: 'black',
          zIndex: 5000  // make sure the zIndex is below 6000 to keep it below tooltips!
      })
      .appendTo(document.body) // append to the document body
      .hide(); // hide it initially


    // defuscate all email addresses
    // the obfuscation pattern is firstname(dot)lastname(at)precio.(dot).se
    $("a[href^='mailto']").each(function(i) {
        $(this).mailDefuscator();
    });
});
