<!-- Hide script from older browsers
var win_width;
var win_height;
var win_left;
var win_top;
var itmName;
var chqAmount=0;
var frmWin=undefined;
var popWin=undefined;
var popWinFile='';

function setItmType(itm) {
  itmName=itm;
  frmWin=window.open("../shop/order/orderform.html", "OrderForm","top=50px,left=100px,width=570px,height=570px,resizable=no,scrollbars=yes,menubar=no");
  frmWin.focus();
}
function fmtValue(aValue) {
  valStr=Math.round(aValue*100).toString();
  n=valStr.length;
  return valStr.substring(0, n-2)+'.'+valStr.substring(n-2, n);
}
function frmWinReset(){
  frmWin=undefined;
}
function openWin(fname, isResizeable) {
// Check for popup already open
 popWinClose(popWin);
 popWinFile=fname;

 win_width=(window.screen.width/2);
 if (win_width<510) {win_width=510;}
 win_height=(window.screen.height/2);
 if (win_height<450) {win_height=450;}

 win_left=(window.screen.width-win_width)/2;
 win_top =(window.screen.height-win_height)/2;
 win_opts="left="+win_left+",top="+win_top+",width="+win_width+",height="+win_height+",scrollbars=yes";
 if(isResizeable) {win_opts+=",resizable=yes";}
 if((fname.indexOf('.jpg')!= -1) || (fname.indexOf('.gif')!=-1)) {
  popWin=window.open("","gw",win_opts);

var theDoc=popWin.document;
  with(theDoc) {
   open();
   writeln('<HTML>');
   writeln('<HEAD>');
   writeln('<TITLE>'+fname+'</TITLE>');
   writeln('</HEAD>');
   writeln('<BODY BGCOLOR="#FFFFFF">');
   writeln('<P ALIGN="CENTER"><IMG SRC="'+fname+'" ALT=""></P>');
   writeln('</BODY>');
   writeln('</HTML>');
   close();
  }
 }
 else {popWin=window.open(fname,"gw",win_opts);}
}

function Capitalize(elem) {
  elem.value=elem.value.toUpperCase();
}
function showPage(fname, hdr, pdf, ctrlpage) {
var ext=(pdf)?'.pdf':'.htm';
if(fname.indexOf('.swf')!=-1) {ext='';}
var itemname=fname+ext;
var hdrpage=(hdr && (ctrlpage==undefined))?'controls.htm':ctrlpage;
var d=new Date();
var months=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var yr=(document.all) ? d.getYear() : d.getYear() + 1900;
var hdrsize=(!pdf & hdr)? 80 : 0;

// Check for popup already open
 popWinClose(popWin);
 popWinFile=fname;

 win_width=(window.screen.width>800)?800:(window.screen.width-100);
 win_height=(window.screen.height-150);
 win_left=(window.screen.width-win_width)/2;
 win_top=(window.screen.height-win_height)/2;

var opts='top='+win_top.toString()+',left='+win_left.toString()+',width='+win_width.toString()+',height='+win_height.toString()+',resizable=yes';
  popWin=window.open("","pw",opts);
var theDoc=popWin.document;
 with(theDoc) {
  open();
  writeln('<HTML>');
  writeln('<HEAD>');
  writeln('<TITLE>RSAF Apprentice Association '+months[d.getMonth()]+' '+yr.toString()+'</TITLE>');
  writeln('</HEAD>');
  writeln('<FRAMESET ROWS="'+(hdrsize).toString()+',*" BORDER="0" FRAMESPACING="0" FRAMEBORDER="0">');
  writeln('<FRAME SRC="'+hdrpage+'" SCROLLING="NO" NAME="upper">');
  writeln('<FRAME SRC="'+itemname+'" NAME="lower">');
  writeln('<NOFRAMES>');
  writeln('<BODY BGCOLOR="#FFFFFF" onUnload="javascript:parent.opener.popWinClose(self);">');
  writeln('<P><I>This document requires a browser that can view frames.</I></P>');
  writeln('</BODY>');
  writeln('</NOFRAMES>');
  writeln('</FRAMESET>');
  writeln('</HTML>');
  close();
 }
}
function loadPage(pageName) {
  top.document.frames["main"].location.replace(pageName);
}
function popWinClose(winObj){
  if(winObj!=null) {winObj.close();}
}
function PDForSWF(fileType) {
 var theFile;
 switch(fileType) {
 case 1: theFile="../constitution/rsaf_const"; break;
 case 2: theFile="../forms/application_form"; break;
 case 3: theFile="./roll_of_honour"; break;
 case 4: theFile="./all_apprentices_list"; break;
 case 5: theFile="./models_and_projects_list"; break;
 case 6: theFile="./jacob_grieb"; break;
 case 7: theFile="./jimmy_squires"; break;
 default: theFile="../heritage/poems/poem_"+(parseInt(fileType)-20).toString();
 }
 var res=confirm("If you have already installed Flash Player in your web browser - Click OK\notherwise click CANCEL");
 if(res) {document.location.href=theFile+".swf";}
 else {
   res=confirm("In this case...\nIf you have Adobe Reader installed and can view PDF files then Click OK\notherwise click CANCEL");
   if(res) {document.location.href=theFile+".pdf";}
   else {
     alert("You will need to download a FREE version of Flash Player or Adobe Reader from our Links Page");
     window.open("../links/links.html", "");}
   }
}
// End hiding script -->