<!-- javascript file

function clearSearch()
{
	var thisObj=document.getElementById('searchbox');
	thisObj.value='';	
}

function hideSub(someID)
{
var thisObj = document.getElementById(someID).style;
thisObj.visibility = "hidden";
}

function showSub(someID)
{
var thisObj = document.getElementById(someID).style;
thisObj.visibility = "visible";
}

function showCompany(coid)
{
	window.open('rnha_company.php?c='+coid,'directory', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=yes, width=325, height=410');
}

function swapImage(someID,someImg)
{
	var someObj=document.getElementById(someID);
		
	someObj.src=someImg;
}

function popPostForm(forum,topic,parent)
{
	window.open('rnha_addpost.php?fid='+forum+'&tid='+topic+'&pid='+parent,'Forum','toolbar=0, scrollbars=0, location=0, statusbar=0, menubar=0, resizable=yes, width=200, height=150');	
}

function popCareHome(hc)
{
	var inpOrg=document.getElementById('inpOrg').value;
	var inpLine1=document.getElementById('inpLine1').value;
	var inpLine2=document.getElementById('inpLine2').value;
	var inpLine3=document.getElementById('inpLine3').value;
	var inpTown=document.getElementById('inpTown').value;
	var inpPostCode=document.getElementById('inpPostCode').value;
	var inpTel=document.getElementById('inpTel').value;
	var inpFax=document.getElementById('inpFax').value;
	var inpEmail=document.getElementById('inpEmail').value;
	var inpLA=document.getElementById('inpLA').value;
	var inpCSCI=document.getElementById('inpCSCI').value;
	var inpProp1=document.getElementById('inpProp1').value;
	var inpProp2=document.getElementById('inpProp2').value;
	var inpOrgType=document.getElementById('inpOrgType').value;
	var inpPatients=document.getElementById('inpPatients').value;
	var inpRegCatDetails=document.getElementById('inpRegCatDetails').value;
	var inpInsurance=document.getElementById('inpInsurance').value;
	var inpRenewalDate=document.getElementById('inpRenewalDate').value;
	
	var homesString='';
	
	for (n=1 ; n<hc ; n++)
	{
		var thisVal=document.getElementById('inpCareHomes'+n).value;
		var homesString=homesString+'&inpCareHomes'+ n +'='+thisVal;	
	}
	
	window.open('rnha_addhome.php?hc='+hc+'&inpOrg='+inpOrg+'&inpLine1='+inpLine1+'&inpLine2='+inpLine2+'&inpLine3='+inpLine3+'&inpTown='+inpTown+'&inpPostCode='+inpPostCode+'&inpTel='+inpTel+'&inpFax='+inpFax+'&inpEmail='+inpEmail+'&inpLA='+inpLA+'&inpCSCI='+inpCSCI+'&inpProp1='+inpProp1+'&inpProp2='+inpProp2+'&inpOrgType='+inpOrgType+'&inpPatients='+inpPatients+'&inpRegCatDetails='+inpRegCatDetails+'&inpInsurance='+inpInsurance+'&inpRenewalDate='+inpRenewalDate+homesString,'CareHomes','toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=yes, width=325, height=485');	
}

function editCareHome(hc)
{
	document.forms['rnhaapp'].elements['hc'].value=hc;
	document.forms['rnhaapp'].submit();
}

function addHome(hc)
{
	document.forms['rnhaapp'].elements['hc'].value=(hc*1)+1;
	document.forms['rnhaapp'].elements['action'].value='addhome';
	
	var returnValue=goValidate('rnhaapp','inpHomeName,inpHomeLine1,inpHomeTown,inpHomePostCode,inpHomePhone','home name,first line of home address,home town,home post code,home phone number','string,string,string,string,string');
	
	//alert ('returnvalue = '+returnValue);
	
	if (returnValue)
	{
		document.forms['rnhaapp'].submit();
	}
}

function sendEditHome(homeid)
{
	var inpHomeName=document.getElementById('inpHomeName').value;
	var inpHomeLine1=document.getElementById('inpHomeLine1').value;
	var inpHomeLine2=document.getElementById('inpHomeLine2').value;
	var inpHomeLine3=document.getElementById('inpHomeLine3').value;
	var inpHomeTown=document.getElementById('inpHomeTown').value;
	var inpHomeCounty=document.getElementById('inpHomeCounty').value;
	var inpHomeCountry=document.getElementById('inpHomeCountry').value;
	var inpHomePostCode=document.getElementById('inpHomePostCode').value;
	var inpHomeEmail=document.getElementById('inpHomeEmail').value;
	var inpHomeWebSite=document.getElementById('inpHomeWebSite').value;
	var inpHomePhone=document.getElementById('inpHomePhone').value;
	var inpHomeFax=document.getElementById('inpHomeFax').value;
	var inpHomeDesc=document.getElementById('inpHomeDesc').value;
	var newHomeDisplay='<strong>'+inpHomeName+'</strong><br>'+inpHomeLine1+'<br>'+inpHomeLine2+'<br>'+inpHomeLine3+'<br>'+inpHomeTown+'<br>'+inpHomeCounty+'<br>'+inpHomeCountry+'<br>'+inpHomePostCode+'<br>'+inpHomeEmail+'<br>'+inpHomeWebSite+'<br>'+inpHomePhone;
	
	
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Name').value=inpHomeName;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Line1').value=inpHomeLine1;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Line2').value=inpHomeLine2;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Line3').value=inpHomeLine3;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Town').value=inpHomeTown;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_County').value=inpHomeCounty;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Country').value=inpHomeCountry;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_PostCode').value=inpHomePostCode;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Email').value=inpHomeEmail;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_WebSite').value=inpHomeWebSite;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Phone').value=inpHomePhone;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Desc').value=inpHomeDesc;
	window.opener.document.getElementById('inpCareHomes'+homeid+'_Fax').value=inpHomeFax;
	window.opener.document.getElementById('homedisplay'+homeid).innerHTML=newHomeDisplay;
	window.close();
}

function deleteCareHome(home)
{
	//alert ('homecount='+document.forms['rnhaapp'].elements['hc'].value);	

	var hc=document.forms['rnhaapp'].elements['hc'].value;
	var newhc=hc-1;
	
	for	(i=1 ; i<=hc ; i++)
	{
		if (i==home || i>home)
		{
			if (i!=hc)
			{
				document.forms['rnhaapp'].elements['inpCareHomes'+i].value=document.forms['rnhaapp'].elements['inpCareHomes'+(i+1)].value;
			}
		}	
	}
	
	document.forms['rnhaapp'].elements['hc'].value=newhc;
	document.forms['rnhaapp'].elements['action'].value='';
	
	document.forms['rnhaapp'].submit();
}

function validateMain()
{
	returnValue = goValidate('rnhaapp','inpOrg,inpLine1,inpTown,inpPostCode,inpTel,inpEmail,inpLA,inpCSCI,inpProp1,inpOrgType,inpPatients,inpRegCatDetails,inpInsurance,inpRenewalDate,inpCareHomes1',
		'organisation name,first line of address,town,post code,telephone number,email address,local authority,CSCI,name of proprietor,status,number of patients,registration category details,insurance copmany,insurance renewal date,home details',
		'string,string,string,string,string,email,string,string,string,string,string,string,string,string,string');

	if (returnValue==true)
	{
		document.forms['rnhaapp'].submit();
	}
}
//-->
