function move(i) {
  return function() {
    $('#activity'+i).remove().css('display', 'none').prependTo('#items');
  }
}
function shift() {
  var toShow = (i + showing) % count;
  $('#activity'+toShow).slideDown(1000, move(i));
  $('#activity'+i).slideUp(1000, move(i));
  i = (i + 1) % count;
  setTimeout('shift()', delay);
}

function home_page_start_carousel() {
  setTimeout('shift()', delay);
}

function fetch_featured_events(featured_events_link) {
 change_to_wait_cursor("#featured_events_box");
 $.ajax({ type: 'GET',
          url: featured_events_link,
          success: paste_featured_results,
          dataType: 'html'
        });
}

function paste_featured_results(data,textStatus,xhr_request) {
  $("#featured_events").html(data);
  change_to_auto_cursor("#featured_events_box")
}

function change_to_wait_cursor(ele) {
  $(ele).css('cursor','wait');
}

function change_to_auto_cursor(ele) {
  $(ele).css('cursor','auto');
}

function VideoLaunch(params) {
    $("a#VideoLink").trigger('click');
}

$(document).ready(function() {
    $("a[rel^='prettyPhoto']").prettyPhoto({
        opacity: 0.60, /* Value between 0 and 1 */
        theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
        autoplay: false /* Automatically start videos: True/False */
    });
});

function hide_text_on_click(id){
    try{$(id).value="";
    $(id).setAttribute("onclick","");
    return false;
}catch(e){}}

function numbersonly(e, decimal) {
       return false;
    }

function num_characters_changed(text_area,text_limit_count,update_field) {
    if(update_field) {
        if (text_limit_count-text_area.value.length<0) {
            update_field.update("0");
            text_area.value = text_area.value.slice(0,text_limit_count);
        }
        else {
            update_field.update(text_limit_count-text_area.value.length);
        }
    }
}


var load_hotgames = function(hotgames_path, tz){
 $.ajax({
  type: 'GET',
  url: hotgames_path,
  data: { tz : tz }});
}

function hide_or_show_fields(type)
{
if(type=='message')
{
$('banner').hide();$('message').show();$('target').show();$('trigger').show();$('h_40').hide()
}
else
{
 $('message').hide();$('banner').show();$('target').hide();$('trigger').hide();$('h_40').show();$('period').show()
}
}