	var today = new Date()
	var weekday = today.getDay()
	var month = today.getMonth() + 1
	var date = today.getDate()
	var caption = "photograph courtesy of C. Syres - www.syres.co.uk"

		var week = "0"
		if (Math.round(date/7) == 0) week = 0
		if (Math.round(date/7) == 1) week = 1
		if (Math.round(date/7) == 2) week = 2
		if (Math.round(date/7) == 3) week = 3
		if (Math.round(date/7) == 4) week = 4
		if (month == 1) { week = week + 0; }
		else if (month == 2) { week = week + 4; }
		else if (month == 3) { week = week + 9; }
		else if (month == 4) { week = week + 14; }
		else if (month == 5) { week = week + 18; }
		else if (month == 6) { week = week + 22; }
		else if (month == 7) { week = week + 27; }
		else if (month == 8) { week = week + 31; }
		else if (month == 9) { week = week + 36; }
		else if (month == 10) { week = week + 40; }
		else if (month == 11) { week = week + 44; }
		else if (month == 12) { week = week + 48; }
		var yearweek = week
		
<!-- make special captions here -->
	if (yearweek == 52) { caption = "Happy Christmas! (photograph courtesy of C. Syres - www.syres.co.uk)"; }
	if (yearweek == 28) { caption = "photograph courtesy of T. Walling)"; }
	if (yearweek == 33) { caption = "photograph courtesy of T. Walling)"; }
	if (yearweek == 43) { caption = "photograph courtesy of T. Walling)"; }
	if (yearweek == 17) { caption = "photograph courtesy of T. Walling)"; }
	
	function RandomImageLong(images,iparams)
{
/* si: start index 
** i: current index
** ei: end index
** cc: current count
*/
 si = 0; 
 ci=0;
 cc=0;
 imageSet = new Array();
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
  document.writeln("<img "+iparams+" src="+imageSet[ind]+" alt=\"HARROGATE ONLINE"+"\">");
}

<!-- random butterfly script -->

function RandomImage(images)
{
  RandomImageLong(images," ");
}

function RandomImageLinkLongTarget(images,urls,iparams,hparams)
{
/* si: start index 
** i: current index
** ei: end index
** cc: current count
*/
 imageSet = new Array();
 urlSet = new Array();
 si = 0; 
 ci=0;
 cc=0;
 ei = images.length;
  for (i=1;i<ei;i++) {
    if (images.charAt(i) == ' ' || images.charAt(i) == ',') {
      imageSet[cc] = images.substring(si,i);
      cc++;
      si=i+1;
      }
    }
  ind = Math.floor(Math.random() *cc);
 si = 0; 
 ci=0;
 cc=0;
 ei = urls.length;
  for (i=1;i<ei && cc <=ind ;i++) {
    if (urls.charAt(i) == ' ' || urls.charAt(i) == ',') {
      urlSet[cc] = urls.substring(si,i);
      cc++;
      si=i+1;
      }
    }

  //document.writeln("<img "+iparams+" src="+imageSet[ind]+" alt=\""+imageSet[ind]+"\">");
  document.writeln("<a "+hparams+" href=\""+urlSet[ind]+"\"><img "+iparams+" src="+imageSet[ind]+"></a>");
}

function RandomImageLinkLong(images,urls,iparams)
{
  RandomImageLinkLongTarget(images,urls,iparams,"");
}

function RandomImageLink(images,urls)
{
  RandomImageLinkLongTarget(images,urls,"border=0","");
}

var cssArray = new Array('blue.css','green.css','red.css');
c=document.cookie;m=c.indexOf("KWCSSSelect=");j=-1;if (m!=-1){
pos1=c.indexOf("=",m)+1;pos2=c.indexOf(";",m);
j=(pos2==-1)?c.substring(pos1):c.substring(pos1,pos2)}
if (j!=-1) document.write('<link rel="stylesheet" href="'+j+'" type="text/css">')
