function StopPress()
{
  if(true)
  {
		expired=CheckIfExpired("27/09/2009");
		if (!expired)
		{
      alert("Places still available for Salt Ayre, Lancaster\n\n3 - 4 Oct 09 - Roller Ski tuition weekend")
    }
  }
}

function CheckIsIE()
{
	if  (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')  { return true;}
	else 
	{ 
		return false; 
	}
}

function PrintThisPage()
{
	if (CheckIsIE() == true) 
	{
		document.xframe.focus();
		document.xframe.print();
	}      
	else  
	{
		window.frames['xframe'].focus();
		window.frames['xframe'].print();
	}
} 
  
function init()
{
	setdpi(); 
	adjustpos(); 
	onresize(); 
	javascript:loadfile('indextxt.htm','WELCOME');
}

// Allow for different monitor dpi settings
// This page developed on 168dpi
dpifact=2;	// Create a public variable

function setdpi()
{
dpiw=document.getElementById('dpi');
dpiw.style.display="";
dpifact=dpiw.offsetWidth/168;
dpiw.style.display="none";
}

// adjust page element sizes to fit new browser setting
// after initial load and after user resizes.
function adjustsize()
{
	omh1 =document.getElementById('mh1');
	nav  =document.getElementById('mainNav');
	
	// Resize navigation column to allow for bug in IE
	nav.style.width=omh1.offsetWidth+"px";

	omh2 =document.getElementById('mh2');
	navwid=nav.offsetWidth/dpifact;
	
	// Change menu and heading fontsizes to suit resultant width
	if (navwid>278)
	{
		omh1.style.fontSize="19pt";
		omh2.style.fontSize="19pt";
		nav.style.fontSize="12pt";
	}
	if (navwid>251 && navwid<279)
	{
		omh1.style.fontSize="17pt";
		omh2.style.fontSize="17pt";
		nav.style.fontSize="11pt";
	}
	if (navwid>222 && navwid<252)
	{
		omh1.style.fontSize="15pt";
		omh2.style.fontSize="15pt";
		nav.style.fontSize="10pt";
	}
	if (navwid>205 && navwid<223)
	{
		omh1.style.fontSize="14pt";
		omh2.style.fontSize="14pt";
		nav.style.fontSize="9pt";
	}
	if (navwid>188 && navwid<206 )
	{
		omh1.style.fontSize="12pt";
		omh2.style.fontSize="12pt";
		nav.style.fontSize="8pt";
	}
	if (navwid>160 && navwid<189)
	{
		omh1.style.fontSize="11pt";
		omh2.style.fontSize="11pt";
		nav.style.fontSize="7pt";
	}
	if (navwid<161)
	{
		omh1.style.fontSize="7pt";
		omh2.style.fontSize="7pt";
		nav.style.fontSize="6pt";
	}

	// Adjust element positions
	adjustpos();
}

// Adjust position of elements
function adjustpos()
{
	// position content division below heading
	omh1 =document.getElementById('mh1');
	mhBott = omh1.offsetTop+omh1.offsetHeight+"px";
	ocon   = document.getElementById('content');
	ocon.style.top=mhBott;
}

// get some dimensions to help with setting out the elements
// Only used during the development phase
function getsizes()
{
	wrap=document.getElementById('wrapper');
	nav =document.getElementById('mainNav');
	cont=document.getElementById('content');
	alert(nav.style.fontSize);
	
	omh1 =document.getElementById('mh1');

//	alert('clientwidth: '+cwidth+':: navwidth: '+navwid);
//	alert('wrapwidth: '+wrap.offsetWidth);
//	alert('navwidth: '+nav.offsetWidth);
//	alert('contwidth: '+cont.offsetWidth);
}

function tblUpdate(TableID)
/* Update the table display so as to show or hide a set of rows
	depending on the values of the check boxes and the class of the row
	TableID is the ID of the table - e.g.'events'
*/
{
	/* Get check box values */
	cbn=document.getElementById('n').checked;
	cbc=document.getElementById('c').checked;
	cbb=document.getElementById('b').checked;
	cbl=document.getElementById('l').checked;
	cba=document.getElementById('a').checked;
	
	/* Get table object */
	tbl=document.getElementById(TableID);
	
	/* Step through the rows */
	rc=0;
	len=tbl.rows.length-1;
	for (i=4; i<len; i++)
	{
		str=tbl.rows[i].id; // Get the id for the row
		tbl.rows[i].style.display='none'; // Hide the row by default

  	if (cba)
  	{
			tbl.rows[i].style.display='';	// Show the row if the All check box is ticked
			document.getElementById('n').checked=true;
			document.getElementById('c').checked=true;
			document.getElementById('b').checked=true;
			document.getElementById('l').checked=true;
		}else
		{
  		if (cbn && (str.search("n")>-1))
  		{
  			tbl.rows[i].style.display='';	// Show the row if 'n' is in the class name
  		}
  		if (cbc && (str.search("c")>-1))
  		{
  			tbl.rows[i].style.display='';	// Show the row if 'c' is in the class name
  		}
  		if (cbb && (str.search("b")>-1))
  		{
  			tbl.rows[i].style.display='';	// Show the row if 'b' is in the class name
  		}
  		if (cbl && (str.search("l")>-1))
  		{
  			tbl.rows[i].style.display='';	// Show the row if 'l' is in the class name
  		}
    }
		
		if (tbl.rows[i].style.display=='')
		{
			// Colour alternate rows
			rc++;
			if (rc % 2 == 0)
			{
				tbl.rows[i].className = "even";
			}else{
				tbl.rows[i].className = "odd";
			}

			// Colour cancelled rows
			if (str.search("x")>-1)
			{
				tbl.rows[i].className = "cancel";
			}

			// Colour expired rows
			due2expire = tbl.rows[i].getAttribute("expiry");
			expired=CheckIfExpired(due2expire);
			if (expired)
			{
				tbl.rows[i].className = "expired";
			}
		}
	}
}

function loadtbl(TableID)
{
	/* Get table object */
	tbl=document.getElementById(TableID);
	len=tbl.rows.length-1;
	for (i=4; i<len; i++)
	{
		// Colour alternate rows
		if (i % 2 == 0)
		{
			tbl.rows[i].className = "odd";
		}else{
			tbl.rows[i].className = "even";
		}
		
		// Colour cancelled rows
		if (tbl.rows[i].id.search("x")>-1)
		{
			tbl.rows[i].className = "cancel";
		}

		// Colour expired rows
		due2expire = tbl.rows[i].getAttribute("expiry");
		expired=CheckIfExpired(due2expire);
		if (expired)
		{
			tbl.rows[i].className = "expired";
		}
		
		/* Works OK with IE, but the cells collection is ReadOnly 
		   in Firefox. Have to enter stars by hand.
		// Place *s in category columns
		str=tbl.rows[i].id; // Get the id for the row
		if (str.search("n")>-1)
		{
			tbl.rows[i].cells[1].innerText='*';	// Add the star
		}
		if (str.search("c")>-1)
		{
			tbl.rows[i].cells[2].innerText='*';	// Add the star
		}
		if (str.search("b")>-1)
		{
			tbl.rows[i].cells[3].innerText='*';	// Add the star
		}
		*/
	}
	lastupdated();
}

function loadtbl2(TableID)
{
	/* Get table object */
	tbl=document.getElementById(TableID);
	len=tbl.rows.length-1;
	for (i=2; i<len; i++)
	{
		// Colour alternate rows
		if (i % 2 == 0)
		{
			tbl.rows[i].className = "odd";
		}else{
			tbl.rows[i].className = "even";
		}

		// Colour expired rows
		due2expire = tbl.rows[i].getAttribute("expiry");
		expired=CheckIfExpired(due2expire);
		if (expired)
		{
			tbl.rows[i].className = "expired";
		}
	}
	lastupdated();
}

// Gets the date stamp of a file and displays the date in the 'footer' element
function lastupdated()
{
  da = new Date(document.lastModified)
  dy = String(da.getFullYear())
  dm = String(da.getMonth()+1)
  if(dm.length==1) dm = "0"+dm
  dd = String(da.getDate())
  if(dd.length==1) dd="0"+dd
  ys = 'Last updated on '+dd+'-'+dm+'-'+dy+'<br>End of Page';
  document.getElementById("footer").innerHTML=ys;
  parent.scroll(0,0);
}

// As above but without the scroll up
function lastupdated2()
{
  da = new Date(document.lastModified)
  dy = String(da.getFullYear())
  dm = String(da.getMonth()+1)
  if(dm.length==1) dm = "0"+dm
  dd = String(da.getDate())
  if(dd.length==1) dd="0"+dd
  ys = 'Last updated on '+dd+'-'+dm+'-'+dy+'<br>End of Page';
  document.getElementById("footer").innerHTML=ys;
}

// Toggle menu to show or hide submenus
function Toggle(item) 
{

	obj=document.getElementById(item);
	visible=(obj.style.display!="none")

	if (visible)
      {
//		obj.style.display="none";
	} else 
      {
      hideall();
		obj.style.display="block";
	}
	
	omh1 =document.getElementById('mh1');
	nav  =document.getElementById('mainNav');
	
	// Resize navigation column to allow for bug in IE
	nav.style.width=omh1.offsetWidth+"px";
}

// Toggle menu to show or hide submenus from within xframe
function xToggle(item) 
{

	obj=parent.document.getElementById(item);
	visible=(obj.style.display!="none")

	if (visible)
      {
//		obj.style.display="none";
	} else 
      {
      xhideall();
		obj.style.display="block";
	}
	
	omh1 =parent.document.getElementById('mh1');
	nav  =parent.document.getElementById('mainNav');
	
	// Resize navigation column to allow for bug in IE
	nav.style.width=omh1.offsetWidth+"px";
}

// Hide all visible sub menus
function hideall()
{
	obj2=document.getElementById('technique');
	obj2.style.display="none";
	obj2=document.getElementById('equip');
	obj2.style.display="none";
	obj2=document.getElementById('committee');
	obj2.style.display="none";
	obj2=document.getElementById('clubs');
	obj2.style.display="none";
	obj2=document.getElementById('train');
	obj2.style.display="none";
	obj2=document.getElementById('race');
	obj2.style.display="none";
	obj2=document.getElementById('links');
	obj2.style.display="none";
	obj2=document.getElementById('award');
	obj2.style.display="none";
	obj2=document.getElementById('diy');
	obj2.style.display="none";
	obj2=document.getElementById('events');
	obj2.style.display="none";
	obj2=document.getElementById('myths');
	obj2.style.display="none";
}

// Hide all visible sub menus from within xframe
function xhideall()
{
	obj2=parent.document.getElementById('technique');
	obj2.style.display="none";
	obj2=parent.document.getElementById('equip');
	obj2.style.display="none";
	obj2=parent.document.getElementById('committee');
	obj2.style.display="none";
	obj2=parent.document.getElementById('clubs');
	obj2.style.display="none";
	obj2=parent.document.getElementById('train');
	obj2.style.display="none";
	obj2=parent.document.getElementById('race');
	obj2.style.display="none";
	obj2=parent.document.getElementById('links');
	obj2.style.display="none";
	obj2=document.getElementById('myths');
	obj2.style.display="none";
}

function loadfile(fname)
{
	if (document.getElementById)
	document.getElementById("xframe").src=fname
}

function CheckIfExpired(Date2Check)
{
	NowDate = new Date();
	DueDate = new Date(Date2Check.split('/')[2],Date2Check.split('/')[1],Date2Check.split('/')[0]);
// Allow for month 0 = Jan
	DueDate.setMonth(DueDate.getMonth()-1);

if(DueDate.getTime()<NowDate.getTime())
	{
		return true;
	}
	else
	{
		return false;
	}
}

/*****

Image Cross Fade Redux
Version 1.0
Last revision: 02.15.2006
steve@slayeroffice.com

Please leave this notice intact. 

Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html


*****/


//window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false,
	 c = null;


function so_init() 
{
	if(!d.getElementById || !d.createElement)return;
	css = d.createElement("link");
	css.setAttribute("href","xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	c = d.getElementById("imageContainer");
	
	imgs = d.getElementById("imageContainer").getElementsByTagName("img");
	for(i=1;i<imgs.length;i++)
	{
		imgs[i].xOpacity = 0;
	}
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;
	

	// Update the preview title
	d.getElementById("ti").innerHTML=imgs[0].title;

	// Update the By line
	d.getElementById("by").innerHTML='By '+imgs[0].name;

	setTimeout(so_xfade,3000);
}

function so_xfade() 
{
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;
	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;
	
	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	setOpacity(imgs[current]); 
	setOpacity(imgs[nIndex]);

	// Update the preview title
	d.getElementById("ti").innerHTML=imgs[nIndex].title;

	// Update the By line
	d.getElementById("by").innerHTML='By '+imgs[nIndex].name;
	
	if(cOpacity<=0) 
	{
		imgs[current].style.display = "none";
		current = nIndex;
		setTimeout(so_xfade,3000);
	} else 
	{
		setTimeout(so_xfade,50);
	}
	function setOpacity(obj) 
	{
		if(obj.xOpacity>.99) 
		{
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
}

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 50 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() 
{
	var dyniframe=new Array()
	if (document.getElementById)
	resizeIframe("xframe")
	//reveal iframe for lower end browsers? (see var above):
	if ((document.all || document.getElementById) && iframehide=="no")
	{
		var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
		tempobj.style.display="block"
	}
}

function resizeIframe(frameid)
{
	var currentfr=document.getElementById(frameid)
  
	if (currentfr && !window.opera)
	{
    
    // Another bug fix
    currentfr.height = 6000;
    if (currentfr.addEventListener) 
			currentfr.addEventListener("load", readjustIframe, false)
		else if (currentfr.attachEvent)
		{
			currentfr.detachEvent("onload", readjustIframe) // Bug fix line
			currentfr.attachEvent("onload", readjustIframe)
		}
	   
	   
		currentfr.style.display="block"
    strsearch=currentfr.src;
    if (strsearch.search('search.htm')>-1) // Don't resize if Google page loaded
      currentfr.height = 6000;
		else if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
			currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
		else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
			currentfr.height = currentfr.Document.body.scrollHeight;

		if (currentfr.addEventListener) 
			currentfr.addEventListener("load", readjustIframe, false)
		else if (currentfr.attachEvent)
		{
			currentfr.detachEvent("onload", readjustIframe) // Bug fix line
			currentfr.attachEvent("onload", readjustIframe)
		}
	}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
