var alreadySubmitted = false;
var m = 'href=mailto:';

function FormOnSubmit(formID)
{
   if(alreadySubmitted){
       alert(alertDowbleClick);
       return false;
   }
   alreadySubmitted = true;
   formID.submit();
}


function CheckMemo(formID)
{
   if (Rtrim(Ltrim(formID.memo1.value)) == '')
   {
       alert(alertEmptyData);
       return false;
   }else{
       FormOnSubmit(formID);
   }
}


function Rtrim(str) {
  var notSp = 0;
  for (var i = str.length - 1; i >= 0; i--) {
    if (str.charAt(i) != ' ' && str.charAt(i) != '\t') {
      notSp = ++i;
      break;
    }
  }
  str = str.substring(0, notSp);
  return str;
}


function Ltrim(str) {
  var notSp = 0;
  while (str.charAt(notSp) == ' ') notSp++;
  str = str.substring(notSp, str.length);
  if (str.charAt(0) == ' ') str = '';
  return str;
}


var maintimerId, Limit;
function maintimer() { 
    if (Limit){
       window.document.SendForm.rtime1.value = alertNextRow;
       window.document.SendForm.rtime3.value = alertSec;
       clearTimeout(maintimerId);
       window.document.SendForm.rtime2.value = Limit;
       Limit -= 1;
       maintimerId = setTimeout("maintimer()",1000);
    }else{
        clearTimeout(maintimerId);
        window.document.SendForm.rtime1.value = '';
        window.document.SendForm.rtime2.value = '';
        window.document.SendForm.rtime3.value = '';
        return;
    }
}

function open_child(scriptname,w,h) {
  var newPath;
  newPath = scriptname;
  ca_window = open(newPath, "MyWin","resizable=no,scrollbars=no,width="+w+",height="+h+",top=50,left=150");
  ca_window.focus();
  return false;
}

