//var isNav = (document.layers);
//var isNS6 = (document.getElementById && !document.all);
//var isIE4 = (document.all && !document.getElementById);
//var isIE5 = (document.all && document.getElementById);
//var isMac = (navigator.platform == 'Mac')? 1:0

<!-- Original:  Eddie Traversa (psych3@primus.com.au) -->
<!-- Web Site:  http://dhtmlnirvana.com/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
window.onerror = null;
var topMargin = 10;
var staticPos = 121;
var slideTime = 800;
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

function layerObject(id,left) {
if (ns6) {
this.obj = document.getElementById(id).style;
//this.obj.left = left;
return this.obj;
}
else if(ie4) {
this.obj = document.all[id].style;
//this.obj.left = left;
return this.obj;
}
else if(ns4) {
this.obj = document.layers[id];
this.obj.left = left;
return this.obj;
   }
}
function layerSetup() {
floatLyr = new layerObject('floatLayer', pageWidth * .5);
window.setInterval("main()", 10)
}
function floatObject() {
if (ns4 || ns6) {
findHt = window.innerHeight;
} else if(ie4) {
findHt = document.body.clientHeight;
   }
}
function main() {
if (ns4) {
this.currentY = document.layers["floatLayer"].top;
this.scrollTop = window.pageYOffset;
mainTrigger();
}
else if(ns6) {
this.currentY = parseInt(document.getElementById('floatLayer').style.top);
this.scrollTop = scrollY;
mainTrigger();
} else if(ie4) {
this.currentY = floatLayer.style.pixelTop;
this.scrollTop = document.body.scrollTop;
mainTrigger();
   }
}
function mainTrigger() {
var newTargetY = this.scrollTop + this.topMargin;

if ( this.currentY != newTargetY ) {
	if ( newTargetY != this.targetY ) {
		this.targetY = newTargetY;
		floatStart();
	}
	animator();
   }
  // window.status = "scroll "+ this.scrollTop +" new pos "+ newTargetY + "layerpos "+ this.currentY ;
}


function floatStart() {
var now = new Date();
this.A = this.targetY - this.currentY;
this.B = Math.PI / ( 2 * this.slideTime );
this.C = now.getTime();

if (Math.abs(this.A) > this.findHt) {
this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
this.A = this.A > 0 ? this.findHt : -this.findHt;
}
else {
this.D = this.currentY;
   }
   //window.status = "findHt= " + this.findHt
}


function animator() {

var now = new Date();
var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
newY = (this.scrollTop < staticPos)? staticPos: Math.round(newY);
if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
if ( ie4 )document.all.floatLayer.style.pixelTop = newY;
if ( ns4 )document.layers["floatLayer"].top = newY;
if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px";
   }
}


function start() {
if(ns6||ns4) {
pageWidth = innerWidth;
pageHeight = innerHeight;
layerSetup();
floatObject();
}
else if(ie4) {
pageWidth = document.body.clientWidth;
pageHeight = document.body.clientHeight;
layerSetup();
floatObject();
   }
}
//  End -->

function check4zeros(obj){
	if(obj.value==999){
		alert("You have indicated 'None of the above'. Please enter new data in the Addition Data field");
		document.forms[0].comments.focus();
		document.forms[0].user_query.value=1;
	}

}


function checkForm(obj){

	if(obj.rpt_pwd && obj.rpt_pwd.value != obj.new_pwd.value){
		alert("The repeated password is not the same as the password");
		return false;
	}

	/*	Check required fields - they are identified by id='required'
		as other user defined props not recognised by older versions of Netscape */
	
	for(i=0; i<document.forms[0].elements.length; i++){
		if(document.forms[0].elements[i].id=='required'){
			if(document.forms[0].elements[i].value==''){
				alert('Please check all the required fields have been filled');
				document.forms[0].elements[i].focus()
				return false;
			}
		}
	}
	return true;
	
}

function openExtract(ref){

	switch(ref){
		case 6:
			var url="why.htm#diagram";
			break;
		case 7:
			var url="why.htm";
			break
		default:
			var url="extracts.htm#" + ref;
			break;		
	}

	//var url="extracts.htm#" + ref;	
	var name = "extract";
	var params = "toolbar=0,location =0,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,width=750,height=550";
	openPopUpWindow(name,url,params);
}

function openOrders(ref){
	var url = "orders.htm#booklets";
	var name = "orders";
	var params = "toolbar=0,location =0,directories=0,status=0,scrollbars=1,resizable=1,copyhistory=0,width=750,height=550";
	openPopUpWindow(name,url,params);
}
	
var myChild = null;
function openPopUpWindow(name,url,params){

	if (myChild && myChild.open && !myChild.closed && myChild.name == name) {
			myChild.focus();
			myChild.location = url;
	}else{
		myChild = window.open(url,name,params)
		myChild.focus();
	}
	
}


function stat(){


  //document.bandeau.top = pageYOffset+window.innerHeight-document.bandeau.document.height-30;
  document.navLayer.top = pageYOffset+ 121
  //document.bandeau.left = (window.innerWidth-document.bandeau.document.width) / 2;
  document.navLayer.left = 30
  setTimeout('stat()',200)
}

function positionne(){
	
	Navig=navigator.appName
	
	setTimeout('positionne()',500)

  if(Navig=='Netscape'){
      stat(layerName)
  }else{
      //bandeau.style.top = document.body.scrollTop+document.body.clientHeight-document.all.bandeau.offsetHeight+10;
      navLayer.style.top = document.body.scrollTop + 121
      //bandeau.style.left = (document.body.clientWidth - document.all.bandeau.offsetWidth) / 2;
      //navLayer.style.left = 28
  }
}



//use pageYOffset for navigator
var oldScroll

function checkScroll(){

	if(isNS6){
		newScroll = document.pageYOffset
			if (newScroll == oldScroll){
				document.navLayer.top = newScroll + 121
			}

	}else{
		newScroll = document.body.scrollTop	
		if (newScroll == oldScroll){
			navLayer.style.top = newScroll + 121		
		}

	}
	oldScroll = newScroll
	window.status = oldScroll
    
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);