
/*********************************************************************************
'*	name:		    Registration.js
'*	date:		    23/01/2007
'*	author:		    Sunu S P
'*  copyright:  	Euro Software Services Pvt Ltd
'*	description :   Client validation JavaScript file for Registration module
' **********************************************************************************/


//-->============================Javascript Validation Functions==================================================

// Regular Expressions for Validation

var charexp = /./;
var numexp = /^\d*$/;
//var textnumexp = /[a-z0-9]*/i;
var textnumexp = /[a-z][0-9]*/i;
var textexp = /[a-z]*/i;
var phoneexp = /^[0-9 +()-]{5,}$/;
var Faxexp = /^[0-9 +-]{5,}$/;
var zipexpNew = /^[0-9a-zA-Z ()-]{5,}$/;
var phoneminimum = /\D*\d\D*\d\D*\d\D*\d\D*\d\D*\d\D*/g;
var zipexp = /^\d{5}$|^\d{5}[\-\s]?\d{4}$/;
var emailexp = /^[a-z_0-9][a-z_0-9\.\-\!\'&]+@[a-z_0-9\.\-\!]+\.[a-z]{1,4}$/i;
var webexp = /^[a-z_0-9\.\-\!]+\.[a-z]{1,4}$/i;
var dateexp =/^([0-2][0-9]|[3][0-1])[\/]([0][0-9]|[1][0-2])[\/][0-9]{4}$/;

// << -----------common functions for validation---------------------------- ------------------------------>> 

// check controlls

function isValid(pattern, control, mandatory, errormsg)
{
    if( mandatory ){
        if( control.value.length == 0 )
        {
           alert(errormsg);
           control.focus();
           return false;
        }
    }
	if(control.value.length != 0)
	{    if( !pattern.test(control.value) )
		{
	        alert(errormsg);
			control.focus();
			return false;
		}
	}
    return true;
}
    
  // Is Checked
  
  function isChecked( control, errormsg )
	{
		if( !control.checked )
		{
		    alert(errormsg);
			return false;
		}
    return true;
	}
	
	// Date validation
	
	function isDateValid(pattern, control, mandatory, errormsg, checkFuture)
	{
	if( mandatory ){
			if( control.value.length == 0 )
			{
				 alert(errormsg);
				 control.focus();
				 return false;
			}
	}

	if(control.value.length != 0)
	{    
		if( !pattern.test(control.value) )
		{
	        alert(errormsg);
			control.focus();
			return false;
		}

		var sDate = control.value;
		
		var YYYY = parseInt(sDate.substr(6,4));
		var DD = parseInt(sDate.substr(0,2));
		var MM = parseInt(sDate.substr(3,2));
		
		if ( MM==04 || MM==06 || MM==09 || MM==11 )
		{
			if (DD>30)
			{
				 alert(errormsg);
				 control.focus();
				 return false;
			}			
		}

		if ( MM==02 )
		{
			if ( (checkYear(YYYY) && DD>29) || (!checkYear(YYYY) && DD>28) )
			{
				 alert(errormsg);
				 control.focus();
				 return false;
			}
		}
		
		if (checkFuture)
		{
			//check that date is in future
			var now=new Date(); //current date
			var now=now.getTime();
			var dateToCheck = new Date(); //input date

			dateToCheck.setYear(YYYY);
			dateToCheck.setMonth(MM-1);
			dateToCheck.setDate(DD);
			var checkDate = dateToCheck.getTime();

			if ( now > checkDate )
			{
				 alert("Please enter a valid future date");
				 control.focus();
				 return false;
			}		
		}		
	}
	
    return true;
}

function Print() {
document.body.offsetHeight;
window.print();
}

function HighlightRow()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].className=='ITEM'||trs[j].className=='AlternateItem')
					{
						trs[j].onmouseover=function(){this.className='Highlight';return false}
						trs[j].onmouseout=function(){this.className='Item';return false}
					}
				}
		}
	}
}

/*============================================================
  page		: /carenet/NewCS/trial.aspx
  Control	: Next button
  Event		: Click
  ===========================================================*/

	function EmailSignUp_Page1()
	{
	//alert("dghgh")
	if( !isValid(emailexp,document.getElementById("txtemail"), true, "Please enter a valid Email address" ))
        return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CompanyDetails.aspx
  Control	: Next button
  Event		: Click
  Note		: Validate all controls 
  ===========================================================*/
	function Feedback_Send()
	{
	var ReturnVal = true;
	if( !isValid(textnumexp,document.getElementById("txtName"), true, "Please enter a valid Name" ))
        {ReturnVal= false;
        return false;}
     if( !isValid(emailexp,document.getElementById("txtEmail"), true, "Please enter a valid Email" ))
        {ReturnVal= false;
        return false;}
	if( document.getElementById("ddlProductName").selectedIndex == 0)
		{alert("Please select a product name");document.getElementById("ddlProductName").focus();
		ReturnVal= false;
		return false;}
	if (ReturnVal==true)
		{frmContactUs.submit();}
	}


/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CompanyDetails.aspx
  Control	: Next button
  Event		: Click
  Note		: Validate all controls 
  ===========================================================*/
	function Registration_HomeDet()
	{
	if( !isValid(textnumexp,document.getElementById("txtHomeName"), true, "Please enter a valid Home name" ))
        return false;
   // if( !isValid(textnumexp,document.getElementById("txtServiceType"), true, "Please enter a valid service name" ))
    //    return false;
    if( !isValid(textnumexp,document.getElementById("txtAddressline1"), true, "Please enter a valid Addressline 1" ))
        return false;
    if( !isValid(textnumexp,document.getElementById("txtAddressline2"), false, "Please enter a valid Addressline 2" ))
        return false;
   /* if( !isValid(textnumexp,document.getElementById("txtCity"), true, "Please enter a valid City name" ))
        return false;
    if( document.getElementById("ddlCounty").selectedIndex == 0)
		{alert("Please select a County"); document.getElementById("ddlCounty").focus();return false;}*/
    if( !isValid(zipexpNew,document.getElementById("txtPostCode"), true, "Please enter a valid Postcode" ))
        return false;
    if( !isValid(phoneexp,document.getElementById("txtPhone"), true, "Please enter a valid Phone Number" ))
        return false; 
    if( !isValid(textnumexp,document.getElementById("txtManager"), true, "Please enter a valid manager name" ))
       return false;
    if( !isValid(emailexp,document.getElementById("txtEmail"), true, "Please enter a valid Email" ))
        return false;
    if( !isValid(numexp,document.getElementById("txtnoOfbeds"), true, "Please enter a valid number" ))
        return false;
     if(parseInt(document.getElementById("txtnoOfbeds").value) < 1)
       {
		alert("Please enter a valid non-zero number");
		document.getElementById("txtnoOfbeds").focus();
		return false;
		}
	if(parseInt(document.getElementById("txtnoOfbeds").value) > 100)
       {
		alert("The maximum number of rooms allowed is 100");
		document.getElementById("txtnoOfbeds").focus();
		return false;
		}
	}

/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CompanyDetails.aspx
  Control	: Reset button
  Event		: Click
  Note		: Reset the controlls 
  ===========================================================*/
	function Registration_CompanyDet_Reset()
	{
		conf = confirm("Are you sure to clear all entered fields ? ");
		if(conf == true)
		{
		document.getElementById("txtCompanyName").value=""
		document.getElementById("txtClientName").value=""
		document.getElementById("txtAddressline1").value=""
		document.getElementById("txtAddressline2").value=""
		document.getElementById("txtCity").value=""
		document.getElementById("txtPostCode").value=""
		document.getElementById("txtPhone").value=""
		document.getElementById("txtEmail").value=""
		//document.getElementById("txtAlternateEmail").value=""
		//document.getElementById("txtFax").value=""
		//document.getElementById("txtHomepage").value=""
		document.getElementById("ddlCounty").selectedIndex = 0
		//document.getElementById("ddlCountry").selectedIndex = 0
		document.getElementById("ddlHearofSW").selectedIndex = 0
		document.getElementById("txtHomeName").value=""
		document.getElementById("txtnoOfbeds").value=""
		document.getElementById("txtOthers").value=""
		document.getElementById("txtCompanyName").focus();
		}
	return false;
	}


/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CompanyDetails.aspx
  Control	: Next button
  Event		: Click
  Note		: Validate all controls 
  ===========================================================*/
	function Registration_HomeDet_HomeManagers()
	{
	//if( !isValid(textnumexp,document.getElementById("txtHomeName"), true, "Please enter a valid Home name" ))
   //     return false;
    if( !isValid(textnumexp,document.getElementById("txtServiceType"), true, "Please enter a valid service name" ))
       return false;
    if( !isValid(textnumexp,document.getElementById("txtAddressline1"), true, "Please enter a valid Addressline 1" ))
        return false;
    if( !isValid(textnumexp,document.getElementById("txtAddressline2"), false, "Please enter a valid Addressline 2" ))
        return false;
   /* if( !isValid(textnumexp,document.getElementById("txtCity"), true, "Please enter a valid City name" ))
        return false;
    if( document.getElementById("ddlCounty").selectedIndex == 0)
		{alert("Please select a County"); document.getElementById("ddlCounty").focus();return false;}*/
    if( !isValid(zipexpNew,document.getElementById("txtPostCode"), true, "Please enter a valid Postcode" ))
        return false;
    if( !isValid(phoneexp,document.getElementById("txtPhone"), true, "Please enter a valid Phone Number" ))
        return false; 
    if( !isValid(textnumexp,document.getElementById("txtManager"), true, "Please enter a valid manager name" ))
       return false;
    if( !isValid(emailexp,document.getElementById("txtEmail"), true, "Please enter a valid Email" ))
        return false;
    if( !isValid(numexp,document.getElementById("txtnoOfbeds"), true, "Please enter a valid number" ))
        return false;
     if(parseInt(document.getElementById("txtnoOfbeds").value) < 1)
       {
		alert("Please enter a valid non-zero number");
		document.getElementById("txtnoOfbeds").focus();
		return false;
		}
	if(parseInt(document.getElementById("txtnoOfbeds").value) > 100)
       {
		alert("The maximum number of rooms allowed is 100");
		document.getElementById("txtnoOfbeds").focus();
		return false;
		}
	if(document.getElementById("txtUserName").value=="") 
			{
			alert("Please enter a valid user name");
			document.getElementById("txtUserName").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value=="") 
			{
			alert("Password field can't be null");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("txtConfirmPWD").value=="") 
			{
			alert("Confirm Password field can't be null");
			document.getElementById("txtConfirmPWD").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value.length < 6 && document.getElementById("txtPassword").value.length > 0)
			{
			alert("Password must be between 6-8 characters ");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value != document.getElementById("txtConfirmPWD").value)
			{
			alert("Confirm Password does not match !");
			document.getElementById("txtPassword").focus();
			return false;
			}
	}
	
	/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CompanyDetails.aspx
  Control	: Next button
  Event		: Click
  Note		: Validate all controls 
  ===========================================================*/
	function Support_SendQuery()
	{
    if( !isValid(textnumexp,document.getElementById("txtName"), true, "Please enter a valid Name" ))
        return false;
    if( !isValid(emailexp,document.getElementById("txtEmail"), true, "Please enter a valid Email address" ))
        return false;
     if( !isValid(textnumexp,document.getElementById("txtComments"), true, "Please enter your comments" ))
        return false;
	}
	
	
	/*============================================================
  page		:
  Control	:
  Event		: 
  Note		:
  ===========================================================*/
	function HomeDet_Click()
	{
     if( !isValid(textnumexp,document.getElementById("txtHomeName"), true, "Please enter a valid Home name" ))
        return false;
     if( !isValid(numexp,document.getElementById("txtnoOfbeds"), true, "Please enter a valid number" ))
        return false;
   }
   
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails_popup.aspx
  Control	: ok button
  Event		: Click
  Note		: validate number & max no of homes 
  ===========================================================*/
  
  function HomeDetails_Popup()
	{
	if( !isValid(numexp,document.getElementById("txtNoofHomes"), true, "Please enter a valid number" ))
        return false;
    if(parseInt(document.getElementById("txtNoofHomes").value) > 25)
        {
			alert("Trial user can't add morethan 25 homes ");
			document.getElementById("txtNoofHomes").focus();
			return false;
		}
	if(parseInt(document.getElementById("txtNoofHomes").value) < 1)
        {
		alert("Please enter a valid number");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
	if( document.getElementById("txtNoofHomes").value != "")
		{
		var homeNo = document.getElementById("txtNoofHomes").value;
		document.getElementById("hdd").value=1;
		myWindow = window.open('HomeDetails_popup.aspx?HomeNo='+parseInt(homeNo));
		return false;
		}
	}   
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails.aspx
  Control	: Hear of caresoft dropdown
  Event		: Changet
  Note		: enable textbox 
  ===========================================================*/
	function EnableOthers()
		{
			if(document.getElementById("ddlHearofSW").selectedIndex == 4)
				{
				document.getElementById("txtOthers").disabled = false;
				document.getElementById("txtOthers").focus();
				return false;
				}
			else
				{
				document.getElementById("txtOthers").disabled = true;
				//document.getElementById("txtOthers").value="";
				return false;
				}
		}
		
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails.aspx
  Control	: submit button
  Event		: Click
  Note		: validate controls on clicking submit button
  ===========================================================*/
		
/* function Registration_HomeDet()
	{
	if( !isValid(numexp,document.getElementById("txtNoofHomes"), true, "Please enter a valid number" ))
        return false;
    if(parseInt(document.getElementById("txtNoofHomes").value) > 25)
        {
		alert("Trial user can't add morethan 25 homes ");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
	 if(parseInt(document.getElementById("txtNoofHomes").value) < 1)
        {
		alert("Please enter a valid number");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
	if( document.getElementById("ddlHearofSW").selectedIndex == 0)
		{
		alert("Please select a Source of Information");
		document.getElementById("ddlHearofSW").focus();
		return false;
		}
	if( document.getElementById("ddlHearofSW").selectedIndex == 4 && document.getElementById("txtOthers").value == "")
		{
		alert("Please enter Other Source of Information");
		document.getElementById("txtOthers").focus();
		return false;
		}
	if( document.getElementById("hdd").value=="")
		{
		alert("Please click Generate Button for Generate/Edit Home details");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
	}*/
				

 /*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails.aspx
  Control	: Reset button
  Event		: Click
  Note		: Reset the controlls 
  ===========================================================*/
	function Registration_HomeDet_Reset()
	{
		conf = confirm("Are you sure to clear all entered fields ? ");
		if(conf == true)
		{
		document.getElementById("txtNoofHomes").value="";
		document.getElementById("ddlHearofSW").selectedIndex = 0;
		document.getElementById("txtOthers").value="";
		
		}
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails_popup.aspx
  Control	: Generae button
  Event		: Click
  Note		: validate control on clicking generaet button
  ===========================================================*/
		
 function Registration_HomeDetPopup_Generate()
	{
	if( !isValid(numexp,document.getElementById("txtNoofHomes"), true, "Please enter a valid number" ))
        return false;
     if(parseInt(document.getElementById("txtNoofHomes").value) < 1)
        {
		alert("Please enter a valid number");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
    if(parseInt(document.getElementById("txtNoofHomes").value) > 25)
        {
		alert("Trial user can't add morethan 25 homes ");
		document.getElementById("txtNoofHomes").focus();
		return false;
		}
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails_popup.aspx
  Control	: Reset button
  Event		: Click
  Note		: Reset control on clicking Reset button
  ===========================================================*/
		
 function Registration_HomeDetPopup_Reset()
	{
	conf = confirm("Are you sure to Reset the Home Details ? ");
	if(conf == true)
		return true;
	else
		return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/HomeDetails_popup.aspx
  Control	: save button
  Event		: Click
  Note		: close the popup window on save button click
  ===========================================================*/
  function Registration_HomeDetPopup_Save()
	{
	conf = confirm("Are you sure to close the Home details Page? ");
	if(conf == true)
	{
		window.close();
		return false;
	}
	else
		return false;
	}  
	
 /*============================================================
  page		: /carenet/NewCSUpdate/Internal/LoginPassword.aspx
  Control	: CONFIRM button
  Event		: Click
  Note		: compare passwords on clicking confirm button
  ===========================================================*/
	function Registration_LoginPassword()
		{
		if(document.getElementById("txtLoginid").value=="") 
			{
			alert("Please enter a valid user name");
			document.getElementById("txtLoginid").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value=="") 
			{
			alert("Password field can't be null");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("txtConfirmPWD").value=="") 
			{
			alert("Confirm Password field can't be null");
			document.getElementById("txtConfirmPWD").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value.length < 6 && document.getElementById("txtPassword").value.length > 0)
			{
			alert("Password must be between 6-8 characters ");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value != document.getElementById("txtConfirmPWD").value)
			{
			alert("Confirm Password does not match !");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("hdAccountType").value=="S" && !isValid(textnumexp,document.getElementById("txtBankerName"), true, "Please enter a valid name" ))
				return false;
		if(document.getElementById("hdAccountType").value=="S" && !isValid(textnumexp,document.getElementById("txtBankerAddress"), true, "Please enter a valid address" ))
				return false;
		if(document.getElementById("hdAccountType").value=="S" && !isValid(textexp,document.getElementById("txtSortCode"), true, "Please enter a valid sort code" ))
				return false;
		if(document.getElementById("hdAccountType").value=="S" && !isValid(textexp,document.getElementById("txtAccountNumber"), true, "Please enter a valid account number" ))
				return false;
		if(document.getElementById("hdAccountType").value=="S" && !isValid(textnumexp,document.getElementById("txtAccountName"), true, "Please enter a valid account name" ))
				return false;
		if(document.getElementById("chkTerms_Conditions").checked==false)
			{
			alert("Please read and accept terms and conditions to register with CareSoftware.Net");
			return false;
			}
		
		}
		
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/LoginPassword.aspx
  Control	: Reset button
  Event		: Click
  Note		: Reset the controlls 
  ===========================================================*/
	function Registration_LoginPassword_Reset()
	{
		conf = confirm("Are you sure to Reset Password ? ");
		if(conf == true)
		{
		document.getElementById("txtPassword").value="";
		document.getElementById("txtConfirmPWD").value="";
		document.getElementById("txtLoginid").value="";
		document.getElementById("txtLoginid").focus();
		}
	return false;
	}
	
 /*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Introduction hyperlink
  Event		: Click
  Note		: displays a description about introduction 
  ===========================================================*/
	function Introduction_Click()
	{
	
	document.getElementById("pnlContents").innerHTML="<font size=3 face=Arial><strong>Introduction</strong></font><br><br><font size=2 face=Verdana>Caresoftware.net is a unique product in the care home industry. No matter how you currently administer your homes, Caresoftware.net can give you something that other products can't: <STRONG>your time back</STRONG>.<br><br>Travel to and from your care home/s can really eat into your productivity. You need to have current information on the state of your business so you can see trends developing and avoid problems at the first opportunity. By allowing you to access your data safely and securely, anywhere and anytime, Caresoftware.net meets these demands head on.<br><br>Information is your greatest asset, so you require proper controls in place to ensure that what you want private, stays private. With in built user permissions you can instantly and effectively secure your data meaning that temporary staff will never see the finance information.</font>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Home hyperlink
  Event		: Click
  Note		: displays a description about home
  ===========================================================*/
	function Home_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<FONT face=Arial size=3><strong>Home Management</strong></FONT></strong><br><br><P align=justify>We know that there's lots to keep track of to run a home efficiently, whilst complying with all necessary regulations. We want to make this easier for you, so we've set up an area just for this.</P><P align=justify><FONT face=Verdana size=2>Home Management helps you to keep track of your inspections, and makes sure you are reminded when one is coming up. Accidents and complaints are recorded and flagged here, to help you keep on top of any issues, and deal with them before they become a problem.</FONT></P><P align=justify><FONT face=Verdana size=2>You can store all the details regarding your home, or homes, here and complete Regulation 26 reports quickly and easily.</FONT></FONT></P><P align=justify><FONT face=Verdana size=2>Home Management provides reports that let you see how your business is doing, such as the gross revenue and average fee per bed for all your homes. This is available at a glance, helping you stay in control.</FONT><br><br></font>";
	return false;
	}
		
		
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/LoginPassword.aspx
  Control	: CONFIRM button
  Event		: Click
  Note		: compare passwords on clicking confirm button
  ===========================================================*/
	function Subscription_LoginPassword()
		{
		if(document.getElementById("txtUserName").value=="") 
			{
			alert("Please enter a valid user name");
			document.getElementById("txtUserName").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value=="") 
			{
			alert("Password field can't be null");
			document.getElementById("txtPassword").focus();
			return false;
			}
		if(document.getElementById("txtPassword").value.length < 6 && document.getElementById("txtPassword").value.length > 0)
			{
			alert("Password must be between 6-8 characters ");
			document.getElementById("txtPassword").focus();
			return false;
			}
		}
		
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/LoginPassword.aspx
  Control	: CONFIRM button
  Event		: Click
  Note		: compare passwords on clicking confirm button
  ===========================================================*/
	function Subscription_Terms()
		{
		if(!isValid(textnumexp,document.getElementById("txtBankerName"), true, "Please enter a valid name" ))
				return false;
		if(!isValid(textnumexp,document.getElementById("txtBankerAddress"), true, "Please enter a valid address" ))
				return false;
		if(!isValid(textexp,document.getElementById("txtSortCode"), true, "Please enter a valid sort code" ))
				return false;
		if(!isValid(textexp,document.getElementById("txtAccountNumber"), true, "Please enter a valid account number" ))
				return false;
		if(!isValid(textnumexp,document.getElementById("txtAccountName"), true, "Please enter a valid account name" ))
				return false;
		if(document.getElementById("chkTerms_Conditions").checked==false)
			{
			alert("Please read and accept terms and conditions to register with CareSoftware.Net");
			return false;
			}
		
		}
		
			
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Care hyperlink
  Event		: Click
  Note		: displays a description about care management
  ===========================================================*/
	function Care_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<FONT face=Arial size=3><strong>Care Management</strong></FONT><br><br><p align=justify><FONT face=Verdana size=2>Caresoftware.net has been designed to help you concentrate on caring for your Service Users, by providing a complete paperless administration system. Caresoftware.net assists you from the moment an enquiry is made, until the Service User is discharged. This is the focus of Care Management, which is divided into Enquiries and Service Users.<br><br>The Enquiries section allows you to record, view and manage your enquiries, whilst linking to your room availability, so that it's just a couple of clicks to convert the enquiry to an admission. We'll also create a prioritised waiting list for you, accommodating any requirements of your potential Service Users.<br><br>The Service Users area helps you to manage both current and discharged Service Users. It also provides a neat little summary, bringing together any information relating to a particular Service User from anywhere on Caresoftware.net.<br><br></font>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Invoicing hyperlink
  Event		: Click
  Note		: displays a description about care invoice
 ===========================================================*/
	function CareInvoice_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<FONT size=3><strong><FONT face=Arial size=3>Care Invoicing</FONT><br></strong><br><p align=justify><FONT face=Verdana size=2>We understand that the invoicing needs of care homes can be complex. Multiple funders per Service User, differing billing cycles for each funder and the requirement to keep track of external reference numbers for your Service Users can all lead to headaches, or worse: loss of income.<br><br>With Caresoftware.net you're benefiting from over six years' experience in designing enterprise systems for the care home sector. You get unique features such as:<br><br><ul><li>The ability to have preferred billing cycles defined for each funder and respected when calculating invoices</li><br><li>The option to bill a funder once for all the service users they fund</li></ul>New to Caresoftware.net is the ease of use designed especially for smaller care businesses to get you up and running in no time at all.</FONT>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: HR hyperlink
  Event		: Click
  Note		: displays a description about HR management
 ===========================================================*/
	function HR_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<font size=3><strong><FONT face=Arial size=3>HR Management</FONT><br></strong><br><p align=justify><FONT face=Verdana size=2>Keeping record of your staff can be time consuming for any care home owner. Caresoftware.net lets you efficiently manage your employees with minimum data input and gives you an overview of hours worked and absences, to help you improve efficiency and plan for future staffing needs.<br><br>The training area lets you keep an up-to-date record of any training and supervision that your employees have undergone, and reminds you of approaching renewal dates. This way, you can see at a glance what experience and qualifications your staff possess, and set them future goals.</font>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Report hyperlink
  Event		: Click
  Note		: displays a description about Reports
 ===========================================================*/
	function Reports_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	//document.getElementById("pnlContents").innerHTML="<font size=3><strong><FONT face=Arial size=3>Reporting</FONT></strong><br><br><FONT face=Verdana size=2>Caresoftware.net provides you with reports on all aspects of your business. Drawing on the most up-to-date data, Caresoftware.net's reports bring together information from disparate residents, employees and even geographical locations. Most importantly, all this power is available whenever you access a computer. With just one simple login you can instantly view, download and print off reports, helping you to get ahead.</font><FONT face=Verdana size=2><br><br>We have designed our reports to meet your needs. Instantly view reports on your care home's income, your occupation rates, your staff training levels and much more. With our filtering options, most reports can be further tailored to a specific date range, employee, resident or other, helping you focus on the information that's important to you.<br><br>Caresoftware.net also produces reports such as the Section 22 Supervision Report that are required by the Care Standards Act. This not only helps you stay informed, but also makes complying with current regulation almost automatic.<br><br>We've included a small selection of the reports available in Caresoftware.net below.<br><br><strong>Home Management </strong><br>. Inspections<br></FONT><FONT face=Verdana size=2>.Gross revenue<br>. Average fee per bed<br><br><strong>Care Management </strong><br>. Admissions and discharges<br>. Accidents<br>. Complaints<br>. Waiting list<br><br><strong>Care Invoicing</strong><br>. Outstanding invoices<br><br><strong>HR Management</strong><br>. Employee hours<br>. Employee absence<br>. Supervision<br>. Training</FONT></FONT><br>";
	//return false;
	document.getElementById("pnlContents").innerHTML="<FONT size=3><strong><FONT face=Arial size=3>Reporting</FONT><br></strong><br><p align=justify><FONT face=Verdana size=2>Caresoftware.net provides you with reports on all aspects of your business, bringing together information from disparate service users, employees and even geographical locations. Most importantly, all this power is available whenever you access any computer, so that with just one simple login you can view, download and print off reports, helping you to stay ahead.<br><br>We have designed our reports to meet your needs, so that important trends and events are flagged. View reports on your care home's income, your occupation rates, your staff training levels and much more. With our filtering options, most reports can be tailored to a specific date range, employee, service user etc, helping you focus on the information that's important to you.<br><br>Caresoftware.net also produces reports that are required by the Care Standards Act 2000, such as the Section 22 Supervision Report. This not only helps you stay informed, but also makes complying with current regulation almost automatic.<br><br>We've included a small selection of the reports available in Caresoftware.net below.<br><br><strong>Home Management</strong><ul><li>Revenue overview</li><li>Occupancy overview</li><li>Accidents</li><li>Complaints</li></ul><strong>Care Management</strong><ul><li>Admissions</li><li>Discharges</li><li>Waiting List</li><li>Service Users</li></ul><strong>Care Invoicing</strong><ul><li>Outstanding invoices</li></ul><strong>HR Management</strong><ul><li>Hours worked</li><li>Absences</li><li>Supervision</li><li>Training</li></ul><br></FONT>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Messaging hyperlink
  Event		: Click
  Note		: displays a description about messaging
 ===========================================================*/
	function Messaging_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<font size=3><strong><FONT face=Arial size=3>Messaging</FONT></strong><br><p align=justify><FONT face=Verdana size=2>We thought it would be helpful if you could communicate with anyone using Caresoftware.net within your organisation. That's why we set up a simple and easy to use messaging system.<br><br>Messaging is available from any page, so you can send a message as soon as you think of it. You’ll also be able to see when someone has sent you a message.</font>";
	return false;
	}
	
/*============================================================
  page		: /carenet/NewCSUpdate/Internal/CSFeatures.aspx
  Control	: Help hyperlink
  Event		: Click
  Note		: displays a description about Caresoftawre help
 ===========================================================*/
	function Help_Click()
	{
	//document.getElementById("pnlContents").innerHTML="";
	document.getElementById("pnlContents").innerHTML="<FONT face=Verdana size=2><STRONG><FONT face=Arial size=3>Help</FONT><BR></STRONG><BR>Extensive help is provided for every section, to help you if you get stuck. The demo is also pretty useful - this shows you how to complete lots of the common tasks in Caresoftware.net<BR><br>If you need any further help, you can always drop us an email. We provide 24 hour support, so we'll get you back on track in no time.</FONT>";
	return false;
	}
	
 /*============================================================
  page		: /carenet/NewCSUpdate/Internal/Login_Account.aspx
  Control	: Go button
  Event		: Click
  Note		: validate accountid on go button click
 ===========================================================*/
	function Login_Account()
	{
	if( !isValid(charexp,document.getElementById("txtAccountID"), true, "Please enter a valid Account name" ))
        return false;
    }
    
    /*============================================================
  page		: /carenet/NewCSUpdate/Internal/Login_Account.aspx
  Control	: Go button
  Event		: Click
  Note		: validate accountid on go button click
 ===========================================================*/
	function Check_AccountName()
	{
	if( !isValid(charexp,document.getElementById("txtAccountName"), true, "Please enter a valid Account name" ))
        return false;
    }
    
   /*============================================================
  page		: /carenet/NewCSUpdate/Internal/Login_User.aspx
  Control	: login button
  Event		: Click
  Note		: validate controls on Login button click
 ===========================================================*/
	function Login_User()
	{
    	/*if( document.getElementById("ddlHomeName").selectedIndex == 0)
		{
		alert("Please select a Home");
		document.getElementById("ddlHomeName").focus();
		return false;
		}*/
       if(document.getElementById("txtLoginID").value=="")
        {
		alert("Please enter a valid User name");
		document.getElementById("txtLoginID").focus();
		return false;
		}
		if(document.getElementById("txtPassword").value=="")
        {
		alert("Please enter a valid Password");
		document.getElementById("txtPassword").focus();
		return false;
		}	
	}
	
 /*============================================================
  page		: /carenet/NewCSUpdate/Internal/ForgotPassword.aspx
  Control	: send mail button
  Event		: Click
  Note		: validate controls on send mail button click
 ===========================================================*/
	function ForgotPassword_SendMail()
	{
		if( !isValid(textnumexp,document.getElementById("txtCompanyName"), true, "Please enter a valid company name" ))
		 return false;
		if( !isValid(textnumexp,document.getElementById("txtClientName"), true, "Please enter a valid client name" ))
		 return false;
        if( !isValid(emailexp,document.getElementById("txtEmail"), true, "Please enter a valid Email address" ))
		 return false;
	}

	
	
/*============================================================
  page		: Rooms.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
	function GeneralSetup_Room_Add()
	{
	if( !isValid(charexp,document.getElementById("txtRoomNo"), true, "Please enter a valid Room Number" ))
        return false;
    if( document.getElementById("ddlRoomType").selectedIndex == 0)
		{alert("Please select a valid Room type"); document.getElementById("ddlRoomType").focus();return false;}
	if( !isValid(charexp,document.getElementById("txtRoomRate"), true, "Please enter a valid Room rate" ))
        return false;
	}
	
	/*============================================================
  page		: Room_EditView.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
 function Room_Delete()
	{
	conf = confirm("Are you sure to delete the selected Room ? ");
	if(conf == true)
		return true;
	else
		return false;
	}
	
		/*============================================================
  page		: Room_EditView.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
 function Cancel_Registration()
	{
	conf = confirm("Are you sure to cancel the registration ? ");
	if(conf == true)
		return true;
	else
		return false;
	}
	
	/*============================================================
  page		: Room_EditView.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
 function Cancel_Subscription()
	{
	conf = confirm("Are you sure to cancel the subscription ? ");
	if(conf == true)
		return true;
	else
		return false;
	}
		
/*============================================================
  page		: 
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
	function GeneralSetup_RoomType_Change()
	{
	if( document.getElementById("ddlRoomType").selectedIndex == 0)//none
		{document.getElementById("txtNoOfBeds").value="0";
		return false;
		}
    if( document.getElementById("ddlRoomType").selectedIndex == 1)//double
		{document.getElementById("txtNoOfBeds").value="2";
		return false;
		}
	if( document.getElementById("ddlRoomType").selectedIndex == 2)//single
		{document.getElementById("txtNoOfBeds").value="1";
		return false;
		}
	}
	
	/*============================================================
  page		: Employee_add.aspx
  Control	: save
  Event		: Click
  Note		: 
 ===========================================================*/
	
	function Employee_Add()
	{
		if( !isValid(textnumexp,document.getElementById("txtforename"), true, "Please enter a valid forename" ))
		 return false;
		 if( !isValid(textnumexp,document.getElementById("txtSurName"), true, "Please enter a valid surname" ))
		 return false;
		if( !isValid(textnumexp,document.getElementById("txtJobRole"), true, "Please enter a valid jobrole" ))
		 return false;
		 if( !isValid(textnumexp,document.getElementById("txtDepartment"), true, "Please enter a valid department name" ))
		 return false;
		if( document.getElementById("ddlSex").selectedIndex == 0)
		{alert("Please select a Sex"); document.getElementById("ddlSex").focus();return false;}
	}
	
	/*============================================================
  page		: Rooms.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
	function Registaration_Login()
	{
    if( document.getElementById("ddlHomeName").selectedIndex == 0)
		{alert("Please select a care home from the list"); document.getElementById("ddlHomeName").focus();return false;}
	}
	
		/*============================================================
  page		: Home_EditView.aspx
  Control	: 
  Event		: Click
  Note		: 
  ===========================================================*/
 function Home_Delete()
	{
	conf = confirm("Are you sure to delete the selected Home ? ");
	if(conf == true)
		return true;
	else
		return false;
	}
