<!-- 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=50,left=100,width=1000,height=650,resizable=yes,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, wSize) {
// Check for popup already open
 popWinClose(popWin);
 popWinFile=fname;
 wWidth=-1;
 wHeight=-1;
 if(wSize!=null) {
   wDims=wSize.split(':');
   if(wDims[0]!=null) {wWidth=parseInt(wDims[0].split('=')[1], 10);}
   if(wDims[0]!=null) {wHeight=parseInt(wDims[1].split('=')[1], 10);}
 }
 win_width=(wWidth==-1) ? (window.screen.width/2) : wWidth;
 win_height=(wHeight==-1) ? (window.screen.height/2) : wHeight;
 if(wSize==null) {
   if (win_width<510) {win_width=510;}
   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(docType) {
 var theFile;
 var theFileExt;
 if(isNaN(docType)==true) {theFile=docType;}
 else {
  switch(docType) {
  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_"+(docType-20).toString();
  }
 }
  var res=confirm("If you have Adobe Reader installed and can view PDF files then Click OK\notherwise click CANCEL");
  if(res) {theFileExt=".pdf";}
  else {
   res=confirm("In this case...\nIf you have already installed Flash Player in your web browser - Click OK\notherwise click CANCEL");
     theFileExt=".swf";
  }
  if(res) {
   alert('Depending on your Internet connection speed - these items may take several minutes to download');
   document.location.href=theFile+theFileExt;
  }
  else {
   alert("You will need to download a FREE version of Flash Player or Adobe Reader from our Links Page");
   document.location.href="../links/links.html";
  }
}
// End hiding script -->
