function checkRadio(objrd) {
 var bIsChecked = false;
	for (var i = 0; i < objrd.length; i++) {
		if (objrd[i].checked) {
			bIsChecked = true;
			break;
		}
	}
	return bIsChecked;
}

// Check whether a string is empty
function isEmpty(s)
{
	return( (s == null) || (s.length == 0) )
}

// Check email address validity
function isEmailAddr(email)
{
	var check = /^.+@.+\..{2,4}$/;

	if ( check.test(email) )
		return true;
	else
		return false;
}


function ViewDetail(key, frm){
	frm.action = 'profile_display.asp';
	frm.key.value = key;
	frm.act.value = 1;
	frm.submit();
}

function ViewOneMBA(key, frm){
	frm.action = 'profile_display.asp';
	frm.key.value = key;
	frm.act.value = 2;
	frm.submit();
}

function EditDetail(key, frm){
	frm.action = 'profile_alumni.asp';
	frm.key.value = key;
	frm.submit();
}

function EditOneMBA(key, frm){
	frm.action = 'profile_onemba.asp';
	frm.key.value = key;
	frm.submit();
}

function DeleteAlumni(key, frm){
	if (confirm("Are you sure to delete this?")){
	frm.action = 'proc_staff.asp';
	frm.key.value = key;
	frm.mod.value = "5";
	frm.submit();
	}
}

function DeleteOneMBA(key, frm){
	if (confirm("Are you sure to delete this?")){
	frm.action = 'proc_staff.asp';
	frm.key.value = key;
	frm.mod.value = "10";
	frm.submit();
	}
}

function AddAdmin(type,frm){
	username = (prompt("Please input the username:", ""));
	pass = (prompt("Please input the password:", ""));
	if (username!="" && pass!=""){
	frm.action = 'proc_staff.asp';
	frm.key.value = username;
	frm.key2.value = pass;
	frm.key3.value =type;
	frm.mod.value = "8";
	frm.submit();}
	else{
		alert("Both username and password cannot be blank.");
	}
}

function ChangeAdmin(key, type, frm){
	new_pass = (prompt("Please input the new password:", ""));
	re_pass = (prompt("Please confirm the new password:", ""));
	if (new_pass==re_pass && new_pass.length > 0){
	frm.action = 'proc_staff.asp';
	frm.mod.value = "6";
	frm.key.value = key;
	frm.key2.value = type;
	frm.key3.value = new_pass;
	frm.submit();}
	else{
		alert("Two password are not match.");
	}
}

function DeleteAdmin(key, type, frm){
	if (confirm("Are you sure to delete this?")){
	frm.action = 'proc_staff.asp';
	frm.key.value = key;
	frm.key2.value = type;
	frm.mod.value = "7";
	frm.submit();
	}
}

function genUser(){
	if (confirm("You are going to generate the username and password for new user(s), are you sure to continue?")){
	window.open('gen_user.asp','_self');
	}
}

function AddrLabel(f)
{
	hWnd = window.open('print_address.asp?act=1', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="print_address.asp?act=1";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}

function AddrLabel_OneMBA(f)
{
	hWnd = window.open('print_address.asp?act=2', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="print_address.asp?act=2";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}

function AddrLabel_Both(f)
{
	hWnd = window.open('print_address.asp?act=2', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=600,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="print_address.asp?act=3";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}

function GetEmail(f)
{
	hWnd = window.open('send_email.asp?act=1', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=540,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="send_email.asp?act=1";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}

function GetEmail_OneMBA(f)
{
	hWnd = window.open('send_email.asp?act=2', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=540,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="send_email.asp?act=2";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}

function GetEmail_Both(f)
{
	hWnd = window.open('send_email.asp?act=2', 'selectWin', 'toolbar=0,location=0,directories=0, status=1,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=540,height=580'); 
	if ((document.window != null) && (!hWnd.opener))
		hWnd.opener = document.window;
	f.action="send_email.asp?act=3";
	f.target="selectWin";
	f.submit();
	hWnd.focus();
}
function Exportdata()
{
	window.open('export_data.asp', '_self'); 

}

function Exportdata_s()
{
	window.open('export_data_s.asp', '_self'); 

}

function Exportdata_OneMBA()
{
	window.open('export_data_onemba.asp', '_self'); 

}

function Exportdata_OneMBA_s()
{
	window.open('export_data_onemba_s.asp', '_self'); 

}

function Exportdata_Both()
{
	window.open('export_data_both.asp', '_self'); 

}

function Exportdata_Both_s()
{
	window.open('export_data_both_s.asp', '_self'); 

}

function Event_Delete(key, frm){
	if (confirm("Are you sure to delete this?")){
	frm.action = 'proc_staff.asp';
	frm.key.value = key;
	frm.mod.value = "16";
	frm.submit();
	}
}

function Event_Edit(key, frm){
	frm.action = 'event_edit.asp';
	frm.key.value = key;
	frm.submit();
}

function Event_List(key, frm){
	frm.action = 'event_detail.asp';
	frm.key.value = key;
	frm.submit();
}

function EventAlu_Delete(key, key2, key3, frm){
	if (confirm("Are you sure to delete this?")){
	frm.action = 'proc_staff.asp';
	frm.key.value = key;
	frm.key2.value = key2;
	frm.key3.value = key3;
	frm.mod.value = "17";
	frm.submit();
	}
}

function EventAlu_Edit(key, key2, key3, frm){
	frm.action = 'event_detail_edit.asp';
	frm.key.value = key;
	frm.key2.value = key2;
	frm.key3.value = key3;
	frm.submit();
	
}

function Event_Export(key, frm){
	
	frm.action = 'export_data_event.asp';
	frm.key.value = key;
	frm.submit();
}

function Event_Import(key, frm){
	
	frm.action = 'event_import.asp';
	frm.key.value = key;
	frm.submit();
}