var InvalidPhoneMail = 'The information provided by you does not appear to be correct.\r\nPlease verify your information and resubmit the form to proceed.\r\n\r\nWe apologize for the inconvenience!'; 
var msgBlank= " cannot be less than 5 char\'s or blank!";
var msgB= " can not be blank!";
var msgInvalidChar= " has some invalid characters!";
var msgReqChar= " requires chars only!";
var msgTotal = " Total characters in Firstname and Lastname should be minimum 5 and maximum 40!";
var msgDigit = " should be in digits only!";
var msgChar = " should be in char!";
var msgEmailTotal = " Total characters in email  should be minimum 7 and maximum 64!";
var msgCommentTotal = " Total characters in comment  should be more than 5 characters!";
var msgEmailInvalid = " missing some valid characters or it is in upper case!";
var msgSelect = " please select";
var msgLength = " number can not be blank and make sure that it is not more than 20 digits!";
var msgPhone=" entry's first character should be numeric!";
var msgEmailCompare = " Please verify your email address and submit again.";


//-------------------------------------------------------------------------------------
//-- VALIDATE - all elements of the form ----------------------------------------------
//-------------------------------------------------------------------------------------
function FrontPage_Form1_Validator(theForm){
	var flen=0;
	var llen=0;
	var qstate=false;
	var email="";
	var verifyemail="";

/*
	if ( ((theForm.firstname.value==theForm.lastname.value) && (theForm.firstname.value==theForm.company.value) && (theForm.lastname.value==theForm.company.value) ) ||		( (theForm.name.value==theForm.lastname.value) && (theForm.name.value==theForm.company.value) && (theForm.lastname.value==theForm.company.value)) )
	{
		alert(InvalidPhoneMail );
		theForm.lastname.focus();
		return false;
	}													


*/
	//--------------------------------------------------------------------
	//-- For loop - START for all elements -------------------------------
	//--------------------------------------------------------------------
	for(j=0;j<theForm.elements.length;j++){ 

		//-- ---------------------------------------------------------
		//-- NULL Validation for text field - Start ------------------
		//-- ---------------------------------------------------------
		if (theForm.elements[j].type=="text"){
			if(theForm.elements[j].name== "folder_name"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Please make sure that folder name has been entered.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}
			
            //-- firstname  - Validating values for 5 char ---
            if(theForm.elements[j].name == "firstname"){
	            var sText=trim(theForm.elements[j].value)
	            flen=sText.length;
	            if (flen==0){
		            alert('Invalid Input, Name can not be blank.')
		            theForm.elements[j].focus()
		            theForm.elements[j].select()
		            return false;
	            }
	            else{
		            if(checkcharacters(sText)==false){
			            alert('Invalid Input, Name has some invalid characters.')
			            theForm.elements[j].focus()
			            theForm.elements[j].select()						
			            return false;
		            }
                }
            }
			
			//-- company ----------------------------------------------------
			if(theForm.elements[j].name == "company"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Company Name can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else{
			   		if(checkSQLServerChar(sVal)==false){
						alert('Invalid Input, Single/double quotes not allowed.');
						theForm.elements[j].focus()
						theForm.elements[j].select()
		        		return false;
			    	}
				}				
							//-- Validating Company Name total length ----------------
			    if(flen>64 ){
				    alert("Invalid Input, Company Name cannot exceed more than 64 char\'s.")
				    theForm.elements[j].focus()
				    theForm.elements[j].select()				
				    return false;
				}
			}
			
			//-- email ------------------------------------------------------
			if(theForm.elements[j].name == "email" || theForm.elements[j].name == "email1"){
				var status=checkChars_Email(trim(theForm.elements[j].value));			
				if(status!=true){
					alert(status);
					theForm.elements[j].focus();
					theForm.elements[j].select();
					return false;
				}
			}
			if(theForm.elements[j].name == "email" || theForm.elements[j].name == "email1")
			{
				if(validate(trim(theForm.elements[j].value))==false)
				{
					alert('Email has some invalid characters!');
					theForm.elements[j].focus();
					theForm.elements[j].select();
					return false;					
				}
			}

			//-- email ------------------------------------------------------
            var offensive = ValidateOffensive(theForm.email.value);
            if(offensive !=true)
            {
	            alert(InvalidPhoneMail);
	            theForm.email.focus();
	            theForm.email.select();
   	            return false;
            }
			
			//-- Name  - Validating values for 5 char ---
			if(theForm.elements[j].name== "name"){
	     		var sText=trim(theForm.elements[j].value)
				flen=sText.length;
				if (flen==0){
					alert('Invalid Input, Name can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else{
					if(checkcharacters(sText)==false){
						alert('Invalid Input, Name has some invalid characters.')
						theForm.elements[j].focus()
						theForm.elements[j].select()
						return false;
					}
                }
			}  

		//-- Validate Country Canada and US with State Region -------------------------------------
//		var test=-1;
//		if(theForm.elements[j].name == "address2")
//		{
//			test=j;
//		}
//		
//		if(test==j)
//		{ 
		if(document.getElementById("country").options[document.getElementById("country").selectedIndex].value == "United States")
		{
			if(document.getElementById("USState_id").options[document.getElementById("USState_id").selectedIndex].value == "SELECT")
			{
				alert("Please select state of United State.");
				document.getElementById("USState_id").focus();
				return false;
			}
		}
		else if(document.getElementById("country").options[document.getElementById("country").selectedIndex].value == "Canada")
		{
			if(document.getElementById("CanadaState_id").options[document.getElementById("CanadaState_id").selectedIndex].value == "SELECT")
			{
				alert("Please select state of Canada.");
				document.getElementById("CanadaState_id").focus();
				return false;
			}
		}
//		}


  
	
			//-- lasttname --------------------------------------------
			if(theForm.elements[j].name== "lastname"){
				var sText=trim(theForm.elements[j].value)
				llen=sText.length;
				if (llen==0){
					alert('Invalid Input, Last Name can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else{
					if(checkcharacters(sText)==false){
						alert('Invalid Input, Last Name has some invalid characters.')
						theForm.elements[j].focus()
						theForm.elements[j].select()						
						return false;
					}
				}
							//-- Validating firstname+lastname total length ----------------
				if((flen+llen)>96 ){
					alert("Invalid Input, First and Last Name together cannot exceed more than 96 char\'s.")
					theForm.elements[j].focus()
					theForm.elements[j].select()				
					return false;
				}
			}


			//-- serialno --------------------------------------------------
			if(theForm.elements[j].name == "serialno"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){			
					alert('Invalid Input, Serial Number can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}

			//-- subscriptionno ---------------------------------------------
			if(theForm.elements[j].name == "subscription_no"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Subscription Number can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}

			

			//-----Address1 and Address2 For all Form accept NCP
			
			if((theForm.elements[j].name=="address1") || (theForm.elements[j].name=="address2") || (theForm.elements[j].name=="address2ncp")){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;
			   	if(checkSQLServerChar(sVal)==false)
					{
						alert('Invalid Input, Single/double quotes not allowed.');
						theForm.elements[j].focus()
						theForm.elements[j].select()
			        	return false;
			    	}
								//-- Validating Address1+Address2 total length ----------------
			if(flen>128 ){
				alert("Invalid Input, Address1 and Address2 together cannot exceed more than 128 char\'s.")
				theForm.elements[j].focus()
				theForm.elements[j].select()				
				return false;
			}
					
			}
			//-- Address 1 NCP ----------------------------------------------------
			if(theForm.elements[j].name == "address1ncp"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Address1 can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}

			//-----City For all Form accept NCP
			
			if(theForm.elements[j].name=="city"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;
			   	if(checkSQLServerChar(sVal)==false)
					{
						alert('Invalid Input, Single/double quotes not allowed.');
						theForm.elements[j].focus()
						theForm.elements[j].select()
			        	return false;
			    	}
								
			//-- Validating City total length ----------------
				if(flen>64 )
					{
						alert("Invalid Input, City cannot exceed more than 64 char\'s.")
						theForm.elements[j].focus()
						theForm.elements[j].select()				
						return false;
					}
			
			}

			//-- City NCP ----------------------------------------------------
			if(theForm.elements[j].name == "cityncp"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, City can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}
			
			//-----State For all Form accept NCP
			
			if(theForm.elements[j].name=="state"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;
			   	if(checkSQLServerChar(sVal)==false)
					{
						alert('Invalid Input, Single/double quotes not allowed.');
						theForm.elements[j].focus()
						theForm.elements[j].select()
			        	return false;
			    	}
			
			//-- Validating State total length ----------------
				if((flen)>64 )
					{
						alert("Invalid Input, State cannot exceed more than 64 char\'s.")
						theForm.elements[j].focus()
						theForm.elements[j].select()				
						return false;
					}
					
			}			

			//-- State NCP ----------------------------------------------------
			if(theForm.elements[j].name == "statencp"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, State can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}				
			}

			//-----Zip/Postal Code For all Form accept NCP
			if(theForm.elements[j].name=="zip"){
				if (checkChars_numbers(theForm.elements[j].value,theForm.elements[j])==false)
					return false;
			}
			
			//-- Zip NCP ----------------------------------------------------
			if(theForm.elements[j].name == "zipncp"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Zip/Postal Code can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
					if (checkChars_numbers(theForm.elements[j].value,theForm.elements[j])==false)
						return false;
				}				
			}

			//-- country ----------------------------------------------------
			//if(theForm.elements[j].name== "country"){
			//	var country=trim(theForm.elements[j].value)
			//	clen=country.length;
			//	if (clen==0){
			//		alert('Invalid Input, Country can not be blank.')
			//		theForm.elements[j].focus()
			//		theForm.elements[j].select()
			//		return false;
			//	}
			//	else{
			//		if(checkcharacters(country)==false){
			//			alert('Invalid Input, Country has some invalid characters.')
			//			theForm.elements[j].focus()
			//			theForm.elements[j].select()
			//			return false;
			//		}
			//	}
			//}  

			//-- products ---------------------------------------------------
			if(theForm.elements[j].name == "products"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Products can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
					if (checkChars_numbers(theForm.elements[j].value,theForm.elements[j])==false)
						return false;
				}
			}

			//-- version ----------------------------------------------------
			if(theForm.elements[j].name == "version"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Version can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
					if (checkChars_numbers(theForm.elements[j].value,theForm.elements[j])==false)
						return false;
				}
			}

			//-- hostapp ----------------------------------------------------
			if(theForm.elements[j].name == "hostapp"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, Host Application can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
			   		if(checkSQLServerChar(sVal)==false)
						{
							alert('Invalid Input, Single/double quotes not allowed.');
							theForm.elements[j].focus()
							theForm.elements[j].select()
			        		return false;
			    		}
				}
			}

			//-- pctype -----------------------------------------------------
			if(theForm.elements[j].name == "pctype"){
	     		var sVal=trim(theForm.elements[j].value)
				flen=sVal.length;			
				if(flen==0){
					alert('Invalid Input, PC type can not be blank.')
					theForm.elements[j].focus()
					theForm.elements[j].select()
					return false;
				}
				else
				{
					if (checkChars_numbers(theForm.elements[j].value,theForm.elements[j])==false)
						return false;
				}
			}

			//-- phone ------------------------------------------------------
			if(theForm.elements[j].name == "phone"){
				if (checkChars_Phone(trim(theForm.elements[j].value),theForm.elements[j])==false)
				return false;
			}
	
			

		}//-- NULL Validation - Text field - end --------------------------------


		//-- Compare email and veryfy email -------------------------------------
		if (trim(theForm.email.value.toLowerCase()) !== trim(theForm.verifyemail.value.toLowerCase())){
			alert(msgEmailCompare);
			theForm.verifyemail.focus();
			theForm.verifyemail.select();
			return false;
		}

		//-- NULL Validation for country drop down ------------------------------
		//if(theForm.elements[j].name == "country"){
		//	if(theForm.elements[j].options.selectedIndex==0){
		//		alert("Invalid Input, please select country name."); 			
		//		theForm.elements[j].focus();
		//		return false;
		//	}
		//}

		//-- NULL Validation for heard from -------------------------------------
/*
		if(theForm.elements[j].name == "heard_from"){
			if(theForm.elements[j].options.selectedIndex==0){
				alert("please select " + theForm.elements[j].name  ); 			
				theForm.elements[j].focus();
				return false;
			}
		}
*/	
		//--------validation start for comments---------------------------------

		if(theForm.elements[j].name == "comment")
		{
	     		var sVal=trim(theForm.elements[j].value)
			flen=sVal.length;			

			if(flen != 0)
			{
		   	//	if(checkSQLServerChar(sVal)==false)
			//	{
			//		alert('Invalid Input, Single/double quotes not allowed.');
			//		theForm.elements[j].focus();
			//		theForm.elements[j].select();
		    //    		return false;
		    //		}

				if(flen>1024){
					alert('Invalid Input, Comments cannot be more than 1024 Characters.')
					theForm.elements[j].focus();
					theForm.elements[j].select();
					return false;
				}

				if(flen<5){
					alert("Invalid Input, Total characters in comment should be more than 5 characters.");
					theForm.elements[j].focus();
					theForm.elements[j].select();
					return false;
				}
			}
		}
	}//-- End of for loop ----------------------------------------------------------		

	SetCookies(theForm);
	return true;

}//-- End of function - FrontPage_Form1_Validator(theForm) ------------------------------		


//-----------------------------------------------------------
//-- Function ltrim - to remove left space ------------------
//-----------------------------------------------------------
function ltrim ( s ){
	return s.replace( /^\s*/, "" )
}

//-----------------------------------------------------------
//-- Function rtrim - to remove Right space -----------------
//-----------------------------------------------------------
function rtrim ( s ){
	return s.replace( /\s*$/, "" );
}

//-----------------------------------------------------------
//-- Funtion trim - to remove space both sides --------------
//-----------------------------------------------------------
function trim ( s ){
	return rtrim(ltrim(s));
}

//-------------------------------------------------------------------------------------
//-- Function to validate email address -------------------------------------------
//-------------------------------------------------------------------------------------
function validate(strEmail)
{
	validRegExp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	if (strEmail.search(validRegExp) == -1)
	{	
		return false;
	}
	return true;
} 
//-----------------------------------------------------------
//-- Funtion - to Validate characters only ------------------
//-----------------------------------------------------------
function checkcharacters(sText) 
	{	
	var validDigits = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ- ";
	var cch = sText.length;
		
	for (var i = 0; i < cch; i++)
	{
		ch = sText.charAt(i);
		if (validDigits.indexOf(ch)<0)
			return false;
	}	
	return true;	
}
//-------------------------------------------------------------------------------------
//-- Function to check alphanumeric values - Phone ------------------------------------
//-------------------------------------------------------------------------------------
	function checkChars_Phone(sText,ele)
	 {	
		//var validChars = ")(-0123456789";
		var validChars = ")(+#-.,0123456789";
		var validChars = validChars +" ";
		var cch = sText.length;
		var state=true;	

		if(cch==0)
			{
			alert("Invalid Input, " + ele.name + ' number cannot be blank.');
			ele.focus();
			ele.select();
			return false;
			}
		if(cch<5)
			{
			alert("Invalid Input, " + ele.name + ' number cannot be less than 5 characters.');
			ele.focus();
			ele.select();
			return false;
			}

		if(ValidatePhone(sText)==false)
		{
			alert(InvalidPhoneMail);
			ele.focus();
			return false;
		}

		for (var i = 0; i < cch; i++)
		{
			ch = sText.charAt(i);
			//alert(ch);
						
			if (validChars.indexOf(ch)==-1)
				{
				state=false;
				break		
				}
		}
		if (state==false)
			{
			alert("Invalid Input, " + ele.name + ' has some invalid characters.');
			ele.focus();
			ele.select();
 		    return false;
			}
		else
			return true;

	 } // function ends here



//-------------------------------------------------------------------------------------
//-- Function to check alphanumeric values --------------------------------------------
//-------------------------------------------------------------------------------------
function checkChars_numbers(sText,ele){	
	var validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.- ";
	var cch = sText.length;
	var state=true;	

	for (var i = 0; i < cch; i++){
		ch = sText.charAt(i);
		if (validChars.indexOf(ch)==-1){
			state=false;
			break		
		}				
	}
	if (state==false){
		  message(msgInvalidChar,ele)
		  return false;
	}
	else{
		return true;
	}
}//-- Function Ends - checkChars_numbers(sText,ele) -----------------------------------

//-------------------------------------------------------------------------------------
//-- Function to show messeges and set focus to passed controls -----------------------
//-------------------------------------------------------------------------------------
function message(msg,ele){
	alert( "Invalid Input, " + ele.name + msg);
	ele.focus();
	ele.select();
}

//-------------------------------------------------------------------------------------
//-- Function to check characters for email -------------------------------------------
//-------------------------------------------------------------------------------------
function checkChars_Email(sText){	
	var inValidChars = "'`,~@#$%^&*()_-+=|!\\//'.?<>;:"
	var x;
	if (sText == "")
		return "Invalid Input, E-mail cannot be blank.";
		
	if (sText.length < 6)
		return "Invalid Input, E-mail Address cannot contain less than 6 characters.";
	if (sText.indexOf(" ") != -1)
		return "Invalid Input, E-mail Address cannot contain space."
	if (sText.indexOf(".") == -1 || sText.indexOf("@") == -1)
		return "Invalid Input, Email Address cannot contains '@@ or ..'"
	if (sText.indexOf("@.") >0)
		return "Invalid Input, Email Address cannot contains '@.'"
	if (sText.indexOf("..") >0)
		return "Invalid Input, Email Address cannot contains '..'"
	if (sText.indexOf("@") <2)
		return "Invalid Input, E-mail Address requires atleast two char\'s before \'@\'!"
	if (sText.search("nobody") >=0 || sText.search("anyone") >=0)
		return "Invalid Input, E-mail Address cannot contain \'anyone\',\'nobody\'!"

	for(var i=0;i<inValidChars.length-1;i++){
		if (sText.indexOf(inValidChars.substring(i,i+1)) ==0)
			return "Invalid E-mail Address! Please re-enter."
	}

	var cntr=0;
	for(var i=0;i<sText.length;i++){
		if (sText.substring(i,i+1)=="@")
			cntr++;
	}

	if(cntr>1)
		return "Invalid E-mail Address! Please re-enter."	
		return true;
}

function checkSQLServerChar(sText)
	{	
	var validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=-~!@#$%^&*`()_+|:;<>?][}{,./ \\";
	var cch = sText.length;
	var state=true;	
	for (var i = 0; i < cch; i++)
	{
		ch = trim(sText.charAt(i));

		if (validChars.indexOf(ch)==-1)
			{
			state=false;
			break		
			}				
	}
	if (state==false)
		{
			return false;
		}
	else{return true;}
}

//-- Validate Offensive words in email -------------------------------------
function ValidateOffensive(userinput)
{
	var forbidden="ZZZZ "; 

	 //babes shit fuck damn porno cum cunt prick "
	 //+"pecker asshole pedophile man-boy man/boy dong twat pussy "
	 //+"monica spam ";

	/* As you add or subtract words from the forbidden list above,
	   be sure to change the nr_words variable below to reflect
	   the actual number of words in your forbidden string. */

	var nr_words=2;
	var bgn=0;
	var element_nr=0;
	var pos=0;
	var txt="";
	var wrd="";
	var state=true;	

	txt=userinput.toLowerCase();
	for (var i=0;i<nr_words;i++)
	{
		bgn=(i==0?0:bgn)
		pos=forbidden.indexOf(" ",bgn);
		wrd=forbidden.substring(bgn,pos);
		bgn=pos+1;
		while (txt.indexOf(wrd)>-1)
		{
			pos=txt.indexOf(wrd);
			state=false;
			break;
		}
	}

	if (state==false)
		return false;
	else
		return true;
}	

//--  Validate Function for Phone Numbers -------------------------------------
function ValidatePhone(txtphone)
{
	var phoneno="5555555|5551212|555-1212|555.1212|555 1212|";

	/* As you add or subtract words from the phoneno list above,
	   be sure to change the nr_phone variable below to reflect
	   the actual number of words in your phoneno string. */

	var nr_phone= 5;
	var bgn=0;
	var pos=0;
	var txt="";
	var wrd="";
	var state=true;
	txt=txtphone;
	for (var i=0; i<nr_phone; i++)
	{
		bgn=(i==0?0:bgn);
		pos=phoneno.indexOf("|",bgn);
		wrd=phoneno.substring(bgn,pos);
		bgn=pos+1;
		while(txt.indexOf(wrd)>-1)
		{
			pos=txt.indexOf(wrd);
			state=false;
			break;
		}
	}
	if (state==false)
	{
		return false;
	}
	else
		return true;
}