// fcsl-stuff.js - (c) Florida Coastal School of Law 2008
// webmaster@fcsl.edu
// version: 1.3.0
// This should be the place for JS stuff so that you don't have to
// constantly edit the theme file.  Just include me and any other
// supporting JS libraries and CSS and you're done.


// ChangeLog:
// 2008-12-28:
//	  *  Widened the thickbox for MSIE users, removing the horizontal scrollbar.
// 2008-11-11:
//    *  Changed flash embed method.  Now requires a specific version.  Clean.
//    *  Cleaned up some of the old comments to make everything sort of less
//       psyhcopathic looking.  I'm all for a progression of events, but it
//       it just doesn't look that good.  Events should really be put up here
//       so that it's not all willy-nilly.
//    *  Updated version to 1.3.0
// 2008-10-29:
//    *  Changed flash video player theme to "nacht".  Seems to look a little
//       better.
// 2008-08-26:
//    *  Initial ChangeLog Entry.
//    *  Cleaned up code a little, redid some commenting


// TODO:
//    *  check for data _before_ creating the top warning area.
//       *  in that same vein, check for singular content before tickering.
//    *  stop the cycling when you close the bar.


// N.B.: Probably smarter to load this guy *after* all the supporting
// libraries as you may run into some funny issues if you don't.

// N.B.2.: This is all jQuery, so, if you're not familar with it, you might
// wanna hit up http://docs.jquery.com/.

$(document).ready(function() {
    // When the DOM is done doing it's thing.

    // Lazy loading of jQuery Plugins
    // $.lazy("/sites/all/inlcudes/js/jquery.newsticker.pack.js", "Newsticker");

    // Probably just easier overall to do it by tagging the
    // li with an ID then shoving the link code in there with .html()
    // this allows me to generate a link while maintaining a <noscript>
    // presence in the li for js-less users that get shoved to a
    // downloader php script.
    // $("#coastal-experience").html("<a id='coastal-video-link' class='thickbox'>\"COASTAL EXPERIENCE\" VIDEO</a>");

    // The New Deal (tm).  Due to the fantastic flash embed jquery module, we're able to pass things
    // along in a little bit of a more-sane fashion. http://jquery.lukelutman.com/plugins/flash/
    // We no longer pass a big 'ole ugly <embed> tag though .html() -- Hooray!
    // While we could have used SWFObject, I'm pretty sold on doing JS with jQuery almost
    // exclusively.  Makes mouth's happy!
    // if ( $("#coastal-experience-video").length > 0 ) {
    //    $("#coastal-experience-video").flash(
    //                                         {
    //                                         src: '/sites/all/includes/js/mediaplayer/player.swf',
    //                                         width: 424, height: 240,
    //                                         flashvars: {
    //                                                     height: 240, width: 424,
    //                                                     file: 'http://www.fcsl.edu/media/video/FCSL.flv',
    //                                                     searchbar: false, autostart: true,
    //                                                     // skin: '/sites/all/includes/js/mediaplayer/nacht.swf',
    //                                                     plugins: 'hd-1',
    //                                                     'hd.file': 'http://www.fcsl.edu/media/video/coastal-experience.mp4',
    //                                                     allowfullscreen: false, logo: '/media/video/video-logo.png'
    //                                                     }
    //                                         },
    //                                         { version: 8 }
    //                                         );
    // }
    // 
    // // Now, lets remove the target and href attributes from
    // // the link, as we can well assume that if you have a browser
    // // that supports jQuery, then the thickbox will work for you
    // $("#coastal-video-link").removeAttr("target").removeAttr("href");
    // 
    // // when you click on it, launch it.
    // $("#coastal-video-link").click(function(){
    //     tb_show("Coastal Law Experience", "#TB_inline?height=260&amp;width=430&amp;inlineId=coastal-experience-video");
    // });


    // And now for something completely different...

    // lets look for document links and make sure they get opened in a new
    // window, as that is the prefered method for people -- apparently
    $("a[href~='pdf']").attr("target", "_new");
    $("a[href~='doc']").attr("target", "_new");
    $("a[href~='docx']").attr("target", "_new");
    $("a[href~='xls']").attr("target", "_new");
    $("a[href~='xlsx']").attr("target", "_new");
    $("a[href~='ppt']").attr("target", "_new");
    $("a[href~='pptx']").attr("target", "_new");
    $("a[href~='pps']").attr("target", "_new");
    $("a[href~='ppsx']").attr("target", "_new");
    $("a[href~='wpd']").attr("target", "_new");
    $("a[href~='catalog']").attr("target", "_new");


    // Misc enhancements that make the site more better :p

    // Page topper alert
    // Update 2008-08-18
    // Made it more ninja-active.  It now fades between alerts, allowing
    // me to create a custom ticker that shows up when there are alert items
    // in the referenced file.  OMG AJAX!!!!!!!!!!!!!!11111!!11one
    //$("body").prepend("<div title='Click to Close' id='top-warning'></div>");
    // Build the top bar
    //$.get (
    // "/sites/all/includes/html/news-ticker.html", {}, function(data)
    // {
         // $("#top-warning").append(data).find("ul").newsTicker(5000);
    //     $("#top-warning").append(data).find("ul");
    // }
   // ); // This gets the HTML from the file that we use for building the top
       // warning ticker.
    //$("#top-warning").click(function(){
     // *click* go away!
     //$(this).hide();
    //});
});

