var BIGSTAR = Class.create({

  initialize: function() {
    this.notifier_msgs = [
      //"Sign up for a free account today",
      "Get your 1st movie free",
      "Check out the new, free classifieds section",
      "Find royalty free music for all your films",
      "Burn your movies to DVD",
      "Win an iPad!",
      //"Join the Race to 1,000 friends",
      "Enter BOFF for a chance to win $50k cash",
      "Have films to sell? List them in our store!",
    ];

    this.notifier_msg_links = [
      //'/register',
      '/free-movie',
      '/classifieds',
      '/music',
      '/download',
      '/twitter',
      //'#',
      '/bigstar-online-film-festival',
      '/info/film-distribution'
    ];
  },

  processing: function() {
    var div = document.createElement('div');
    div.id = "Star_Processing";
    div.style.height = '100%';
    div.style.width = '100%';
    div.style.position = 'fixed';
    div.style.top = '0px';
    div.style.left ='0px';
    div.style.backgroundColor = '#000000';
    div.style.opacity = '0.7';
    document.body.appendChild(div);

    var divbk = document.createElement('div');
    divbk.id = "Star_Processing2";
    document.body.appendChild(divbk);

    var msg = document.createElement('div');
    divbk.appendChild(msg);

    var img = document.createElement('img');
    img.src = '/images/ajaxload.gif';
    msg.appendChild(img);
  },

  processing_die: function() {
    $('Star_Processing').remove();
    $('Star_Processing2').remove();
  },

  notification: function(msg, link, type) {

    var ScrollTop = document.body.scrollTop;
    if (ScrollTop == 0) {
      if (window.pageYOffset) ScrollTop = window.pageYOffset;
      else ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
    }

    if (ScrollTop > 40) {
      $('notifier').setStyle({
        top: '0px',
        position: 'fixed'
      });
    }

    type = !type ? 'neu' : type;
    $('BIGSTAR_STATUS').className = type;
    $('BIGSTAR_STATUS').innerHTML = '';

    var die = function() {
      Effect.DropOut('notifier');
      $('notifier').setStyle({
        position: 'static'
      });
      clearTimeout(Star.timeout);
    }

    var a = document.createElement('a');
    a.href = link;
    if (link == '#') a.onclick = die
    a.innerHTML = msg;
    $('BIGSTAR_STATUS').appendChild(a);

    Effect.SlideDown('notifier', { duration: 0.5 });

    this.timeout = setTimeout(die, 15000);
  },

});









/* Refactor plz */
function CommunityComments(hash) {
  $('m'+hash).value = '';

  var div = document.createElement('div');
  div.innerHTML = $('c'+hash).innerHTML;

  $('c'+hash).innerHTML = '';
  $('c2'+hash).appendChild(div);
}
function CommunityPost() {
  if ($('nfeed2')) {
    var div = document.createElement('div');
    div.innerHTML = $('nfeed').innerHTML;

    $('nfeed').innerHTML = '';
    var content = $('nfeed2').innerHTML;
    $('nfeed2').innerHTML = '';
    $('nfeed2').appendChild(div);
    $('nfeed2').innerHTML += content;
  }
}
function CommunityMore(link) {
  new Ajax.Request('/ajax/more/offset/'+link.title, {
    method: 'get',
    onSuccess: function(transport) {
      $('feedme').innerHTML += transport.responseText;
    }
  });

  link.title = parseInt(link.title) + 25;
}
function CommunityRemove(hash) {
  $(hash).remove();
}

$(document).observe('dom:loaded', function () 
{
});

var Star = new BIGSTAR;
