//---------------------------------------------------------------------
	var myreferer = document.referrer;
	var mylocation = document.location;
	
	var win = null;
	var ns4 = (document.layers)? true:false
	var ie4 = (document.all)? true:false
	var ns6=document.getElementById&&!document.all
	//var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1

	
	var pw = (screen.width * 75)/100 ;
	var ph = (screen.height * 75)/100;

	
//---------------------------------------------------------------------
	var myvar = getQueryVariable('a');
	if (myvar) {
		createCookie('gtx_advert_code', myvar ,7,1);
	} 
	
		
//---------------------------------------------------------------------
	
	if (!Number.toFixed){
          // the function toFixed takes the # of decimal places to use
          Number.toFixed = function (x) {
               var temp = this;
               temp=Math.ceil(temp*Math.pow(10,x))/Math.pow(10,x);
               return temp;
          }
     
     }
     // Browsers that support JS 1.5 will skip the entire previous if statement
 
//---------------------------------------------------------------------

	
	
	
	var head="display:''"
	var folder=''
	
	function expandit(curobj){
	folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+1].style
	if (folder.display=="none")
	folder.display=""
	else
	folder.display="none"
	}

	


if (ie4) {
document.write("<link rel='stylesheet' href='/gtx/manual/html/include/toc-ie.css' type='text/css'>");
} else {
	if (ns6) {
		document.write("<link rel='stylesheet' href='/gtx/manual/html/include/toc-ns.css' type='text/css'>");
	} else {
		document.write("<link rel='stylesheet' href='/gtx/manual/html/include/toc-ie.css' type='text/css'>");
	}
}
		
		
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }




// Break out of frames!! But not for the manual menu
//---------------------------------------------------------------------

if (top.location != location && !parent.frames['helptoc'] && !parent.frames['trbmain']) {
	top.location.href = document.location.href;
}



// LHS MENU MOUSE OVER BG
//---------------------------------------------------------------------
//For Netscape the general way to access the CSS-P properties is like this: 
//	document.blockDiv.propertyName
//or 
//	document.layers["blockDiv"].propertyName

//And then for Internet Explorer it's: 
//	blockDiv.style.propertyName
//or 
//	document.all["blockDiv"].style.propertyName


function LHSMenuOn(which) {
	if (ns4) block = document.layers[which].classnname='lhsmenuon';
	if (ie4) block = document.all[which].className='lhsmenuon';
	return false;
}

function LHSMenuOff(which) {
	if (ns4) block = document.layers[which].classname='lhsmenu';
	if (ie4) block = document.all[which].className='lhsmenu';
	return false;
}



function TopMenuOn(which) {
	if (ns4) block = document.layers[which].classname='redmenuon';
	if (ie4) block = document.all[which].className='redmenuon';
	return false;
}

function TopMenuOff(which) {
	if (ns4) block = document.layers[which].classname='redmenu';
	if (ie4) block = document.all[which].className='redmenu';
	return false;
}



//---------------------------------------------------------------------
	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}
	
	function getQueryVariable(variable) {
	  var query = window.location.search.substring(1);
	  var vars = query.split("&");
	  for (var i=0;i<vars.length;i++) {
	    var pair = vars[i].split("=");
	    if (pair[0] == variable) {
	      return pair[1];
	    }
	  } 
	}
	



//---------------------------------------------------------------------
function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}



//---------------------------------------------------------------------
function OpenGTS(mypage, myname, w, h, scroll) {
	
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,location=no'

	if (win && win.closed) { 
		//alert("closed");
		win = window.open(mypage, myname, winprops) 
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		
	} else if (win && win.open) {
		//alert("open");
		win.focus();
	} else {
		win = window.open(mypage, myname, winprops) 
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
}


//---------------------------------------------------------------------
function GoFromHelp(url) {
	if (window.opener && !window.opener.closed) {
	window.opener.focus(); 
		if (window.opener.document.location != url) {
			window.opener.document.location = url;
		}
	} else {
		newwin = window.open(url, 'gtxhome', 'height=600,width=800,top=10,left=10,scrollbars=yes,resizable,menubar=yes,toolbar=yes,statusbar=yes,location=yes,status=yes');
		if (parseInt(navigator.appVersion) >= 4) { newwin.window.focus(); }
	}
	//window.close();
	//return false;
}
	
	
	
//---------------------------------------------------------------------
function GoFromWin(url) {
	if (window.opener && !window.opener.closed) {
		window.opener.focus(); 
		if (url != "") { 
		//if (window.opener.document.location != url) {
			window.opener.document.location = url;
		//}
		}
	} else {
		newwin = window.open(url, 'gtxhome', 'height=600,width=800,top=10,left=10,scrollbars=yes,resizable,menubar=yes,toolbar=yes,statusbar=yes,location=yes,status=yes');
		if (parseInt(navigator.appVersion) >= 4) { newwin.window.focus(); }
	}
	window.close();
	return false;
}
	



//---------------------------------------------------------------------

	function ShowLoggedOn_Top(real_name) {
		document.write('<tr><td COLSPAN=3><img src="/gtx/images/layout/lhs/lhs_login_header.gif" width="149" height="23"></td></tr>');
		document.write('<tr><td colspan=3 align="center"><br><small>');
		document.write('	<b>Welcome back,<br>'+real_name+'</b><br>');
		document.write('	<a href="/gtx/ratings/hottip.html"> View Todays Selections <font color="#FF6600">&#155;&#155;</font></a></small>');
		document.write('	<br><br></td></tr>');
		document.write('<tr><td COLSPAN=3>&nbsp;</td></tr>');
	}
	
	function ShowNotLoggedOn_Top() {
		document.write('<tr><td colspan=3><a href="/gtx/register/"><img src="/gtx/images/layout/free_membership.gif" width="149" height="43" border="0"></a></td></tr>');
		document.write('<tr><td COLSPAN=3><img src="/gtx/images/layout/lhs/lhs_login_header.gif" width="149" height="23"></td></tr>');
		document.write('<TR><TD COLSPAN=3><IMG src="/gtx/images/layout/lhs/lhs_login_box_bg.gif" WIDTH=149 HEIGHT=9 ALT=""></TD></TR>');
		document.write('<TR><TD><IMG src="/gtx/images/layout/lhs/lhs_login_user.gif" WIDTH=38 HEIGHT=17 ALT=""></TD>');
		document.write('		<TD><input type="text" name="login_username" size="15" class="logintext"></TD>');
		document.write('		<TD>&nbsp;</TD></TR>');
		document.write('<TR><TD COLSPAN=3><IMG src="/gtx/images/layout/lhs/lhs_login_box_bg.gif" WIDTH=149 HEIGHT=9 ALT=""></TD></TR>');
		document.write('<TR><TD><IMG src="/gtx/images/layout/lhs/lhs_login_pass.gif" WIDTH=38 HEIGHT=17 ALT=""></TD>');
		document.write('		<TD><input type="password" name="login_password" size="15" class="logintext"></TD>');
		document.write('		<TD>&nbsp;</TD></TR>');
		document.write('<TR><TD COLSPAN=3 align="center"><br><input type="image"  src="/gtx/images/body/login.gif"  width="93" height="20" name="submit" ><br><br></TD></TR>');
		document.write('');
		document.write('');
		document.write('');

	}
	
	function ShowMenu(menui, menuitem, menulink) {
		document.write('<tr><td height="18" id="menu'+ menui +'>" style="background: url(\'/gtx/images/layout/lhs/lhs_menu_bg.gif\') no-repeat; " valign="middle" COLSPAN=3>&nbsp;   &nbsp; ');
		document.write('		<a href="'+ menulink +'" onMouseOver="LHSMenuOn(\'menu'+ menui +'\'); return false;" ');
		document.write('			onMouseOut="LHSMenuOff(\'menu'+ menui +'\'); return false;"');
		document.write('			><b class="bluesm">'+ menuitem +'</b></a></td>');
		document.write('</tr>');
	
	}
	
	function ShowLoggedOn_Menu(mstatus) {
		
		
		document.write('<tr><td COLSPAN=3><img src="/gtx/images/layout/lhs/lhs_menuhead_members.gif" width="149" height="24"></td></tr>');
		ShowMenu("3a", "Member Start", "/gtx/members/index.html");
		
		
//		ShowMenu("3b", "Your Details", "/gtx/members/user.php");
//		menui = menui + 1;
		
//		if (mstatus != "free") {
//			ShowMenu("3c", "Account Top Up", "/gtx/members/renew.php");
		
//		}
		
	}
			
			

var slideshow_width='650px' //SET IMAGE WIDTH
var slideshow_height='50px' //SET IMAGE HEIGHT
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)

var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed


////NO need to edit beyond here/////////////

var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}

var ie4=document.all
var dom=document.getElementById
			
			
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout("rotateimage()",pause)
}
}

function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}

function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
rotateimage()
}
//---------------------------------------------------------------------

function filter(imagename,objectsrc){
if (document.images)
document.images[imagename].src=eval(objectsrc+".src")
}
	
			
			
			




//---------------------------------------------------------------------

// login button
signupa=new Image(93,20)
signupa.src="/gtx/images/body/button_signup_on.gif"
signupb=new Image(93,20)
signupb.src="/gtx/images/body/button_signup.gif"

// order button
orderbtna=new Image(169,37)
orderbtna.src="/gtx/images/sales/button_order_on.gif"
orderbtnb=new Image(169,37)
orderbtnb.src="/gtx/images/sales/button_order.gif"

// second order button
orderbtn2a=new Image(169,37)
orderbtn2a.src="/gtx/images/sales/button_order_on.gif"
orderbtn2b=new Image(169,37)
orderbtn2b.src="/gtx/images/sales/button_order.gif"

// click here button
clickherea=new Image(141,27)
clickherea.src="/gtx/images/sales/button_click_on.gif"
clickhereb=new Image(141,27)
clickhereb.src="/gtx/images/sales/button_click.gif"

// lhs menu background
lhsmenua=new Image(59,28)
lhsmenua.src="/gtx/images/layout/lhs/lhs_menu_bg_on.gif"
lhsmenub=new Image(59,28)
lhsmenub.src="/gtx/images/layout/lhs/lhs_menu_bg.gif"


// backbutton
backbuttona=new Image(59,28)
backbuttona.src="/gtx/images/main/main_box_back_on.gif"
backbuttonb=new Image(59,28)
backbuttonb.src="/gtx/images/main/main_box_back.gif"

//---------------------------------------------------------------------
//var baseDIR = "http://www.trb.com.au/gtx/images/layout/"
var baseDIR = "/gtx/images/layout/redmenu/"

// home
homea=new Image(75,17)
homea.src=baseDIR+"trbbtn-home-on.gif"
homeb=new Image(75,17)
homeb.src=baseDIR+"trbbtn-home.gif"

// close
closea=new Image(79,17)
closea.src=baseDIR+"trbbtn-close-on.gif"
closeb=new Image(79,17)
closeb.src=baseDIR+"trbbtn-close.gif"

// educate
educatea=new Image(75,17)
educatea.src=baseDIR+"trbbtn-educate-on.gif"
educateb=new Image(75,17)
educateb.src=baseDIR+"trbbtn-educate.gif"

// shop
shopa=new Image(75,17)
shopa.src=baseDIR+"trbbtn-shop-on.gif"
shopb=new Image(75,17)
shopb.src=baseDIR+"trbbtn-shop.gif"

// contacts
contactsa=new Image(75,17)
contactsa.src=baseDIR+"trbbtn-support-on.gif"
contactsb=new Image(75,17)
contactsb.src=baseDIR+"trbbtn-support.gif"

// manual
manuala=new Image(75,17)
manuala.src=baseDIR+"trbbtn-manual-on.gif"
manualb=new Image(75,17)
manualb.src=baseDIR+"trbbtn-manual.gif"



// login
//logina=new Image(75,17)
//logina.src=baseDIR+"trbbtn-login-on.gif"
//loginb=new Image(75,17)
//loginb.src=baseDIR+"trbbtn-login.gif"

// logout
logouta=new Image(75,17)
logouta.src=baseDIR+"trbbtn-logout-on.gif"
logoutb=new Image(75,17)
logoutb.src=baseDIR+"trbbtn-logout.gif"

// members
membersa=new Image(75,17)
membersa.src=baseDIR+"trbbtn-members-on.gif"
membersb=new Image(75,17)
membersb.src=baseDIR+"trbbtn-members.gif"

function checkDecimal(numFld){
  msg = "";
  iChr = numFld.value.replace(/[0-9\.\,\$]/g,'');
  if(iChr>""){
    msg = "Invalid input character: "+iChr;
    numFld.value=numFld.value.replace(/[^0-9\.\,]/g,'');
  }
  num = numFld.value.replace(/[^0-9\.]/g,'').split('.');
  if(num.length>2){
    msg += "\nMore than one dot found.";
  } else if (num.length == 1) {
  	msg += "\nYou must supply a decmial value.";
  } else {
    if(num[0].length > 7){
      msg += "\nMore than 7 digits to the left of dot.";
    }
    if(num.length==2){
      if(num[1].length > 2){
        msg += "\nMore than 2 digits to the right of dot.";
      }
      if(num[1].length==0){
        msg += "\nRight of the dot is no digit.";
      }
    }
  }
  
  if(msg>"") {
    alert(msg);
    numFld.select();
    numFld.focus();
    return false; 
  } else {
    if(num[0]>""){
      num[0]=parseInt(num[0],10)+'';
      n = num[0].length;
      for(i=n-3;i>0;i-=3){
        num[0] = num[0].substr(0,i)+","+num[0].substr(i);
      }
      if(num.length==2){
        num[1] = "."+(num[1]+"0").substr(0,2);
      } else {
        num[1]="";
      }
      numFld.value=num[0]+num[1];
    }
  }
  return true;
}

