function _toTheTop(){
  this.speed = 800;
  this.css = {
    width           : '100px',
    border          : '1px solid #939393',
    background      : '#f7f7f7',
    'text-align'    : 'center',
    padding         : '5px',
    'border-radius' : '4px',
    position        : 'fixed',
    bottom          : '10px',
    right           : '10px',
    cursor          : 'pointer',
    color           : '#333',
    'box-shadow'    : 'none',
    'font-family'   : 'verdana',
    'font-size'     : '11px',
    'z-index'       : '11001'
  }
  this.css_hover = {
    border          : '1px solid #c6c6c6',
    'box-shadow'    : '0 2px 2px #ddd'
  }
}
_toTheTop.prototype = {
  init : function(){
    var self = this;
    var a = $('<div>')
              .attr('id','toTheTop')
              .html('^ Back to Top')
              .css(self.css)
              .hide()
              .prependTo('body');
  	$(window).scroll(function() {
  		if($(this).scrollTop() != 0) {
  			a.fadeIn();	
  		} else {
  			a.fadeOut();
  		}
  	});
    a.hover(function(){a.css(self.css_hover)},function(){a.css(self.css)});
  	a.click(function() {
  		$('body,html').animate({scrollTop:0},self.speed);
  	});	
  }
}
var toTheTop = new _toTheTop();
$(function(){
  toTheTop.init();
});

