    /***************************************************************** 
    *   
    *   This is the source code for the Menu Bar function.
    *  
    ******************************************************************/ 
//---------------------------------Variable input ------------------------------------ 

    /**************************************************  
    * Sets the variable values for each menu entry 
    * and to set links for each menu array.   
    *   
    **************************************************/
//Contents for menu 1
var menu1=new Array()

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="history.php">History</a>'
menu2[1]='<a href="whenfly.php">When we Fly</a>'
menu2[2]='<a href="wherefly.php">Where we Fly</a>'
menu2[3]='<a href="whatfly.php">What we Fly</a>'
menu2[4]='<a href="tuition.php">Tuition</a>'
menu2[5]='<a href="rules.php">Club Rules</a>'
menu2[6]='<a href="faq.php">F.A.Q.</a>'

var menu3=new Array()
menu3[0]='<a href="smallmap.php">Small scale Map</a>'
menu3[1]='<a href="largemap.php">Large scale Map</a>'
menu3[2]='<a href="directions.php">Directions</a>'


var menu4=new Array()

var menu5=new Array()
menu5[0]='<a href="whatyouget.php">What you Get</a>'
menu5[1]='<a href="whatitcost.php">What it Costs</a>'
menu5[2]='<a href="howtojoin.php">How to Join</a>'

var menu6=new Array()
menu6[0]='<a href="newsletter.php">News Letter</a>'
menu6[1]='<a href="noticeboard.php">Notice Board</a>'

var menu7=new Array()
menu7[0]='<a href="summerfly.php">Summer Rally 2012</a>'
menu7[1]='<a href="calender.php">Calendar</a>'

var menu8=new Array()
menu8[0]='<a href="links.php">Links</a>'
menu8[1]='<a href="converter.php">Curency Converter</a>'
menu8[2]='<a href="weather.php">Weather</a>'
menu8[3]='<a href="game.php">Games</a>'
menu8[4]='<a href="load.php">Downloads</a>'

var menu9=new Array()
menu9[0]='<a href="returns.php">Delivery/Returns</a>'
menu9[1]='<a href="privacy.php">Privacy Policy</a>'
menu9[2]='<a href="conditions.php">Conditions of Use</a>'

var menu10=new Array()
menu10[0]='<a href="video.php">Video Links</a>'
menu10[1]='<a href="photo_album.php">Photo Album</a>'
	
var menuwidth='165px' //default menu width
var menubgcolor='#293F54'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

//A simple javascript function to warn customers when they press submit on the form if it has been left blank 

function formValidation(form){
if(notEmpty(form.user)){
if(notEmpty(form.pass)){
return true;
}
}
return false;
}
function notEmpty(elem){
var str = elem.value;
if(str.length == 0){
alert("You must fill in Both your Username and Password before Login");
return false;
} else {
return true;
}
}

//-->

    /***************************************************************** 
    *   
    *   This is the source code for the Form validation function.
    *  
    ******************************************************************/ 
//---------------------------------Variable input ------------------------------------ 

    /**************************************************  
    * Sets the variable values for each form entry 
    * and alert messages for each error entry.   
    *   
    **************************************************/

var arrFormValidation=
[
[//First Name Billing Information
["maxlen=25","First Name should no be more than 25 characters"],
["minlen=1","Please Enter your First Name or Initial"],
["alpha","Only alphabetic characters expected in your First Name"]
],
[//Family Name Billing Information
["maxlen=25","Family Name should no be more than 25 characters"],
["minlen=3","Please Enter your Family Name"],
["alpha","Only alphabetic characters expected in your Family Name"]
],
[//Bill Street Address
["maxlen=30"],
["minlen=3","Please Enter your Street Address"]
],
[//Bill City 
["maxlen=25"],
["minlen=3","Please Enter your Town/City"]
],
[//Bill County
["maxlen=30"],
["minlen=2","Please Enter your County"],
["alpha","Only alphabetic characters expected in your County Name"]
],
[//Bill Country
["maxlen=30"],
["minlen=2","Please Enter your Country"]
],
[//Bill PostCode
["maxlen=10"],
["minlen=3","Please Enter your Postal Code"]
],
[//Email address Billing Information
["maxlen=30"],
["minlen=1"],
["email"," Please enter the correct Email address"]
],
[//Contact Phone Number Billing Information
["maxlen=20","Contact Phone Number should not be more than 15 characters"],
["minlen=3","Please Enter your Contact Phone Number"],
["numeric","Only numeric characters expected in your Contact Phone Number. No spaces Please"]
],
[//Credit Card Number Shipping Information
["maxlen=18","Credit Card Number should no be more than 18 characters"],
["minlen=3","Please Enter your Credit Card Number"],
["numeric","Only numeric characters expected in your Credit Card Number. No spaces Please"]
],
[//Bill Card Expiary Date
["maxlen=20"],
["minlen=3","Please Enter your Expiary Date"]
],
[//Bill Card Security Code
["maxlen=4"],
["minlen=3","Please Enter your Security Code"]
],
[//Credit Card Type Billing Information
["dontselect=0",
"Please Select your Credit Card Type"
]
]
];

//---------------------------------EMail Checker ------------------------------------ 
 

    /**************************************************
    * function validateEmail  
    * checks the validity of an email address entered 
    * using a reg expression  returns true or false 
    *   
    **************************************************/
function validateEmail(email)
{
// a very simple email validation checking.  
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

//---------------------------------Input data Checker ------------------------------------

    /**************************************************** 
     *function validateData 
     *  Checks each field in a form 
     *  Called from validateForm function 
     *****************************************************/ 
function validateData(strValidateStr,objValue,strError) 
{ 
    var epos = strValidateStr.search("="); 
    var  command  = ""; 
    var  cmdvalue = ""; 
    if(epos >= 0) 
    { 
     command  = strValidateStr.substring(0,epos); 
     cmdvalue = strValidateStr.substr(epos+1); 
    } 
    else 
    { 
     command = strValidateStr; 
    } 

    switch(command) 
    { 
        case "req": 
        case "required": 
         { 
           if(eval(objValue.value.length) == 0) 
           { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : Required Field"; 
              }//if 
              alert(strError); 
              return false; 
           }//if 
           break;             
         }//case required 
        case "maxlength": 
        case "maxlen": 
          { 
             if(eval(objValue.value.length) >  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : "+cmdvalue+" characters maximum "; 
               }//if 
               alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
               return false; 
             }//if 
             break; 
          }//case maxlen 
        case "minlength": 
        case "minlen": 
           { 
             if(eval(objValue.value.length) <  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
               }//if               
               alert(strError + "\n[Current length = " + objValue.value.length + " ]"); 
               return false;                 
             }//if 
             break; 
            }//case minlen 
        case "alnum": 
        case "alphanumeric": 
           { 
              var charpos = objValue.value.search("[^A-Za-z0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }//if 
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
                return false; 
              }//if 
              break; 
           }//case alphanumeric 
        case "num": 
        case "numeric": 
           { 
              var charpos = objValue.value.search("[^0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }//if               
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
                return false; 
              }//if 
              break;               
           }//numeric 
        case "alphabetic": 
        case "alpha": 
           { 
              var charpos = objValue.value.search("[^A-Za-z]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alphabetic characters allowed "; 
                }//if                             
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
                return false; 
              }//if 
              break; 
           }//alpha 
		case "alnumhyphen":
			{
              var charpos = objValue.value.search("[^A-Za-z0-9\-_]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": characters allowed are A-Z,a-z,0-9,- and _"; 
                }//if                             
                alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
                return false; 
              }//if 			
			break;
			}
        case "email": 
          { 
               if(!validateEmail(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = objValue.name+": Enter a valid Email address "; 
                 }//if                                               
                 alert(strError); 
                 return false; 
               }//if 
           break; 
          }//case email 
        case "lt": 
        case "lessthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+": Should be a number "); 
              return false; 
            }//if 
            if(eval(objValue.value) >=  eval(cmdvalue)) 
            { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : value should be less than "+ cmdvalue; 
              }//if               
              alert(strError); 
              return false;                 
             }//if             
            break; 
         }//case lessthan 
        case "gt": 
        case "greaterthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
              alert(objValue.name+": Should be a number "); 
              return false; 
            }//if 
             if(eval(objValue.value) <=  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : value should be greater than "+ cmdvalue; 
               }//if               
               alert(strError); 
               return false;                 
             }//if             
            break; 
         }//case greaterthan 
        case "regexp": 
         { 
            if(!objValue.value.match(cmdvalue)) 
            { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name+": Invalid characters found "; 
              }//if                                                               
              alert(strError); 
              return false;                   
            }//if 
           break; 
         }//case regexp 
        case "dontselect": 
         { 
            if(objValue.selectedIndex == null) 
            { 
              alert("BUG: dontselect command for non-select Item"); 
              return false; 
            } 
            if(objValue.selectedIndex == eval(cmdvalue)) 
            { 
             if(!strError || strError.length ==0) 
              { 
              strError = objValue.name+": Please Select one option "; 
              }//if                                                               
              alert(strError); 
              return false;                                   
             } 
             break; 
         }//case dontselect 
    }//switch 
    return true; 
} 

/********************************************************************************* 
* function validateForm 
* this function is used to validate form 
* returns false if the validation fails; true if success 
* arguments : 
*   objFrm     : the form object 
*   arrObjDesc : an array of objects describing the validations to conduct on each 
*                input item.  
*************************************************************************************/ 

function validateForm(objFrm,arrObjDesc) 
{ 
 for(var itrobj=0; itrobj < arrObjDesc.length; itrobj++) 
 { 
   if(objFrm.elements.length <= itrobj) 
   { 
        alert("BUG: Obj descriptor for a non existent form element"); 
        return false; 
   }//if 
   for(var itrdesc=0; itrdesc < arrObjDesc[itrobj].length ;itrdesc++) 
   { 
      if(validateData(arrObjDesc[itrobj][itrdesc][0], 
                 objFrm[itrobj],arrObjDesc[itrobj][itrdesc][1]) == false) 
       { 
	     objFrm[itrobj].focus();
         return false; 
       }//if 
   }//for 
 }//for 
 return true;
} 
/********************************************************************************* 
* function show(id)
* this function is used for the dropdown menu 
*************************************************************************************/ 
window.onload=show;
function show(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}



function startclock()
{
var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var AorP=" ";

if (nhours>=12)
    AorP="p.m.";
else
    AorP="a.m.";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
 nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

document.clockform.clockspot.value=nhours+":"+nmins+":"+nsecn+" "+AorP;

setTimeout('startclock()',1000);

}









