/****************************************************************************************************/
/* Date created    Author           Comments ********************************************************/
/****************************************************************************************************/
/* 10/14/2008      Poojitha           To validate the Relator Parteners page
/****************************************************************************************************/


//Function to clear all the values in the Submit Resume form

		/*This is to Alert the User */
		var msgFlag = document.getElementById("msgFlag")
		var message = document.getElementById("message")
		var Status = document.getElementById("msgStatus")
			
		if(msgFlag.value == "Y")
		{
			function messagedisplay(msgvalue)
			{
				alert(msgvalue)
				return false;
			}
			messagedisplay(message.value)
			msgFlag.value="N"
			
			//To check whether the values are saved and Mail is sent
			if(Status.value == "Y")
			{
				var omniturevalue = document.getElementById("hidOmniture").value ;
				
				//Call the Omniture function to send the values to Omniture
				LoadOmniture(omniturevalue);
				
				//Redirecting to the Contact Us Main Page
				location.replace("contactUsmain.aspx"); 
			}
		}				

		function ValidateForm(event, obj, objID)
		{
			var sId;
			var ctl;
			
				
			//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;
				}		
			}
			
			//Validate confirm Email Address
			sId = obj.id;
			sId = sId.replace(objID, "txtEmailConfirm")
			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+$/, "");	
				sEmail2 = ctl.value;
				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+$/, "");	
					sEmail = ctl.value;
					if (sEmail != sEmail2) 
					{
						alert("Email and Confirmation of Email do not match.");
						event.cancelBubble = true;
						event.returnValue = false;
						ctl.focus();
						return false;
					}		
				}
			}			
			
			//To check the mandatory option for First Name field
			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;
				}
			}
			
			//To check the mandatory option for Last Name field
			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;
				}
			}
			
			//To check the mandatory option for Last Name field
			sId = obj.id;
			sId = sId.replace(objID, "txtCompanyName")
			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 Company name.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			
			
			//To check the mandatory option for Street 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 == "--"))
				{
					alert("Please Select Your State.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}			
			
			//To check for mandatory Zip Code and Validate it.			
			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 validate the Cell phone number
			sId = obj.id;
			sId = sId.replace(objID, "txtOfficePhone")
			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 10 digit office phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				if ((ctl.value != "") && (!ctl.value.match(regPhone)))
				{
					alert("Please enter your 10 digit office phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
						
			// To validate the Work Phone Number
			sId = obj.id;
			sId = sId.replace(objID, "txtCellPhone")
			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 10 digit Cell phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
				if ((ctl.value != "") && (!ctl.value.match(regPhone)))
				{
					alert("Please enter your 10 digit cell phone number, starting with the area code.");
					event.cancelBubble = true;
					event.returnValue = false;
					ctl.focus();
					return false;
				}
			}
			return true;
		}	
		// -->
