ns4 = (document.layers) ? true:false
ns6 = (document.getElementById) ? true:false

function opConfirm(op, msg, id) {
 if (confirm(msg)) {
  document.opForm.oper.value = op;
  
  if (op=='mail') {
   document.opForm.action = 'ak_email.php?id='+id;
   ol('', 'mail_win', 710, 500, true);
   document.opForm.target = 'mail_win';
  }
  
  document.opForm.submit();
  
  document.opForm.action = '';
  document.opForm.oper.value = '';
  document.opForm.target = '';
 }
}

function note(uid) {
 r = Math.round(Math.random()*10000000000);
 nw = window.open('ak_note.php?id='+uid+'&r='+r, 'noteedit','width=710,height=450,left=0,top=0,scrollbars=1,resizable=1,location=0');
 nw.focus();
 return false;
}

function note2(uid) {
 r = Math.round(Math.random()*10000000000);
 nw = window.open('ad_note.php?id='+uid+'&r='+r, 'noteedit','width=740,height=400,left=0,top=0,scrollbars=1,resizable=1,location=0');
 nw.focus();
 return false;
}

//Set member id
function smid(mid) {
 r = Math.round(Math.random()*10000000000);
 nw = window.open('ak_mid.php?id='+mid+'&r='+r, 'midedit','width=550,height=320,left=0,top=0,scrollbars=1,resizable=1,location=0');
 nw.focus();
 
 return false;
}

function grd(uid) {
 r = Math.round(Math.random()*10000000000);
 grdw = window.open('ak_grade.php?id='+uid+'&r='+r, 'gradeit','width=300,height=160,left=0,top=0,scrollbars=1,resizable=1,location=0');
 grdw.focus();
 return false;
}

function stf(uid) {
 r = Math.round(Math.random()*10000000000);
 stfw = window.open('ak_stufe.php?id='+uid+'&r='+r, 'stufeit','width=380,height=170,left=0,top=0,scrollbars=1,resizable=1,location=0');
 stfw.focus();
 return false;
}

function checkAll(oper) {
  if (oper=='check') { op = true; }
  else { op = false; }

  for (i=0; i<document.opForm.elements.length; i++) {
	if (document.opForm.elements[i].type == 'checkbox') {
	 if (document.opForm.elements[i].name != 'sel[]') { continue; }
//	 if (document.opForm.elements[i].name == 'p_real') { continue; }
//	 if (document.opForm.elements[i].name == 'pause_ch') { continue; }
	 
	 document.opForm.elements[i].checked = op;
	}
  }
}

function setIni(refcol) {
 document.opForm.refcol.selectedIndex = refcol;
}

function setIni2(sel, selcol) {
  for (var i=0; i<sel.length; i++) {
   if (sel.options[i].value == selcol) { sel.selectedIndex = i; break; }
  }
}


/*
function ol(url, wid, w, h) {
 alert(w+' '+h);
 if (wid == '') { wid = 'ad_pop'; }
 if (w == '') { w = 900; }
 if (h == '') { h = 800; }
 var tw = window.open(url, wid, "width="+w+",height="+h+",left=0,top=0,scrollbars=1,menubar=1,resizable=1,status=1,toolbar=1,location=1");
 tw.focus();
 
 return false;
}
*/

function ol(url, wname, w, h, simple) {
// alert(w);
 if (w == '') { w = '850'; }
 if (h == '') { h = '800'; }
 if (wname == '') { wname = 'newwin'; }
 
 if (simple == true) {
  nw = window.open(url,wname,"width="+w+",height="+h+",left=0,top=0,scrollbars=1,resizable=1,status=0");
 }
 else {
  nw = window.open(url,wname,"width="+w+",height="+h+",left=0,top=0,scrollbars=1,menubar=1,resizable=1,status=1,location=1,toolbar=1");
 }

 nw.focus();
 return false;
}


function chDateOK(id) {
 if (confirm('Forms sent Today.')) { 
  window.chDate.location.href = 'chDateOK.php?id='+id+'&r='+Math.round(Math.random() * 10000000);
 }
 return false;
}

function vsc(delta) {
 window.scrollBy(0,delta);
 return false;
}

function verData(frm) {
/*	if ((frm.kbid != undefined) && (frm.kbid.value != "") && (Number(frm.kbid.value) != frm.kbid.value)) {
		alert("Die von Ihnen eingegebene Nummer wird von unserem System nicht erkannt.");
		frm.kbid.focus();
		return false;
	}*/
	return true;
}

function ih(id, text) {
 if (ns4) {
	var lyr = (nestref)?
	eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
	lyr.open()
	lyr.write(text)
	lyr.close()
 }
 else if (ns6) { document.getElementById(id).innerHTML = text; }
 else { document.all[id].innerHTML = text; }
}
