/* --------------------------------------------------------------------------------------------------------- */
function fnDoAction(_action)
{
  window.location.href = 'Workspace.php?action=' + _action;
}
/* --------------------------------------------------------------------------------------------------------- */
function fnOnSubmit(_form,_action)
{
	switch(_action)
	 {
	  case "E":
                _form.exeAction.value="SE";
                _form.submit();
                //alert(_action);
	  break;

	  case "DE":
		_form.exeAction.value="DE";
	        _form.submit();
	        //alert(_action);
	  break;

	  case "N":
	        _form.exeAction.value="N";
	        _form.submit();
	        //alert(_action);
	  break;

	  default:
		_form.exeAction.value="N";
		//alert('Default ' + _action);
                _form.submit();
                //alert('Nothing passed');
                //alert(_form);
	  break;

	 }
}
/* --------------------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------------------- */
function fnAddNewProject()
{
        document.getElementById('Action').value = 'N';
        document.getElementById('txtPrjName').value = "";
        document.getElementById('txtPrjDesc').value = "";
        document.getElementById('txtPrjCustomer').value = "";
        document.getElementById('txtPrjCustomerAdd').value = "";
        document.getElementById('txtPrjCustomerPhone').value = "";
        document.getElementById('txtPrjCustomerFax').value = "";
        document.getElementById('txtPrjCustomerEmail').value = "";
        document.getElementById('txtPrjStartDate').value = "";
        document.getElementById('spNew').style.visibility="visible";
}
/* --------------------------------------------------------------------------------------------------------- */
function fnGetStudentScore(_stat)
{
        var _sel_stat = _stat;
        var _sel_stat_parsed = _sel_stat.split("/");
        document.forms.frmAddEditScores.exeAction.value = _sel_stat_parsed[1];
        document.forms.frmAddEditScores.StudentFullName.value = _sel_stat.substring(0,_sel_stat.indexOf("/"));
}
/* --------------------------------------------------------------------------------------------------------- */
function fnGetClassGrade(_class)
{
        var _sel_class = _class;
        var _sel_class_parsed = _sel_class.split("-");
        document.forms.frmAddEditStudents.txtStudentGrade.value = _sel_class_parsed[1];
}
/* --------------------------------------------------------------------------------------------------------- */
function fnGetClassPeriod(_class)
{
        var _sel_class = _class;
        var _sel_class_parsed = _sel_class.split("/");
        //alert(_sel_class_parsed[1]);
        document.forms.frmAddEditScores.txtClassPeriod.value = _sel_class_parsed[1];
}

/* --------------------------------------------------------------------------------------------------------- */
function fnShowSearch(_search,_hide)
  {
    document.getElementById(_search).style.visibility="visible";
    document.getElementById(_hide).style.visibility="hidden";
  }
/* --------------------------------------------------------------------------------------------------------- */
function fnCheckAction()
{
        if(document.all.selMenus.value == "X")
                {
                 alert('Invalid Action Selection');
                 return;
                }
        else
                {
                  window.location.href=selMenus.value;
                }
}
/* --------------------------------------------------------------------------------------------------------- */
function fnValidateEnduranceSeconds()
{
  if(document.forms.frmAddEditScores.EnduranceRunS.value >= 60)
    {
      alert('You can enter up to 59 seconds for this field');
      //document.forms.frmAddEditScores.EnduranceRunS.value = "";
      //document.forms.frmAddEditScores.EnduranceRunS.onfocus();
      return;
    }
}
/* --------------------------------------------------------------------------------------------------------- */
function DoCal(_target)
 {
    var sRtn;
    sRtn = showModalDialog("Calendar.html","","center=yes;resizable:no;scroll:no;status:no;dialogWidth=300px;dialogHeight=300px;dialogLeft:300;dialogTop:200");
    _target.value = sRtn;
 }

/* --------------------------------------------------------------------------------------------------------- */
function fnCreateUserID(_fname, _lname)
 {
        var v_fname = _fname;
        var v_lname = _lname;
        var v_uid = _fname.substring(0,1) + v_lname;
	return(v_uid);

 }
/* --------------------------------------------------------------------------------------------------------- */
function fnPersistFirstCapital(_text)
{
	var v_text = _text.substring(0,1).toUpperCase() + _text.substring(1);
	return(v_text);
}

/* --------------------------------------------------------------------------------------------------------- */
function fnOpenWindow(_param)
{
	//alert(_param);
	var settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=200,left=100,top=100";
        //window.open("PageAdmin.php?user=TOrabi" ,"YourlinkWeb Timekeeping",settings);
        window.open('PageAdmin.php?user='+_param,'Timekeeping',settings);
}
/* --------------------------------------------------------------------------------------------------------- */
function fnUserProfile(_param)
{
	//alert(_param);
	var settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=400,left=200,top=200";
        //window.open("PageAdmin.php?user=TOrabi" ,"YourlinkWeb Timekeeping",settings);
        window.open('../wkspc/UserProfile.php?user='+_param,'Timekeeping',settings);
}