// Initializes User Scripts:
$(document).ready(function() {
  $('input.txtSearch').focus(function() {
    if ( $(this).val() == 'Search...' ) {
      $(this).val('');
    }
  });
  $('input.txtSearch').blur(function() {
    if ( $(this).val() == '' ) {
      $(this).val('Search...');
    }
  });

  $("a.lnkBlank").click(function() {
    window.open($(this).attr("href"), 'window2', '');
    return false;
  });

  pixelsilk2.renderSkin({skin: '[' + '[Menu1]' + ']', path: ''}, function(html) {
    $("#siteMenu").after('<div id="subNavigation"></div>');
    $("#subNavigation").html(html);
    var sections = $("#subNavigation div");
    var topElements = $("#topMenu li:not(.separator)");
    for (z = 0; z < sections.length; z++) {
      var li = topElements[z];
      var lihtml = li.innerHTML;
      li.innerHTML = lihtml + sections[z].innerHTML;
    }
    $("#topMenu").navMenu({
      menuWidth: 200,
      containerElement: "#theme",
      menuElement: "ul",
      rightArrow: ' »'
    });
  });
  
  $(".listItem .listItemImage").each(function() {
    if ( $(this).attr("src") == '' || $(this).attr("src") == '/' || $(this).attr("src").substr(0, 1) == '?' ) {
      $(this).hide();
    }
  });
  if ( $("div.celebrityListItem").length ) {
    $("#mainColumn div.celebrityListItem:nth-child(3n+2)").after('<div class="clear"></div>');
  }
  
  //$("#siteMenu").after('<div id="menuBottomDivider"><img src="/green-bar-l.gif" width="15" height="30" alt="" class="left" /><img src="/green-bar-r.gif" width="15" height="30" alt="" class="right" /></div>');
  $("#content").append('<img src="/content-corner-bl.gif" width="8" height="8" alt="" class="leftCorner" /><img src="/content-corner-br.gif" width="8" height="8" alt="" class="rightCorner" />');
  $("#search").append('<img src="/search-l.gif" width="13" height="30" alt="" class="left" />');
  $("#sponsors").append('<img src="/sponsor-corner-bl.gif" width="7" height="7" alt="" class="leftCorner" /><img src="/sponsor-corner-br.gif" width="7" height="7" alt="" class="rightCorner" />');
});