var wotPlatForm="Unknown";
var wotBrowser="Unknown";
var bSetup="Unknown";
if (navigator.appVersion.indexOf("Mac") !== -1){wotPlatForm="Mac";}else{wotPlatForm="Win";}
if (navigator.userAgent.indexOf("Safari") !== -1){wotBrowser="Safari";}
if (navigator.userAgent.indexOf("Firefox") !== -1){wotBrowser="Firefox";}
if (navigator.userAgent.indexOf("Navigator") !== -1){wotBrowser="Netscape";}
if (navigator.userAgent.indexOf("Netscape") !== -1){wotBrowser="Netscape";}
if (navigator.appVersion.indexOf("MSIE") !== -1){wotBrowser="MSIE";}
if (navigator.userAgent.indexOf("Opera") !== -1){wotBrowser="Opera";}

if ((wotBrowser=="Firefox")&&(wotPlatForm=="Mac")){bSetup="Mac_Firefox";}
if ((wotBrowser=="Firefox")&&(wotPlatForm=="Win")){bSetup="Win_Firefox";}
if ((wotBrowser=="Safari")&&(wotPlatForm=="Mac")){bSetup="Mac_Safari";}
if ((wotBrowser=="Safari")&&(wotPlatForm=="Win")){bSetup="Win_Safari";}
if ((wotBrowser=="MSIE")&&(wotPlatForm=="Mac")){bSetup="Mac_MSIE";}
if ((wotBrowser=="MSIE")&&(wotPlatForm=="Win")){bSetup="Win_MSIE";}
if ((wotBrowser=="Netscape")&&(wotPlatForm=="Mac")){bSetup="Mac_Netscape";}
if ((wotBrowser=="Netscape")&&(wotPlatForm=="Win")){bSetup="Win_Netscape";}
if ((wotBrowser=="Opera")&&(wotPlatForm=="Mac")){bSetup="Mac_Opera";}
if ((wotBrowser=="Opera")&&(wotPlatForm=="Win")){bSetup="Win_Opera";}

var ie6 = (document.all && document.getElementbyID) ? true : false;
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns3 = (document.images) ? true : false;

function myUnescape(theWord){
var x=0;
var outStr ="";
var ch="";
for (x=0; x<theWord.length; x++){
  ch = theWord.substr(x,1);
  if (ch=='+') {ch=" "};
  outStr+=ch;
  }
  return outStr;
}

function putdate(){
 var thisDate=new Date();
 var thismonth=thisDate.getMonth()+1;
 if (thismonth=="1") {monthname="January"}
 if (thismonth=="2") {monthname="February"}
 if (thismonth=="3") {monthname="March"}
 if (thismonth=="4") {monthname="April"}
 if (thismonth=="5") {monthname="May"}
 if (thismonth=="6") {monthname="June"}
 if (thismonth=="7") {monthname="July"}
 if (thismonth=="8") {monthname="August"}
 if (thismonth=="9") {monthname="September"}
 if (thismonth=="10") {monthname="October"}
 if (thismonth=="11") {monthname="November"}
 if (thismonth=="12") {monthname="December"}
 var year=thisDate.getYear();
 if (navigator.appVersion.lastIndexOf('Mac') != -1) 
  if (navigator.appName == ('Microsoft Internet Explorer')) 
  var year = (thisDate.getYear());
  else var year = (thisDate.getYear()+1900);
 if ((navigator.appName=="Netscape") && (navigator.appVersion.indexOf("Win") != -1))
      var year = (thisDate.getYear()+1900);
 currentDate=monthname+' '+thisDate.getDate()+', '+year+'';
 document.write(currentDate);
}


if (document.images) {
topBtn01off = new Image(204,35);topBtn01off.src="images/topbtns/btn01_0.jpg";
topBtn01ovr = new Image(204,35);topBtn01ovr.src="images/topbtns/btn01_1.jpg";
topBtn01on =  new Image(204,35);topBtn01on.src="images/topbtns/btn01_2.jpg";
topBtn02off = new Image(204,35);topBtn02off.src="images/topbtns/btn02_0.jpg";
topBtn02ovr = new Image(204,35);topBtn02ovr.src="images/topbtns/btn02_1.jpg";
topBtn02on =  new Image(204,35);topBtn02on.src="images/topbtns/btn02_2.jpg";
topBtn03off = new Image(204,35);topBtn03off.src="images/topbtns/btn03_0.jpg";
topBtn03ovr = new Image(204,35);topBtn03ovr.src="images/topbtns/btn03_1.jpg";
topBtn03on =  new Image(204,35);topBtn03on.src="images/topbtns/btn03_2.jpg";
}

sideBtns1=new Array("Welcome","School+Facilities","Admission+Policy","School+Uniform","School+Safety","Equal+Opportunities","Staff and Governors","Contact+Us","School+News");
sideBtnsURLs1=new Array("index","facilities","admission","uniform","safety","equalopps","staff","contact","news");
sideBtns2=new Array("Teaching+Methods","Foundation Stage","Key Stage 1","Key Stage 2","English","Maths","Science","ICT","Religious+Education","Art","History","PSHE","Modern Languages","Music","After+School+Activities","Sports","Children's University");
sideBtnsURLs2=new Array("methods","foundation","ks1","ks2","english","maths","science","ict","re","art","history","pshe","languages","music","activities","sports","kidsuni");
sideBtns3=new Array("Art+Gallery","Design Technology");
sideBtnsURLs3=new Array("gallery","gallery_designtechnology");

mainBtns=new Array("About+Our+School","School+Life","School+Gallery");
mainBtnsURLs=new Array("index","methods","gallery");
mainBtnsImages=new Array("btn01","btn02","btn03");

var buttonNum;
if (wotMainSect=="1"){
if (wotPage=="index") {var buttonNum="1"};
if (wotPage=="facilities") {var buttonNum="2"};
if (wotPage=="admission") {var buttonNum="3"};
if (wotPage=="uniform") {var buttonNum="4"};
if (wotPage=="safety") {var buttonNum="5"};
if (wotPage=="equalopps") {var buttonNum="6"};
if (wotPage=="staff") {var buttonNum="7"};
if (wotPage=="contact") {var buttonNum="8"};
if (wotPage=="news") {buttonNum="9"};
}
if (wotMainSect=="2"){
if (wotPage=="methods") {buttonNum="1"};
if (wotPage=="foundation") {buttonNum="2"};
if (wotPage=="ks1") {buttonNum="3"};
if (wotPage=="ks2") {buttonNum="4"};
if (wotPage=="english") {buttonNum="5"};
if (wotPage=="maths") {buttonNum="6"};
if (wotPage=="science") {buttonNum="7"};
if (wotPage=="ict") {buttonNum="8"};
if (wotPage=="re") {buttonNum="9"};
if (wotPage=="art") {buttonNum="10"};
if (wotPage=="history") {buttonNum="11"};
if (wotPage=="pshe") {buttonNum="12"};
if (wotPage=="languages") {buttonNum="13"};
if (wotPage=="music") {buttonNum="14"};
if (wotPage=="activities") {buttonNum="15"};
if (wotPage=="sports") {buttonNum="16"};
if (wotPage=="kidsuni") {buttonNum="17"};
}
if (wotMainSect=="3"){
if (wotPage=="gallery") {buttonNum="1"};
if (wotPage=="gallery_designtechnology") {buttonNum="2"};
}

function writeHeader(){
var wHead='';
wHead+='<div id="container">';
wHead+='<div id="hBox">';
wHead+='<div id="topButtons">';

wHead+='<img src="images/topbtns/btn_bgnd_01.jpg" alt="" width="13" height="35" hspace="0" vspace="0" border="0" class="b0">';

if (wotMainSect=="1"){
wHead+='<a href="index.htm">';
wHead+='<img name="topBtn01" src="images/topbtns/btn01_1.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}
else{
wHead+='<a href="index.htm" onmouseover="glow(\'topBtn01\')" onmouseout="fade(\'topBtn01\')">';
wHead+='<img name="topBtn01" src="images/topbtns/btn01_0.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}

wHead+='<img src="images/topbtns/btn_bgnd_02.jpg" alt="" width="72" height="35" hspace="0" vspace="0" border="0" class="b0">';

if (wotMainSect=="2"){
wHead+='<a href="methods.htm">';
wHead+='<img name="topBtn02" src="images/topbtns/btn02_1.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}
else{
wHead+='<a href="methods.htm" onmouseover="glow(\'topBtn02\')" onmouseout="fade(\'topBtn02\')">';
wHead+='<img name="topBtn02" src="images/topbtns/btn02_0.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}

wHead+='<img src="images/topbtns/btn_bgnd_03.jpg" alt="" width="85" height="35" hspace="0" vspace="0" border="0" class="b0">';

if (wotMainSect=="3"){
wHead+='<a href="gallery.htm">';
wHead+='<img name="topBtn03" src="images/topbtns/btn03_1.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}
else{
wHead+='<a href="gallery.htm" onmouseover="glow(\'topBtn03\')" onmouseout="fade(\'topBtn03\')">';
wHead+='<img name="topBtn03" src="images/topbtns/btn03_0.jpg" alt="" width="204" height="35" hspace="0" vspace="0" border="0" class="b0"><'+'/a>';
}

wHead+='<img src="images/topbtns/btn_bgnd_04.jpg" alt="" width="18" height="35" hspace="0" vspace="0" border="0" class="b0">';

wHead+='</div>';//topButtons
wHead+='</div>';//hBox

wHead+='<div id="cBox">';

wHead+='<div class="navSectL fL">';
wHead+='<div id="navPanel">';

//var theSideBtns=eval("theButtons"+wotMainSect);
//var theSideBtnsUrls=eval("theButtonsURLs"+wotMainSect);
//for (var loop=0;loop<theButtons.length;loop++){
//if (buttonNum!=(loop+1)){

var secNum=1;//if more sections are to be written at once, this'd obviously change

for (var loop=0;loop<secNum;loop++){
  wHead+='<ul class="butList">';
  var theBtns=eval("sideBtns"+eval(wotMainSect));
  var theBtnsURLs=eval("sideBtnsURLs"+eval(wotMainSect));
  for (var bLoop=0;bLoop<theBtns.length;bLoop++){
    if (buttonNum!=(bLoop+1)){
      wHead+='<li class="inactive"><a href="'+myUnescape(theBtnsURLs[bLoop])+'.htm" class="bOff" title="Click here to visit ';
      wHead+='the &quot;'+myUnescape(theBtns[bLoop])+'&quot; page">'+myUnescape(theBtns[bLoop])+' </a> </li>';
    }
    else{
      wHead+='<li class="active"><a href="'+myUnescape(theBtnsURLs[bLoop])+'.htm" class="bOn" ';
      wHead+='title="Click here to reload this page">'+myUnescape(theBtns[bLoop])+' </a> </li>';
    }
  }
}
//alert(wotMainSect);
  
wHead+='</ul>';
wHead+='</div>';//navPanel

wHead+='</div>';//navSectL


wHead+='<div id="pageH">'+pageTitle+'</div>';
wHead+='<div id="textwrap">';
if (pagePic!=""){
wHead+='<img src="'+picPath+pagePic+'" alt="'+pageTitle+'" title="'+pageTitle+'" width="'+ppW+'" height="'+ppH+'" hspace="0" vspace="0" border="0" class="'+ppC+'">';
}

document.write(wHead);
}

function writeFooter(){
var wFoot='<div id="fLine"></div>';
wFoot+='</div>';//container
wFoot+='</div>';//cBox
wFoot+='<div id="fBox"></div>';
wFoot+='<div id="creditFooter">';
wFoot+='site by <a class="creditFooter" href="http://www.macdigital-uk.com/" ';
wFoot+='target="_blank" title="Click to visit macDigital">macdigital<'+'/a>';
wFoot+='</div>';//creditFooter
wFoot+='</div>';//container
document.write(wFoot);
}

function glow(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "ovr.src");
  }
}

function fade(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "off.src");
  }
}
