		//Function to open pop up window for city,zip code
		function fnOpenWindow(url, winname, width, height)
		{
			ShowPopup(url, winname, width, height)
			return false;
		}
		
		function CompareValue()
			{
				var retval = document.frmAddEditUser.txtPassword.value;
				var strLoginName  = document.frmAddEditUser.txtLoginName.value;
				var Fname = document.frmAddEditUser.txtFirstName.value;
				var Lname = document.frmAddEditUser.txtLastName.value;
				var Uname = document.frmAddEditUser.txtUserName.value;
				
				var intCounterNumber = 0
				var intCounterCharacter = 0
				var intCounterCharacterCapital = 0
				var intCounterCharacterSmall = 0
				var intRetVal;
				
				if(strLoginName!="")
				{
					if(retval.toUpperCase() == strLoginName.toUpperCase())
					{
						alert("Login id and password cannot be same")
						document.frmAddEditUser.txtPassword.value="";
						return false;
					}				
				}	
				
				if(Fname!="")
				{
					intRetVal = retval.toUpperCase().indexOf(Fname.toUpperCase())
					if(intRetVal >=0)
					{
						alert("Password should not contain the first name")
						document.frmAddEditUser.txtPassword.value="";
						return false;
					}
				}	
				
				if(Lname!="")
				{
					intRetVal = retval.toUpperCase().indexOf(Lname.toUpperCase())	
					
					if(intRetVal >=0)
					{
						alert("Password should not contain the last name")
						document.frmAddEditUser.txtPassword.value="";
						return false;
					}		
				}	
				
				if(Uname!="")
				{
					intRetVal = retval.toUpperCase().indexOf(Uname.toUpperCase())
					
					if(intRetVal >=0)
					{
						alert("Password should not contain the combination of first and last name")
						document.frmAddEditUser.txtPassword.value="";
						return false;
					}
				}	
				
				if(retval!="")
				{
					for(i=0;i<=retval.length-1;i++)
					{
						if(isNaN(retval.charAt(i)))
						{
							intCounterCharacter = parseInt(intCounterCharacter) + 1
							
							if(retval.charAt(i) == retval.charAt(i).toUpperCase())
							{
								intCounterCharacterCapital = parseInt(intCounterCharacterCapital) + 1
							}
						}
						else
						{
							intCounterNumber = parseInt(intCounterNumber) + 1							
						}
					}
				}
				
				if(retval!="")
				{
					for(i=0;i<=retval.length-1;i++)
					{
						if(isNaN(retval.charAt(i)))
						{
							intCounterCharacter = parseInt(intCounterCharacter) + 1
							
							if(retval.charAt(i) == retval.charAt(i).toLowerCase())
							{
								intCounterCharacterSmall = parseInt(intCounterCharacterSmall) + 1
							}
						}
						else
						{
							intCounterNumber = parseInt(intCounterNumber) + 1							
						}
					}
				}
					
				if(parseInt(intCounterNumber) > 0 && parseInt(intCounterCharacter) >=2 && parseInt(intCounterCharacterCapital) > 0 && parseInt(intCounterCharacterSmall) > 0)
				{					
					return true;
				}
				else
				{
				
					document.frmAddEditUser.txtPassword.value="";
					alert(" - Must be between 7 and 10 characters long \n - Must contain at least 1 capital letter and 1 numeric digit \n - Cannot contain any special characters (@, _, !, %, &amp;) \n - Cannot contain your first or last name.");
					return false;
				}
			}
			
			
			function eMailcheck(strObjName) 
			{
				var testresults;
				var strObject;
				var str = eval('document.frmAddEditUser.' + strObjName + '.value');
				if(str=="")
				{
					alert("Please enter email");
					
				}
				else
				{
					if(str.length == 0)
						{						
							return false;
						}
					var filter=/^.+@.+\..{2,3}$/

					if (filter.test(str))
						testresults=true
					else 
					{
						alert("Please input a valid email address!")
						
						strObject = eval('document.frmAddEditUser.' + strObjName);
						if(strObject)
						{
							strObject.value="";
							strObject.focus();
						}
						
						testresults=false
					}
				}
				
				return (testresults)
			}
		function ShowPopup(url, winname, width, height)
		{
			var MyURL = url;
			var MyWindowName = winname;
			var MyWidth = width;
			var MyHeight = height;
			var MyScrollBars = 'Yes';
			var MyResizable = 'Yes';
			var MyMenuBar = 'No';
			var MyToolBar = 'No';
			var MyStatusBar = 'No';

			    if (document.all)
			        var xMax = screen.width, yMax = screen.height;
			    else
			        if (document.layers)
			            var xMax = window.outerWidth, yMax = window.outerHeight;
			        else
			            var xMax = 640, yMax=480;

			    var xOffset = (xMax - MyWidth)/2, yOffset = (yMax - MyHeight)/2;

				MyWin = window.open(MyURL,MyWindowName,'width=' + MyWidth + ',height=' + MyHeight + ',screenX= ' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset + ',scrollbars=' + MyScrollBars + ',resizable=' + MyResizable + ',menubar=' + MyMenuBar + ',toolbar=' + MyToolBar + ',status=' + MyStatusBar + '' );
				MyWin.focus();	
				/*
				if (window.document.Form1.txtSearchCity)
				{
					window.document.Form1.txtSearchCity.focus();
				}
				*/			
		}
		
		//Function to open pop up window for city,zip code.This function calls ShowPopup(url, winname, width, height)
		//function 
		function OpenCity()
		{
			
			//var strState = "AK";
			var strState =document.Form1.cboState.value
			var strCity = document.Form1.txtSearchCity.value			
			var url = "CityZipPopUp.aspx?StateCode="+strState+"&City="+strCity;			
			var winname = "CityZip";
			var width = "500";
			var height = "580";
			ShowPopup(url, winname, width, height)
			
			return false;
		}
		
		function SetFocus(ctrl)
		{
			if(window.document.Form1.elements(ctrl))
			{
				window.document.Form1.elements(ctrl).focus();
				//document.getElementById(ctrl).focus();
				//ctrl.focus();
				
			}
		}
		
		
		//Function to capture Enter key.This function is used on UserContactInfo.aspx
		
		function CaptureEnterKey(e)
				{	
					var sKey;
					if (window.event) {						
						e = window.event;
						//e.cancelBubble = true;
						//e.returnValue = false;
						sKey = e.keyCode;
					} else {
						sKey = e.keyCode;
					
					}					
					
					if (sKey == 13) 						
					{						
						if (document.getElementById('btnContinue').disabled)
						{
							document.getElementById('btnAddUpdtCont').click(); 
						}
						else
						{
							document.getElementById('btnContinue').click(); 
						}
						
						return false				
					}
					
				}
		
		//Function to claer the contents .This function is used on UserContactInfo.aspx
		function clearContents()
				{	
				//Check if company is IBM ,SUN or other
					if (window.document.Form1.hidCompflag.value =="")
					{
						//Check if it is update or add.
						if (window.document.Form1.hidflag.value =="")
						{
							
							window.document.Form1.txtFirstName.value = ""
							window.document.Form1.txtLastName.value = ""
							window.document.Form1.txtZip.value = ""							
							if(window.document.Form1.txtState)
							{
								window.document.Form1.txtState.value = ""
							}
							window.document.Form1.txtCity.value = ""												
							window.document.Form1.txtPhoneNo.value = ""
							window.document.Form1.txtAreaCode.value = ""					
							window.document.Form1.txtExtension.value = ""
							if(window.document.Form1.txtCompany)
							{
								window.document.Form1.txtCompany.value = ""
							}
							
							if(window.document.Form1.txtAddress)
							{
								window.document.Form1.txtAddress.value = ""
							}
							
							
						}
						else
						{
							
							window.document.Form1.txtFirstName.value = ""
							window.document.Form1.txtLastName.value = ""
							window.document.Form1.txtZip.value = ""							
							if(window.document.Form1.txtState)
							{
								window.document.Form1.txtState.value = ""
							}
							window.document.Form1.txtCity.value = ""
							if(window.document.Form1.txtAddress)
							{
								window.document.Form1.txtAddress.value = ""
							}						
							window.document.Form1.txtPhoneNo.value = ""
							window.document.Form1.txtAreaCode.value = ""					
							window.document.Form1.txtExtension.value = ""
							if(window.document.Form1.txtCompany)
							{
								window.document.Form1.txtCompany.value = ""
							}	
						}	
					}
					else
					{
							window.document.Form1.txtFirstName.value = ""
							window.document.Form1.txtLastName.value = ""													
							window.document.Form1.txtPhoneNo.value = ""
							window.document.Form1.txtAreaCode.value = ""					
							window.document.Form1.txtExtension.value = ""
							if(window.document.Form1.txtCompany)
							{
								window.document.Form1.txtCompany.value = ""
							}	
						
					}
				}
				
				//Function used to reset city and zip code values.
				//This function is used on UserContactInfo.aspx
				function refreshCityZip()
				{
							window.document.Form1.txtZip.value = ""														
							window.document.Form1.txtCity.value = ""
							window.document.Form1.btnAddUpdtCont.disabled = false
							if(window.document.Form1.btnContinue)
							{
								window.document.Form1.btnContinue.disabled = true
							}
				}
				
				

				function EnableUpdateEmail(ctrlVal)
				{	
					if (ctrlVal.name == "txtEmail" && window.document.Form1.hidEmail.value != ctrlVal.value) 
						{
							
							window.document.Form1.btnAddUpdtCont.disabled = false			
						
							if(window.document.Form1.btnContinue)
							{
								window.document.Form1.btnContinue.disabled = true
								
							}
							
						}
						
				}
				
				function EnableUpdate(ctrlVal)
				{	
					window.document.Form1.btnAddUpdtCont.disabled = false			
						
					if(window.document.Form1.btnContinue)
					{
						window.document.Form1.btnContinue.disabled = true
								
					}
						
				}
		
		//Function used to close the pop up window.
		//This function is used on UserContactInfo.aspx
		function fnCloseWindow()
			{
				if(document.frmCityZip.hidID.value=="")
				{
					alert("Please select option");
				}
				else
				{
					
					var strCityZip
					var varCity
					var strZip 
					strCityZip = document.frmCityZip.hidID.value
					splitCityZip = strCityZip.split("~")
					window.opener.document.Form1.txtCity.value = unescape(splitCityZip[1])//document.frmCityZip.hidID.value;
					window.opener.document.Form1.txtZip.value = splitCityZip[0]
					window.opener.document.Form1.hidCounty.value = unescape(splitCityZip[2])
					window.opener.document.Form1.btnAddUpdtCont.disabled = false			
					
					if(window.opener.document.Form1.btnContinue)
					{
						window.opener.document.Form1.btnContinue.disabled = true
					} 
					window.close();
					
					if (window.opener.document.Form1.txtSearchCity)
					{
						window.opener.document.Form1.txtSearchCity.focus();
					}
				}
				return false;
			}
			
			
			//function to check iduplicate transction code.

			function CompareTransctionCode(sender, args)		
			{
				var transCodes = ""
				
				for (i=0;i<document.Form1.elements.length ;i++) 
				{	
					
					if (document.Form1.elements[i].type == "text" && Trim(document.Form1.elements[i].value)!="")
					{			
						if( transCodes == ""){
						
							transCodes = "," + Trim(document.Form1.elements[i].value)+ ",";
						}
						else{
							transCodes = transCodes + Trim(document.Form1.elements[i].value)+ ",";
						}
						
					}	
				
				}
				
					
				for (i=0;i<document.Form1.elements.length ;i++) 
				{	
					var str = transCodes					
					if (document.Form1.elements[i].type == "text" && Trim(document.Form1.elements[i].value)!="")
					{	
						//var reg = new RegExp("\\b"+"," + Trim(document.Form1.elements[i].value) +","+ "\\b");
						var reg = new RegExp("," + Trim(document.Form1.elements[i].value) +",");						
						if (str.match(reg))					{	
							
							str = str.replace(","+Trim(document.Form1.elements[i].value)+",",",")	
							
							if (str.match(reg))
							
							{	
								args.IsValid=false;
								return false;		
							}
							
						}
				
					}
					
								
				
				}
				
		}
		
		//Function used to trim the values.
		function Trim(TRIM_VALUE){
						if(TRIM_VALUE.length < 1){
						return"";
						}
						TRIM_VALUE = RTrim(TRIM_VALUE);
						TRIM_VALUE = LTrim(TRIM_VALUE);
						if(TRIM_VALUE==""){
						return "";
						}
						else{
						return TRIM_VALUE;
						}
						} //End Function

						function RTrim(VALUE){
						var w_space = String.fromCharCode(32);
						var v_length = VALUE.length;
						var strTemp = "";
						if(v_length < 0){
						return"";
						}
						var iTemp = v_length -1;

						while(iTemp > -1){
						if(VALUE.charAt(iTemp) == w_space){
						}
						else{
						strTemp = VALUE.substring(0,iTemp +1);
						break;
						}
						iTemp = iTemp-1;

						} //End While
						return strTemp;

						} //End Function

						function LTrim(VALUE){
						var w_space = String.fromCharCode(32);
						if(v_length < 1){
						return"";
						}
						var v_length = VALUE.length;
						var strTemp = "";

						var iTemp = 0;

						while(iTemp < v_length){
						if(VALUE.charAt(iTemp) == w_space){
						}
						else{
						strTemp = VALUE.substring(iTemp,v_length);
						break;
						}
						iTemp = iTemp + 1;
						} //End While
						return strTemp;
						} //End Function