//********************************************************************************
//********************************************************************************
// Version 01.00 - 28/04/2006
// Version 01.10 - 26/05/2006 - Change FormatPanelNo to FormatAskHHld
// Version 01.20 - 08/09/2009 - Change FormatAskHHld to v4 format
//
// This file contains some routines specific to this application
//********************************************************************************
//********************************************************************************


//********************************************************************************
//    Author: Steve Betts
//      Date: Mar 2006
//      Desc: Validate the form fields.
//            This master function calls a series of sub-functions, each of which
//            checks a single form field.
//
// Amendment:
//********************************************************************************
function ValidateForm(p_oForm, p_sAction) {

 if (p_sAction == "10CHECKPANEL") {
    var why = "";
    why += CheckPanelNo(p_oForm.ePanelNo.value);

    if (why != "") {
       alert(why);
       return false;
    }
 }

 return true;
}

function CheckPanelNo (p_sValue) {
 var sError = "";
 var sValue = Trim(p_sValue);

 if (sValue == "") {
    sError = "No Panel Number has been entered.\n";
 }
 return sError;
}       


//********************************************************************************
//    Author: Steve Betts
//      Date: Mar 2006
//      Desc: FormatAskHhld
//            Returns a formatted entry for Activity List for an AskHhld action
//
// Amendment:
//********************************************************************************
function FormatAskHhld (p_sPanelNo) {
 var sAskHhld='-[A01]-00000000000000000000?'+p_sPanelNo;
 return sAskHhld;
}       

//********************************************************************************
//    Author: Steve Betts
//      Date: Oct 2005
//      Desc: NoEnter
//            Traps the [Enter] key to prevent a form from being submitted
//
// Amendment:
//********************************************************************************
function NoEnter() {
  return !(window.event && window.event.keyCode == 13); 
}


//********************************************************************************
//    Author: Steve Betts
//      Date: Mar 2006
//      Desc: ShowActionLog
//            Unhides the action log
//
// Amendment:
//********************************************************************************
function ShowActionLog() {
 var element;
 element = document.getElementById("divActionLog");
 element.style.display = "inline";
 element.style.visibility = "visible";
 element = document.getElementById("aActionLog")
 element.style.display = "none";
 element.style.visibility = "hidden";
}


//********************************************************************************
//    Author: Steve Betts
//      Date: Mar 2006
//      Desc: ShowErrorList
//            Unhides the error list
//
// Amendment:
//********************************************************************************
function ShowErrorList() {
 var element;
 element = document.getElementById("divErrorList");
 element.style.display = "inline";
 element.style.visibility = "visible";
}


