var formSubmit = false;//used to check whether the form submitted or not 

function highLightInvalidFields(domainnames,whitepaper)
{
	formSubmit = true;	//value is set to true as the user submits the form
	//Setting all the fields initially to grey color.
	document.getElementById("name").style.borderColor = "#9a9b9d";
	document.getElementById("company").style.borderColor = "#9a9b9d";
	document.getElementById("jobtitle").style.borderColor = "#9a9b9d";
	document.getElementById("email").style.borderColor = "#9a9b9d";
	document.getElementById("country").style.borderColor = "#9a9b9d";
	document.getElementById("countrySpanId").style.borderColor = "#9a9b9d";
	document.getElementById("phone").style.borderColor = "#9a9b9d";				
	document.getElementById("captcha").style.borderColor = "#9a9b9d";
	
	//Checking whether the first name is empty
	if(trim(document.frmlogin.name.value)=="")
	{	
		document.getElementById("name").style.borderColor = "#cc0000";//Highlights the name field as it is empty		  
	}	

	if(trim(document.frmlogin.name.value) != null)
	{
		//Checking whether the name has any numbers
		var nonums = /[0-9]/;	 		
		if (nonums.test(trim(document.frmlogin.name.value))) 
		{ 		
			document.getElementById("name").style.borderColor = "#cc0000";//Highlights the name field as it has numbers
		}	
	}
	
	var iChars = "  !@#$%^&*()+=[]\\\;,/{}|\":<>?";
	
	//This checks whether the name has any special characters
    for (var i = 0; i < trim(document.frmlogin.name.value).length; i++) 
    {
    	if (iChars.indexOf(trim(document.frmlogin.name.value).charAt(i)) != -1) 
    	{	 	  		
    		document.getElementById("name").style.borderColor = "#cc0000";//Highlights the name field as it has special characters
    	} 	 		 	
    }
    
    if(trim(document.frmlogin.email.value)=="")
    {
	  document.getElementById("email").style.borderColor = "#cc0000";//Highlights the email field as it is empty
    }  
    var splitComma = domainnames.split(",");
	var my_email=trim(document.frmlogin.email.value);
	var ind=my_email.indexOf("@");
	var mai=my_email.slice((ind+1),my_email.length);
	
	var mail = mai.slice(0, mai.indexOf("."));
	for(var i = 0; i < splitComma.length; i++)
	{
	
		if(mail == splitComma[i])
		{
		 	document.getElementById("email").style.borderColor = "#cc0000";//Highlights the email field as it is empty
		}
		
	}
    //Checks whether the email entered has the standard email format
	var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
	
	if (!trim(document.frmlogin.email.value).match(re)) 
	{
		document.getElementById("email").style.borderColor = "#cc0000";//Highlights the email field as it doesn't have the standard format
	}
	
	var Phone=document.getElementById('phone');
	if (document.frmlogin.requesttype[7].checked == true)
	{
		
		//Checks whether the contact sales check box is checked or not
		if (document.frmlogin.requesttype[7].checked == true)
		{
			//Checks whether the phone value is null or empty
			if ((trim(Phone.value)==null)||(trim(Phone.value)==""))
		    {
				document.getElementById("phone").style.borderColor = "#cc0000";//Highlights the phone field as it is empty	
		    }
				
		}
	}
	//Checks whether the phone value entered follows the standard format
	if (checkInternationalPhone(trim(Phone.value))==false)
	{
		document.getElementById("phone").style.borderColor = "#cc0000";//Highlights the phone field as it doesnt follow the standard format
	}	
	if(document.frmlogin.requesttype[5].checked == false || document.frmlogin.requesttype[7].checked == true || document.frmlogin.requesttype[4].checked == true || document.frmlogin.requesttype[8].checked == true)
	{
			    
		//Checks whether the company is empty			
		if(trim(document.frmlogin.company.value)=="")
		{
			document.getElementById("company").style.borderColor = "#cc0000";//Highlights the company field as it is empty
		}
		//Checks whether the jobtitle field is empty
		if(trim(document.frmlogin.jobtitle.value) =="")
		{
			document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the jobtitle field as it is empty		  
		}
	}
	//Checks whether the user selects the country    
	if(document.frmlogin.country.selectedIndex==0)
	{
		document.getElementById("countrySpanId").style.borderColor = "#cc0000";//highlights the country field in IE as the user did not select country
		document.getElementById("country").style.borderColor = "#cc0000";//highlights the country field in Firefox as the user did not select country
	}
	if(trim(document.frmlogin.captcha.value)=="")
	{	
		document.getElementById("captcha").style.borderColor = "#cc0000";//Highlights the name field as it is empty		  
	}	
}

			/**
			 * This shows the mandatory symbol for the phone field once the user checks the 
			 * contact sales and hides the mandatory symbol if the user uncheck it.
			 * It also highlights the phone field, if the contact sales enabled and 
			 * user presses submit
			 */  
function cntSalesCkbValidation()
{
	//Checks whether the contact sales is checked
	if (document.frmlogin.requesttype[7].checked == true)
	{
		//Checks whether the form is submitted
		if(formSubmit==true)
		{  		
			var PhoneField = document.getElementById('phone');
			var CompanyField	=	document.getElementById('company');
			var JobField		=	document.getElementById('jobtitle');
			//Checks whether the phone field is null or empty
			if((trim(PhoneField.value) == null) ||(trim(PhoneField.value) == ""))
			{
				document.getElementById("phone").style.borderColor = "#cc0000";//Highlights the pone field as it is empty
			}  	
			if((CompanyField.value == null) ||(CompanyField.value == ""))
			{
				document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
			}
			if((JobField.value == null) ||(JobField.value == ""))
			{
				document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
			}
		}
		if(document.frmlogin.requesttype[5].checked == true)
		{
			document.getElementById("selected").className='visible';
			document.getElementById("whitepaper").className='invisible';
			document.getElementById("contact").className='invisible';
			document.getElementById("noselection").className='invisible';
		}
		else
		{
			document.getElementById("contact").className='visible';
			document.getElementById("selected").className='invisible';
			document.getElementById("whitepaper").className='invisible';
			document.getElementById("noselection").className='invisible';
		}
		document.getElementById("phoneMandatory").style.visibility='visible';
		document.getElementById("jobMandatory").style.visibility='visible';
		document.getElementById("companyMandatory").style.visibility='visible';//makes the mandatory symbol for the phone field visible  	
	}
	else
	{
		if(document.frmlogin.requesttype[5].checked == false)
		{
			document.getElementById("noselection").className='visible';
			document.getElementById("selected").className='invisible';
			document.getElementById("contact").className='invisible';
			document.getElementById("whitepaper").className='invisible';
			
		}
		else
		{
			document.getElementById("whitepaper").className='visible';
			document.getElementById("selected").className='invisible';
			document.getElementById("contact").className='invisible';
			document.getElementById("noselection").className='invisible';
			document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
			
			document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
			var companyEmptyFont     = document.getElementById('company_empty_font');
			var jobTitleEmptyFont    = document.getElementById('title_empty_font');
			var newIdForCompany  	   = document.getElementById('newIdForCompany');
			var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
			//Checks whether the tooltip is available or not
			if(newIdForPhone != null)
			{	
				phoneEmptyFont.removeChild(newIdForPhone);//removes the tool tip for the phone field 
			}
			if (newIdForCompany != null)//Checks whether the tool tip for the company field available
			{	
				companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
			}
			
			if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
			{	
				jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
			}
			document.getElementById("jobMandatory").style.visibility='hidden';
			document.getElementById("companyMandatory").style.visibility='hidden';
		}
		document.getElementById("phoneMandatory").style.visibility='hidden';//hides the mandatory symbol for the phone field
	
		document.getElementById("phone").style.borderColor = "#9a9b9d";//Changes the phone field border color to grey
		var phoneEmptyFont = document.getElementById('phone_empty_font');//gets the parent id of the tool tip created
		var newIdForPhone    	   = document.getElementById('newIdForPhone');//Gets the id of the tooltip created
		if (document.frmlogin.requesttype[4].checked == false  && document.frmlogin.requesttype[8].checked == false)
		{
			if (document.frmlogin.requesttype[5].checked == false)
			{
				document.getElementById("jobMandatory").style.visibility='visible';
				document.getElementById("companyMandatory").style.visibility='visible';
			}
			else
			{
				if(formSubmit==true)
				{  
					document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
					
					document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
				
					var companyEmptyFont     = document.getElementById('company_empty_font');
					var jobTitleEmptyFont    = document.getElementById('title_empty_font');
					var countryEmptyFont     = document.getElementById('country_empty_font');
					var newIdForCompany  	   = document.getElementById('newIdForCompany');
					var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
					
					if (newIdForCompany != null)//Checks whether the tool tip for the company field available
					{	
						companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
					}
					
					if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
					{	
						jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
					}
				}
			}
		}
		else
		{
			if(formSubmit==true)
			{
				var CompanyField	=	document.getElementById('company');
				var JobField		=	document.getElementById('jobtitle');
				//Checks whether the phone field is null or empty
				if((CompanyField.value == null) ||(CompanyField.value == ""))
				{
					document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
				}
				if((JobField.value == null) ||(JobField.value == ""))
				{
					document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
				}
			}
			document.getElementById("jobMandatory").style.visibility='visible';
			document.getElementById("companyMandatory").style.visibility='visible';
		}
		
	}  		
}

function newsLetterCkbValidation()
{
	if (document.frmlogin.requesttype[4].checked == true)
	{
		if(formSubmit==true)
		{
			var CompanyField	=	document.getElementById('company');
			var JobField		=	document.getElementById('jobtitle');
			var CountryField	=	document.getElementById('country');
			//Checks whether the phone field is null or empty
			if((CompanyField.value == null) ||(CompanyField.value == ""))
			{
				document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
			}
			if((JobField.value == null) ||(JobField.value == ""))
			{
				document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
			}
			if(document.frmlogin.country.selectedIndex==0)
			{
				document.getElementById("country").style.borderColor = "#cc0000";//Highlights the Country field as it is empty
				document.getElementById("countrySpanId").style.borderColor = "#cc0000";
			}
		}
		document.getElementById("jobMandatory").style.visibility='visible';
		document.getElementById("companyMandatory").style.visibility='visible';
		document.getElementById("countryMandatory").style.visibility='visible';
	}
	else
	{
		if (document.frmlogin.requesttype[7].checked == false)
		{
			document.getElementById("jobMandatory").style.visibility='hidden';
			document.getElementById("companyMandatory").style.visibility='hidden';
			if(formSubmit==true)
			{  
				document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
				
				document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
			
				var companyEmptyFont     = document.getElementById('company_empty_font');
				var jobTitleEmptyFont    = document.getElementById('title_empty_font');
				var countryEmptyFont     = document.getElementById('country_empty_font');
				var newIdForCompany  	   = document.getElementById('newIdForCompany');
				var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
				
				if (newIdForCompany != null)//Checks whether the tool tip for the company field available
				{	
					companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
				}
				
				if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
				{	
					jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
				}
			}
		}
		else
		{
			if(formSubmit==true)
			{
				var CompanyField	=	document.getElementById('company');
				var JobField		=	document.getElementById('jobtitle');
				//Checks whether the phone field is null or empty
				if((CompanyField.value == null) ||(CompanyField.value == ""))
				{
					document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
				}
				if((JobField.value == null) ||(JobField.value == ""))
				{
					document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
				}
			}
			document.getElementById("jobMandatory").style.visibility='visible';
			document.getElementById("companyMandatory").style.visibility='visible';
		}
		if (document.frmlogin.requesttype[7].checked == false  && document.frmlogin.requesttype[8].checked == false)
		{
			if (document.frmlogin.requesttype[5].checked == false)
			{
				document.getElementById("jobMandatory").style.visibility='visible';
				document.getElementById("companyMandatory").style.visibility='visible';
			}
			else
			{
				if(formSubmit==true)
				{  
					document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
					
					document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
				
					var companyEmptyFont     = document.getElementById('company_empty_font');
					var jobTitleEmptyFont    = document.getElementById('title_empty_font');
					var countryEmptyFont     = document.getElementById('country_empty_font');
					var newIdForCompany  	   = document.getElementById('newIdForCompany');
					var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
					
					if (newIdForCompany != null)//Checks whether the tool tip for the company field available
					{	
						companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
					}
					
					if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
					{	
						jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
					}
				}
			}
		}
		else
		{
			if(formSubmit==true)
			{
				var CompanyField	=	document.getElementById('company');
				var JobField		=	document.getElementById('jobtitle');
				//Checks whether the phone field is null or empty
				if((CompanyField.value == null) ||(CompanyField.value == ""))
				{
					document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
				}
				if((JobField.value == null) ||(JobField.value == ""))
				{
					document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
				}
			}
			document.getElementById("jobMandatory").style.visibility='visible';
			document.getElementById("companyMandatory").style.visibility='visible';
		}
	}
}
function otherCkbValidation()
{
	if (document.frmlogin.requesttype[8].checked == true)
	{
		if(formSubmit==true)
		{
			var CompanyField	=	document.getElementById('company');
			var JobField		=	document.getElementById('jobtitle');
			var CountryField	=	document.getElementById('country');
			//Checks whether the phone field is null or empty
			if((CompanyField.value == null) ||(CompanyField.value == ""))
			{
				document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
			}
			if((JobField.value == null) ||(JobField.value == ""))
			{
				document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
			}
			if(document.frmlogin.country.selectedIndex==0)
			{
				document.getElementById("country").style.borderColor = "#cc0000";//Highlights the Country field as it is empty
				document.getElementById("countrySpanId").style.borderColor = "#cc0000";
			}
		}
		document.getElementById("jobMandatory").style.visibility='visible';
		document.getElementById("companyMandatory").style.visibility='visible';
		document.getElementById("countryMandatory").style.visibility='visible';
	}
	else
	{
		if (document.frmlogin.requesttype[7].checked == false)
		{
			document.getElementById("jobMandatory").style.visibility='hidden';
			document.getElementById("companyMandatory").style.visibility='hidden';
			if(formSubmit==true)
			{  
				document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
				
				document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
			
				var companyEmptyFont     = document.getElementById('company_empty_font');
				var jobTitleEmptyFont    = document.getElementById('title_empty_font');
				var countryEmptyFont     = document.getElementById('country_empty_font');
				var newIdForCompany  	   = document.getElementById('newIdForCompany');
				var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
				
				if (newIdForCompany != null)//Checks whether the tool tip for the company field available
				{	
					companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
				}
				
				if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
				{	
					jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
				}
			}
		}
		else
		{
			if(formSubmit==true)
			{
				var CompanyField	=	document.getElementById('company');
				var JobField		=	document.getElementById('jobtitle');
				//Checks whether the phone field is null or empty
				if((CompanyField.value == null) ||(CompanyField.value == ""))
				{
					document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
				}
				if((JobField.value == null) ||(JobField.value == ""))
				{
					document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
				}
			}
			document.getElementById("jobMandatory").style.visibility='visible';
			document.getElementById("companyMandatory").style.visibility='visible';
			if (document.frmlogin.requesttype[4].checked == false  && document.frmlogin.requesttype[7].checked == false)
			{
				if (document.frmlogin.requesttype[5].checked == false)
				{
					document.getElementById("jobMandatory").style.visibility='visible';
					document.getElementById("companyMandatory").style.visibility='visible';
				}
				else
				{
					if(formSubmit==true)
					{  
						document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
						
						document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
					
						var companyEmptyFont     = document.getElementById('company_empty_font');
						var jobTitleEmptyFont    = document.getElementById('title_empty_font');
						var countryEmptyFont     = document.getElementById('country_empty_font');
						var newIdForCompany  	   = document.getElementById('newIdForCompany');
						var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
						
						if (newIdForCompany != null)//Checks whether the tool tip for the company field available
						{	
							companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
						}
						
						if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
						{	
							jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
						}
					}
				}
			}
			else
			{
				if(formSubmit==true)
				{
					var CompanyField	=	document.getElementById('company');
					var JobField		=	document.getElementById('jobtitle');
					//Checks whether the phone field is null or empty
					if((CompanyField.value == null) ||(CompanyField.value == ""))
					{
						document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
					}
					if((JobField.value == null) ||(JobField.value == ""))
					{
						document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
					}
				}
				document.getElementById("jobMandatory").style.visibility='visible';
				document.getElementById("companyMandatory").style.visibility='visible';
			}
		}
	}
}
function whitepCkbValidation()
{
	//Checks whether the contact sales is checked
	if (document.frmlogin.requesttype[5].checked == true)
	{
		//Checks whether the form is submitted
		
		if(formSubmit==true)
		{  		
			//var PhoneField 		=	document.getElementById('phone');
			var CompanyField	=	document.getElementById('company');
			var JobField		=	document.getElementById('jobtitle');
			if(document.frmlogin.requesttype[7].checked == true || document.frmlogin.requesttype[4].checked == true || document.frmlogin.requesttype[8].checked == true)
			{
				
				//Checks whether the phone field is null or empty
				if((CompanyField.value == null) ||(CompanyField.value == ""))
				{
					document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
				}
				if((JobField.value == null) ||(JobField.value == ""))
				{
					document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
				}
				document.getElementById("jobMandatory").style.visibility='visible';
				document.getElementById("companyMandatory").style.visibility='visible';
			}
			else
			{
				var CountryField	=	document.getElementById('country');
			
				document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
			
				document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
			
				var companyEmptyFont     = document.getElementById('company_empty_font');
				var jobTitleEmptyFont    = document.getElementById('title_empty_font');
				var countryEmptyFont     = document.getElementById('country_empty_font');
				var newIdForCompany  	   = document.getElementById('newIdForCompany');
				var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
				
				if (newIdForCompany != null)//Checks whether the tool tip for the company field available
				{	
					companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
				}
				
				if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
				{	
					jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
				}
				
				
				cntSalesCkbValidation();
			}
		}
		else
		{
			if(document.frmlogin.requesttype[7].checked == true || document.frmlogin.requesttype[4].checked == true  || document.frmlogin.requesttype[8].checked == true)
			{
				document.getElementById("jobMandatory").style.visibility='visible';
				document.getElementById("companyMandatory").style.visibility='visible';
			}
			else
			{
				
				document.getElementById("jobMandatory").style.visibility='hidden';
				document.getElementById("companyMandatory").style.visibility='hidden';
				
				cntSalesCkbValidation();
			}
		}
		if(document.frmlogin.requesttype[7].checked == true)
		{
			document.getElementById("selected").className='visible';
			document.getElementById("contact").className='invisible';
			document.getElementById("noselection").className='invisible';
			document.getElementById("whitepaper").className='invisible';
		}
		else
		{
			document.getElementById("whitepaper").className='visible';
			document.getElementById("selected").className='invisible';
			document.getElementById("contact").className='invisible';
			document.getElementById("noselection").className='invisible';
		}
		document.getElementById("countryMandatory").style.visibility='visible';
		
		//document.getElementById("phoneMandatory").style.visibility='visible';//makes the mandatory symbol for the phone field visible  	
	}
	else
	{
	document.getElementById("jobMandatory").style.visibility='visible';
	document.getElementById("companyMandatory").style.visibility='visible';
	if(formSubmit==true)
	{  		
		//var PhoneField 		=	document.getElementById('phone');
		var CompanyField	=	document.getElementById('company');
		var JobField		=	document.getElementById('jobtitle');
		var CountryField	=	document.getElementById('country');
		//Checks whether the phone field is null or empty
		if((CompanyField.value == null) ||(CompanyField.value == ""))
		{
			document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
		}
		if((JobField.value == null) ||(JobField.value == ""))
		{
			document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
		}
		if(document.frmlogin.country.selectedIndex==0)
		{
			document.getElementById("country").style.borderColor = "#cc0000";//Highlights the Country field as it is empty
			document.getElementById("countrySpanId").style.borderColor = "#cc0000";
		}
		cntSalesCkbValidation();
	}
	if(document.frmlogin.requesttype[7].checked == false)
	{
		document.getElementById("noselection").className='visible';
		document.getElementById("whitepaper").className='invisible';
		document.getElementById("contact").className='invisible';
		document.getElementById("selected").className='invisible';
	}
	else
	{
		document.getElementById("noselection").className='invisible';
		document.getElementById("selected").className='invisible';
		document.getElementById("whitepaper").className='invisible';
		document.getElementById("contact").className='visible';
		document.getElementById("jobMandatory").style.visibility='hidden';
		document.getElementById("companyMandatory").style.visibility='hidden';
		document.getElementById("company").style.borderColor = "#9a9b9d";//Highlights the Company field as it is empty
		document.getElementById("jobtitle").style.borderColor = "#9a9b9d";//Highlights the Job field as it is empty
	
		var companyEmptyFont     = document.getElementById('company_empty_font');
		var jobTitleEmptyFont    = document.getElementById('title_empty_font');
		var countryEmptyFont     = document.getElementById('country_empty_font');
		var newIdForCompany  	   = document.getElementById('newIdForCompany');
		var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
		
		if (newIdForCompany != null)//Checks whether the tool tip for the company field available
		{	
			companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
		}
		
		if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
		{	
			jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
		}
		
	}
	if(document.frmlogin.requesttype[7].checked == true || document.frmlogin.requesttype[4].checked == true || document.frmlogin.requesttype[8].checked == true)
	{
		if(formSubmit==true)
		{
			var CompanyField	=	document.getElementById('company');
			var JobField		=	document.getElementById('jobtitle');
			//Checks whether the phone field is null or empty
			if((CompanyField.value == null) ||(CompanyField.value == ""))
			{
				document.getElementById("company").style.borderColor = "#cc0000";//Highlights the Company field as it is empty
			}
			if((JobField.value == null) ||(JobField.value == ""))
			{
				document.getElementById("jobtitle").style.borderColor = "#cc0000";//Highlights the Job field as it is empty
			}
		}
		document.getElementById("jobMandatory").style.visibility='visible';
		document.getElementById("companyMandatory").style.visibility='visible';
	}
		//hides the mandatory symbol for the phone field
		var phoneEmptyFont = document.getElementById('phone_empty_font');//gets the parent id of the tool tip created
		var newIdForPhone    	   = document.getElementById('newIdForPhone');//Gets the id of the tooltip created
		//Checks whether the tooltip is available or not
		if(newIdForPhone != null)
		{
			phoneEmptyFont.removeChild(newIdForPhone);//removes the tool tip for the phone field 
		}
	}
	
}


//Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
//var minDigitsInIPhoneNumber = 10;
var minDigitsInIPhoneNumber = 0;
			
/**
* Checks whether the number entered by the user contains only the phone number
* @param s - Input entered for the phone field
* @return - Returns whether the phone field contains only integer
*/
function isInteger(s)
{   
	var i;
	for (i = 0; i < s.length; i++)
	{   
		//Check that current character is number.
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}			    
	return true;
}
			
/**
* Trims the phone field to avoid the empty space at the end
* @param s - Input entered for the phone field
* @return - Returns the trimmed value
*/
function trim(s)
{   
	var i;
    var returnString = "";
    // Search through string's characters one by one.
	// If character is not a whitespace, append to returnString.
	for (i = 0; i < s.length; i++)
	{   
		//Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (c != " ") returnString += c;
	}
	return returnString;
	
}
			
/**
* Removes the valid special characters and returns only integer which is 
* useful for further processing
* @param s - The phone number entered
* @param bag - Special characters allowed for phone
* @return - The number without special characters
*/

function stripCharsInBag(s, bag)
{   
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
       //Check that current character isn't whitespace.
       var c = s.charAt(i);
       if (bag.indexOf(c) == -1) returnString += c;
    }			    
    return returnString;
    
}
			
/**
* Checks whether the phone value entered follows the standard format
* @param strPhone - Phone number entered by the user
* @return - Whether the phone number is valid or not
*/
function checkInternationalPhone(strPhone)
{
	var bracket=3
	strPhone=trim(strPhone);
	
	//Checks whether the position of the plus(+) symbol for the phone field is greater than one
	if(strPhone.indexOf("+")>1)
	{	
		return false
	}
	if(strPhone.indexOf("-")!=-1)
	{
		bracket=bracket+1
	}
	if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)
	{	
		return false
	}
	var brchr=strPhone.indexOf("(")
	
	if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")
	return false
	
	if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)
	return false
	
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	
	return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

/**
* This creates the tool tip for the phone field error message
* @param message - This is the html tag with error message dynamically created
*/
function createToolTip(message)
{
	var field = document.getElementById('phone_empty_font'); 	   
	var newSpanForName = document.createElement('span');
	newSpanForName.setAttribute('id','newIdForPhone');	
	newSpanForName.innerHTML = message;
	//Checks whether the tool tip is available or not
	
   if(document.getElementById('newIdForPhone') == null)
   {  		  			  
	   field.appendChild(newSpanForName);//Creates the tooltip
   }
}			

/**
* This removes the tool tips if available			
*/
function removeElementIfAvailable()
{
	var nameEmptyFont        = document.getElementById('name_empty_font');
	var companyEmptyFont     = document.getElementById('company_empty_font');
	var jobTitleEmptyFont    = document.getElementById('title_empty_font');
	var emailIdEmptyFont     = document.getElementById('email_empty_font');
	var countryEmptyFont     = document.getElementById('country_empty_font');
	var phoneEmptyFont       = document.getElementById('phone_empty_font');
	var captchaEmptyFont     = document.getElementById('captcha_empty_font');
	var requestTypeEmptyFont = document.getElementById('request_type_empty_font');

	var newIdForName           = document.getElementById('newIdForName');
	var newIdForCompany  	   = document.getElementById('newIdForCompany');
	var newIdForJobTitle 	   = document.getElementById('newIdForJobTitle');
	var newIdForEmailId  	   = document.getElementById('newIdForEmailId');
	var newIdForCountry  	   = document.getElementById('newIdForCountry');
	var newIdForPhone    	   = document.getElementById('newIdForPhone');
	var newIdForCaptcha    	   = document.getElementById('newIdForCaptcha');
	var newIdForCheckBox  	   = document.getElementById('newIdForCheckBox');

	if (newIdForCheckBox != null)//Checks whether the tool tip for the request type is available 
	{	
		requestTypeEmptyFont.removeChild(newIdForCheckBox);//Removes the tool tip near the request type
	}
	
	if(newIdForPhone != null)//Checks whether the tool tip  for the phone field is available
	{	
		phoneEmptyFont.removeChild(newIdForPhone);//Removes the tool tip for the phone field
	}
	if(newIdForCaptcha != null)//Checks whether the tool tip  for the phone field is available
	{	
		captchaEmptyFont.removeChild(newIdForCaptcha);//Removes the tool tip for the phone field
	}
	
	if (newIdForName != null)//Checks whether the tool tip  for the name field is available
	{	
		nameEmptyFont.removeChild(newIdForName);//removes the name field tool tip
	}
	
	if (newIdForCompany != null)//Checks whether the tool tip for the company field available
	{	
		companyEmptyFont.removeChild(newIdForCompany);//Removes the tool tip near the company field
	}
	
	if (newIdForJobTitle != null)//Checks whether the tool tip for the jobtitle title available
	{	
		jobTitleEmptyFont.removeChild(newIdForJobTitle);//Removes the tool tip for the jobtitle title
	}
	
	if (newIdForEmailId != null)//Checks whether the tool tip for the email id available
	{	
		emailIdEmptyFont.removeChild(newIdForEmailId);//Removes the tool tip for the email id.
	}
	
	if (newIdForCountry != null)//Checks whether the tool tip available for the country field 
	{	
		countryEmptyFont.removeChild(newIdForCountry);//Removes the tool tip for the country field
	}
}

/**
 * Validates and creates the error message with the tool tip for the form submitted.
 * 
 */
function formsubmit()
{ 
	document.body.style.cursor = "wait";
	document.frmlogin.action = "./EmailRegistrationServlet";
	document.frmlogin.method = "post";
	document.frmlogin.submit();  
}
function validate(domainnames, whitepaper)
{  
	removeElementIfAvailable();//Removes the tool tip if available
	highLightInvalidFields(domainnames, whitepaper);  
	var splitComma = domainnames.split(",");
	var my_email=trim(document.frmlogin.email.value);
	var ind=my_email.indexOf("@");
	var mai=my_email.slice((ind+1),my_email.length);
	
	var mail = mai.slice(0, mai.indexOf("."));
	for(var i = 0; i < splitComma.length; i++)
	{
		if(mail == splitComma[i])
		{
			var field = document.getElementById('email_empty_font');
			var newSpanForEmailId = document.createElement('span');
			newSpanForEmailId.setAttribute('id','newIdForEmailId');		  
			newSpanForEmailId.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide your Work Email Id.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the email
			if(document.getElementById('newIdForEmailId') == null)
			{
				field.appendChild(newSpanForEmailId);//Appends the tool tip to the parent
			}
			document.frmlogin.email.focus();
			return false;
		}
	}
			  		// set var checkbox_choices to zero
    var checkbox_choices = 0;
    var counter = 0;
    var checkBoxSelected ='';
    var requesttypeSelectedList = '';    
    // Loop from zero to the one minus the number of checkbox button selections
    for (counter; counter < frmlogin.requesttype.length; counter++)
    {
        // If a checkbox has been selected it will return true
        // (If not it will return false)
        if (frmlogin.requesttype[counter].checked)
        {
        	checkbox_choices = checkbox_choices + 1; 
            checkBoxSelected += counter + '-';
            requesttypeSelectedList = requesttypeSelectedList +  frmlogin.requesttype[counter].value + "|";
        }
    }
    document.getElementById('requesttypeSelectedList').value = requesttypeSelectedList;    
    if(checkbox_choices < 1)//Checks if any check boxes for the request type is checked
	{    			 
		 var field = document.getElementById('request_type_empty_font');		  
		  var newSpanForName = document.createElement('span');
		  newSpanForName.setAttribute('id','newIdForCheckBox');
		  newSpanForName.innerHTML = '&nbsp;&nbsp;<span class=\"request\">Please select atleast one Request Type.<span class=\"request-pointer\">&nbsp;</span></span>';//Creates the tool tip for the request type
		  if(document.getElementById('newIdForName') == null)
		  {		    	    		  
  			field.appendChild(newSpanForName);//Appends the tool tip to the parent
		  }		  
		 document.frmlogin.requesttype[0].focus();
		 return false;
	}	  
	
    if(trim(document.frmlogin.name.value) =="")//Checks whether the name is empty
	{
    	document.frmlogin.name.focus();		  
    	var field = document.getElementById('name_empty_font');		  
		var newSpanForName = document.createElement('span');
		newSpanForName.setAttribute('id','newIdForName');
		newSpanForName.innerHTML = '&nbsp;&nbsp;<span class=\"hint\"><font align=\"justify\">Please provide your Name.</font><span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the name
		if(document.getElementById('newIdForName') == null)
		{		    		  
			field.appendChild(newSpanForName);//Appends the tool tip to the parent
		}
		return false;
	}

    if(trim(document.frmlogin.name.value) != null)//Checks whether the name is not null
 	{	 	   		 
    	var nonums = /[0-9]/;	 		
	 	if (nonums.test(document.frmlogin.name.value))//Checks whether the name has no numbers 
		{
	 		var field = document.getElementById('name_empty_font'); 	   
	 		var newSpanForName = document.createElement('span');
	 		newSpanForName.setAttribute('id','newIdForName');	
	 		newSpanForName.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide a valid Name.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the name
	 		
	 		if(document.getElementById('newDiv') == null)//Checks whether the tool tip is already available
	 		{  		  			  
	 			field.appendChild(newSpanForName);//Appends the tool tip to the parent
	 		}
	 			document.frmlogin.name.focus();
	 			return false;
	 	}

	 	var iChars = "!@#$%^&*()+=[]\\\;,/{}|\":<>?";

	 	for (var i = 0; i < trim(document.frmlogin.name.value).length; i++) 
	 	{
	 		if (iChars.indexOf(trim(document.frmlogin.name.value).charAt(i)) != -1) 
	 	  	{
	 			var field = document.getElementById('name_empty_font');
	 	  		var newSpanForName = document.createElement('span');
	 	  		newSpanForName.setAttribute('id','newIdForName');
		  		newSpanForName.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide a valid Name.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the name
		  		if(document.getElementById('newIdForName') == null)
		  		{			  
		  			field.appendChild(newSpanForName);//Appends the tool tip to the parent
		        }
	 	  		document.frmlogin.name.focus();
	 	  		return false;
	 	  	}
	 	  }			 	
 	  }		
    if(document.frmlogin.requesttype[5].checked == false  || document.frmlogin.requesttype[7].checked == true || document.frmlogin.requesttype[4].checked == true)
    {
    	if(trim(document.frmlogin.company.value) =="")//Checks whether the company is empty
		{
    		var field = document.getElementById('company_empty_font');
    		var newSpanForCompany = document.createElement('span');
    		newSpanForCompany.setAttribute('id','newIdForCompany');		  
    		newSpanForCompany.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide your Company name.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the company
    		
			if(document.getElementById('newIdForCompany') == null)//Checks whether the tool tip is already available
			{
				field.appendChild(newSpanForCompany);//Appends the tool tip to the parent
			}
			
			document.frmlogin.company.focus();
			return false;
		}		  
		  
    	if(trim(document.frmlogin.jobtitle.value) == "")//Checks whether the company is empty
		{
    		var field = document.getElementById('title_empty_font');		  
    		var newSpanForJobTitle = document.createElement('span');
    		newSpanForJobTitle.setAttribute('id','newIdForJobTitle');		  
    		newSpanForJobTitle.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide your Job Title.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the jobtitle
    		
    		if(document.getElementById('newIdForJobTitle') == null)
			{
    			field.appendChild(newSpanForJobTitle);//Appends the tool tip to the parent
			}
			document.frmlogin.jobtitle.focus();
			
			return false;
		}	
		  
        if(trim(document.frmlogin.email.value) =="")//Checks whether the email field is empty
		{
			var field = document.getElementById('email_empty_font');
			var newSpanForEmailId = document.createElement('span');
			newSpanForEmailId.setAttribute('id','newIdForEmailId');		  
			newSpanForEmailId.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide your Email Id.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the email
			
			if(document.getElementById('newIdForEmailId') == null)
			{
				field.appendChild(newSpanForEmailId);//Appends the tool tip to the parent
			}
			document.frmlogin.email.focus();
			return false;
		}  
	  
		var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
		  
		if (!trim(document.frmlogin.email.value).match(re)) //Checks whether the email id is in allowed format
		{
		 	var field = document.getElementById('email_empty_font');
		  
		  	var newSpanForInvalidEmailId = document.createElement('span');
		  	newSpanForInvalidEmailId.setAttribute('id','newIdForEmailId');		  
			newSpanForInvalidEmailId.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide a valid Email Id.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the email
			
			if(document.getElementById('newIdForInvalidEmailId') == null)
			{
				field.appendChild(newSpanForInvalidEmailId);//Appends the tool tip to the parent
			}
		  	document.frmlogin.email.focus();
		  	return false;
		}
		if (document.frmlogin.requesttype[7].checked == true)
		{
			var Phone=document.getElementById('phone');
			
			if(document.frmlogin.requesttype[7].checked == true)//Checks whether the contact sales checked
			{			
				if ((Phone.value==null)||(Phone.value==""))//Checks whether the phone is null or empty
				{
					createToolTip('&nbsp;&nbsp;<span class=\"phone\">Please provide your Business Phone Number for us to contact you, else uncheck the Request Type that says \"Contact Sales\" and submit the form.<span class=\"phone-pointer\">&nbsp;</span></span>');
					Phone.focus()
					return false;
				}
				if (checkInternationalPhone(Phone.value)==false)//Checks whether the phone number is valid
				{
					createToolTip('&nbsp;&nbsp;<span class=\"phone\">Please provide a valid Business Phone Number for us to contact you, else uncheck the Request Type that says \"Contact Sales\" and submit the form.<span class=\"phone-pointer\">&nbsp;</span></span>');
					Phone.focus()
					return false;
				}
			} 
		}
    	
    	
	}

    if(trim(document.frmlogin.email.value)=="")//Checks whether the email field is empty
	{
		var field = document.getElementById('email_empty_font');
		var newSpanForEmailId = document.createElement('span');
		newSpanForEmailId.setAttribute('id','newIdForEmailId');		  
		newSpanForEmailId.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide your Email Id.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the email
		
		if(document.getElementById('newIdForEmailId') == null)
		{
			field.appendChild(newSpanForEmailId);//Appends the tool tip to the parent
		}
		document.frmlogin.email.focus();
		return false;
	}  
	
	var re = /^[_\.0-9a-z-]+\@([0-9a-z][0-9a-z-]*\.)+([a-z]{2,4})+$/i
	  
	if (!trim(document.frmlogin.email.value).match(re)) //Checks whether the email id is in allowed format
	{
	 	var field = document.getElementById('email_empty_font');
	  
	  	var newSpanForInvalidEmailId = document.createElement('span');
	  	newSpanForInvalidEmailId.setAttribute('id','newIdForEmailId');		  
		newSpanForInvalidEmailId.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please provide a valid Email Id.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the email
		
		if(document.getElementById('newIdForInvalidEmailId') == null)
		{
			field.appendChild(newSpanForInvalidEmailId);//Appends the tool tip to the parent
		}
	  	document.frmlogin.email.focus();
	  	return false;
	}
	var Phone=document.getElementById('phone');
	if (document.frmlogin.requesttype[7].checked == true)
	{
		var Phone=document.getElementById('phone');
		
		if(document.frmlogin.requesttype[7].checked == true)//Checks whether the contact sales checked
		{			
			if ((trim(Phone.value)==null)||(trim(Phone.value) ==""))//Checks whether the phone is null or empty
			{
				createToolTip('&nbsp;&nbsp;<span class=\"phone\">Please provide your Phone Number for us to contact you, else uncheck the Request Type that says \"Contact Sales\" and submit the form.<span class=\"phone-pointer\">&nbsp;</span></span>');
				Phone.focus()
				return false;
			}
			
		} 
	}
	if (checkInternationalPhone(trim(Phone.value))==false)//Checks whether the phone number is valid
	{
		createToolTip('&nbsp;&nbsp;<span class=\"phone\">Please provide a valid Phone Number for us to contact you, else uncheck the Request Type that says \"Contact Sales\" and submit the form.<span class=\"phone-pointer\">&nbsp;</span></span>');
		Phone.focus()
		return false;
	}
	if(document.frmlogin.country.selectedIndex==0)//Checks whether the country is empty 
	{		  
		var field = document.getElementById('country_empty_font');
		var newSpanForCountry = document.createElement('span');
		newSpanForCountry.setAttribute('id','newIdForCountry');		  
		newSpanForCountry.innerHTML = '&nbsp;&nbsp;<span class=\"hint\">Please select your Country.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the country
		
		if(document.getElementById('newIdForCountry') == null)
		{
			field.appendChild(newSpanForCountry);//Appends the tool tip to the parent
		}
		document.frmlogin.country.focus();
		return false;
	}
	if(trim(document.frmlogin.captcha.value)=="")//Checks whether the company is empty
	{
		var field = document.getElementById('captcha_empty_font');		  
		var newSpanForCaptcha = document.createElement('span');
		newSpanForCaptcha.setAttribute('id','newIdForCaptcha');		  
		newSpanForCaptcha.innerHTML = '&nbsp;&nbsp;<span class=\"hint\" style=\"height: 105px;\">By entering this code you help Net-O<sub>2</sub> prevent spam and fake registrations.  This code can be typed in all lowercase.<span class=\"hint-pointer\">&nbsp;</span></span>';//Creates the tool tip for the jobtitle
	  
		if(document.getElementById('newIdForCaptcha') == null)
		{
			field.appendChild(newSpanForCaptcha);//Appends the tool tip to the parent
		}
		document.frmlogin.captcha.focus();
		return false;
	}
	
	// set var checkbox_choices to zero
	var productgroup_checkbox_choices = 0;
	var productgroup_counter = 0;
	var productgroup_checkBoxSelected ='';
	var productgroupSelectedList = '';
	   
	// Loop from zero to the one minus the number of checkbox button selections
	for (productgroup_counter; productgroup_counter < frmlogin.productgroup.length; productgroup_counter++)
	{
		//If a checkbox has been selected it will return true
	    // (If not it will return false)
	    if (frmlogin.productgroup[productgroup_counter].checked)
	    {  
	    	productgroup_checkbox_choices = productgroup_checkbox_choices + 1; 
	    	productgroup_checkBoxSelected += productgroup_counter + '-';
	    	productgroupSelectedList = productgroupSelectedList +  frmlogin.productgroup[productgroup_counter].value + ","; 
	    }
	   
	}
	var splitlist = productgroupSelectedList.split(",");
	var list = '';
	for(var i = 0; i < splitlist.length; i++)
	{	
		if(i != splitlist.length - 2)
		{
	
			list = list + " " + splitlist[i] + ",";
		}
		else
		{
			list = list + " " + splitlist[i];
		}
	}
	
	document.getElementById('areaofinterest').value = list;

	
	
	formSubmit = false;

}
			  
function valid_pincode(pincodeValue)
{
	var pincode = /\d{6}/g;
	return pincode.test(pincodeValue);
}

function resetForm()
{
	 window.location.reload( true );
}
/**
 * Resets the register form when the user presses reset.
 */
function resetRegisterForm()
{
	formSubmit = false;		
	document.getElementById("jobMandatory").style.visibility='visible';
	document.getElementById("companyMandatory").style.visibility='visible';
	document.getElementById("countryMandatory").style.visibility='visible';
	document.getElementById("phoneMandatory").style.visibility='hidden';//Hides the mandatory field for phone
	document.getElementById("noselection").className='visible';	
	document.getElementById("contact").className='invisible';	
	document.getElementById("whitepaper").className='invisible';	
	document.getElementById("selected").className='invisible';	
	//Sets the border color for all the fields
	document.getElementById("name").style.borderColor = "#9a9b9d";
	document.getElementById("company").style.borderColor = "#9a9b9d";
	document.getElementById("jobtitle").style.borderColor = "#9a9b9d";
	document.getElementById("email").style.borderColor = "#9a9b9d";
	document.getElementById("country").style.borderColor = "#9a9b9d";
	document.getElementById("phone").style.borderColor = "#9a9b9d";
	document.getElementById("countrySpanId").style.borderColor = "#9a9b9d";
	document.getElementById("country").style.borderColor = "#9a9b9d";
	document.getElementById("captcha").style.borderColor = "#9a9b9d";
	removeElementIfAvailable();//Removes the tool tip if available
			
	if(trim(document.frmlogin.name.value) != "")
	{
		document.frmlogin.name.value = "";
	}
	
	if(trim(document.frmlogin.company.value) != "")
	{
		document.frmlogin.company.value = "";
	}
	
	if(trim(document.frmlogin.jobtitle.value) != "")
	{
		document.frmlogin.jobtitle.value = "";
	}	 

	if(trim(document.frmlogin.division.value) != "")
	{
		document.frmlogin.division.value = "";
	}	 
			  	 
	if(document.frmlogin.country.selectedIndex != 0)
	{
		document.frmlogin.country.value = 0;
	}	
			  
	if(trim(document.frmlogin.email.value) != "")
	{
		document.frmlogin.email.value = "";
	}
	
	if(trim(document.frmlogin.phone.value) != "")
	{
		document.frmlogin.phone.value = "";
	}	 
	
	if(trim(document.frmlogin.captcha.value) != "")
	{
		document.frmlogin.captcha.value = "";
	}	
	// resets the protocols checked

	var p_chkbox_choice = 0;
	var p_counter = 0;
	var p_checkBoxSelected ='';
			   
	// Loop from zero to the one minus the number of checkbox button selections
	for (p_counter; p_counter < frmlogin.productgroup.length; p_counter++)
	{
		if (frmlogin.productgroup[p_counter].checked)
		{  
			frmlogin.productgroup[p_counter].checked = false;
		}
	}
	// resets the request type checked
	var r_chkbox_choice = 0;
	var r_counter = 0;
	var r_checkBoxSelected ='';
	// Loop from zero to the one minus the number of checkbox button selections
	for (r_counter;r_counter < frmlogin.requesttype.length; r_counter++)
	{
		if (frmlogin.requesttype[r_counter].checked)
		{  
			frmlogin.requesttype[r_counter].checked = false;
		}
	}
	// validation for additional information
	if(document.frmlogin.additionalinfo.value !="")
	{
		document.frmlogin.additionalinfo.value = "";
	}
}

/**
 * This sets the request type when the page loads
 */
function setRequestType()
{
	document.frmlogin.requesttype[4].checked = true;	
	document.frmlogin.requesttype[7].checked = true;
}

/**
 * Limits the text for all the field
 * @param limitField - Field to be limited
 * @param limitNum - Length of the input allowed
 */
function limitText(limitField, limitNum) 
{
	if (limitField.value.length > limitNum) 
	{
		limitField.value = limitField.value.substring(0, limitNum);
	} 
}