function OpenSetWindow(URL, target, width, height) {
	window.open(URL, target,'toolbar=no,scrollbars=yes,width=' + width + ',height=' + height + '');
}

//used on Homepage
function OpenWindow(URL) {
	window.open(URL, '_blank','toolbar=no,scrollbars=yes,width=420,height=440');
}


function PopUp(aurl) {
	window.open(aurl, "newWindow", "width=600,height=400,resizable=1,scrollbars=1");
}


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();
}

// Call
MM_reloadPage(true);


function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}


function openAWindow( pageToLoad, winName, width, height, center, scrollbars) {
	xposition=0; yposition=0;
	
	if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
	
	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;
	}
	args = "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=0,"
	+ "scrollbars=" + scrollbars + ","
	+ "status=0," 
	+ "titlebar=1,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + ","  //NN Only
	+ "screeny=" + yposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only
	
	window.open( pageToLoad,winName,args );
}
function SubRollOverRow(oTr) {if (!oTr.contains(event.fromElement)) {oTr.bgColor="FFFF99";}}
function SubRollOutRow(oTr) {if (!oTr.contains(event.toElement)) {oTr.bgColor="FFFFFF";}}

function SubRollOver(oTd) {if (!oTd.contains(event.fromElement)) {oTd.bgColor="FFFFFF";}}
function SubRollOut(oTd) {if (!oTd.contains(event.toElement)) {oTd.bgColor="99CCFF";}}

function SubRollOverT(o) {if (!o.contains(event.fromElement)) {o.bgColor="003399";}}
function SubRollOutT(o) {if (!o.contains(event.toElement)) {o.bgColor="CCCCCC";}}

function ValidateFields()
{
	if ((document.form1.amount.value ==	'0')||(document.form1.amount.value == ''))
    {
		alert('You must	enter a valid NUMBER between 1-999999');
		document.form1.amount.focus();
		return (false);
    }

	var	varAmount=document.form1.amount.value;
	if (isNaN(varAmount))
    {
		alert('You must	enter a valid NUMBER between 1-999999');
		document.form1.amount.focus();
		return (false);
    }

	if ((parseInt(varAmount)<=0)||(parseInt(varAmount)>999999))
    {
		alert('You must	enter a valid NUMBER between 1-999999');
		document.form1.amount.focus();
		return (false);
	}

return true;
}


// Un-frame if we're in a frameset and we weren't referred by ourselves or authorised clients.
function checkAuthorisedFrameset() 
{
	if (top.location != self.location) {
		if (document.referrer) {
			// There is a referrer, check it's authorised to frame inFARMation. 
			// Ignore no referrers.
	     	if ( document.referrer.indexOf("infarmation.com.au")== -1 &&
	     	     document.referrer.indexOf("countryrugby.com.au")== -1 &&
	     	     document.referrer.indexOf("farmsupplies.com.au")== -1 &&
	      		 document.referrer.indexOf("infochoice.com.au")== -1
	      		 ) {
				// Load inFARMation into the top frame.
				top.location = self.location.href;	
			}
		}
	}
}