// <!--
// Main Menu Style

var indexW=1;

// method to display an image in its own window
function portrait(mylink,sx,sy)
{
  var href;

  if (typeof(mylink)=='string')
    href=mylink; 
  else 
    href=mylink.href;

  var options="status=0,toolbar=0,location=0,menubar=0,width="+sx+",height="+sy
  indexW++;
  var title = "btmImg"+indexW;
  mypopup = window.open(href,title,options);
  mypopup.moveTo(50,10);
}

// Method for more secure emails
function email(user,domain,subject,anchorText) {

  var url = "mailto:" + user + "&#64;" + domain;
  if(subject != null && subject.length > 0 ) {
    // replace all spaces with %20
    subject = subject.replace(/\s/g,"%20");
    url = url + "?subject=" + subject;
  }
  if(anchorText == null || anchorText.length == 0) {
    anchorText=""+user+"&#64;"+domain;
  }
  document.write('<a title="click here to email" href='+url+'>'+anchorText+'</a>');
}

// Function to return root path to pre-append to all html links.
function getRoot()
{
  var root = "http://www.bracknell-parish.org/";
  if( self.location.pathname.toLowerCase().indexOf("c:") != -1 ) {
    root = "file:///c:/www/";
  }
  return root;
}

// method to call the display of the notice board
function notice()
{
    var s_link = getRoot() + 'notebook/notebook_ht.html'
    portrait(s_link,417,575)
}


// methods for displaying the updated flashing gif on the front screen
function xupdate(d)
{
    document.write('&nbsp;<img alt="" src="../../gifs/updated.gif" width="44" height="11" border="0">');
    if(d != null)
      document.write('<span class="upd">&nbsp;('+d+')</span>');
}
// methods for displaying the recent flashing gif on the front screen
function xrecent(d)
{
    document.write('&nbsp;<img alt="" src="../../gifs/recent.gif" width="38" height="11" border="0">');
    if(d != null)
      document.write('<span class="rec">&nbsp;('+d+')</span>');
}
// methods for displaying the new flashing gif on the front screen
function xnew(d)
{
    document.write('&nbsp;<img alt="new" src="../../gifs/new.gif" width="26" height="11" border="0">');
    if(d != null)
      document.write('<span class="new">&nbsp;('+d+')</span>');
}

// method for hilighting the current day's events
function checkdate(dayNo, monthNo, row)
{
  var d = new Date();
  var defs=row;
  if( (d.getMonth()+1) == monthNo && d.getDate() == dayNo) {
    if( row == "even")
       defs = 'evencol';
    else
       defs='oddcol';
  }
  
  document.write('<table width="100%" class="'+defs+'" cellpadding="0" cellspacing="0">');
}

function getPartURL(pw)
{
var pwddata=new String("6C1TC"+"RA38Y551R"+"APD2C6N0DN"+"0LP2C4A51PEZ9");
var pw2=""+pw.toUpperCase()+pw.length;var pw1="";
for(var j=0;j<pw2.length;j++)pw1+=pw2.charAt(pw2.length-j-1);var i=pwddata.indexOf(pw1);
if( i!=-1)return pwddata.substring(i+pw2.length,i+pw2.length+3);return "";
}

function createCookie(name,value,days) 
{
  if (days) 
  {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else 
  {
    var expires = "";
  }
  document.cookie = name+"="+escape(value)+expires+"; path=/";
}

function readCookie(name) 
{
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(name + "=");
    if (c_start!=-1)
    { 
      c_start=c_start + name.length+1; 
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) 
  	c_end=document.cookie.length;

      return unescape(document.cookie.substring(c_start,c_end));
    }
  } 
  
  return "";
}

function readCookieData() 
{
    if (document.cookie.length>0)
    {
        return unescape(document.cookie);
    } 
  
    return "";
}

function eraseCookie(name) 
{
    createCookie(name,"",-1);
}

// method to either get date string, or set 'clock' id contents to current time string
function getDateString()
{
    var aDay=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    var aMonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
    var dateNow=new Date();

    var year=dateNow.getYear();
    var dayIndex=dateNow.getDay();
    var monthIndex=dateNow.getMonth();
    var day=dateNow.getDate();
    var daysuffix="th";
    if( day==1 || day==21 || day==31 ) daysuffix="st";
    if( day==2 || day==22 ) daysuffix="nd";
    if( day==3 || day==23 ) daysuffix="rd";
    if ( year < 100 ) year+=2000;
    if ( day<10 )day="0"+day;

    var hour24=dateNow.getHours();
    var hour=hour24;
    var minute=dateNow.getMinutes();
    var second=dateNow.getSeconds();
    var dayZone="am";
    if (hour>=12)dayZone="pm";
    if (hour>12)hour=hour-12;
    if (hour==0)hour=12;
    if (minute<=9)minute="0"+minute;
    if (second<=9)second="0"+second;

    //change font size here
    var dateString= aDay[dayIndex]+" "+day+"<sup>"+daysuffix+"</sup> "+aMonth[monthIndex]+" "+year+" "
                   +hour+":"+minute+":"+second+" "+dayZone;


    if (document.all && document.all.clock) 
    {
    	document.all.clock.innerHTML=dateString;
    }
    else if (document.getElementById("clock"))
    {
    	document.getElementById("clock").innerHTML=dateString;
    }
    else 
    {
    	document.write(dateString);
    }
}

// realtime clock
function goforit()
{ 
    if ( (document.all && document.all.clock ) || ( document.getElementById("clock")) )
    {
    	setInterval("getDateString()",1000); 
    }
}

function lastChanged()
{
    var aMonth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
    var dateObj = new Date(document.lastModified)
    var month = aMonth[dateObj.getMonth()]
    var day = dateObj.getDate()
    var year = dateObj.getYear()
    if (year < 2000) 
        year = year + 1900

    document.write('<p align="right"><font face="Arial" size="1">last changed: '+day+'.'+month+'.'+year+'</font></p>');
}
//--> 
