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

function UploadedImageId(imgid) {
  $('new_faq').insert('<input type="hidden" name="faq[image_ids][]" value="'+imgid+'">');
}

function FCKeditor_OnComplete(editorInstance) {
  expand_textarea(editorInstance.Name+'___Frame');
}

function expand_textarea(id) {
  var current_height = ($(id).getHeight) ? $(id).getHeight() : parseInt($(id).style.height);
  var current_top = ($(id).viewportOffset) ? $(id).viewportOffset()[1] : $(id).parentNode.viewportOffset()[1];
  var offset = $('main').viewportOffset()[1] + $('main').getHeight() - current_top - current_height;
  var footer_offset = ($('ft').viewportOffset()[1] >= document.viewport.getHeight()) ? 0 : 32;
  $(id).style.height = (current_height + (document.viewport.getHeight() - current_top - current_height - offset - $('ft').getHeight() - footer_offset)).toString() + 'px';
}