var profitPuller_enabled = true
;

var profitPuller_display_delay = 2000;
var profitPuller_hide_delay = 9000;
var profitPuller_arrow_visible = false;
var profitPuller_cookie = 'profitPuller_profitpuller';

window.addEvent('resize', function(){
    profitPullerCheckAndDisplayArrow();
});

window.addEvent("domready", function(){
    if(profitPuller_enabled){
        setTimeout("profitPullerCheckAndDisplayArrow()", profitPuller_display_delay);
    }
});

function profitPullerCheckAndDisplayArrow()
{
    var profitPuller_c = ReadCookie(profitPuller_cookie);
    if(profitPuller_c == '1'){
        return;
    }

    profitPullerDisplayArrow();
    if(!profitPuller_arrow_visible){
        profitPuller_arrow_visible = true;
        WriteCookie(profitPuller_cookie, '1', 1);
    }
}

function profitPullerHideArrow()
{
    var profitPuller = new Fx.Style('profitPuller', 'opacity', {duration: 2000}).addEvent('onComplete', function(){
        document.getElementById('profitPuller').style.display = 'none';
    });
    profitPuller.start(1, 0);
}

function profitPullerDisplayArrow()
{
    var profitPuller = $('profitPuller');
    var fx = new Fx.Styles(profitPuller, {duration: 2000, wait: false});
    fx.options.transition = Fx.Transitions.Elastic.easeInOut;

    fx.start({
        'left': [window.getScrollWidth() - 300],
        'top': [315]
    });
}

function ReadCookie(name)
{
  var val = "";
  var sch = name + "=";

  if(document.cookie.length > 0){
    offs = document.cookie.indexOf(sch);
    if(offs != -1){
      offs += sch.length;
      end = document.cookie.indexOf(";", offs);
      if(end == -1){ end = document.cookie.length; }
      val = unescape(document.cookie.substring(offs, end));
    }
  }

  return val;
}

function WriteCookie(name, val, tm)
{
  var expire = "";
  if(tm != null){
    expire = new Date((new Date()).getTime() + tm * 28800);
    expire = "; expires=" + expire.toGMTString();
  }

  document.cookie = name + "=" + escape(val) + expire;
}
