function getMessageContent(id)
{
  return FCKeditorAPI.GetInstance(id).GetData() ;
}

function setMessageContent(id, value)
{
  return FCKeditorAPI.GetInstance(id).SetData(value) ;
}


function isString(a)
{
  return typeof(a) == 'string';
}

function isUrl(ctrl)
{
  var str = ctrl.value ;
  if (str.substring(0, 7).toLowerCase() != "http://".toLowerCase())
    str = "http://" + str ;
  var filter=/^(http:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?)$/i 
  return filter.test(str) ;
}

function previousPage(targetId)
{
  var loc = location.toString(); 
  if (isString(targetId) && targetId.length > 0 && loc.indexOf('#'+targetId) > 0) 
  {
    history.go(-2);
  }
  else 
  {
    history.go(-1);
  }
}

function upcaseAccent(obj) 
{
  var txt = obj.value;
  txt = txt.replace(/\xc0/gi,"A'");
  txt = txt.replace(/\xc1/gi,"A'");
  txt = txt.replace(/\xc8/gi,"E'");
  txt = txt.replace(/\xc9/gi,"E'");
  txt = txt.replace(/\xcc/gi,"I'");
  txt = txt.replace(/\xcd/gi,"I'");
  txt = txt.replace(/\xd2/gi,"O'");
  txt = txt.replace(/\xd3/gi,"O'");
  txt = txt.replace(/\xd9/gi,"U'");
  txt = txt.replace(/\xda/gi,"U'");
  obj.value = txt;
}

function arrangeText(ctrl)
{
  ctrl.value = ctrl.value.toUpperCase() ;
  upcaseAccent(ctrl) ;
}

function lowerText(ctrl)
{
  ctrl.value = ctrl.value.toLowerCase() ;
}

function isTimeString(ctlHour, ctlMin) 
{
  var ora = ctlHour.value.replace(/ /gi,'');
  var min = ctlMin.value.replace(/ /gi,'');
  
  if (ora.length == 0 && min.length == 0)
   return true ;
   
  if ((!isNaN(ora) && ora<24 && ora>=0 && ora!='') && 
      (!isNaN(min) && min<60 && min>=0 && min!=''))
     return true;
   else
     return false;
}