var BG_COLOUR="#000099";
var listMenu;		// For the Menu
var arrow = null;		// For the Menu

function SetPath()
{
    Location = new String(document.location);
    if (Location.search("nippers") == -1 && Location.search("pictures") == -1 && Location.search("100years") == -1)
    {  REL_PATH="./"; }
    else
    {  REL_PATH="../"; } 
    delete Location;
    return REL_PATH;
}

function BuildHeader()
{
document.write(" \
<table border='0' width='100%' bgcolor='"+BG_COLOUR+"' bordercolor='#000000' bordercolordark='#000000' bordercolorlight='#000000' > \
  <tr align='center'><td width='10%'> \
      <a href='"+SetPath()+"main.htm'><img border='0' src='"+SetPath()+"pictures/Sheild%20copy%20header4.jpg' width='70' height='70'></a></td> \
    <td width='80%'><b><font size='6' face='Arial' color='#FFFFFF'>North Wollongong Surf Life Saving Club</font></b><BR><b><font face='Arial' color='#FFFFFF' size='2'>Established 1908</font></b></td> \
    <td width='10%'><a href='"+SetPath()+"main.htm'><img border='0' src='"+SetPath()+"pictures/Sheild%20copy%20header4.jpg' width='70' height='70'></a></td> \
  </tr> </table> ");
}

function BuildMenu()
{
  document.write(" \
<TABLE border='0' width='100%' bgcolor='"+BG_COLOUR+"'> \
<TR align='left'><TD class='MenuBar' width=55><FONT color=white>Menus<FONT face='webdings'>8</FONT></FONT></TD><TD> \
<ul class='menulist' id='listMenuRoot'> \
<LI><a href='"+SetPath()+"main.htm'>General</a> \
	<UL> \
  	<LI><a href='"+SetPath()+"main.htm'>Home</a></LI> \
 	<LI><a href='"+SetPath()+"noticeboard.htm'>Notice Board</a></LI> \
  	<LI><a href='"+SetPath()+"aboutus.htm'>About Us</a> \
		<UL> \
 		<LI><a href='"+SetPath()+"sponsors.htm'>Our Sponsors</a></LI> \
 		<LI><a href='"+SetPath()+"hall%20bookings.htm'>Function Centre</a></LI> \
 		<LI><a href='"+SetPath()+"history.htm'>Club History</a></LI> \
 		<LI><a href='"+SetPath()+"location.htm'>Our Location</a></LI> \
  		<LI><a href='"+SetPath()+"the_committee.htm'>The Committee</a></LI> \
  		<LI><a href='"+SetPath()+"links.htm'>SLS Links</a></LI> \
  		<LI><a href='"+SetPath()+"contact.htm'>Contact Us</a></LI> \
		</UL> \
  	</LI> \
 	<LI><a href='"+SetPath()+"join.htm'>How To Join</a></LI> \
 	<LI><a href='"+SetPath()+"sponsors.htm'>Sponsors</a></LI> \
 	<LI><a href='"+SetPath()+"links.htm'>SLS Links</a></LI> \
 	<LI><a href='"+SetPath()+"building.htm'>Building Disrepair</a></LI> \
 	<LI><a href='"+SetPath()+"100years/'>2008 Centenary</a></LI> \
 	<LI><a href='"+SetPath()+"privacy.htm'>Privacy</a></LI> \
	</UL> \
</LI> \
<LI><a href='"+SetPath()+"members.htm'>Senior Members</a> \
	<UL> \
	<LI><a href='"+SetPath()+"members.htm'>Seniors Home</a></LI> \
	<LI><a href='"+SetPath()+"members.htm'>Patrol</a> \
		<UL> \
		<LI><a href='"+SetPath()+"patrol_information.htm'>Patrol Information</a></LI> \
		<LI><a href='"+SetPath()+"patrol_information.htm#roster'>Patrol Roster</a></LI> \
		<LI><a href='"+SetPath()+"patrol_information.htm#roster'>Patrol Lists</a></LI> \
		</UL> \
	</LI> \
	<LI><a href='"+SetPath()+"membership_renewal.htm'>Renewal Info</a></LI> \
	<LI><a href='"+SetPath()+"the_committee.htm'>Committee</a></LI> \
	<LI><a href='"+SetPath()+"gym.htm'>Gym Info</a></LI> \
	<LI><a href='"+SetPath()+"newsletters.htm'>Newsletters</a></LI> \
	<LI><a href='"+SetPath()+"photo_gallery.htm'>Photo Gallery</a></LI> \
	</UL> \
</LI> \
<LI><a href='"+SetPath()+"nippers/nippers.htm'>Junior Members</a> \
	<UL> \
	<LI><a href='"+SetPath()+"nippers/nippers.htm'>Juniors Home</a></LI> \
	<LI><a href='"+SetPath()+"newsletters.htm'>Newsletters</a></LI> \
	<LI><a href='"+SetPath()+"nippers/introduction.htm'>Introduction</a></LI> \
	<LI><a href='"+SetPath()+"nippers/sandpiper_history.htm'>Sandpiper History</a></LI> \
	<LI><a href='"+SetPath()+"nippers/age_managers.htm'>Age Managers</a></LI> \
	<LI><a href='"+SetPath()+"nippers/structure.htm'>Structure</a></LI> \
	<LI><a href='"+SetPath()+"nippers/dress_regulations.htm'>Dress Regs.</a></LI> \
	<LI><a href='"+SetPath()+"nippers/carnivals.htm'>Carnivals</a></LI> \
	<LI><a href='"+SetPath()+"nippers/carnival_conduct.htm'>Carnival Conduct</a></LI> \
	<LI><a href='"+SetPath()+"nippers/surf_education.htm'>Surf Education</a></LI> \
	<LI><a href='"+SetPath()+"nippers/proficiency_requirements.htm'>Proficiency</a></LI> \
	<LI><a href='"+SetPath()+"nippers/training.htm'>Training</a></LI> \
	<LI><a href='"+SetPath()+"nippers/pointscore.htm'>Pointscore</a></LI> \
	<LI><a href='"+SetPath()+"nippers/junior_calendar.htm'>Calendar</a></LI> \
	<LI><a href='"+SetPath()+"nippers/photo_album.htm'>Nipper<BR>Photo Gallery</a></LI> \
	</UL> \
</LI> \
</UL> \
</TD></TR></TABLE> \
");

listMenu = new FSMenu('listMenu', true, 'visibility', 'visible', 'hidden');

//listMenu.showDelay = 0;
//listMenu.switchDelay = 125;
//listMenu.hideDelay = 500;
listMenu.cssLitClass = 'highlighted';
//listMenu.showOnClick = 1;

listMenu.animations[listMenu.animations.length] = animFade;
listMenu.animations[listMenu.animations.length] = animClipDown;
listMenu.animSpeed = 20;

arrow=null;
if (document.createElement && document.documentElement)
{
 arrow = document.createElement('span');
 arrow.appendChild(document.createTextNode('8'));
 arrow.className = 'subind';
}

addEvent(window, 'load', new Function('listMenu.activateMenu("listMenuRoot", arrow)'));
}

// ========================================================================
// Animation Functions for the Menus
function animClipDown(ref, counter)
{
 var cP = Math.pow(Math.sin(Math.PI*counter/200),0.75);
 ref.style.clip = (counter==100 ?
  ((window.opera || navigator.userAgent.indexOf('KHTML') > -1) ? '':
   'rect(auto, auto, auto, auto)') :
    'rect(0, ' + ref.offsetWidth + 'px, '+(ref.offsetHeight*cP)+'px, 0)');
};

// ========================================================================
// Animation Function for the Menus
function animFade(ref, counter)
{
 var f = ref.filters, done = (counter==100);
 if (f)
 {
  if (!done && ref.style.filter.indexOf("alpha") == -1)
   ref.style.filter += ' alpha(opacity=' + counter + ')';
  else if (f.length && f.alpha) with (f.alpha)
  {
   if (done) enabled = false;
   else { opacity = counter; enabled=true }
  }
 }
 else ref.style.opacity = ref.style.MozOpacity = counter/100.1;
};

// ========================================================================
// Function for building a photo album given an array of filenames
function BuildAlbum(arr,perRow,path)
{
    document.write("<P>Click on each photo to view it as a larger image</P>");
    document.write("<TABLE ALIGN=center BORDER=0 CELLSPACING=50 CELLPADDING=20 WIDTH=100%>")
    document.write("<TR>")
    for (var i=1; i <= arr.length; i++)
    {
       document.write("<TD ALIGN=CENTER><A HREF=javascript:PopItUp('"+path+arr[i-1][0]+"')><IMG SRC='"+path+arr[i-1][0]+"' HEIGHT=120 BORDER=0></IMG></A><BR>"+i+". ")
       if (arr[i-1][1] == '') { document.write("No Caption") } else { document.write(arr[i-1][1]+"</TD>") }
       if (i % perRow == 0) { document.write("</TR><TR>") }
    } 
    document.write("</TR></TABLE>")
}

// ========================================================================
// Function to create a pop-up window for the photo album
function PopItUp(url) 
{
   if (newwindow.location && !newwindow.closed) {
     newwindow.location.href = url;
     newwindow.focus(); }
   else {
     newwindow=window.open(url,'htmlname','width=404,height=316,resizable=1');}
}

// ========================================================================
// Function to tidy up the above pop-ups
function tidy()
{
    if (newwindow.location && !newwindow.closed) {
   newwindow.close(); }
}

