try {
  document.execCommand("BackgroundImageCache", true, true)
} catch (err) {}
if (window.__noconflict) {
  jQuery.noConflict()
}(function ($) {
  $.fn.activebar = function (a) {
    a = $.fn.extend({}, $.fn.activebar.defaults, a);
    if ($.fn.activebar.container === null) {
      $.fn.activebar.container = initializeActivebar(a)
    }
    setOptionsOnContainer($.fn.activebar.container, a);
    $.fn.activebar.hide();
    $('.content', $.fn.activebar.container).empty();
    $(this).each(function () {
      $('.content', $.fn.activebar.container).append(this)
    });
    $.fn.activebar.container.unbind('click');
    if (a.url !== null) {
      $.fn.activebar.container.click(function () {
        window.location.href = a.url
      })
    }
    $.fn.activebar.container.css('top', '-' + $.fn.activebar.container.height() + 'px');
    if (a.preload) {
      var b = {
        a: 0,
        b: 0,
        c: 0,
        d: 0
      };

      function preloadInit() {
        if (b.c) {
          $.fn.activebar.show()
        }
      }
      $('<img src="/img/ie6update_close.png" class="normal">').load(function () {
        b.c = 1;
        preloadInit()
      })
    } else {
      $.fn.activebar.show()
    }
  };
  $.fn.activebar.defaults = {
    'background': '#ffffe1',
    'border': '#666',
    'highlight': '#ffffe1',
    'font': 'Bitstream Vera Sans,verdana,sans-serif',
    'fontColor': 'InfoText',
    'fontSize': '11px',
    'url': null,
    'preload': true
  };
  $.fn.activebar.state = 0;
  $.fn.activebar.container = null;
  $.fn.activebar.show = function () {
    if ($.fn.activebar.state > 1) {
      return
    }
    $.fn.activebar.state = 2;
    $.fn.activebar.container.css('display', 'block');
    var a = $.fn.activebar.container.height();
    $.fn.activebar.container.animate({
      'top': '+=' + a + 'px'
    }, a * 20, 'linear', function () {
      $.fn.activebar.state = 3
    })
  };
  $.fn.activebar.hide = function () {
    if ($.fn.activebar.state < 2) {	
      return
    }
    $.fn.activebar.state = 1;
    var a = $.fn.activebar.container.height();
    $.fn.activebar.container.animate({
      'top': '-=' + a + 'px'
    }, a * 20, 'linear', function () {
      $.fn.activebar.container.css('display', 'none');
      $.fn.activebar.visible = false
    })
  };

  function initializeActivebar(b) {
    var c = $('<div></div>').attr('id', 'activebar-container');
    c.css({
      'display': 'none',
      'position': 'fixed',
      'zIndex': '9999',
      'top': '0px',
      'left': '0px',
      'cursor': 'default',
      'padding': '4px 0',
      'font-size': '9px',
      'background': b.background,
      'borderBottom': '1px solid ' + b.border,
      'color': b.fontColor
    });
    $(window).bind('resize', function () {
      c.width($(this).width())
    });
    $(window).trigger('resize');
    if ($.browser.msie && ($.browser.version.substring(0, 1) == '5' || $.browser.version.substring(0, 1) == '6')) {
      c.css('position', 'absolute');
      $(window).scroll(function () {
        c.stop(true, true);
        if ($.fn.activebar.state == 3) {
          c.css('top', $(window).scrollTop() + 'px')
        } else {
          c.css('top', ($(window).scrollTop() - c.height()) + 'px')
        }
      }).resize(function () {
        $(window).scroll()
      })
    }
    c.append($('<div></div>').attr('class', 'close').css({
      'float': 'right',
      'margin': '0 5px 0 0 ',
      'width': '16px',
      'height': '16px',
	  'cursor':'pointer'
    }).click(function (a) {
      $.fn.activebar.hide();
	  //add a cookie to remember the state of the BetaBar
	  $.cookie('JWbetaBar', '0',{path:'/'});
	  // End Cookie
      a.stopPropagation()
    }).append('<img src="/img/ie6update_close.png" class="normal">').append('<img src="/img/ie6update_close.png" class="hover">'));
    c.append($('<div></div>').attr('class', 'content').css({
      'margin': '0px auto',
      'paddingBottom': '1px',
	  'width' :'640px'
    }));
    $('.hover', c).hide();
    $('body').prepend(c);
    return c
  }
  function setOptionsOnContainer(a, b) {
    a.unbind('mouseenter mouseleave');
    a.hover(function () {
      $(this).css({
        backgroundColor: b.highlight,
        color: "#000000"
      }).addClass('hover');
      $('.hover', a).show();
      $('.normal', a).hide()
    }, function () {
      $(this).css({
        'backgroundColor': b.background,
        color: "#000000"
      }).removeClass('hover');
      $('.hover', a).hide();
      $('.normal', a).show()
    });
    $('.content', a).css({
      'fontFamily': b.font,
      'fontSize': b.fontSize
    })
  }
})(jQuery);
jQuery(document).ready(function ($) {
	if( $.cookie('JWbetaBar')!= 0 ) {
    // do something
	  $('<div></div>').html('Ahoy there, We are now in <strong>BETA</strong> which means you can <strong>sign up</strong> to the site right now! <a href="/contact/invite/" title="Jollywatcher invite request" rel="boxy_contact">Request an invite now</a>').activebar()

}

	
	
});