
//----Menu--------------

function logo(){
document.Account.formname.value="Logoff";
document.Account.action="log.asp";
document.Account.submit();
}

function airt(){
document.Account.Control.value="Airtime";
document.Account.submit();
//alert("wel well");
}

function stat(){
document.Account.Control.value="List";
document.Account.submit();
//alert("wel well");
}

function mont(){
document.Account.Control.value="Transfer";
document.Account.submit();
//alert("wel well");
}

function util(){
document.Account.Control.value="Utility";
document.Account.submit();
//alert("wel well");
}
function othe(){
document.Account.Control.value="Other";
document.Account.submit();
//alert("wel well");
}
function scho(){
document.Account.Control.value="School";
document.Account.submit();
//alert("wel well");
}


function newt(){
document.Account.formname.value="NewTransaction";
document.Account.action="log.asp";
document.Account.submit();
}
function pent(){
document.Account.Control.value="PendingList";
document.Account.submit();
}
function comt(){
document.Account.Control.value="CompleteTrans";
document.Account.submit();
}
function acct(){
document.Account.Control.value="Accounts";
document.Account.submit();
}
function nacc(){
document.Account.Control.value="AccountsAdd";
document.Account.submit();
//alert("wel well");
}
function prof(){
document.Account.Control.value="Profile";
document.Account.submit();
}
function pass(){
document.Account.Control.value="Passwords";
document.Account.submit();
}
function balt(){
document.Account.Control.value="Statment";
document.Account.submit();
//alert("wel well");
}
function bene(){
document.Account.Control.value="Beneficiary";
document.Account.submit();
//alert("wel well");
}

function prob(){
document.Account.Control.value="ProjectedBudget";
document.Account.submit();
//alert("wel well");
}

function listuser(){
document.Account.Control.value="ListUsers";
document.Account.submit();
//alert("wel well");
}


function listmember(){
document.Account.Control.value="ListMembers";
document.Account.submit();
//alert("wel well");
}

function listbeneficiary(){
document.Account.Control.value="ListBeneficiary";
document.Account.submit();
//alert("wel well");
}

function listvendor(){
document.Account.Control.value="ListVendor";
document.Account.submit();
//alert("wel well");
}

function listbudget(){
document.Account.Control.value="ListBudget";
document.Account.submit();
//alert("wel well");
}

function transferfund(){
document.Account.Control.value="FundsList";
document.Account.submit();
//alert("wel well");
}

function sear(){
document.Account.Control.value="RecordSearch";
document.Account.submit();
//alert("wel well");
}

function vouc(){
document.Account.Control.value="VouchersList";
document.Account.submit();
//alert("wel well");
}

function rece(){
document.Account.Control.value="ReceiptList";
document.Account.submit();
//alert("wel well");
}

function url(id){
window.location= id;
//alert("wel well");
}

//---------Notices Add--------
function addnotice(){
	//alert("wel well");
document.Account.Control.value="Notices";
document.Account.submit();
}

//---------Notices Add--------
function addwebsite(){
	//alert("wel well");
document.Account.Control.value="Websites";
document.Account.submit();
}

//---------Notices Add--------
function addresource(){
	//alert("wel well");
document.Account.Control.value="Resources";
document.Account.submit();
}

//---------Internal Data----------

//---------Show Transaction Details--------
function tran(id){
document.Account.Control.value="Transaction";
document.Account.TNumber.value=id;
document.Account.submit();
}

//---------update transaction-----
function UpTrans(id){
	//alert('what');
document.forms[id].Control.value="NewTransaction";
document.forms[id].formname.value="TransEdit";
document.forms[id].submit();
}

//---------commit transaction-----
function CommTrans(id){
document.Account.Control.value="List";
document.Account.TNumber.value=id;
document.Account.formname.value="CommitTrans";
document.Account.submit();
}

//---------Add Transaction------------------
function addTrans(id){
document.forms[id].Control.value="Transfer";
document.forms[id].formname.value="TransAdd";
document.forms[id].submit();
}


//---------Delete Transaction------------
function delTrans(id){
document.forms[id].Control.value="Transfer";
document.forms[id].formname.value="TransDel";
document.forms[id].submit();
}

//--------Add Beneficiary -------------

function addBen(){
document.Account.Control.value="BeneficiaryAdd";
document.Account.submit();

}
//--------Edit Beneficiary -------------

function editBen(id){
document.Account.Control.value="BeneficiaryEdit";
document.Account.AccountID.value=id;
document.Account.submit();

}

//--------Delete Beneficiary -------------

function delBen(id){
alert(document.forms[id].AccountID.value);
document.forms[id].Control.value="Beneficiary";
document.forms[id].formname.value="BenDel";
document.forms[id].submit();

}
//--------Edit Accounts--------------
function editAcc(id){
	//alert(document.Account.Control.value)
document.Account.Control.value="AccountsEdit";
document.Account.AccountID.value=id;
document.Account.submit();

}
//-------Delete Accounts-------------
function delAcc(id){
//alert(id);
id.Control.value="AccountsEdit";
id.formname.value="AcctDel";
//id.AccountID.value=id;
id.submit();
}
//-----------Add Acounts----------
function addAcc(id){
//alert("wel well");
id.Control.value="Accounts";
id.formname.value="AcctAdd";
id.submit();

}

//--------Edit Users----------
function useredit(id){
document.Account.Control.value="EditUsers";
document.Account.AccNumber.value=id;
document.Account.submit();
//alert("wel well");
}

//--------Edit Members------------S
function memberedit(id){
document.Account.Control.value="EditMembers";
document.Account.AccNumber.value=id;
document.Account.submit();
//alert("wel well");
}

//-------Activate Member---------
function memberAct(id){
document.Account.Control.value="MemberActivate";
document.Account.AccNumber.value=id;
document.Account.submit();
//alert("wel well");
}

//--------View Budgets -----------
function vbud(id){
document.Account.Control.value="ProjectedBudget";
document.Account.AccNumber.value=id;
document.Account.submit();
//alert("wel well");
}

//--------View Funds Transfer Details-------

function fund(id){
document.Account.Control.value="TransferFundEdit";
document.Account.TNumber.value=id;
document.Account.submit();
//alert("wel well");
}

function fundAdd(){
document.Account.Control.value="TransferFundAdd";
document.Account.submit();
//alert("wel well");
}
//-------Add Admin User------------

function useradd(){
document.Account.Control.value="AddUsers";
document.Account.submit();
}
//---------Show Constituency Details--------
function cons(id){
	//alert("wel well");
document.Account.catid.value=id;
document.Account.submit();
}
//---------Show Community Details--------
function coms(id){
	//alert("wel well");
document.Account.communityid.value=id;
document.Account.submit();
}

//---------Voucher Create ----
function cvoucher(){
document.Account.Control.value="VoucherCreate";
document.Account.submit();
}

//---------Voucher View--------
function voucher(id){
	//alert("wel well");
document.Account.Control.value="VoucherView";
document.Account.TNumber.value=id;
document.Account.submit();
}
//---------Receipt View--------
function receipt(id){
	//alert("wel well");
document.Account.Control.value="ReceiptView";
document.Account.TNumber.value=id;
document.Account.submit();
}



function PassValid(){
//alert("wel well");
	if (clip(document.PassChange.passw.value).length<=5){
       alert("Password required to be at least 5 Characters")
        document.PassChange.passw.focus();
      return false;
    }
   	if((clip(document.PassChange.passwconf.value))!= (clip(document.PassChange.passw.value))){
       alert("Please reconfirm your password!")
       document.PassChange.passwconf.focus();
        return false;
       }
}

function CheckEmail (s)
{  
    var i = 1;
    var sLength = s.length;
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }
    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    while ((i < sLength) && (s.charAt(i) != "."))
    { 
    i++
    }
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}


function clip(string)
{
        if (string.length<=0) {return('');}
        position = string.indexOf(' ');
        while (position==0) {
                string = string.substr(1, string.length-1);
                position = string.indexOf(' ');
        }
        position = string.charCodeAt(string.length-1);
        while (position==10) {
              string = string.substr(0, string.length-1);
                position = string.charCodeAt(string.length-1);
        }
        return(string);
} 


