function GenValidation(str,output,divname)
	{
		if(str.value == "")
		{
			var res=output;
			//alert(res);
			document.getElementById(divname).innerHTML = res;
			document.getElementById(divname).style.display = "block";
			return 0;
		}
		else
		{
			allSpaces = 0;
			k = str.value;
			for (var i=0;i<k.length;i++)
			{			
				if(k.charAt(i) == " ")
					allSpaces++;
			}		
			
			if(allSpaces == k.length)
			{	
				var res=output;
				document.getElementById(divname).innerHTML = res;
				document.getElementById(divname).style.display = "block";
				return 0;
			}
			
		}
    }

function urlValidation(str,output,divname)
{
	   var totalstring=str.value;
	   var l=totalstring.length;
	   var t= totalstring.substring(l-3,l-2);
	   var f= totalstring.substring(l-4,l-3);
	   var enddot= totalstring.substring(l,l-1);
	   if(t!='.' && f!='.' || enddot=='.')
	   {
			var res= output;
			document.getElementById(divname).innerHTML = res;
			document.getElementById(divname).style.display = "block";
			return 0;
	   }
}

function textOnly(Val,output,divname)
	{
		var alp = "çgösüçgösüŞÇĞ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="No special characters \nValid entries are [a-z][A-Z][ space ]";
				var resstr=output;
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = "block";
				return 0;
			}
			
		} // closing the for loop
	} // closing the function textOnly()

function invalidChars(Val)
	{
		var alp = "*";
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			
			if (alp.indexOf(temp)!=-1)
			{
				
				//var resstr="No special characters \nValid entries are [a-z][A-Z][ space ]";
				return 0;
			}
		} // closing the for loop
	} // closing the function textOnly()

	function textOnlyjs(Val)
	{
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="No special characters \nValid entries are [a-z][A-Z][ space ]";
				//alert(resstr);
				return 0;
			}
			
		} // closing the for loop
	} // closing the function textOnly()
function ALPHANUM3(Val,MESG,divname) {
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="Please enter a valid "+MESG+" [A-Z] [0-9] Allowed";
				var resstr=MESG;
				//alert(resstr);return false;
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = "block";
				return 0;
			}
			//return false;
		} // closing the for loop
	
	}
	 // closing the function SplCharacters()
function validateintegers(Val,MESG,divname) {
	
		var alp = "1234567890 ";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				var resstr="Please enter a valid "+MESG+" [0-9] Allowed";
				Val.focus();
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = 'block';
				return 0;
			}
		} // closing the for loop
	
	}
function validateonlyintegers(Val,MESG,divname) {
	
		var alp = "1234567890";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="Please enter a valid "+MESG+" [0-9] Allowed";
				var resstr=MESG;
				Val.focus();
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = 'block';
				return 0;
			}
		} // closing the for loop
	
	}	
function validateonlymobile(Val,MESG,divname) {
	
		var alp = "1234567890-";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="Please enter a valid "+MESG+" [0-9] Allowed";
				var resstr=MESG;
				Val.focus();
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = 'block';
				return 0;
			}
		} // closing the for loop
	
	}	

function validateonlyphone(Val,MESG,divname) {
	
		var alp = "1234567890-";
	
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				//var resstr="Please enter a valid "+MESG+" [0-9] Allowed";
				var resstr=MESG;
				Val.focus();
				document.getElementById(divname).innerHTML = resstr;
				document.getElementById(divname).style.display = 'block';
				return 0;
			}
		} // closing the for loop
	
	}	


// E-mail Validations
	
	function EmailValidation(Element,output,divname)
	{
	
		Flag  = 1;
		count = 0;
	
		/*var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.-";
		
		if(Element.value.length > 0)
		{
			for (var i=0; i<Element.value.length; i++)
			{
				temp = Element.value.substring(i, i+1);
	
				if (alp.indexOf(temp) == -1)
				{
					Flag = 0;
				}
			} // closing the for loop
		}
		else
		{
			Flag = 0;
		}
	
		for(var i=0; i <= Element.value.length; i++)
		{
			if(Element.value.charAt(0)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(Element.value.length-1)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(i)=='@') 
			{
				count = count + 1;

				if(count>1)
				{
					Flag = 0;
					break;
				}
			  
				if((Element.value.charAt(i-1)=='.') || (Element.value.charAt(i+1)=='.'))
				{
					Flag = 0;
					break;
				}
			}
			if(Element.value.indexOf('@')==-1)
			{
				Flag = 0;		    	
				break;
			}
			if(Element.value.charAt(0)=='.')
			{
				Flag = 0;
				break;
			}
			if(Element.value.indexOf('.')==-1)
			{
				Flag = 0;		    	
				break;
			}
		  } //closing the for loop
		
		if(Element.value.charAt(Element.value.length-1) == '.')
			Flag = 0;*/
		
		/*Above code is commented by Chaitanya and added following on Nov.24*/
		if(Element.value != "")
		{
				var reg = /^[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+(\.[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+)*@(([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9]+)?){1,63}\.)+([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9]+)?){2,63}$/;
				if(!reg.test( Element.value ))
					Flag = 0;
				else
					Flag = 1;		
		}
		else
			Flag = 0;
			
		if(Flag == "0")
		{
			//resstr="Please enter a valid Email Address";
			resstr = output;
			Element.focus();
			document.getElementById(divname).innerHTML = resstr;
			return 0;
		}	
		else
			return 1;
	}
	
	function EmailValidationjs(Element)
	{
	
		Flag  = 1;
		count = 0;
	
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.-";
		
		if(Element.value.length > 0)
		{
			for (var i=0; i<Element.value.length; i++)
			{
				temp = Element.value.substring(i, i+1);
				if (alp.indexOf(temp) == -1)
				{
					Flag = 0;
				}
			} // closing the for loop
		}
		else
		{
			Flag = 0;
		}
	
		for(var i=0; i <= Element.value.length; i++)
		{
				if(Element.value.charAt(0)=='@')
				{
					Flag = 0;
					break;
				}
				if(Element.value.charAt(Element.value.length-1)=='@')
				{
					Flag = 0;
					break;
				}
				if(Element.value.charAt(i)=='@') 
				{
					count = count + 1;
					if(count>1)
					{
						Flag = 0;
						break;
					}
					if((Element.value.charAt(i-1)=='.') || (Element.value.charAt(i+1)=='.'))
					{
						Flag = 0;
						break;
					}
				}
				if(Element.value.indexOf('@')==-1)
				{
					Flag = 0;		    	
					break;
				}
				if(Element.value.charAt(0)=='.')
				{
					Flag = 0;
					break;
				}
				if(Element.value.indexOf('.')==-1)
				{
					Flag = 0;		    	
					break;
				}
		  } //closing the for loop
		
		if(Element.value.charAt(Element.value.length-1) == '.')
			Flag = 0;
		
		/*if(Element.value != "")
		{
				var reg = /^[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+(\.[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+)*@(([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9]+)?){1,63}\.)+([a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9]+)?){2,63}$/;
				if(!reg.test( Element.value ))
					Flag = 0;
				else
					Flag = 1;		
		}
		else
			Flag = 0;*/

		if(Flag == "0")
		{
			//resstr="Please enter a valid Email Address";
			//resstr = output;
			//Element.focus();
			//document.getElementById(divname).innerHTML = resstr;
			return 0;
		}	
		else
			return 1;
	}

function EmailValidationContest(Element,error_msg)
	{
		var stremail=Element.value;
    	var emailchar=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,3}(?:\.[a-z]{2})?)$/;
	 	// alert(emailchar.test(stremail));
      	if(emailchar.test(stremail))
		  return true;
		else 
    	{
			var str = error_msg;
			alert(str);
			Element.focus();
			return false;
    	}
}
function EmailValidationContestdiv(Element,output,divname)
	{
		var stremail=Element.value;
		//alert(stremail);
      var emailchar=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,3}(?:\.[a-z]{2})?)$/;
	 // alert(emailchar.test(stremail));
      if(emailchar.test(stremail))
      {
		  return true;
       }
	      else 
    {
			document.getElementById(divname).innerHTML = output;
			return false;
    }
}
function checkInCharSet(txt, charset)
	{
		var b = true;
	
		for(i = 0; i < txt.length; i++ )
		{
			if( charset.indexOf(txt.charAt(i)) == -1 )
			{
				b = false;
			}
		}
	
		return b;
	}
	
	