function BrowserUpdate(conteiner){
  if(jQuery.browser.msie && jQuery.browser.version.substr(2,1) < "10"){
    this.conteiner = conteiner;
    
    this.barra;
    this.btfechar;

    this.init();
  }
};

BrowserUpdate.prototype.init = function() {
  this.createDom();
};

BrowserUpdate.prototype.createDom = function() {
  var versionBrowser;

  if(jQuery.browser.mozilla) versionBrowser = "Navegador";
  if(jQuery.browser.msie) versionBrowser = "Navegador";

  var dom ="<div id='barra-BrowserUpdate'>";
  dom +="<div id='barra-BrowserUpdate-content' style='float:left;padding-left:10px;'>";
  dom +="<p><strong>O Site não funciona corretamente no seu navegador atual </strong><br />";
  dom +="Para uma melhor visualiza&ccedil;&atilde;o do site escolha outro navegador clicando nos bot&otilde;es ao lado.</p>";
  dom +="<ul>";
  if(jQuery.browser.msie){

    dom +="<li><a href='http://br.mozdev.org/download/' class='barra-BrowserUpdate-ff' title='Mozilla Firefox'><img src='/img/firefox.jpg' alt='Mozilla Firefox' /></a></li>";
  }
  else{
    dom +="<li><a href='http://br.mozdev.org/download/' class='barra-BrowserUpdate-ff' title='Mozilla Firefox'><img src='/imagens/firefox.jpg' alt='Mozilla Firefox' /></a></li>";
    dom +="<li><a href='#' class='barra-BrowserUpdate-ie' title='Internet Explorer 8'><img src='"+this.base_url+"/img/firefox.jpg' alt='Internet Explorer' /></a></li>";
  }
  dom +="<li><a href='http://www.google.com/chrome/eula.html?hl=pt-BR' class='barra-BrowserUpdate-gc' title='Google Chrome 4'><img src='/img/google_chrome.jpg' alt='Google Chrome' /></a></li></ul>";
  dom +="<a href='#' class='barra-BrowserUpdate-fechar' title='Fechar'>fechar</a>";
  dom +="</div>";
  dom +="</div>";
  $(this.conteiner).append(dom);

  this.barra = $("#barra-BrowserUpdate");
  this.btfechar = $(".barra-BrowserUpdate-fechar", this.barra);
  this.createStyle();
};

BrowserUpdate.prototype.createStyle = function() {
  this.barra.css({
    'background' : '#f0f0f0',
    'display' : 'none',
    'font-family' : 'arial',
    'margin' : '0',
    'padding' : '50px 0',
    'position' : 'relative',
    'width' : '100%'
  });
  $("#barra-BrowserUpdate-content", this.barra).css({
    'height' : '40px',
    'margin' : '0 auto',
    'width' : '940px'
  });
  $("strong", this.barra).css({
    'color' : '#333',
    'font-size' : '14px'
  });
  $("p", this.barra).css({
    'color' : '#666',
    'float' : 'left',
    'font-size' : '12px',
    'line-height' : '18px',
    'margin' : '2px 20px 0 0',
    'text-align' : 'left'
  });
  $("li", this.barra).css({
    'float' : 'left',
    'list-style' : 'none',
    'margin-right' : '5px'
  });
  $("a", this.barra).css({
    'background' : '#fff url('+this.base_url+'/images/browser-update/sprite-bt.gif) no-repeat 0 0',
    'display' : 'block',
    'height' : '40px',
    'outline' : 'none',
    'overflow' : 'hidden',
    'width' : '150px'
  });
  this.btfechar.css({
    'background' : 'url('+this.base_url+'/images/browser-update/bt-close.gif) no-repeat 0 0',
    'height' : '15px',
    'position' : 'absolute',
    'right' : '5px',
    'text-indent' : '-99999px',
    'top' : '5px',
    'width' : '15px'
  });
  this.creatEvents();
};

BrowserUpdate.prototype.creatEvents = function() {
  $(window).resize(function() {
    $("#barra-BrowserUpdate").css({
      'width' : $(window).width() + 'px'
    });
    $(".barra-BrowserUpdate-fechar", "#barra-BrowserUpdate").css({
      'right' : '5px'
    });
  });
  this.barra.slideDown('slow');
  $("a", this.barra).bind('mouseover', function() {
    $(this).css({
      'background-position' : '0 -40px'
    });
  }).bind('mouseout', function() {
      $(this).css({
        'background-position' : '0 0'
      });
    }).bind('mousedown', function() {
      $(this).css({
        'background-position' : '0 -80px'
      });
      $(this).children('img').css({
        'margin-top' : '1px'
      });
    });
  this.btfechar.bind('click', function() {
    $("#barra-BrowserUpdate").slideUp('slow', function() {
      $(this).css({
        'display' : 'none'
      });
      $(this).remove();
    });
    return false;
  }).bind('mouseover', function() {
    $(this).css({
      'background-position' : '0 -15px'
    });
  }).bind('mouseout', function() {
    $(this).css({
      'background-position' : '0 0'
    });
  }).bind('mousedown', function() {
    $(this).css({
      'background-position' : '0 -30px'
    });
  });
};

