function showHideNotes(){

  document.getElementById('notes').style.display=(document.getElementById('notes').style.display=="block") ? "none" : "block";

}

function popup(url){
  myRef = window.open(url,"mywin","left=100,top=100,width=530,height=485,toolbar=0,resizable=0");
  myRef.focus();
}

function  validateNumeric( strValue ) {

  var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;

  return objRegExp.test(strValue);
}

function validate() {
  var frm = document.forms[0];
  var amount = document.getElementById("amount").value;
  var radio = document.getElementById("rdoGiftAid");
  var desc = "";
  var bValid = true;
  var bGiftAid = false;
  var bGiftAidSpecified = false;

  document.getElementById("errorMsg").innerHTML = "";

  for (var i=0; i<document.forms[0].rdoGiftAid.length; i++){ 
     if (document.forms[0].rdoGiftAid[i].checked){
       bGiftAidSpecified = true;
     } 
  } 

  if(bGiftAidSpecified){
    bGiftAid = document.getElementById("rdoGiftAid").checked;
  }else{
    bValid = false;
    document.getElementById("errorMsg").innerHTML = "Please specify your Gift Aid preference.";
  }

  if(bGiftAid){
    document.getElementById("desc").value = "Chello Foundation Donation with Gift Aid.";
  }else{
    document.getElementById("desc").value = "Chello Foundation Donation without Gift Aid.";
  }

  if(amount.length == 0){
    bValid = false;
    document.getElementById("errorMsg").innerHTML = "Please enter a donation amount";
  }else if(!validateNumeric(amount)){
    bValid = false;
    document.getElementById("errorMsg").innerHTML = "Please enter a numeric donation amount";
  }

 
  return bValid;

}
