var cwu_enabled = true
;

var cwu_display_delay = 2000;
var cwu_hide_delay = 9000;
var cwu_arrow_visible = false;
var cwu_cookie = 'cwu_htmlblender';

window.addEvent('resize', function(){
    cwuCheckAndDisplayArrow();
});

window.addEvent("domready", function(){
    if(cwu_enabled){
        setTimeout("cwuCheckAndDisplayArrow()", cwu_display_delay);
    }
});

function cwuCheckAndDisplayArrow()
{
    var cwu_c = ReadCookie(cwu_cookie);
    if(cwu_c == '1'){
        return;
    }

    cwuDisplayArrow();
    if(!cwu_arrow_visible){
        cwu_arrow_visible = true;
        setTimeout("cwuHideArrow()", cwu_hide_delay);
        WriteCookie(cwu_cookie, '1', 1);
    }
}

function cwuHideArrow()
{
    var cwu = new Fx.Style('cwu', 'opacity', {duration: 2000}).addEvent('onComplete', function(){
        document.getElementById('cwu').style.display = 'none';
    });
    cwu.start(1, 0);
}

function cwuDisplayArrow()
{
    var cwu = $('cwu');
    var fx = new Fx.Styles(cwu, {duration: 2000, wait: false});
    fx.options.transition = Fx.Transitions.Elastic.easeInOut;

    fx.start({
        'left': [window.getScrollWidth() - 470],
        'top': [47]
    });
}

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;
}