/* ---------------------------------------
 * Filename: engine.js
 * Version: 1.5.0 (2010-9-25) yyyy-mm-dd
 * Description: script configurations and document onload functions - multiple dependencies
 * Website:
 * Author: Anthony Eggert - http://www.stylephreak.com
 ----------------------------------------- */
var Stylephreak = { 

  // Link Treatments
    treatLinks: function() { 
    // Link Treatment - Find all links with external designations and open them in a new window (validates Strict)
        $('a[rel="external"]').click(function() {
            window.open($(this).attr('href'));
            return false;
        }); 
        // Link Treatment - Appends the class 'selected' to the current navigation link's parent.  
        $("#nav a").each(function() {
            var hreflink = $(this).attr("href");
            if (hreflink.toLowerCase() == location.href.toLowerCase()) {
                $(this).parent("li").addClass("selected");
            }
        });
    },
  
    // NivoSlider
    nivoSlider: function() {  
    setTimeout(function(){
      $('#slider .nivoSlider').nivoSlider({
        effect:'random', //Specify sets like: 'fold,fade,sliceDown'
        slices:8,
        directionNav:false,
        animSpeed:1000,
        pauseTime:5000,
        captionOpacity: 1
      });
    }, 500);
    },
  
  //tabs
  buildTabs: function() {
    $("ul.tabs").tabs("div.panes > div.pane", {
      effect: 'fade',
      history: true
    });
  }
}

// functions to run when the DOM is ready
$(document).ready(function() {
    Stylephreak.treatLinks();  
  Stylephreak.nivoSlider();  
  Stylephreak.buildTabs();
  Shadowbox.init();
});
// functions to run after page is fully loaded
$(window).load(function() {  

});

// wait for the DOM to load using jQuery
$(function() {
  
  // setup player normally
  $f("player1", "http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf", {
  
    // clip properties common to all playlist entries
    clip: {
      baseUrl: 'http://edmontonfootclinic.com/videos/',
      subTitle: 'Step Ahead',
      time: '20 sec'
    },
    
    // our playlist
    playlist: [
      {
        url: 'AngelaBittnerTestimonialVideo.flv',
        title: 'Angela Bittner Testimonial',
        thumbnail: '/videos/thumbs/angela.jpg'
      },  
      {
        url: 'BettySawchenkoTestimonialVideo.flv',
        title: 'Betty Sawchenko Testmonial',
        thumbnail: '/videos/thumbs/betty.jpg'
      },  
      {
        url: 'BrianDoranVideoTestimonials.flv',
        title: 'Brian Doran Testimonial;',
        thumbnail: '/videos/thumbs/brian.jpg'
      },
      {
        url: 'JillDoranVideoTestimonials.flv',
        title: 'Jill Doran Testimonial',
        thumbnail: '/videos/thumbs/jill.jpg'
      },
      {
        url: 'PeterKershawVideoTestimonials.flv',
        title: 'Peter Kershaw Testimonial',
        thumbnail: '/videos/thumbs/peter.jpg'
      }
    ],
    
    // show playlist buttons in controlbar
    plugins: {
      controls: {
        playlist: true
      }
    }
  });
  
  /*
    here comes the magic plugin. It uses first div.clips element as the 
    root for as playlist entries. loop parameter makes clips play
    from the beginning to the end.
  */
  $f("player1").playlist("#testimonial_videos:first", {loop:false});
  
});

