//SCRIPT FILE CONTAINING FUNCTIONS FOR BRISTOL HASH WEB SITE (c) Martin Wolff 2001-2004

// This is the function that will open the
// new window when the mouse is moved over the link
function open_new_window() 
{
new_window = open("","","width=420,height=520,left=100,top=50");

// open new document 
//new_window.document.open('#','','width=450,height=550');

// Text of the new document
// Replace your " with ' or \" or your document.write statements will fail
new_window.document.write("<html><title>Party!</title>");
new_window.document.write("<body bgcolor=\"#FFFFFF\">");
new_window.document.write("<img src='images/party1970s.jpg' width='400' height='500' alt='' border='1'>");
new_window.document.write("<br>");
new_window.document.write("</body></html>");

// close the document
new_window.document.close(); 
}

// This is the function that will close the
// new window when the mouse is moved off the link
function close_window() 
{
new_window.close();
}

function add_days(start,days)
// start is date in form "dd/mm/yy"
{						

m_year	= start.substring(6,8);	
m_month	= start.substr(3,5);
m_day	= start.substr(0,2);
var y1	= parseInt(m_year,10); 
var m1	= parseInt(m_month,10)-1;
var d1	= parseInt(m_day,10);
datevar	= Date(y1,m1,d1);	
datevar.setDate(datevar.getDate()+7);

document.write(datevar+'<br>');
}

function mailit(first,second,subject)
// send parts of a mailto link to this function to hide it from spammers
{
if (subject != "")
	{
	subject = "?subject="+subject
	}
document.write('<a href=\"mailto:'+first+'@'+second+subject+'\">'+first+'@'+second+'</a>' )
}

function telit(area,code)
{
code=area+" "+code;
document.write(code);
}
function midline(call,textcolor,backcolor,splash,expire,startit)
{
now   = new Date();
nyear = now.getYear();
if(nyear<1000) nyear=nyear+1900;
nyear = nyear-2000;
nyear = ((nyear<10) ? "0":"")+nyear;
nmonth= now.getMonth()+1;
nmonth= ((nmonth<10) ? "0":"")+nmonth ;
nday  = now.getDate() ;
nday  = ((nday<10) ? "0":"")+nday ;
ndate = nday+'/'+ nmonth +'/'+ nyear;
testnow = nyear+nmonth+nday;
testexp = expire.substring(6,8)+expire.substring(3,5)+expire.substring(0,2);
		
		if(startit == "")
		{
		testbeg = "020202"
		}
		else
		{
		testbeg = startit.substring(6,8)+startit.substring(3,5)+startit.substring(0,2)
		}
		if(testnow<testexp && testnow>=testbeg) 
		{
		document.write('<div valign="top" align="center" style="color:'+textcolor+';background-color:'+backcolor+'">');
		document.write(splash);
		document.write('</div>');
		document.write('<HR color=#0000a0 size=1>');
		}
}

function nblocktop(ndate,author)
{
document.write('<div  align="left" style="font-family:courier new; font-size:10pt">');
document.write('<span style="color:Black"><b>Date:</b>'+ndate+'</span><br>');
document.write('<span style="color:Black"><b>From:</b>'+author+'</span><br>');
document.write('<span style="color:Black"><b>Message:</b></span><br>')
}
function nblockbot()
{
document.write('<div align="center" style="color:red; font-size:8pt">')
document.write('<form action="#top"><input type=submit value="Back to top" style="background:Lime;color:Black;font-size:8pt"></form></div>');
}

function hw20Window(winfile)
    {
    window.open(winfile, '','scrollbars=no,resizable=yes,width=470,height=450')
    }
function bikeWindow(winfile)
    {
    window.open(winfile, '','scrollbars=no,width=600,height=175')
    }
function openWindow(winfile)
   {
   window.open(winfile, '','scrollbars=yes,resizable=yes,width=550,height=255')
   }
function genWindow(winfile,gwidth,gheight)
   {
   window.open(winfile, '','scrollbars=yes,resizable=yes,width='+gwidth+',height='+gheight)
   }


function openMendip()
   {
   window.open('http://www.bristolhash.org.uk/mendip.php', '','scrollbars=yes,resizable=yes,width=650,height=560') 
   }
function bigWindow(winfile)
   {
   window.open(winfile, '','scrollbars=yes,resizable=yes,width=690,height=620')
   }	
function roosterWindow(winfile)
   {
   window.open(winfile, '','scrollbars=yes,resizable=yes,width=550,height=600')
   }
function closeWindow() 
{
window.close();
}
function myclosebutton(cColor)// this simple close button has been modified for the hash stats so that, if the colour is #000090, it goes back rather than closes the form.
{
if (cColor=="") { cColor = "#000000"; }
if (cColor=="#000090") 
	{
	document.writeln("<hr color=#707070 size=8>");  
// this option removed as used on Stats system run sheets, which are now displayed via bh3intro.php
//document.writeln("<input style='font-size:10px;color:White;background:"+cColor+";font-weight:bold' type='button' value=' BACK ' onclick='history.back()'>");
	}
else
	{
document.writeln("<input style='font-size:10px;color:White;background:"+cColor+";font-weight:bold' type='button' value=' CLOSE ' onclick='window.close()'>");
	}
}
function bigclosebutton(cColor)
{
document.writeln("<input style='font-size:14px;color:White;background:"+cColor+";font-weight:bold' type='button' value=' CLOSE ' onclick='window.close()'>");
}

function welcomeWindow()
	{
	window.open('kahello.html','','scrollbars=yes,resizable=yes,width=330,height=385')
	}

function bh3top()
{

document.writeln('<H1 style="color:#808080;font-size:24pt;font-family:arial" align="center">')
document.writeln('<span style="color:Red">Bristol H</span>ash<span style="color:Red">')
document.writeln('H</span>ouse <span style="color:Red">H</span>arriers </H1>')

document.writeln('<table border="0" cellspacing="0" cellpadding="0" align="center">')

document.writeln('<tr valign="top" nowrap>')

document.writeln('<td><form action="bh3.html" target="_top"><input type=submit value="Home" style="background:#ffcccc;color:Red;font-size:10pt"></input></form></td>')
document.writeln('<td><form action="bh3runs.php"><input type=submit value="Run List" style="background:#99cc00;color:Red;font-size:10pt"></input></form></td>')
document.writeln('<td><form action="page7.html"><input type=submit value="Contacts" style="background:#ffcc99;color:Red;font-size:10pt"></input></form></td>')
document.writeln('<td><form action="page8.html"><input type=submit value="Hash Mag." style="background:#ffff99;color:Red;font-size:10pt"></input></form></td>')
document.writeln('<td><form action="page9.html"><input type=submit value="Pictures" style="background:#99ffff;color:Red;font-size:10pt"></input></form></td>')
document.writeln('<td><form action="stats.html"><input type=submit value="Statistics" style="background:#acdcf8;color:Red;font-size:10pt"></input></form></td>')
document.writeln('</tr>')
document.writeln('</table>')

}

function greeting()
{
  date = new Date();
   hourofday = date.getHours();
   if(hourofday >=0 && hourofday <=11)
     document.write('good morning, ');
   if(hourofday >=12 && hourofday <= 17)
     document.write('good afternoon, ');
   if(hourofday >=18 && hourofday <= 23)
     document.write('good evening, ');
}


function announce()
{
document.writeln('<div align="center" style=" font-family:arial; font-size:9pt; color:#005000;">');
document.writeln('<hr color="#00a000">');
document.writeln('</div>');

}

function datetoday()
{
now = new Date();
mth = now.getMonth()+1;
mth = ((mth<10) ? "0":"")+mth ;
yr  = now.getYear();
day = now.getDate();
day = ((day<10) ? "0":"")+day ;
timeout = (yr+""+mth+""+day);
datetoday=day+"/"+mth+"/"+yr;
document.writeln(""+day+"/"+mth+"/"+yr+"")
}
function yeartoday()
{
now = new Date();
yr  = now.getYear();
if (yr<200)
{
yr=yr+1900;
}
yeartoday = yr;
document.write(yr);
}
