function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}



function hide(hide)
{

document.getElementById(hide).style.visibility="hidden";
}






function validname(yourvalue)
{
var namepattern = new RegExp("^[A-Z][a-z]+([ ][A-Z][a-z]+)+$","g");
if (namepattern.exec(yourvalue))
{return true;}
else return false;
}




function emailvalidation(yourvalue)
{
apos=yourvalue.indexOf("@"); 
apos2=yourvalue.lastIndexOf("@");
dotpos=yourvalue.lastIndexOf(".");
dotpos2=yourvalue.indexOf(".");
lastpos=yourvalue.length-1;
if (apos<1 || dotpos2-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2 || apos != apos2)
   {
   return false;
   }
   else return true;

}
function test(thisdata)
{


   if (validname(document.getElementById("name").value)==false)
   {
   alert('Please enter a valid full name - With each name beginning with a Capital Letter');
   document.getElementById("name").focus();
   
   }
   else{
	
		if(document.getElementById("address1").value==false)
		{
		alert("Sorry, you must enter an address");
		document.getElementById("address1").focus();
		}
		else
		{
			if(document.getElementById("town").value==false)
		{
		alert("Sorry, you must enter witch town you live in");
		document.getElementById("town").focus();
		}
		
		else
		{
			
			var dateofbirth = document.getElementById("dob").value;  
			if(dateofbirth.length != 10)
			{alert("Not");
			}	
                        else{
			var year1=dateofbirth.charAt(6);
			var year2=dateofbirth.charAt(7);
			var year3=dateofbirth.charAt(8);
			var year4=dateofbirth.charAt(9);


			var fullyear = year1+year2+year3+year4;
			var yearnow = 2008;
			var age = (yearnow - fullyear);
			
			
			}
			if(age <= 12 )
			{
			alert("Sorry, you are to young to join our school. Try again when you are older");
			}
			else if(age >= 19)
			{
			alert("Sorry, you are to old to join our school.");
			}


			else
			{
			if(document.getElementById("county").value==false)
			{
			alert("Sorry, you must enter witch county you live in");
			document.getElementById("county").focus();
			}
			else
			{
				var temp1 = document.getElementById("tel").value;
				var tel_char = temp1.charAt(0);
				if(tel_char != "0")
				{
				alert("Please enter a value telephone number, including the dialing code");
				document.getElementById("tel").focus();
				}
				else
				{
					if (emailvalidation(document.getElementById("email").value)==false)
  					{
  					 alert("Your email address contains invalid syntax ... Please include 1 @ symbol and at least 1 . symbol");
   					document.getElementById("email").focus();
   
  					}
					else
					{
	
						results=window.open("","thewindow","toolbar=no, location=no, directories=no,status = no, menubar=no, scrollbars=yes,resizable=no, width=300, height=400");
  						results.moveTo(300,130);
						results.document.write("<html><head><title>Application</title></head><body>");
						results.document.write("<p/> Thank You your applicatoin, we will be in contact with you within a few weeks");

  
 						results.document.write("<p/><a href = 'javascript:self.close()'>Close</a>");
  						results.document.write("</body></html>");
  						results.document.close();
	
					}
				}
			}
			}
		}
	}
   
}





}

function emptyvalidation(yourvalue)
{ 
   if(yourvalue=="" || yourvalue==null)
   {
   return false;
   }
else return true;
}

function optionvalidation(thedata)
{
if (!(thedata[0].checked) && !(thedata[1].checked))
{return false;
}
else return true;
}












	


























function date()
{

var now = new Date();
var day = now.getDay();
var dayte = now.getDate();
var myyear = now.getFullYear();
var mymonth = now.getMonth();
var dayname;


switch (day)
{
case 0:
dayname = "Sunday";
break;
case 1: 
dayname = "Monday"; 
break;
case 2: 
dayname = "Tuesday"; 
break;
case 3: 
dayname = "Wednesday";
break;
case 4: 
dayname = "Thursday";
break;
case 5: 
dayname = "Friday";
break;
case 6: 
dayname = "Saturday";
break;
}

switch (mymonth)
{
case 0:
monthname = "January";
break;
case 1: 
monthname = "February";
break;
case 2: 
monthname = "March";
break;
case 3: 
monthname = "April";
break;
case 4: 
monthname = "May";
break;
case 5: 
monthname = "June";
break;
case 6: 
monthname = "July";
break;
case 7: 
monthname = "August";
break;
case 8: 
monthname = "September";
break;
case 9: 
monthname = "October";
break;
case 10: 
monthname = "November";
break;
case 11: 
monthname = "December";
break;
}

string=  dayname + " "+dayte + " "+ monthname+ " "+myyear;




document.write(string);

}






function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden";
}




//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="/sports/index.htm">Sports Home</a>'
menu1[1]='<a href="/sports/news.htm">News</a>'
menu1[2]='<a href="/sports/superschools.htm">Superschools</a>'
menu1[3]='<a href="/sports/results.htm">Results</a>'


//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="/news/index.htm">Current News</a>'
menu2[1]='<a href="/news/archive.htm">News Archive</a>'



var menu3=new Array()
menu3[0]='<a href="/curriculum/index.htm">Our Curriculum</a>'
menu3[1]='<a href="/curriculum/Junior.htm">Junior</a>'
menu3[2]='<a href="/curriculum/ty.htm">TY</a>'
menu3[3]='<a href="/curriculum/senior.htm">Senior</a>'

var menu4=new Array()
menu4[0]='<a href="/ethos/index.htm">Our School Ethos</a>'
menu4[1]='<a href="/ethos/emblem.htm">Our School Emblem</a>'


var menu5=new Array()
menu5[0]='<a href="/aboutus/index.htm">About Us</a>'
menu5[2]='<a href="/aboutus/facilities.htm">Our School Facilities</a>'
menu5[3]='<a href="/aboutus/findus.htm">How To Find Us</a>'
menu5[4]='<a href="/aboutus/otherschools.htm">Other Augustinian Schools</a>'



var menu6=new Array()
menu6[0]='<a href="/teachers/index.htm">Teachers Home</a>'


var menu7=new Array()
menu7[0]='<a href="/parents/index.htm">Parents Home</a>'
menu7[1]='<a href="/parents/pa.htm">Parents Assocation</a>'
menu7[2]='<a href="/parents/polices.htm">Our Polices</a>'
menu7[3]='<a href="/parents/apply.htm">Apply For A Prospectus</a>'
menu7[4]='<a href="/parents/Prospectus.htm">View an Online Prospectus</a>'
menu7[5]='<a href="/parents/booklist.htm">Book Lists</a>'
menu7[7]='<a href="/parents/presentations.htm">Presentations</a>'





		
var menuwidth='190px' //default menu width
var menubgcolor='lightgreen'  //menu bgcolor
var disappeardelay=300  //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











