function InitForm()
{
	//AttachFieldEvent('cmbLocation','change',OnChangeLocation);
	SuburbMap.dfSuburb =  new CPostcode('dfState','dfPostcode');	
	//SpecialLoad();
	useAJAXSuburbs=true;
}

function MakePrintable()
{
	//Change CSS styles	
	document.styleSheets[0].disabled = true;
	document.styleSheets[1].disabled = false;

	//Hide everything with class of 'noprint', show everything with class of 'print'

	//Change 'Printable version' link
	document.all('PrintLink').onclick = MakeNonPrintable;
	document.all('PrintImg').src = 'images/noprinter.gif';
	document.all('PrintTxt').innerHTML = 'Non-Printable Version';
}


function MakeNonPrintable()
{
	//Change CSS styles back
	document.styleSheets[0].disabled = false;
	document.styleSheets[1].disabled = true;
	
	//Show everything with class of 'noprint', hide everything with class of 'print'

	//Change 'Non-Printable version' link	
	document.all('PrintLink').onclick = MakePrintable;
	document.all('PrintImg').src = 'images/printer.gif';
	document.all('PrintTxt').innerHTML = 'Printable Version';
}


function ShowResults()
{
	var critCount;
	 critCount= 0;
	 mandCount=0;
	 if(document.all("dfLicenceeRegNo").value != '')
		mandCount++;
	if(document.all("dfLicenceename").value != '')
		mandCount++;
	if(document.all("dfTradingName").value != '')
		mandCount++;	
	 
	if(document.all("cmbLicenceType").value != '')
		critCount++;
	if(document.all("dfAddress").value != '')
		critCount++;
	if(document.all("dfSuburb").value != '')
		critCount++;
		
	var cmbLicType = document.all('cmbLicenceType');
	
	if(mandCount == 0 && cmbLicType.selectedIndex == 0)
	{
		alert('To conduct a search you must supply one or both of:\na) The Registration/Licence Number, Licensee Name or Trading Name.\nb) The Registration/Licence Type, Address and Suburb to ensure an accurate search.')
		return;
	}
	if(mandCount == 0 && critCount < 3)
	{
		alert('To conduct a search you must supply one or both of:\na) The Registration/Licence Number, Licensee Name or Trading Name.\nb) The Registration/Licence Type, Address and Suburb to ensure an accurate search.')
		return;
	}
	document.all("$PARAM2").value = "DISPLAYRESULTS";
	SaveScreen();
}

function RefineCriteria()
{
	document.all("$PARAM2").value = "";
	SaveScreen();
}
function OnPageSearchResults(pageno)
{
	document.all('$ACTION').value = 'PageList';
	document.all('$PARAM').value = ''+pageno;
	document.forms[0].submit();
}

function MakePrintable()
{
	//Change CSS styles	
	document.styleSheets[0].disabled = true;
	document.styleSheets[1].disabled = false;

	//Hide everything with class of 'noprint', show everything with class of 'print'

	//Change 'Printable version' link
	document.all('PrintLink').onclick = MakeNonPrintable;
	document.all('PrintImg').src = 'images/noprinter.gif';
	document.all('PrintTxt').innerHTML = 'Non-Printable Version';
	
	document.getElementById('newheader').style.display = 'none';
	document.getElementById('newfooter').style.display = 'none';
	
	var a = document.getElementById('NonPrintText1');
	if(a)
		document.getElementById('NonPrintText1').style.display = 'none';
}

function MakeNonPrintable()
{
	//Change CSS styles back
	document.styleSheets[0].disabled = false;
	document.styleSheets[1].disabled = true;

	//Show everything with class of 'noprint', hide everything with class of 'print'

	//Change 'Non-Printable version' link	
	document.all('PrintLink').onclick = MakePrintable;
	document.all('PrintImg').src = 'images/printer.gif';
	document.all('PrintTxt').innerHTML = 'Printable Version';
	
	document.getElementById('newheader').style.display = 'block';
	document.getElementById('newfooter').style.display = 'block';	
	
	var a = document.getElementById('NonPrintText1');
	if(a)
		document.getElementById('NonPrintText1').style.display = 'block';
}

function OnChangeLocation()
{
	//pop building combo
	var val = document.all('cmbLocation').value;
	if (val == '')
	{
		RemoveAllCodes(document.all('cmbBuilding'));		
		return;
	}	
	PopulateCodes('cmbBuilding','BUILDING',val,'','',3);
}

function OnClear()
{
	//Do this manually: form reset will clear hidden fields too! (bad)
	document.all("dfLicenceeRegNo").value = '';
	document.all("dfLicenceename").value = '';
	document.all("dfTradingName").value = '';
	document.all("dfAddress").value = '';
	document.all("dfSuburb").value = '';
	document.all("dfState").value = '';
	document.all("dfPostcode").value = '';
	document.all("cmbLicenceType").value = '';
}

function ViewActions(incid)
{
	var ret = window.showModalDialog('dialog.asp?title=Other+Controls','actions.asp?incid='+incid,'dialogWidth:560px;dialogHeight:315px;status:yes;help:no;resizable:no');
}
