/*---------------------------------------------------*/
/* NeoCMS Core File : js_general.js                  */
/*                                                   */
/* These are general functions                       */
/*                                                   */
/*---------------------------------------------------*/

function action_confirm(question,targeturl) {
// This function asks the user a question and
// if they click OK they directed to targeturl
  if (confirm(question)) {
    document.location = targeturl;
  }
//Usage
//<a href=\"javascript:action_confirm('Are you sure you wish to do that?','test.php');\" title=\"Delete Confirmation\">  
}

function checkAllold(checkname, flag) {
// This function checks or unchecks all the checkboxes named 'checkname'
// flag = 1 checked
// flag = 0 unchecked
  for (i = 0; i < checkname.length; i++) {
    if (flag==1) {
    checkname[i].checked = true;
    } else {
    checkname[i].checked = false;    
    }
  }
}

function checkAll(myForm,mycheckbox,myflag) {
    var theForm = myForm;
    for (i=0; i<theForm.elements.length; i++) {
        if (theForm.elements[i].name==mycheckbox)
            theForm.elements[i].checked = myflag;
    }
}