function filterSubmit(p,f) {
  f.pager.value = p;
  f.submit();
}

function filterSubmit1(p, f) {
  f.page.value = p;
  f.submit();
}
function filterSubmit2(p, f) {
  f.page_number.value = p;
  f.submit();
}

function actionSubmit(opt, p, f) {
  f.pager.value = p;
  f.option.value = opt;
  f.submit();
}


function confirmActionSubmit(opt,p,f) {
  if(confirm("Do you really want to delete this account?\nAfter deleting, the data is not recoverable!"))
  {actionSubmit(opt,p,f);}
}

function updateMembership(opt,f) {
  f.action = "membershipForm.do";
  f.option.value = opt;
  f.submit();
}

function submitWithPrompt(f){
  alert('action will be saved!');
  f.submit();
}

function checkAll2(obj,objCheck,bCheck) {
  objCheck.checked = bCheck;
  checkAll(obj,objCheck);
}

function checkAll(obj,objCheck) {
 var cb = obj;//getElementsById("add_flag");
   if(cb.length>0){
  for(i=0; i<cb.length; i++) {
    cb[i].checked = objCheck.checked;
    }} else cb.checked = objCheck.checked;
  }

function onReminder(obj) {//alert(obj.checked);
  var form = obj.form;
  var flag = obj.checked;
  form.remind_date.disabled = !flag;
  form.remind_time.disabled = !flag;
}

function newWindow(url)
{
  window.open(url,'Win','width=600,height=500,menubar=1,location=1,status=1,resizable=1,toolbar=1,scrollbars=1');
}

function refreshParent() {
  window.opener.location.reload()
}
function closeWindow(){
//window.opener='X';
window.open('','_parent','');
window.close();
}
function prepareClose(){
  //alert("here");
  refreshParent();
  closeWindow();
  //setTimeout("1000","closeWindow");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  //alert(document.getElementById("top1").offsetTop);
  //document.getElementById("sub1").style.left = document.getElementById("top1").offsetLeft

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v;
	    //obj.posTop = document.getElementById("top1").offsetTop;
		}
}
function checkAll(obj,bCheck) {
  var cb = obj;//document.getAllElementsById(obj);
  if(cb.length>0){
  for(i=0; i<cb.length; i++) {
    cb[i].checked = bCheck;
  }} else cb.checked = bCheck;
}
function confirmDelete() {
  return confirm("Record no recoverable! Are you sure you want to delete it permenantly?");
}

function calTotal(obj,totalObj)
{
  var total = 0;
  if(obj.length>0) {
    for (i =0; i<obj.length; i++){
      total += checkCal(obj[i]);
    }
  } else {
    total = checkCal(obj);
  }
  totalObj.value = total.toFixed(2);
}

function checkCal(obj) {
  var temp = obj.value;
  var fval = 0;
  if(''!=temp) {
    fval = parseFloat(temp);
    if (isNaN(fval)) {
      alert("data must be in numaric");
      obj.value='';
      fval = 0;
    }
  }
  return fval;
}
function textEdit(f, obj_name, obj_name2)
{
//alert(obj_name);
//alert(obj_name2);
   var obj = eval("f."+obj_name);
//alert(obj.value);
   var message = obj.value;

   var str = "/texteditor/textEditorForm.jsp?fname="+f.name+"."+obj_name+"&dname="+obj_name2;
//alert(str);
   window.open(str,"","height=620,width=750px,scrollbars=0,status=no,toolbar=0,resizable=no");
   return false;
}
