
jQuery.preloadImages = function()
{
    for(var i = 0; i<arguments.length; i++)
    {
        jQuery("<img>").attr("src", arguments[i]);
    }
}

var email_cleared = false;
function read_more_on()
{
    elem_hover_on("#tweets_footer");
    elem_hover_on("#read_more");
}
function read_more_off()
{
    elem_hover_off("#tweets_footer");
    elem_hover_off("#read_more");
}
function footer_on()
{
    elem_hover_on("#footer_footer");
    elem_hover_on("#wwlat");
}
function footer_off()
{
    elem_hover_off("#footer_footer");
    elem_hover_off("#wwlat");
}
function elem_hover_on(elem)
{
    $(elem).css("background-color", "#ffffff");
}
function elem_hover_off(elem)
{
    $(elem).css("background-color", "#ffef00");
}
function init_email()
{
    if (!email_cleared)
    {
        $("#subscribe_email").val("");
        $("#subscribe_email").css("color", "black");
        email_cleared = true;
    }
}
function go_email()
{
    if ($("#subscribe_email").val() == "" || $("#subscribe_email").val() == "Email...")
    {
        alert("Please enter a valid email address.");
        return;
    }
    window.location="email.php?email="+$("#subscribe_email").val();
}
function submit_email_on_enter(event)
{
    if (event.keyCode == 13) go_email();
}
function news_scroll(index)
{
    $("#news_choice").scrollTop(index*31);
}
function video_scroll(index)
{
    $("#video_choices").scrollTop(index*151);
}
function lit_on()
{
    $("#top_logo").attr("src", "images/top_logo_lit.png");
}
function lit_off()
{
    $("#top_logo").attr("src", "images/top_logo.png");
}
var pic = new Image(940,93); 
pic.src = "images/top_logo_lit.png"; 

function link_swap(type)
{
    $("#link_"+type).attr("src", "links_lit/"+type+".png");
}
function link_swap_out(type)
{
    $("#link_"+type).attr("src", "links/"+type+".png");
}
function go_pic(name)
{
 $.ajax({
   type: "GET",
   url: "photo.php",
   data: {name: name},
   success: function(msg){
    $("#pic_current").html(msg);
   }
 });
}
function expand_month(month, year)
{
    $(".month").hide();
    $("#month_"+month+"_"+year).show();
}

var share_showing = false;

function share_toggle()
{
    if (share_showing)
    {
        $("#share_drop").hide();
        share_showing = false;
    }
    else
    {
        $("#share_drop").show();
        share_showing = true;
    }
}

function news_snip_on()
{
    elem_hover_on("#news_snip_footer");
}
function news_snip_off()
{
    elem_hover_off("#news_snip_footer");
}

function share_on_index()
{
    elem_hover_on("#featured_footer");
    elem_hover_on("#video_info_footer_share");
}
function share_off_index()
{
    elem_hover_off("#featured_footer");
    elem_hover_off("#video_info_footer_share");
}

function share_on()
{
    elem_hover_on("#video_info_footer");
    elem_hover_on("#video_info_footer_share");
}
function share_off()
{
    elem_hover_off("#video_info_footer");
    elem_hover_off("#video_info_footer_share");
}
function init_types()
{
    $("#type_all").css({"font-weight": "bold"});
}

function videos_from(type)
{
    $("#video_types > a").css({"font-weight": "normal"});
    $("#type_"+type).css({"font-weight": "bold"});

    $.ajax({
      type: "GET",
      url: "/videostype.php",
      data: {type: type},
      success: function(msg)
      {
        $("#video_choices").html(msg);
      }
    });
}

$.preloadImages("links_lit/about.png", "links_lit/email_us.png", "links_lit/extras.png", "links_lit/news.png", "links_lit/videos.png", "images/top_logo_lit.png");

