﻿$(document).ready(function() {
    $("#header .tab").each(function(i) {
        $(this).append("<div class='left'></div>");
        $(this).append("<div class='right'></div>");

        if ($(this).hasClass("has-dropdown"))
            $(this).append("<div class='arrow'></div>");

        if ($(this).hasClass("selected"))
            $(this).find(".arrow").addClass("arrow-selected");
    });

    $("#header .tab .left").click(function() {
        window.location = $(this).siblings("a:first").attr("href");
    });

    $("#header .tab").mouseenter(function() {
        $(this).addClass("hovered");
        $(this).find(".arrow").addClass("arrow-hovered");
    });

    $("#header .tab").mouseleave(function() {
        $(this).removeClass("hovered");
        $(this).find(".arrow").removeClass("arrow-hovered");
        $(this).find(".dropdown").hide();
    });

    $("#header .tab .arrow").click(function() {
        $(this).siblings(".dropdown").slideToggle("fast");
    });

    $("#header .tab .arrow").mouseenter(function() {
        $(this).removeClass("arrow-selected");
        $(this).addClass("arrow-focused");
    });

    $("#header .tab .arrow").mouseleave(function() {
        $(this).removeClass("arrow-focused");
        if ($(this).parent().hasClass("selected"))
            $(this).addClass("arrow-selected");
    });

    $("#header .tab .dropdown div:not(.separator)").click(function() {
        window.location = $(this).find("a:first").attr("href");
    });

    $("#header .tab .dropdown div:not(.separator)").mouseenter(function() {
        $(this).addClass("hovered");
    });

    $("#header .tab .dropdown div:not(.separator)").mouseleave(function() {
        $(this).removeClass("hovered");
    });
});

function selectTab(tabName) {
    $("#header .tab a").each(function(i) {
        if ($(this).text() == tabName) {
            $(this).parent().addClass("selected");
            $(this).siblings(".arrow").addClass("arrow-selected");
        }
    });
}

function ShowVideos() {
    var version = swfobject.getFlashPlayerVersion();

    if (version.major < 10) 
        videoString = '<br /> <br /><br /><br /><br /><br /><br /><br /><br />Hello, you have an older version of Adobe Flash Player.<br /> <br />Get the latest<a style="color:blue" href="http://www.adobe.com/go/getflashplayer/"> Adobe Flash player</a> to view the video.'
    else 
        videoString = '<object width="680" height="435"><param name="movie" value="http://media8.dropshots.com/photos/532553/20090714/134120.flv&autostart=true"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="/images/player.swf?file=http://media8.dropshots.com/photos/532553/20090714/134120.flv&autostart=true" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="680" height="435"></embed></object>';
    $('#vidClick').attr("href", "#TB_inline?height=500&width=670&inlineId=videoPopup");
    $("#videoPopup>p").html(videoString);
}

function SwitchPics(num) {
    $(this).each(function(i) {
        $("#pluginText div").addClass("noLight");
        $("#pluginText a").addClass("fontBlue");
        $("#pluginText img").addClass("noLeft noRight");
        $("#images img").addClass("nodisplay");
    });
    $('#mid' + num).removeClass("noLight").addClass("hiLight");
    $('#img' + num).removeClass("nodisplay");
    $('#link' + num).removeClass("fontBlue").addClass("fontWhite");
    $('#l' + num).removeClass("noLeft noRight").addClass("hiLeft");
    $('#r' + num).removeClass("noLeft noRight").addClass("hiRight");
}
