// JavaScript Document

<!--
	// Table Header (06-Mar-2006);
	// by Vic Phillips http://www.vicsjavascripts.org.uk/FormCompendium/FormCompendium.htm#f50
	
	// As the page is scrolled and while the table is in view
	// the first row(header) of the table is retained in view
	
	// Application Notes
	
	// Each table to apply the script must have a <TBODY> with a unique ID name
	// <table width="200" border="1" bgcolor="#FFCC66">
	//  <tbody  id="fred">
	//   <tr>
	//    <td bgcolor="red" height=50>Header</td>
	//   </tr>
	//   <tr>
	//    <td >Row 1</td>
	//   </tr>
	//   <tr height=50 >
	//    <td bgcolor="#FFCC66">Row 2</td>
	//   </tr>
	//   <tr>
	//    <td bgcolor="#FFCC66">Row 3</td>
	//   </tr>
	//   <tr>
	//    <td bgcolor="#FFCC66">Row 4</td>
	//   </tr>
	//  </tbody>
	// </table>
	
	// The Table may have more than one <TBODY>
	
	// The script is initialised from a <BODY> or window onload event call
	// e.g. <body onload="f50InitTableHeader('fred','tom');" >
	// where each parameter of the function is the  unique ID name of a table to apply the script (string)
	
	// All function, variable names are prefixed with 'f50' to minimise conflicts with other JavaScripts
	
	// The functional Code(1.4k) is best as an external javascript
	
	// Tested with IE6 and Mozilla FireFox
	
	
	// Functional Code - NO NEED to Change
	
	var f50Ary=new Array();
	
	function f50InitTableHeader(id){
	var test = document.getElementById(id);
	if (test) {
		 var f50args=f50InitTableHeader.arguments;
		 var f500,f50t;
		 for (f500=0;f500<f50args.length;f500++){
		  f50t=document.getElementById(f50args[f500]);
		  f50ttrs=f50t.getElementsByTagName('TR');
		  f50t.trs=[];
		  for (f501=0;f501<f50ttrs.length;f501++){
		   f50t.trs.push(f50ttrs[f501]);
		  }
		  f50t.hh=f50t.trs[0].offsetHeight;
		  f50t.trs[0].pn=f50t;
		  f50Ary.push(f50t);
		 }
		}
	}
	
	function f50CkScroll(){
	 var f50t,f50o,f501;
	 if (!document.body.scrollTop){ f50t=document.documentElement.scrollTop; }
	 else if (document.all){ f50t=document.body.scrollTop; }
	 else if (document.getElementById){ f50t=window.pageYOffset; }
	 for (f500=0;f500<f50Ary.length;f500++){
	  if (f50Pos(f50Ary[f500])-f50Ary[f500].hh*2<f50t){
	   for (f501=1;f501<f50Ary[f500].trs.length;f501++){
		if ((f50Pos(f50Ary[f500].trs[f501]))>(f50t+f50Ary[f500].hh)){
		 if (f50Ary[f500].trs[0].pn==f50Ary[f500]){ f50Ary[f500].trs[0].parentNode.removeChild(f50Ary[f500].trs[0]); }
		 f50Ary[f500].insertBefore(f50Ary[f500].trs[0],f50Ary[f500].trs[f501]);
		 break;
		}
	   }
	  }
	 }
	}
	
	function f50Pos(f50){
	 f50ObjTop = f50.offsetTop;
	 while(f50.offsetParent!=null){
	  f50ObjParent=f50.offsetParent;
	  f50ObjTop+=f50ObjParent.offsetTop;
	  f50=f50ObjParent;
	 }
	 return f50ObjTop;
	}
	
	window.onscroll=f50CkScroll;