jQuery(document).ready(function() {
	jQuery('head').append('<link rel="stylesheet" href="/styles/javascript_enabled.css" type="text/css" />');

	jQuery.each(['search-hubblesite','search-newscenter','search-gallery'], function(i, which) {
	  (function($) {
	    if ($('#' + which)) {
        $('#' + which + ' input[type=text]').val('search').focus(function() {
          $(this).val('').css('color', 'black').unbind();
        });
        $('#' + which).submit(function() { $('span', this).text('Searching...'); });
      }
	  }(jQuery));

	});
	//temporary fix for IE6 bug in webb telescope podcast page
	if(jQuery.browser.msie && jQuery.browser.version < 7) {return}
	if (jQuery('body.no-height-fix').length == 0) {
    jQuery('#container').css('height',
      Math.max(jQuery('nav-box-container').height(), jQuery('#container-padding').height()) +
      jQuery('#search-section-bar').height() +
      jQuery('#top-menu-container').height()
    );
  }
});

jQuery.fn.clonePosition = function(other, options) {
  options = jQuery.extend({
    setLeft: true,
    setTop: true,
    setWidth: true,
    setHeight: true,
    offsetTop: 0,
    offsetLeft: 0
  }, options);

  var offset = jQuery(other).offset();

  var css = { position: 'absolute' };
  if (options.setLeft) { css.left = offset.left + options.offsetLeft; }
  if (options.setTop) { css.top = offset.top + options.offsetTop; }
  if (options.setWidth) { css.width = jQuery(other).width(); }
  if (options.setHeight) { css.height = jQuery(other).height(); }

  jQuery(this).css(css);

  return this;
};

