function makeButton(name, text, alt, target)
{
    document.write('<td nowrap><div class="menubutton" title="' + alt + '">');
    document.write('<a ');
    if (Tab.indexOf(target) != 1)
    {
        document.write('class="menubutton" ');
    }
    document.write('name="');
    document.write(name);
    document.write('" href="');
    document.write(target);
    document.write('" alt="');
    document.write(alt);
    document.write('">');
    
    document.write('&nbsp;');
    document.write(text);
    document.write('&nbsp;');
    
    if (Tab.indexOf(target) != 1)
    {
        document.writeln('</a>');
    }
    
    document.write('</div></td><td width="10%"></td>');
}



function SetTab(currentTab)
{
    Tab = Base + currentTab;
}


function display(stuff)
{
    window.status = stuff;
}


function dohead(title, description)
{
    openhead(title, description);
    closehead();
}


function openhead(title, description)
{
    document.writeln('<head>');
    document.write('<title>');
    document.write(title);
    document.write('</title>');
    document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
    document.writeln('<link rel="stylesheet" href="/style.css" type="text/css">');
}

function closehead()
{
    document.writeln('</head>');
}

function openbody()
{
    document.writeln('<script language="JavaScript" fptype="dynamicanimation">');
    document.writeln('<!--');
    document.writeln('function dynAnimation() {}');
    document.writeln('function clickSwapImg() {}');
    document.writeln('//-->');
    document.writeln('</script>');
    document.writeln('<script language="JavaScript1.2" fptype="dynamicanimation" src="animate.js"></script>');
    document.writeln('<script language="javascript" src="/whatsnewtop.js" type="text/javascript"></script>');
    document.writeln('<script language="javascript" src="whatsnew.js" type="text/javascript"></script>');
    document.writeln('<script language="javascript" src="navbar.js" type="text/javascript"></script>');
    document.writeln('<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="dynAnimation()" link="#000000" vlink="#000000" alink="#31CF31">');
}

var IFrameObj;

function closebody()
{
    document.writeln('</body>');

    // Prepare a popup within the page...
    document.writeln('<div id="overlay"></div>');
    document.writeln('<div id="popcontent">');
    document.writeln('<div id="top">');
    document.writeln('<div id="info"></div>');
    document.writeln('<div id="rt"><a href="#" class="tiny" onclick="parent.closepopup();">close</a>');
    document.writeln('</div>');
    document.writeln('</div>');
    document.writeln('<div id="left"></div>');
    document.writeln('<div id="middle">');
    document.writeln('<pre>');
    document.writeln('</pre>');
    document.writeln('<div align="right"></div>');
    document.writeln('</div>');
    document.writeln('<div id="right"></div></div>');

    document.getElementById('middle').innerHTML ='<iframe align="top" frameborder="0" scrolling="auto" width="98%" height="400" name="ifr" id="ifr"></iframe>';
    IFrameObj = frames['ifr'];
    
    document.writeln('</html>');
}

function openpopup(url,w,h,heading)
{
    document.getElementById('overlay').style.display ='block';
    document.getElementById('popcontent').style.display ='block';
    document.getElementById('popcontent').style.left ='30px';
    document.getElementById('popcontent').style.top ='15px';
    document.getElementById('top').style.width = w +8+"px"
    document.getElementById('middle').style.width = w+8+"px"
    document.getElementById('middle').style.height = h+"px"
    document.getElementById('ifr').style.height = h+"px"
    document.getElementById('info').innerHTML = heading;
    IFrameObj.location.href=(window.location.protocol + "//" + window.location.host + "/" + url);
}

function closepopup()
{
    document.getElementById('overlay').style.display ='none';
    document.getElementById('popcontent').style.display ='none';
}
// usage instruction - openpopup(url,width,height,heading);
//openpopup(urle,800,700,’Page Heading’);


function addToFavorite(favTitle)
{
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4))
  {
    window.external.AddFavorite(location.href, unescape(favTitle));
  }
}

function header()
{
    document.writeln('<table border="0" hspace="0" vspace="0" cellpadding="0" cellspacing="0" class="text">');
    document.writeln('  <tr height=20>&nbsp;</tr>');
    document.writeln('  <tr>');
    document.writeln('      <td>');
//    document.writeln('          <img src="/images/spacer.gif" width=20><a href="/"><img border="0" src="/images/peapods.gif" width="400" height="120"></a>');
    document.writeln('          <a href="/"><img style="border:0px; margin:0px 150px 10px 25px;" src="/images/Peapod_green_logo.png" width="148" height="90"></a>');
    document.writeln('      </td>');
/*
    document.writeln('              <td align="center">');
    document.writeln('                    If you\'d like to support us, please consider a <a href="/donate.html">donation</a><br/>');
    document.writeln('                    or buy our Christmas cards below.');
    document.writeln('              </td>');
*/
/*
    document.writeln('              <td align="center">');
    document.writeln('                    <a href="/yellow_moon.html"><img src="/images/thirdparty/yellow_moon_logo.gif" width="217" height="105" border="0"><br/>');
    document.writeln('                    Christmas shopping for Peapods.</a>');
    document.writeln('              </td>');
*/
    document.writeln('              <td align="center">');
    whatsnewbox();
    document.writeln('              </td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
    document.writeln('<table width="100%" border="0" hspace="0" vspace="0" cellpadding="0" cellspacing="0" class="text">');
    document.writeln('  <tr>');
    document.writeln('      <td><img src="/images/barleft.gif" width="44" height="36"></td>');
    document.writeln('      <td width="100%" align="left" background="/images/barcenter.gif">');
    document.writeln('          <table border="0" hspace="0" vspace="0" cellpadding="0" cellspacing="0">');
    document.writeln('              <tr valign=middle>');
/*
    makeButton("home", "Home", "Home", "/index.html");
    makeButton("news", "News", "News articles and press releases", "/news/index.html");
    makeButton("events", "Events", "What\'s on soon", "/events.html");
    makeButton("challenges", "Challenges", "Disability has many repercussions", "/challenges.html");
    makeButton("wishlist", "Wishlist", "Some of the things our members wish for", "/wishlist.html");
    makeButton("q_and_a", "Q & A", "Your questions and answers", "/q_and_a.html");
    makeButton("links", "Links", "Outside Peapods", "/links/index.html");
    makeButton("contactus", "Contact", "How to contact us", "/contact_us.html");
    makeButton("join", "Join", "How to become a member", "/join_us.html");
    makeButton("members", "Member Centre", "Member's facilities", "/members/index.html");
*/
    makeButton("home", "Home", "Home", "/index.html");
    makeButton("events", "Events", "What's on soon", "/events/index.html");
    makeButton("news", "News", "News articles and press releases", "/news/index.html");
//    makeButton("parents", "Parents", "Information and support for parents", "/parents.html");
    makeButton("volunteers", "How you can help", "How you can help families of disabled children", "/how_to_help.html");
    makeButton("contact", "Contact", "How to contact us", "/contact.html");
    makeButton("aboutus", "About Us", "More information about Peapods", "/about_us.html");
    document.writeln('              </tr>');
    document.writeln('          </table>');
    document.writeln('      </td>');
    document.writeln('      <td><img src="/images/barright.gif" width="44" height="36"></td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
    document.writeln('<table border="0" hspace="0" vspace="0" cellpadding="0" cellspacing="0">');
    document.writeln('  <tr>');
    document.writeln('      <td width="33"><img src="/images/spacer.gif" width="33" height="15"></td>');
    document.writeln('      <td valign="top" width="185" height="241" style="background-image: url(/images/menubar.jpg); background-repeat: no-repeat">');
    document.writeln('          <table border="0" cellspacing="0" cellpadding="0" valign="top" width="183">');
    document.writeln('              <tr><td valign="top" height="250">');
    document.writeln('                  <table border="0" cellspacing="0" cellpadding="0" valign="top" width="183">');
    document.writeln('                      <tr><td>&nbsp;</td></tr>');
    document.writeln(Navigations);
    document.writeln('                  </table>');
    document.writeln('              </td></tr>');

//    document.writeln('              <tr><td align="center">');
//    document.writeln('                <table bgcolor=#4EC320 border="1" frame="box" rules="none" cellpadding=5>');
//    document.writeln('                  <tr><td align="center">');
//    document.writeln('                Christmas cards designed by our children:<br/>');
//    document.writeln('                <a href="/xmascards/index.html"><img src="/images/xmascards/cardanim.gif" border="0" width="92" height="92"/></a><br/><br/>');
//    document.writeln('                Just £2.00 for<br/>a pack of 6 cards.<br/><a href="/xmascards/index.html">More information>>></a>');
//    document.writeln('                  </td></tr>');
//    document.writeln('                </table>');
//    document.writeln('                <br/>');
//    document.writeln('              </td></tr>');

    document.writeln('              <tr><td align="center">');
    document.writeln('                <table bgcolor=#4EC320 border="1" frame="box" rules="none" cellpadding=5>');
    document.writeln('                  <tr><td align="center">');
    document.writeln('                    Recycle your inkjet cartridges and old mobile phones here<br/>');
    document.writeln('                    <a href="http://www.recycle4charity.co.uk/intelsignup.aspx?supporterid=C2177" target="_blank"><img src="/images/thirdparty/recycle4charity_banner_small.gif" border="0" width="120" height="60"/></a><br/>');
//    document.writeln('                    or contact us<br/>');
    document.writeln('                  </td></tr>');
    document.writeln('                </table>');
    document.writeln('                <br/>');
    document.writeln('              </td></tr>');

    document.writeln('              <tr><td align="center">');
    document.writeln('                    If you\'d like to support us, please consider making a <a href="/donate.html">donation</a>.<br/><br/>');
    document.writeln('              </td></tr>');

    document.writeln('          </table>');
    document.writeln('          <br>');
    document.writeln('      </td>');
    document.writeln('      <td valign="top">');
    document.writeln('          <table border="0" cellspacing="0" cellpadding="0" width="100%">');
    document.writeln('              <tr>');
    document.writeln('                  <td valign="right" colspan="3">');
    document.writeln('                      <img src="/images/welcome.gif" width="263" height="28">');
    document.writeln('                  </td>');
    document.writeln('              </tr>');
    document.writeln('              <tr>');
    document.writeln('                  <td width=15>&nbsp;</td>');
    document.writeln('                  <td>');
//    document.writeln('        <br>');
    document.writeln('        <div align="justify">');
//    navbar();
}


function getDate()
{
    // Formatted last-modified date
    // Jim Dettwiler  http://www.icehouse.net/jim_d/
    // Further enhanced by JWM.
    var modiDate = new Date("3 Dec 2006 UTC") 
    if (Date.parse(document.lastModified) != 0) {
	modiDate = new Date(document.lastModified);
    }
    return(modiDate);
}

function getDateString()
{
    var modiDate = getDate();
    var monthName = new Array("January", "February", "March", "April", "May", 
	"June", "July", "August", "September", "October", "November", "December");
    return(modiDate.getDate() + " " + monthName[modiDate.getMonth()] + " " + modiDate.getFullYear());
}


function footer()
{
//    document.writeln('        <center>');
//    document.writeln('        <a href="http://www.timetogetequal.org.uk"><img src="/images/thirdparty/timetogetequalbanner.gif" width=468 height=60 border=0></a>');
//    document.writeln('        </center>');
    document.writeln('      </div>');
    document.writeln('        <br>');
    document.writeln('                  </td>');
    document.writeln('                  <td width=20></td>');
    document.writeln('              </tr>');
    document.writeln('          </table>');
    document.writeln('    </td>');
    document.writeln('    <td>&nbsp;</td>');
    document.writeln('  </tr>');
    document.writeln('</table>');

    document.writeln('          <table width="100%" border="0" cellpadding="0" cellspacing="0">');
    document.writeln('          <tr>');
    document.writeln('            <td width="50%" height="55" background="/images/bottomleft.gif"></td>');
    document.writeln('            <td width="511">');
    document.writeln('              <table height="55" width="511" border="0" cellpadding="0" cellspacing="0" background="/images/bottom01.gif">');
    document.writeln('                  <tr>');
    document.writeln('                  <td valign="bottom" align="center">');
    document.writeln('                      <font face="Verdana"><small class="smallest" style="color: #FFFFFF">');
    document.writeln('                      &copy; ' + getDate().getFullYear() + ' Peapods - UK registered charity 1104665.<br>');
    document.writeln('                      All rights reserved.');
    document.writeln('                      All other trademarks and copyrights are the ');
    document.writeln('                      property of their respective holders.');
    document.writeln('                      </small></font>');
    document.writeln('                  </td>');
    document.writeln('                  <td width="30px">&nbsp;</td>');
    document.writeln('                  <td valign=bottom nowrap>');
    document.writeln('                  	<font color="#FFFFFF" size="1" face="Verdana">' + getDateString() + '</font>');
    document.writeln('                  </td>');
    document.writeln('                  </tr>');
    document.writeln('               </table>');
    document.writeln('            </td>');
    document.writeln('            <td><img src="/images/bottom02.gif" width="244" height="55"></td>');
    document.writeln('            <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>');
    document.writeln('          </tr>');
    document.writeln('        </table>');
}

function smallheader()
{
//  document.writeln('<body bgcolor="#FFFFFF" alink="#336633" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
    document.writeln('<table width="530" border="0" cellspacing="0" cellpadding="0">');
    document.writeln('  <tr>');
    document.writeln('    <td><img src="' + Base + 'images/esbgateway_sml.jpg" width="529" height="75"></td>');
    document.writeln('  </tr>');
    document.writeln('  <tr>');
    document.writeln('    <td height="15" align="right" valign="top">&nbsp;</td>');
    document.writeln('  </tr>');
    document.writeln('  <tr>');
    document.writeln('    <td height="15" align="right" valign="top"><table width="124" border="0" cellspacing="0" cellpadding="0">');
    document.writeln('        <tr>');
    document.writeln('          <td width="21"><img src="' + Base + 'images/print_icon.gif" width="17" height="16" hspace="2"></td>');
    document.writeln('          <td width="42"><a href="#" onClick="window.print()" OnFocus="this.blur()" ><img src="' + Base + 'images/print.gif" width="28" height="14" hspace="3" border="0"></a></td>');
    document.writeln('          <td width="18"><img src="' + Base + 'images/close_icon.gif" width="17" height="16"></td>');
    document.writeln('          <td width="39" align="right"><a href="#" onClick="window.close()" OnFocus="this.blur()"><img src="' + Base + 'images/close.gif" width="34" height="12" hspace="2" border="0"></a>');
    document.writeln('          </td>');
    document.writeln('        </tr>');
    document.writeln('      </table></td>');
    document.writeln('  </tr>');
    document.writeln('  <tr>');
    document.writeln('    <td valign="top"> <table width="100%" border="0" cellspacing="1" cellpadding="7">');
    document.writeln('        <tr>');
    document.writeln('          <td>');
}


function smallfooter()
{
    document.writeln('      </td>');
    document.writeln('        </tr>');
    document.writeln('      </table>');
    document.writeln('      <font color="#666666">');
    document.writeln('      <p><br>');
    document.writeln('      </p>');
    document.writeln('      </font> </td>');
    document.writeln('  </tr>');
    document.writeln('</table>');
}

function popup(mylink, windowname, width, height, settings)
{
    if (!window.focus)
        return true;

    var href;
    
    if (typeof(mylink) == 'string')
        href=mylink;
    else
        href=mylink.href;
        
    window.open(href, windowname,
        'width=' + width + ',height=' + height + ',' + settings);
    
    return false;
}

function AddNav(title, link)
{
    if (Navigations != '')
    {
        Navigations += '<tr><td align="right"><table><tr><td height="2" width="157" background="/images/menubardiv.gif"></td></tr></table></td></tr>';
    }
    Navigations += '<tr><td><a class="menubutton" href="';
    Navigations += link;
    Navigations += '"> > ';
    Navigations += title;
    Navigations += '</a></td></tr>';
}


function AddNavPart(data)
{
    Navigations += '<tr><td width="105">';
    Navigations += data;
    Navigations += '</td></tr>';
}


function AddNavsFor(section)
{
    if (section == 'home') {
        AddNav("About us", "/about_us.html");
        AddNav("Events", "/events/index.html");
        AddNav("Calendar", "/events/calendar.html");
        SetTab("/index.html");
    } else if (section == 'events') {
        AddNav("Calendar", "/events/calendar.html");
//        AddNav("Parent's meetings", "/events/meetings/index.html");
        AddNav("Saturday Club", "/events/saturdayclub/index.html");
//        AddNav("Coffee mornings", "/events/coffee_mornings.html");
//        AddNav("Nights out", "/events/nights_out.html");
//        AddNav("Days out", "/events/daysout/index.html");
        AddNav("Peaplod 2010", "/events/peaplod_2010/index.html");
        SetTab("/events/index.html");
    } else if (section == 'news') {
        AddNav("Current news", "/news/index.html");
        AddNav("Newsletters", "/newsletters/index.html");
        AddNav("Archive 2009", "/news/2009.html");
        AddNav("Archive 2008", "/news/2008.html");
        AddNav("Archive to 2007", "/news/to2007.html");
        SetTab("/news/index.html");
    } else if (section == 'support') {
        AddNav("Q &amp; A", "/q_and_a.html");
        AddNav("Grants", "/grants.html");
        AddNav("Testimonials", "/testimonials.html");
        AddNav("Events", "/events/index.html");
        AddNav("Links", "/links.html");
        AddNav("Library", "/library.html");
        AddNav("Join us", "/join.html");
        SetTab("/support.html");
    } else if (section == 'how_to_help') {
        AddNav("Donations", "/donate.html");
        AddNav("Fundraising", "/fundraising.html");
        AddNav("Volunteers", "/volunteer.html");
        AddNav("Grants", "/grants.html");
        AddNav("Testimonials", "/testimonials.html");
        AddNav("Events", "/events/index.html");
        SetTab("/how_to_help.html");
    } else if (section == 'contact') {
        AddNav("Join us", "/join.html");
        AddNav("Fundraising", "/fundraising.html");
        AddNav("Volunteers", "/volunteer.html");
        AddNav("Donate", "/donate.html");
        SetTab("/contact.html");
    }
    
    header();
}


function AddMenu(status, imageName, imageFile, height, width, hspace, target)
{

}


var Navigations = '';
var Menus = '';
var Tab = window.location.pathname;

var Base = '/';
