
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- Idea by:  Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL:  http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=620,height=600,left = 312,top = 184');");
}
// End -->
<!-- Begin
function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=800,height=700,left = 312,top = 30');");
}
// End -->

<!--
	var win=null;
	function NewWindow(mypage,myname,w,h,pos,infocus){
	if (w=='')
		w = 600;
	if (h=='')
		h = 500;
	
	
	if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=window.open(mypage,myname,settings);
	win.focus();}
	// -->
<!--
	function getNextElement (field) 
	{
		var form = field.form;
		for (var e = 0; e < form.elements.length; e++)
		if (field == form.elements[e])
		{
			if (form.elements[e+1].disabled == true)
			{
				e = e+1;
			}
			break;

		}
			return form.elements[++e % form.elements.length];
	}

	function tabOnEnter (field, evt) 
	{
		var keyCode = document.layers ? evt.which : document.all ? evt.keyCode : evt.keyCode;
		if (keyCode != 13)
			return true;
		else 
		{
			if (getNextElement(field).disabled == false)
				getNextElement(field).focus();
			return false;
		}
	}
	function clickTab(field, evt)
	{
		var keyCode = document.layers ? evt.which : document.all ? evt.keyCode : evt.keyCode;
		getNextElement(field).focus();
		return false;
	
	}
	function selectItem(field, evt)
	{
//				if (getNextElement(field).disabled == false)
				getNextElement(field).focus();
				return false;
	}

	
	function skipNextElement (field) 
	{
		var form = field.form;
		for (var e = 0; e < form.elements.length; e++)
		if (field == form.elements[e])
		{
			e = e+1;
			break;

		}
			return form.elements[++e % form.elements.length];
	}

	function enableTextBox(option, radio)
	{
		//alert(radio.value);
		if (radio.value == 'yes')
			document.form1[option].disabled = false;
		else
			document.form1[option].disabled = true;
	}
	function enableTextBoxUnits(text1, text2, capacity_no, capacity_yes, trustname, radio)
	{
	//alert(capacity_yes);
		if (radio.value == 'yes')
		{
			document.form1[text1].disabled = false;
			document.form1[text2].disabled = false;
			document.form1[capacity_yes].disabled = false;
			document.form1[capacity_no].disabled = false;
		}
		else
		{
			document.form1[text1].disabled = true;
			document.form1[text2].disabled = true;
			document.form1[capacity_yes].disabled = true;
			document.form1[capacity_no].disabled = true;
			document.form1[trustname].disabled = true;
		}
	}


	function checkIndividuals(formid)
	{
		
		if (document.form1['multiple'].checked == true && document.form1['num_individuals'].value == '')
			{
			alert('Please select the number of individuals you would like to select');
			return false;
			}
		if (document.form1['num_unit_holders'].disabled == false && document.form1['num_unit_holders'].value == '')
			{
			alert('Please select the number of Additional Holders');
			return false;
			}
		
		return true;
	}
function ccCheck(ID) {
  document.payment.cardType[ID].checked = true;
}

function openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
	function comp_fields(formid, totalCount, formDeed, entityType, numCompany, numOther)
	{
		var count;
		var msg;
		var temp;
		var numBeneficiary;
		var numAddHolder;
		var ok = "yes";
		var temp;
		var check_string;
		

		var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&' "


		if (formDeed == 'family')
			numBeneficiary = numOther;
		else
			numAddHolder = numOther;
		
		msg = '';
		
		if (document.form1['prop_name_trust'].value == '')
		{
			msg = msg + 'Proposed Name of Trust must be entered\n';
		}
		else if ((document.form1['prop_name_trust'].value).length < 8)
		{
			msg = msg + 'The number of characters must be greater than seven for the Proposed Name of Trust\n';
		}

		temp = (document.form1['prop_name_trust'].value).indexOf("  ");
		//alert ((document.form1['prop_name_trust'].value).length);
		if (temp > -1 )
			msg = msg +("Please remove the extra spacing in the Proposed Name of Trust!\n");
		

		check_string = document.form1['prop_name_trust'].value;
		for (var i=0; i<check_string.length; i++) 
		{

			temp = "" + check_string.substring(i, i+1);
			if (valid.indexOf(temp) == "-1") ok = "no";
			if (document.form1['prop_name_trust'].value == '  ') ok = "no";
			if (ok == "no") 
			{
				msg = msg +('Proposed Name of Trust can only accept letters and numbers!\n');
				i = check_string.length;
				//return false;
			}	
		}




		if ((document.form1['commencement_date'].value != '') && ((document.form1['commencement_month'].value == '') || (document.form1['commencement_year'].value == '')))
		{
			msg = msg + 'The Date of Commencement of Trust is incomplete\n';
		}
		else if ((document.form1['commencement_month'].value != '') && ((document.form1['commencement_date'].value == '') || (document.form1['commencement_year'].value == '')))
		{
			msg = msg + 'The Date of Commencement of Trust is incomplete\n';
		}
		else if ((document.form1['commencement_year'].value != '') && ((document.form1['commencement_date'].value == '') || (document.form1['commencement_month'].value == '')))
		{
			msg = msg + 'The Date of Commencement of Trust is incomplete\n';
		}


		for (count = 1; count <= totalCount; count++)
		{
			//if indiv surname is left blank
			if (document.form1['individual'+count+'_surname'].value == '')
			{
				temp = 'Individual Details ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Surname must be specified.\n';
				msg = msg + temp;
			}
			else
			{
				var pcodeRegxp = /^([a-zA-Z]+)$/;
				if (pcodeRegxp.test(document.form1['individual'+count+'_surname'].value) != true)
				{
					temp = 'Individual Details ';
	
					if (totalCount > 1)
						temp = temp + count;
					temp = temp + ' Surname must be character only.\n';
					msg = msg + temp;
				}			
			}			
			

			//if indiv surname is left blank
			if (document.form1['individual'+count+'_first_christ_name'].value == '')
			{
				temp = 'Individual Details ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Firstname must be specified.\n';
				msg = msg + temp;
			}
			else
			{
				var pcodeRegxp = /^([a-zA-Z]+)$/;
				if (pcodeRegxp.test(document.form1['individual'+count+'_first_christ_name'].value) != true)
				{
					temp = 'Individual Details ';
	
					if (totalCount > 1)
						temp = temp + count;
					temp = temp + ' Firstname must be character only.\n';
					msg = msg + temp;
				}			
			}



			if (document.form1['individual'+count+'_res_street_name'].value == '')
			{
				temp = 'Individual Address ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Street name must be specified.\n';
				msg = msg + temp;
			}



			if (document.form1['individual'+count+'_res_street_type'].value == '')
			{
				temp = 'Individual Address ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Street type must be specified.\n';
				msg = msg + temp;
			}

			if (document.form1['individual'+count+'_res_suburb'].value == '')
			{
				temp = 'Individual Address ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Suburb must be specified.\n';
				msg = msg + temp;
			}

			if (document.form1['individual'+count+'_res_state'].value == '')
			{
				temp = 'Individual Address ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' State must be specified.\n';
				msg = msg + temp;
			}

			if (document.form1['individual'+count+'_res_postcode'].value == '')
			{
				temp = 'Individual Address ';

				if (totalCount > 1)
					temp = temp + count;
				temp = temp + ' Postcode must be specified.\n';
				msg = msg + temp;
			}
			else
			{
				var pcodeRegxp = /^([0-9]{4})$/;
				if (pcodeRegxp.test(document.form1['individual'+count+'_res_postcode'].value) != true)
				{
					temp = 'Individual Address ';
	
					if (totalCount > 1)
						temp = temp + count;
					temp = temp + ' Postcode must be numeric.\n';
					msg = msg + temp;
				}			
			}
			
			if (formDeed == 'unit')
			{
				if (document.form1['indiv'+count+'_issued_units'].checked == true && document.form1['individual'+count+'_num_units'].value == '')
				{
					
					temp = 'Individual ';
	
					if (totalCount > 1)
						temp = temp + count;
					temp = temp + ' Number of units must be specified.\n';
					msg = msg + temp;
					//alert('Please enter a number of units');
					//return false;
				}
				if (document.form1['indiv'+count+'_issued_units'].checked == true)
					document.form1['individual'+count+'_num_units'].disabled = false;
					document.form1['individual'+count+'_num_units_words'].disabled = false;
				

				if (document.form1['ind_trust_yes'+count].checked == true && document.form1['individual'+count+'_trust_name'].value == '')
				{
					
					temp = 'Individual ';
	
					if (totalCount > 1)
						temp = temp + count;
					temp = temp + ' Name of the trust must be specified.\n';
					msg = msg + temp;
					
					//alert('Please enter a number of units');
					//return false;
				}
				if (document.form1['ind_trust_yes'+count].checked == true)
					document.form1['individual'+count+'_trust_name'].disabled = false;
			}

		}

		for (count = 1; count <= numCompany; count++)
		{
			 if (entityType == 'Two Companies Jointly' || entityType == 'Company only' || entityType == 'Company Yet to be Registered')
			{
				if (document.form1['company'+count+'_name'].value == '')
				{
					temp = 'Company: ';
					if (numCompany > 1)
					{
						temp = temp + count;
					}
					temp = temp + ' Full Name of Company must be specified\n';
					msg = msg + temp;
				}


				if ((entityType == 'Two Companies Jointly' || entityType == 'Company only') && document.form1['company'+count+'_acn'].value == '')
				{
					temp = 'Company: ';
					if (numCompany > 1)
					{
						temp = temp + count;
					}
					temp = temp + ' ACN must be specified\n';
					msg = msg + temp;
				}
				if (formDeed == 'unit')
				{
					//alert(document.form1['comp'+count+'_units_issued'].checked);
					if (document.form1['comp'+count+'_units_issued'].checked == true && document.form1['company'+count+'_num_units2'].value == '')

					{
						temp = 'Company: ';
						if (numCompany > 1)
						{
							temp = temp + count;
						}
						temp = temp + ' number of units must be specified\n';
						msg = msg + temp;
					}
					if (document.form1['comp'+count+'_units_issued'].checked == true)
					{
						document.form1['company'+count+'_num_units2'].disabled = false;
						document.form1['company'+count+'_num_units_words'].disabled = false;
					}
					if (document.form1['comp_trust_yes'+count].checked == true && document.form1['company'+count+'_trust_name'].value == '')
					{
						
						temp = 'Company: ';
		
						if (totalCount > 1)
							temp = temp + count;
						temp = temp + ' name of the trust must be specified.\n';
						msg = msg + temp;
						//alert('Please enter a number of units');
						//return false;
					}
					if (document.form1['comp_trust_yes'+count].checked == true)
						document.form1['company'+count+'_trust_name'].disabled = false;
				}



			}
		
		}
		
		// settlor & beneficiary details is compulsory if family deed
		if (formDeed == 'family')
		{
			if (document.form1['settlor_surname'].value == '')
			{
				msg = msg + 'Settlor surname must be specified\n';
			}
			else
			{
				var pcodeRegxp = /^([a-zA-Z]+)$/;
				if (pcodeRegxp.test(document.form1['settlor_surname'].value) != true)
					msg = msg + 'Settlor surname must be character only\n';
			}
			if (document.form1['settlor_first_christ_name'].value == '')
			{
				msg = msg + 'Settlor firstname must be specified\n';
			}
			else
			{
				var pcodeRegxp = /^([a-zA-Z]+)$/;
				if (pcodeRegxp.test(document.form1['settlor_first_christ_name'].value) != true)
					msg = msg + 'Settlor firstname must be character only\n';
			}				
			if (document.form1['settlor_street_name'].value == '')
				msg = msg + 'Settlor street name must be specified\n';
			if (document.form1['settlor_street_type'].value == '')
				msg = msg + 'Settlor street type must be specified\n';
			if (document.form1['settlor_suburb'].value == '')
				msg = msg + 'Settlor suburb must be specified\n';
			if (document.form1['settlor_state'].value == '')
				msg = msg + 'Settlor state must be specified\n';
			if (document.form1['settlor_postcode'].value == '')
				msg = msg + 'Settlor postcode must be specified\n';			
			var pcodeRegxp = /^([0-9]{4})$/;
			if (pcodeRegxp.test(document.form1['settlor_postcode'].value) != true)
				msg = msg + 'Settlor postcode must be numeric\n';

		

			for (count = 1; count <= numBeneficiary; count++)
			{

				//if indiv surname is left blank
				if (document.form1['beneficiary'+count+'_surname'].value == '')
				{
					temp = 'Beneficiary Details ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Surname must be specified.\n';
					msg = msg + temp;
				}
				else
				{
					var pcodeRegxp = /^([a-zA-Z]+)$/;
					if (pcodeRegxp.test(document.form1['beneficiary'+count+'_surname'].value) != true)
					{
						temp = 'Individual Details ';
		
						if (totalCount > 1)
							temp = temp + count;
						temp = temp + ' Surname must be character only.\n';
						msg = msg + temp;
					}			
				}				

	
				//if indiv surname is left blank
				if (document.form1['beneficiary'+count+'_first_christ_name'].value == '')
				{
					temp = 'Beneficiary Details ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Firstname must be specified.\n';
					msg = msg + temp;
				}
				else
				{
					var pcodeRegxp = /^([a-zA-Z]+)$/;
					if (pcodeRegxp.test(document.form1['beneficiary'+count+'_first_christ_name'].value) != true)
					{
						temp = 'Individual Details ';
		
						if (totalCount > 1)
							temp = temp + count;
						temp = temp + ' Firstname must be character only.\n';
						msg = msg + temp;
					}			
				}

	
	
	
				if (document.form1['beneficiary'+count+'_street_name'].value == '')
				{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Street name must be specified.\n';
					msg = msg + temp;
				}

	
	
	
				if (document.form1['beneficiary'+count+'_street_type'].value == '')
				{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Street type must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['beneficiary'+count+'_suburb'].value == '')
				{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Suburb must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['beneficiary'+count+'_state'].value == '')
				{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' State must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['beneficiary'+count+'_postcode'].value == '')
				{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Postcode must be specified.\n';
					msg = msg + temp;
				}
				var pcodeRegxp = /^([0-9]{4})$/;
				if (pcodeRegxp.test(document.form1['beneficiary'+count+'_postcode'].value) != true)
					{
					temp = 'Beneficiary Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Postcode must be numeric.\n';
					msg = msg + temp;
				}
								
			
			}




		}
		else
		{
			for (count = 1; count <= numAddHolder; count++)
			{

				//if AddHolder surname is left blank
				if (document.form1['additional_holder'+count+'_sur_company_name'].value == '')
				{
					temp = 'Additional Holder Details ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Surname must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['additional_holder'+count+'_res_street_name'].value == '')
				{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Street name must be specified.\n';
					msg = msg + temp;
				}

	
				if (document.form1['additional_holder'+count+'_res_street_type'].value == '')
				{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Street type must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['additional_holder'+count+'_res_suburb'].value == '')
				{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Suburb must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['additional_holder'+count+'_res_state'].value == '')
				{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' State must be specified.\n';
					msg = msg + temp;
				}

				if (document.form1['additional_holder'+count+'_res_postcode'].value == '')
				{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Postcode must be specified.\n';
					msg = msg + temp;
				}
				
				var pcodeRegxp = /^([0-9]{4})$/;
				if (pcodeRegxp.test(document.form1['additional_holder'+count+'_res_postcode'].value) != true)
					{
					temp = 'Additional Holder Address ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Postcode must be numeric.\n';
					msg = msg + temp;
				}				
				
				if (document.form1['addit_holder'+count+'_trustee_capacity'].checked == true && document.form1['additional_holder'+count+'_trust_name'].value == '')
				{
					temp = 'Additional Holder Trustee Capacity ';
	
					if (numBeneficiary > 1)
						temp = temp + count;
					temp = temp + ' Name of the trust must be specified.\n';
					msg = msg + temp;
					
				}
				if (document.form1['addit_holder'+count+'_trustee_capacity'].checked)
					document.form1['additional_holder'+count+'_trust_name'].disabled = false;
			}
			if (document.form1['dollar_value_units'].value == '')
				msg = msg + 'Dollar Value of each of those Initial Units to be issued must be specified.\n';
			if (document.form1['signature_name'].value == '')
				msg = msg + 'Signature on Initial Unit Certificate must be specified.\n';
		}


		if (msg != '')
		{
			msg = /*'For testing purposes, the form will continue.\n*/'These fields must be filled in:\n' + msg;
			alert (msg);
			return false;
		}
		else
		{
			if (formDeed == 'unit')
			{
				document.form1['total_num_units'].disabled = false;
				document.form1['total_value_units'].disabled = false;
			}
		
		}
//		alert('sent');
		return true;	
	}

function indiv(option)
{
	//alert(option);
	document.form1['num_individuals'].disabled = option;
}
function confirmDelete(filename,prompt)
	{
	if(confirm(prompt))
		location= filename;
	}

// End -->