// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var last_object_id = false;

function show_ajax_region(object_id, content) {
  if (last_object_id) {
    Effect.BlindUp(last_object_id);
    if (last_object_id != object_id) {
      setTimeout(function() { create_ajax_region(object_id, content) }, 1000);
    } else {
      last_object_id = false;
    }
  } else {
    create_ajax_region(object_id, content);
  }
}

function create_ajax_region(object_id, content) {
  if ($(object_id).innerHTML == '') {
    Element.update(object_id, content);
    setTimeout(function() { enable_tinymce(object_id); }, 800);
  }
  Effect.BlindDown(object_id, 1000);
  last_object_id = object_id;
}

function enable_tinymce(object_id) {
  textareas = $(object_id).getElementsByTagName('textarea');
  for (x = 0; x < textareas.length; x ++) {
    tinyMCE.execCommand('mceAddControl', false, textareas[x].id);
  }
}

function new_window(xsize, ysize, url, name) {
  window.open(url, name, 'height='+ysize+',width='+xsize+'toolbar=no,menubar=no,status=no,scrollbars=yes,resize=yes');
  return false;
}

function enable_rotating_logo() {
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    window.document.headerFlash.SetVariable("jchloaded", 1);
  } else {
    document.headerFlash.SetVariable("jchloaded", 1);
  }
}

