// Initializes User Scripts:

$(document).ready(function() {

  // Selects text in Search Box when focused:
  $('input.txtSearch').focus(function() {
    this.select();
  });

  // Footer Links - pop up in new window / tab:
  $('a#smartzLink').click(function() {
    window.open($(this).attr("href"), 'window2', '');
    return false;
  });

    pixelsilk2.renderSkin({skin: '[' + '[Menu1]' + ']', path: ''}, function(html) {
    $('#subNavigation').html(html);
    var sections = $('#subNavigation div');
    var topElements = $('#Menu li:not(.separator)');
    for (z = 0; z < sections.length; z++) {
      var li = topElements[z];
      var lihtml = li.innerHTML;
      li.innerHTML = lihtml + sections[z].innerHTML;
    }
    $('#Menu').navMenu({
      menuWidth: 200,
      containerElement: "#theme",
      menuElement: "ul",
      rightArrow: ' »'
    });
  });

  if ( document.getElementById('column2') ) {
    var pad = 40;
    if ($("#column1 .columnInner").height() + pad > $("#column2 .columnInner").height()) {
      $("#column2 .columnInner").height($("#column1 .columnInner").height() + pad);
    } else {
      $("#column1 .columnInner").height($("#column2 .columnInner").height() - pad);
    }
  } else {
    $("#column1").width(900);
  }
});
