// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function initEditor(id){
  tinyMCE.idCounter=0;
  tinyMCE.execCommand('mceAddControl', true, id);
}
// Call triggerSave to collect the input data in the TinyMCE test editor to your plain vanilla textarea
// and remove the control for the text area.
function killEditor(id){
  tinyMCE.triggerSave(true,true);
  tinyMCE.execCommand('mceRemoveControl', true, id);
}

function getUrlParams(parameter) { 
  var loc = location.search.substring(1, location.search.length);
  var param_value = false;

  var params = loc.split("&");
  for (i=0; i<params.length;i++) {
    param_name = params[i].substring(0,params[i].indexOf('='));
    if (param_name == parameter) {
      param_value = params[i].substring(params[i].indexOf('=')+1)
    }
  }
  if (param_value) {
    return param_value;
  }
  else {
    return false; //Here determine return if no parameter is found
  }
}
