
			function EnableSMSAddButton(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				if(obj.value.length > 0)
				{
					//alert("Enabling send button");
					document.all("btnAddForSMS").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnAddForSMS").disabled = true;				
				}
				
			}


			function EnableEmailAddButton(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				if(obj.value.length > 0)
				{
					//alert("Enabling send button");
					document.all("btnAddForEmail").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnAddForEmail").disabled = true;				
				}
				
			}


			function CancelSearchButton() 
			{
				//alert("CancelSearchButton");
				//alert("txtSearchButtonClicked" + document.Form1.txtSearchButtonClicked.value);
				document.Form1.txtSearchButtonClicked.value = "0";
				
			}

			function SearchButtonHasBeenClicked() 
			{
				//alert("SearchButtonHasBeenClicked");
				//alert("txtSearchButtonClicked" + document.Form1.txtSearchButtonClicked.value);
				document.Form1.txtSearchButtonClicked.value = "1";
			}
		
		
			function blankOutUserName() 
			{
				//alert("BlankBefore we display message");
				//parent.MainContent.document.Form1.txtUserMobileNumber.value = document.Form1.txtSearchMobile.value
				document.Form1.txtName.value = "";
			}
			
			function blankOutMobileNumber() 
			{
				//alert("Before we display message");
				//parent.MainContent.document.Form1.txtUserMobileNumber.value = document.Form1.txtSearchMobile.value
				document.Form1.txtSearchMobile.value = "";
			}

			function ChangeHRef(obj) 
			{
				//alert(obj.href);
				var sTargetAddr = "";
				var mobileNumber = "";
				var userName = "";
				
				sTargetAddr = "IncidentDetails.aspx?Action=Search";
				
				var mobileNumber = document.Form1.txtSearchMobile.value;
				//alert("MobileNumber is *" + mobileNumber + "*");
				//alert("Length of MobileNumber is " + mobileNumber.value.length);
				
				
				var userName = document.Form1.txtName.value;
				//alert("UserName is " + userName);
				//alert("Length of userName is " + userName.value.length);
				
				if(mobileNumber!="")
				{
					//alert("MobileNumber is " + mobileNumber);
					sTargetAddr += "&SearchMobile=" + mobileNumber;
					//alert("Target Address is " + sTargetAddr);
				
				}
				else if(userName!="")
				{
					//alert("UserName is " + userName);
					sTargetAddr += "&SearchUser="+ userName;
					//alert("Target Address is " + sTargetAddr);
				}

				//alert(sTargetAddr);
				obj.href = sTargetAddr;
			}
			


			function CheckInput(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}
			}
			

			function CheckLoginInput(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var NameValue = document.all("txtName");
				var PasswordValue = document.all("txtPassword");
				//alert("Email Value is " + EmailValue.value.length);
				if( (NameValue.value.length > 0) && (PasswordValue.value.length > 0) )
				{
					//alert("Enabling send button");
					document.all("btnLogin").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnLogin").disabled = true;
				}
			}
			
			
			
			
			function CheckPassword(obj)
			{
				document.all("txtPassword").value = "";
				document.all("txtConfirmPassword").value = "";
				
				if(obj.checked)
				{
					//alert("Password Checked!!");
					document.all("txtPassword").disabled = false;
					document.all("txtConfirmPassword").disabled = false;
				}
				else
				{
					//alert("Password NOT Checked!!");
					document.all("txtPassword").disabled = true;
					document.all("txtConfirmPassword").disabled = true;					
				}
			}
			
			
			function CheckUserSaveButtonInput(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var sFirstName = document.all("txtFirstName");
				var sSurNam = document.all("txtSurName");
				if( (sFirstName.value.length > 0) && (sSurNam.value.length > 0) )
				{
					//alert("Enabling send button");
					document.all("btnSaveUserDetails").disabled = false;
					document.all("btnAssignDevice").disabled = false;
				}
				else
				{
					document.all("btnSaveUserDetails").disabled = true;
					document.all("btnAssignDevice").disabled = true;
				}
				
			}
			
		
			function CheckInputEnquiry(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var txtLen = obj.value.length;				
				var EmailValue = document.all("txtEmailField");
				var ContactNameValue = document.all("txtContactName");
				var EnquiryValue = document.all("txtEnquiry");
				var PositionInCompany = document.all("txtPositionInCompany");
				var CompanyName = document.all("txtCompanyName");
				//var CompanyWebSite = document.all("txtCompanyWebSite");
				//alert("Email Value is " + EmailValue.value.length);
				if( (EmailValue.value.length > 0) && (ContactNameValue.value.length > 0) && (EnquiryValue.value.length > 0) && (PositionInCompany.value.length > 0) && (CompanyName.value.length > 0) )
				{
					//alert("Enabling send button");
					document.all("btnSendMessage").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnSendMessage").disabled = true;				
				}
				
			}
			
			
			function Check3ARCAngelInputEnquiry(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var txtLen = obj.value.length;				
				var EmailValue = document.all("txtEmailField");
				var ContactNameValue = document.all("txtContactName");
				var EnquiryValue = document.all("txtEnquiry");
				if( (EmailValue.value.length > 0) && (ContactNameValue.value.length > 0) && (EnquiryValue.value.length > 0) )
				{
					//alert("Enabling send button");
					document.all("btnSendMessage").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnSendMessage").disabled = true;				
				}
				
			}
			
			
			
			function CheckSearchButton(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var SearchMobile = document.all("txtSearchMobile");
				var Name = document.all("txtName");
				if( (SearchMobile.value.length > 0) || (Name.value.length > 0) )
				{
					//alert("Enabling send button");
					document.all("btnSearchName").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnSearchName").disabled = true;				
				}
				
			}


			function ClearOutMobileNumber()
			{
				//alert("We are here!!");
				var Name = document.all("txtSearchMobile");
				var ErrorMsg = document.all("txtErrorMsgs");
				
				if(Name != null)
				{
					Name.value = "";
				}
				
				if(ErrorMsg != null)
				{
					ErrorMsg.value = "";
				}
				
				
				
			}
			
			
			function ClearOutUserName()
			{
				//alert("We are here!!");
				var Name = document.all("txtName");
				var ErrorMsg = document.all("txtErrorMsgs");
				if(Name != null)
				{
					Name.value = "";
				}
				
				if(ErrorMsg != null)
				{
					ErrorMsg.value = "";
				}
				
			}
			
			
			function CheckSaveDetailsButton(obj)
			{
				//alert(obj.value);
				for(i=0; i<obj.value.length;i++)
				{
					if(obj.value.charAt(i)=="<")
					{	
						obj.focus();
						obj.value = obj.value.substr(0, i);
						return true;
					}
				}

				var TypeOfCallNotes = document.all("txtTypeOfCallNotes");
				if( TypeOfCallNotes.value.length > 0)
				{
					//alert("Enabling send button");
					document.all("btnSaveDetails").disabled = false;
				}
				else
				{
					//alert("Disabled send button");
					document.all("btnSaveDetails").disabled = true;				
				}
				
			}
			

			


			
			function changeTextColor(element, colorstring)
			{
				element.style.color=colorstring;
			}
			
			function changeBgColor(element, colorstring)
			{
				element.style.background=colorstring;
			}
			


			function gotoPage(url)
			{
				//alert("The url =" + url)
				document.location.href=url;
			}
			
			function submitForm(stringVal)
			{
				alert("The String value is =" + stringVal)
				document.Form1.submit();

			}
			
			
			function LoginPage(url)
			{
					
				var username = document.all("txtName");
				var userPwd = document.all("txtPassword");
				
				var sPassString = url + "?username=" + username.value + "&password="+userPwd.value
				alert("The url =" + sPassString)
				document.location.href=sPassString;
			}
			

			function ParentSelected(element)
			{
				alert('Parent Selected');
				element.setAttribute("background","Images2/ParentSelected.gif");
				changeTextColor(element,"#FF8C00");
				
			}


			function ParentUnselectedHover(element)
			{
				//alert('We are in the blue corner');
				element.setAttribute("background","Images2/ParentUnselectedHover.gif");
				changeTextColor(element,"#389FC6");
				
			}
			
			function ParentUnselected(element)
			{
				//alert('We are in the grey corner');
				element.setAttribute("background","Images2/ParentUnselected.gif");
				changeTextColor(element,"#389FC6");
			}


			function ChildSelected(element)
			{
				//alert('We are in the Child Seclected corner');
				element.setAttribute("background","Images2/ChildSelected.gif");
				changeTextColor(element,"#FF8E00");
				
			}


			function ChildUnselectedHover(element)
			{
				//alert('We are in the ChildUnSelectedHover corner');
				element.setAttribute("background","Images2/ChildUnselectedHover.gif");
				changeTextColor(element,"#389FC6");
				
			}
			
			function ChildUnselected(element)
			{
				//alert('We are in the ChildUnselected area');
				element.setAttribute("background","Images2/ChildUnselected.gif");
				changeTextColor(element,"#389FC6");
			}
			
			
		function ShowLeftHandMenu(HTMLForDiv)
		{
			if(HTMLForDiv.length = 1)
			{
				//alert("We are here");
				document.getElementById("NothingSelected").style.display = 'block';
				document.getElementById("Menu1Selected").style.display = 'none';
			}
			else if(HTMLForDiv.length = 2)
			{
				//alert("We are here - displaying not!");
				document.getElementById("NothingSelected").style.display = 'none';				
				document.getElementById("Menu1Selected").style.display = 'block';				
			}
		}
		
		
		
		function ChangeArmBandPictureMouseOver(element)
		{
			//alert('Parent Selected');
			element.setAttribute("src","Images2/ProductArmbandAfter.gif");
			//changeTextColor(element,"#FF8C00");
			
		}
		
		
		function SubmitDeviceItemData(obj)
		{
			var arrItems, iArrIndex, lenOfArrayItems;
			var documentElementID, elementValue;
			
			var	arrItems = document.all.tags("INPUT");
			lenOfArrayItems = arrItems.length;
			//alert("The number of chk tags is " + lenOfArrayItems);
			
			if(lenOfArrayItems > 0) 
			{
				var hRefValue = "MappingTest.aspx?List=";
				var iIndex = 0;
				for( iArrIndex=0; iArrIndex < lenOfArrayItems; iArrIndex++)
				{
					// Now what we will do is find out is whether we have found the
					// correct table or not
					documentElementID = arrItems(iArrIndex).id;
					//alert("The iArrIndex is " + iArrIndex);
				
					if(documentElementID == "chk")
					{
						if(arrItems(iArrIndex).checked == true)
						{
							elementValue = arrItems(iArrIndex).value;
							//alert("The elementValue is " + elementValue);
							
							if(iIndex==0)
							{
								hRefValue = hRefValue + elementValue;
								//alert("1- The elementValue is " + elementValue);
							}
							else if(iIndex<lenOfArrayItems)
							{
								hRefValue = hRefValue + "|" + elementValue;
								//alert("More - The elementValue is " + elementValue);
							}
							iIndex = iIndex + 1;
						}
					}
				}
				//alert("The hRefValue is " + hRefValue);
				obj.href = hRefValue;
			}
		}
		
		function changeBackColor(toColor)
		{
			//alert("Back Colour is " + toColor);
			document.getElementById("BkColorCell").style.backgroundColor = toColor;
			document.getElementById("BkColorCellColourText").value = toColor;
			//alert("BkColorCellColourText Colour is " + document.getElementById("BkColorCellColourText").value);
		}

		function changeForeColor(toColor)
		{
			//alert("Fore Colour is " + toColor);
			document.getElementById("ForeColorCell").style.backgroundColor = toColor;
			document.getElementById("ForeColorCellColourText").value = toColor;
		}
		
		
		function OpenPDF(documentFile)
		{
			//alert("The documentFile =" + documentFile)
			window.open(documentFile);
		}		

