/****************************************************************************************************/
/* Date created    Author           Comments ********************************************************/
/****************************************************************************************************/
/* 10/10/2007      Muni Mahimaluru  As part of the clean up this file is created for contactjob.aspx*/
/* 12/28/2007      Harish           Added the Zip code, Telephone number validations and Javascript to clear the form fields*/
/****************************************************************************************************/

//Added by Harish
//Function to clear all the values in the Submit Resume form
function Clearvalues()
{
		document.Form1.reset() ;
		return false ;
}


		function ValidateForm(event, obj, objID)
		{
			var sId;
			var ctl;
			
			//Added by Harish
			//To check the mandatory option for First Name field
			sId = obj.id;
			sId = sId.replace(objID, "txtPersonFirstName")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your First Name.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//To check the mandatory option for Last Name field
			sId = obj.id;
			sId = sId.replace(objID, "txtPersonLastName")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Last Name.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//To check the mandatory option for Last Name field
			sId = obj.id;
			sId = sId.replace(objID, "txtStreet")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Street Address.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			
			//To check the mandatory option for Street1 Address field
			sId = obj.id;
			sId = sId.replace(objID, "txtStreet")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Street Address.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//To check the mandatory option for City field
			sId = obj.id;
			sId = sId.replace(objID, "txtCity")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your City Address.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			
			//To check the mandatory option for State field
			sId = obj.id;
			sId = sId.replace(objID, "ddlState")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				if ((ctl.options[ctl.selectedIndex].value == "-Select One-") || (ctl.options[ctl.selectedIndex].value == 0))
				{
					alert("Please Select Your State.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//Zip Code Validations
			sId = obj.id;
			sId = sId.replace(objID, "txtZip")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
				ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
				ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "") 
				{
					alert("Please enter the Zip Code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				if ((ctl.value != "") && (!ctl.value.match(regZip)))
				{
					alert("Please enter a valid Zip Code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}		
			
			//To check the mandatory option for Recen Experience field
			sId = obj.id;
			sId = sId.replace(objID, "ddlExperience")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				if ((ctl.options[ctl.selectedIndex].value == "-select-") || (ctl.options[ctl.selectedIndex].value == 0))
				{
					alert("Please Select Your Most recent Experience.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			
			//To check the mandatory option for Salary Range field
			sId = obj.id;
			sId = sId.replace(objID, "ddlSalary")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				
				if ((ctl.options[ctl.selectedIndex].value == "-select-") || (ctl.options[ctl.selectedIndex].value == 0))
				{
					alert("Please Select Your Salary Range.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//To check the mandatory option for Referral Source field
			sId = obj.id;
			sId = sId.replace(objID, "ddlReferral")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				
				if ((ctl.options[ctl.selectedIndex].value == "-select-") || (ctl.options[ctl.selectedIndex].value == 0))
				{
					alert("Please Select Your Referral Source.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			//End

			//Validations for Telephone Area code
			sId = obj.id;
			sId = sId.replace(objID, "txtPhone_Area")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Telephone Area Code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				else 
				//To check whether its a valid integer values
				{
					var objRegExp  = /(^-?\d\d*$)/;
					if (!objRegExp.test(ctl.value)) 
					{
						alert("Please enter A Valid Telephone Area Code.");
						event.cancelBubble = true;
						event.returnValue = false;
						ctl.focus();
						return false;
					}
				}
			}
			
			sId = obj.id;
			sId = sId.replace(objID, "txtPhone_Number")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Telephone Number.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				else 
				//To check whether its a valid integer values
				{
					var objRegExp  = /(^-?\d\d*$)/;
					if (!objRegExp.test(ctl.value)) 
					{
						alert("Please enter A Valid Telephone Number.");
						event.cancelBubble = true;
						event.returnValue = false;
						ctl.focus();
						return false;
					}
				}
			}
			
			//Validations for Email Address
			sId = obj.id;
			sId = sId.replace(objID, "txtEmail")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter Your Email Address.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				if (!ctl.value.match(regEmail))
				{
					alert('Please enter a valid Email Address.');
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}		
			}
			
			sId = obj.id;
			sId = sId.replace(objID, "txtFirstName")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your First Name.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			sId = obj.id;
			sId = sId.replace(objID, "txtLastName")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Last Name.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			sId = obj.id;
			sId = sId.replace(objID, "txtEmailQuestion")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter Your Email Address.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				if (!ctl.value.match(regEmail))
				{
					alert('Please enter a valid Email Address.');
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}		
			}
			sId = obj.id;
			sId = sId.replace(objID, "txtPhone")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if ((ctl.value != "") && (!ctl.value.match(regPhone)))
				{
					alert("Please enter your 10 digit phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				sHome = ctl.value;
			}
			sId = obj.id;
			sId = sId.replace(objID, "txtPhone2")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if ((ctl.value != "") && (!ctl.value.match(regPhone)))
				{
					alert("Please enter your 10 digit phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				sHome = ctl.value;
			}
			sId = obj.id;
			sId = sId.replace(objID, "txtQuestion")
			ctl = document.getElementById(sId);
			if (ctl)
			{
				while (ctl.value.search(/^\s+/) >= 0)		
					ctl.value = ctl.value.replace(/^\s+/, "");
				while (ctl.value.search(/\s+$/) >= 0)		
					ctl.value = ctl.value.replace(/\s+$/, "");	
				if (ctl.value == "")
				{
					alert("Please enter your Question.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			return true;
        }  
				
		// -->
