	function verify_form(form)
	{
		// onsubmit =  "return verify_form(this)" 
		var index=0;
		var html = "";
		for(index=0;index<form.length;++index)
		{
			name =form.elements[index].name;
			val = form.elements[index].value;
			compulsory = name.charAt(name.length-2);
			datatyp = name.charAt(name.length-1);
			itm = form.elements[index];
			if(!verify_comma(form.elements[index].value)){
				//alert("Comma Character is not allowed Check field"+form.elements[index].name);	
				correctString(itm);
				//alert(itm.value);
				//return false;
			}
				
				//first to check the cumpulsory field
				if(compulsory=='c')
				{
					if(!verify_length(val))
					{
						//html= html+"Error: Please fill field Focused ";
						html = CheckObject(name);
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+name;
						//html= html+"'";
						alert(html);
						itm.focus();
						return false;
					}
				}
				//for string and cumpulsory field
				if(datatyp=='s' && compulsory=='c')
				{
					if(!verify_string(val))
					{
						html = CheckObject(name+"_string");
						//html= html+"Error: Please fill focused field with numeric data";
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+"With Numeric data..";
						if (html != "true")
						{
							document.getElementById(name).value = "";
							alert (html);
							itm.focus();
							return false;
						}
					}
				}
				//for number and cumpulsory field
				if(datatyp=='n' && compulsory=='c')
				{
					if(!CheckNumber(val))
					{
						html = CheckObject(name+"_number");
						document.getElementById(name).value = "";
						//html= html+"Error: Please fill focused field with numeric data";
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+"With Numeric data..";
						alert (html);
						itm.focus();
						return false;
					}
				}
				//For Number and optional field
				if(datatyp=='n' && compulsory=='o')
				{
					if(verify_length(val))
					{
						if(!verify_number(val))
						{
							html = CheckObject(name+"_number");
							document.getElementById(name).value = "";
							//html= html+"Error: Please fill focused field with numeric data";
							//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
							//html= html+"With Numeric data..\n";
							alert (html);
							itm.focus();
							return false;
						}
					}
				}
				//For email and cumpulsory field
				if(datatyp=='e' && compulsory=='c')
				{
					if(!verify_email(val))
					{
						html = CheckObject(name+"_email");
						document.getElementById(name).value = "";
						//html= html+"Error: Please fill focused field with valid email address";
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+"With Valid email format..\n";
						alert (html);
						itm.focus();
						return false;
					}
				}
				//For email and cumpulsory field
				if(datatyp=='e' && compulsory=='o')
				{
					if(verify_length(val))
					{
						if(!verify_email(val))
						{
							html= html+"Error: Please fill focused field with valid email address";
							//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
							//html= html+"With Valid email format..\n";
							alert (html);
							itm.focus();
							return false;
						}
					}
			
				}
		
				//For date and cumpulsory field
				if(datatyp=='d' && compulsory=='c')
				{
				
					if(!verify_date(val))
					{
						html= html+"Error : Please fill field Focused with Valid date in YYYYMMDD format";
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+"With Valid date format..\n";
						alert (html);
						itm.focus();
						return false;
					}
				
				}
				//For date and cumpulsory field
				if(datatyp=='d' && compulsory=='o')
				{
					if(verify_length(val))
					{
						if(!verify_date(val))
						{
							html= html+"Error : Please fill field Focused with Valid date in YYYYMMDD format";
							//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
							//html= html+"With Valid Date format..\n";
							alert (html);
							itm.focus();
							return false;
						}
					}
				
				}
				//For time and cumpulsory field
				if(datatyp=='t' && compulsory=='c')
				{
					if(!verify_time(val))
					{
						html= html+"Error : Please fill field Focused with Valid Time Format HHMMSS";
						//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
						//html= html+"With Valid time format..\n";
						alert (html);
						itm.focus();
						return false;
					}
					
				}
				//For time and cumpulsory field
				if(datatyp=='t' && compulsory=='o')
				{
					if(verify_length(val))
					{
						if(!verify_time(val))
						{
							html= html+"Error : Please fill field Focused with Valid Time Format HHMMSS";
							//html= html+write_string_removing_underscore(name.substring(0,name.length-2));
							//html= html+"With Valid time format..\n";
							alert (html);
							itm.focus();
							return false;
						}
					}
				}
	
		/////////////////////////////////end of checks //////////////////////////
		}
		return true;
	}
	function verify_length(vals)
	{
		var val=vals.length;
		if(val==0||val==null)
			return false;
		return true;
	}
	function verify_number(val)
	{
		var str = val;
		var dotflag=false;
		for(var i=0;i<str.length;++i)
		{
			ch=str.charAt(i);
			if(dotflag && ch=='.')
			{return false;}
			if(ch=='.')
			{  dotflag=true;continue;}
			else
			if(!(ch=='0' || ch=='1' || ch=='2' || ch=='3' || ch=='4' || ch=='5' || ch=='6' || ch=='7' || ch=='8' || ch=='9' || ch=='+' )) 
			{return false;}
		}
		return true;
	}
	function verify_string(val)
	{
		var str = val;
		var dotflag=false;
		for(var i=0;i<str.length;++i)
		{
			ch=str.charCodeAt(i);
			if(dotflag && ch=='.')
			{return false;}
			if(ch=='.')
			{  dotflag=true;continue;}
			else
			if(!((ch >= '65' && ch <= '90') || (ch >= '97' && ch <= '122') || (ch == '32') ))
			{return false;}
		}
		return true;
	}
	function write_string_removing_underscore(str)
	{
		var stringtemp = "";
		for(var i=0;i<str.length;++i)
		{
			ch=str.charAt(i);
				if(ch!='_')
				{stringtemp = stringtemp+ch;}
				else
				stringtemp = stringtemp+" ";
		}
		return stringtemp;
	}
	
	function verify_comma(str)
	{
		if(str.indexOf("'")==-1)return true;
		return false;		
	}
	
	function verify_email(email)
	{
		var firstchar=email.charAt(0);	
		if((firstchar>='A' && firstchar<='Z')||(firstchar>='a' && firstchar<='z'))
		{
			if( (email.indexOf('@')!=-1) && (email.indexOf('.')!=-1) )
				return true;
			else
				return false;
		}
		else
			return false;
	}	
				
	function verify_date(date)
	{
		if(date.length==8)
		{
			if(!isNaN(date))
			{	
				var year=date.substring(0,4);
				var month=date.substring(4,6);
				var day=date.substring(6,8);
				if( (year>=1900 && year<=3050)  && (month>=1 && month<=12) )
				{			
					if(month==2)
					{
						if(year%4==0 && day==29)
						{
							return true;
						}
						else if(day>=1 && day<=28 && year%4!=0)
						{
						
							return true;								
							
						}
					}
	
					if(month==4||month==6||month==9||month==11)
					{
						if(day>=1 && day<=30)
						{
							return true;
						}
						else
						{
							return false;
						}
					}

					if(day>=1 && day<=31)
					{
						return true;
					}
				}	
			
			}
			return false;
		}
		return false;
	}	


	function verify_time(time)
	{
	
		if(time.length==6)
		{
			if(!isNaN(time))
			{
				var hour=time.substring(0,2);
				var minute=time.substring(2,4);
				var second=time.substring(4,6);
			
				if( (hour>=0 && hour<=23) && (minute>=0 && minute<=59) && (second>=0 && second<=59) )
				{
					return true;
				}			
			}
		}
		return false;	
	}
	
	function correctString(itm)
	{
		var valtemp=itm.value;
		var stringtemp = "";
		for(var i=0;i<valtemp.length;++i)
		{
			ch=valtemp.charAt(i);
			tstr = ch+"";
			if(tstr!="'")
			{stringtemp = stringtemp+ch;}
			else
			stringtemp = stringtemp+"''";
			
		}
		itm.value=stringtemp;
	}
	function CheckObject(obj){
		switch (obj){
			case "name_cs":
			return "Please Enter Your Name.";
			break;
			case "name_cs_string":
			return "Please Enter Alphabets for Name.";
			break;
			case "email_ce":
			return "Please Enter Your e-mail address.";
			break;
			case "email_ce_email":
			return "Please Enter valid e-mail address.";
			break;
			case "telephone_cn":
			return "Please Enter Telephone Number.";
			break;
			case "telephone_cn_number":
			return "Please Enter valid Telephone Number.";
			break;
			case "mobile telephone number_cn":
			return "Please Enter Mobile Number.";
			break;
			case "mobile telephone number_cn_number":
			return "Please Enter valid Mobile Number.";
			break;
			case "subjectofemail_cs":
			return "Please Enter Subject.";
			break;
			case "message_cs":
			return "Please Enter Message or Request.";
			break;
			default :
			return "true";
		}
	}

//Internation Phone Number Validation Code

// 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;

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;
    }
    // All characters are numbers.
    return true;
}

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;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function CheckNumber(val){
	if (checkInternationalPhone(val)==false){
		return false
	}
	return true
}