function theValidator(theForm,theControl,theMessage,theNumeric,theEMail,theURL,theConfirmPassword,thebadstuff,theinteger,thepercent,thesize,thedecimal,theimage,theempty,themin,themax,thecheckboxlength,thephoneno)
{
	// This function is used to validate that all text
	// fields in a given form contain some value
	//Split the controls + Messages + Numerics by comma ,
	
	var theMessages = new Array();
	var theNumerics = new Array();
	var theEMails = new Array();
	var theURLs = new Array();
	var theConfirmPasswords = new Array();
	theControls=theControl.split(",");
	theMessages=theMessage.split(",");
	theNumerics=theNumeric.split(",");
	theEMails=theEMail.split(",");
	theURLs=theURL.split(",");
	thebadstuffs=thebadstuff.split(",");
	theintegers=theinteger.split(",");
	thepercents=thepercent.split(",");
	thesizes=thesize.split(",");
	thedecimals=thedecimal.split(",");
	theimages=theimage.split(",");
	theemptys=theempty.split(",");
	themins=themin.split(",");
	themaxs=themax.split(",");
	thecheckboxlengths=thecheckboxlength.split(",");
	theConfirmPasswords=theConfirmPassword.split(",");
	thephonenos=thephoneno.split(",");
	//alert(thecheckboxlength);
	//alert(theForm.elements.length);
	//alert(theControl);
	for (var i=0; i < theForm.elements.length; i++){
		//alert("Type: " + theForm.elements[i].type);
		for(var counter=0;counter < theControls.length; counter++)
		{
			if (theForm.elements[i].name == theControls[counter])
			{
				if (theForm.elements[i].type == 'file')
				{
					//Blank value check
					if (trim(theForm.elements[i].value) == '' && theemptys[counter] == "Y" )
					{
//						alert(theMessages[counter] + " cannot be blank.");
						alert("Please select the "+theMessages[counter]+" to upload.");
						theForm.elements[i].focus();
						return false;	
					}
					else
					{
						
						if (theimages[counter] == "YG")
						{
							var s=theForm.elements[i].value;
						
							if (s!="")
							{
								array=s.split("\\");
								len=array.length;
								filename=array[len-1];
								array1=filename.split(".");
								if (array1.length == 1)
								{
									alert("Files with extensions .jpg, .jpeg, .jpe, .gif can only be uploaded.");
									theForm.elements[i].focus();
									return false;									
								}
//if(array1[1].toLowerCase()!="jpg" && array1[1].toLowerCase()!="jpeg" && array1[1].toLowerCase()!="gif" && array1[1].toLowerCase()!="png")
if(array1[1].toLowerCase()!="jpg" && array1[1].toLowerCase()!="jpeg" && array1[1].toLowerCase()!="jpe" && array1[1].toLowerCase()!="gif")
								{
									alert("Files with extensions .jpg, .jpeg, .jpe, .gif can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
							}
						}
if (theimages[counter] == "Y")
{
	
	var s=theForm.elements[i].value;
	if (s!="")
	{
		array=s.split("\\");
		len=array.length;
		filename=array[len-1];
		array1=filename.split(".");
		if (array1.length == 1)
		{
		alert("Files with extensions .jpg, .jpeg, .jpe, .gif can only be uploaded.");
		theForm.elements[i].focus();
		return false;									
		}
		if(array1[1].toLowerCase()!="jpg" && array1[1].toLowerCase()!="jpeg" && array1[1].toLowerCase()!="gif")
		{
			alert("Files with extensions .jpg, .jpeg, .jpe, .gif can only be uploaded.");
			theForm.elements[i].focus();
			return false;
		}
	}
// 	else
// 	{
// 		
// 		alert("Please upload the "+theMessages[counter]+".");
// 		theForm.elements[i].focus();
// 		return false;
// 	}
}
						
						if (theimages[counter] == "C")
						{
							var s=theForm.elements[i].value;
							if (s!="")
							{
								array=s.split("\\");
								len=array.length;
								filename=array[len-1];
								array1=filename.split(".");
								len1 = array1.length;
								len1 = len1-1;
								if (array1.length == 1)
								{
									alert("Files with extensions .txt can only be uploaded.");
									theForm.elements[i].focus();
									return false;									
								}
								if(array1[len1].toLowerCase()!="txt")
								{
									alert("Files with extensions .txt can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
							}
						}
						if (theimages[counter] == "YC")
						{
							var s=theForm.elements[i].value;
							if (s!="")
							{
								array=s.split("\\");
								len=array.length;
								filename=array[len-1];
								array1=filename.split(".");
								len1 = array1.length;
								len1 = len1-1;
								if (array1.length == 1)
								{
									alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf,.swf can only be uploaded.");
									theForm.elements[i].focus();
									return false;									
								}
								if(array1[len1].toLowerCase()!="jpg" && array1[len1].toLowerCase()!="jpeg" && array1[len1].toLowerCase()!="gif" && array1[len1].toLowerCase()!="swf" && array1[len1].toLowerCase()!="txt" && array1[len1].toLowerCase()!="doc" && array1[len1].toLowerCase()!="pdf")
								{
									alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
							}
						}
						if (theimages[counter] == "YCX")
						{
							var s=theForm.elements[i].value;
							if (s!="")
							{
								array=s.split("\\");
								len=array.length;
								filename=array[len-1];
								array1=filename.split(".");
								len1 = array1.length;
								len1 = len1-1;
								if (array1.length == 1)
								{
									alert("Files with extensions .txt, .doc, .xls, .pdf can only be uploaded.");
									theForm.elements[i].focus();
									return false;									
								}
								if(array1[len1].toLowerCase()!="txt" && array1[len1].toLowerCase()!="doc" && array1[len1].toLowerCase()!="xls" && array1[len1].toLowerCase()!="pdf")
								{
									alert("Files with extensions .txt, .doc, .xls, .pdf can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
							}
						}
						if (theimages[counter] == "YCW")
						{
							var s=theForm.elements[i].value;
							if (s!="")
							{
								array=s.split("\\");
								len=array.length;
								filename=array[len-1];
								array1=filename.split(".");
								len1 = array1.length;
								len1 = len1-1;
								if (array1.length == 1)
								{
									alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf,.xls,.csv,.odt can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
								if(array1[len1].toLowerCase()!="jpg" && array1[len1].toLowerCase()!="jpeg" && array1[len1].toLowerCase()!="gif" && array1[len1].toLowerCase()!="txt" && array1[len1].toLowerCase()!="doc" && array1[len1].toLowerCase()!="pdf" && array1[len1].toLowerCase()!="csv" && array1[len1].toLowerCase()!="xls" && array1[len1].toLowerCase()!="odt")
								{
									alert("Files with extensions .gif, .jpg, .jpeg, .txt, .doc, .pdf,.xls,.csv,.odt can only be uploaded.");
									theForm.elements[i].focus();
									return false;
								}
							}
						}
					}
				}
				if (theForm.elements[i].type == 'text'||theForm.elements[i].name == 'creditCardVerCode')
				{
					//Blank value check
					if (trim(theForm.elements[i].value) == '' && theemptys[counter] == "Y")
					{
//						alert(theMessages[counter] + " cannot be blank.");
						alert("Please enter the "+theMessages[counter]+".");
						theForm.elements[i].focus();
						return false;	
					}
					
					// integer value >=0
				/*	if (theEMails[counter] != "Y" && theURLs[counter] != "Y" && theNumerics[counter] != "Y")
					{
						chkstring = trim(theForm.elements[i].value);
						badStuff = "~`!@#$%^&*()=+|<>?;:/\"\\";
						for (x=0; x<badStuff.length; x++)
						{
							badCheck = badStuff.charAt(x);
							if (chkstring.indexOf(badCheck,0) != -1)
							{							
															
								alert(theMessages[counter]+" can not have special characters.");
								theForm.elements[i].focus();
								return false;
							}
						}
					}*/
					// Numeric value check
					if (trim(theForm.elements[i].value) != '' && theNumerics[counter] == "Y")
					{
						if(isNaN(trim(theForm.elements[i].value)))
						{
//							alert(theMessages[counter] + " should be numeric.");
							alert("Please enter numeric values for "+theMessages[counter]+".");
							theForm.elements[i].focus();
							return false;	
						}
						if(trim(theForm.elements[i].value)<= 0 )
						{
//							alert(theMessages[counter] + " should be greater than 0.");
							alert("Please enter "+theMessages[counter]+" greater than  0 (zero).");
							theForm.elements[i].focus();
							return false;	
						}					
					}
					if  (trim(theForm.elements[i].value) != '' && theintegers[counter] == "Y")
					{
							if(isNaN(trim(theForm.elements[i].value)))
								{
		//							alert(theMessages[counter] + " should be numeric.");
									alert("Please enter numeric values for "+theMessages[counter]+".");
									theForm.elements[i].focus();
									return false;	
								}
							if(parseInt(trim(theForm.elements[i].value))< 0 )
								{
								alert("Please enter "+theMessages[counter]+" greater than or equal to 0 (zero).");
								theForm.elements[i].focus();
								return false;
								}
					}
					
					// for bad stuff in password type
                     if ((trim(theForm.elements[i].value) != '' ) && (thebadstuffs[counter] != ""))
					{
						if (thebadstuffs[counter]==1)// for company name & '",.:()-_@#$
								badStuff = "`~!%^*()=+|<>?;/\\\[]{}";
							else if(thebadstuffs[counter]==2)
							badStuff="~`!@$%^&* #()=+|<>?;.':/\"\\-_[]{},";//for not a single bad stuff 
							else if(thebadstuffs[counter]==3)//price sequence only deci
								badStuff="~`!@$%^&* ()=+|<>?;':/\"\\-_[]{},";
							else if(thebadstuffs[counter]==4)
								badStuff=".~`#!@$%^&* ()=+|<>?;':/\"\\-_[]{},";
							else if(thebadstuffs[counter]==5)//productname
								badStuff=".`-~#!@$%^&*()=+|<>?;:/\"\\[]{},";
							else if(thebadstuffs[counter]==6)//User Name only under score 
								badStuff=".`-'~  #!@$%^&*()=+|<>?;:/\"\\[]{},";
							else if(thebadstuffs[counter]==7)//First/Last Name only ' come
								badStuff=".`-~#!@$%^&*_()=+|<>?;:/\"\\[]{},";
							else if(thebadstuffs[counter]==8)//for zip code
					badStuff="`'~#!@$%^&* _()=+|<>?;:/\"\\[]{},ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                            else if(thebadstuffs[counter]==9)
								badStuff="~`!@$%^&*#()=|<>?;.':/\"\\_[]{},";//only - and  space for a city 
							else if(thebadstuffs[counter]==10)// Name only ' space - come
								badStuff=".`~#!@$%^&*()=+|<>?;:/\"\\[]{},";
							
							else
								badStuff='"';
							chkstring = trim(theForm.elements[i].value);
							for (x=0; x<badStuff.length; x++)
							{
								badCheck = badStuff.charAt(x);
								if (chkstring.indexOf(badCheck,0) != -1)
								{							
									if(badStuff=='"')
									alert("Please replace double quotes with single quotes for "+theMessages[counter]+".");
									else
									alert(theMessages[counter]+" can not have special characters.");
									theForm.elements[i].focus();
									return false;
								}
							}
					}
					if (trim(theForm.elements[i].value) != '' && thepercents[counter] == 'Y')
					{			
								if (parseInt(theForm.elements[i].value)<0 || parseInt(theForm.elements[i].value)>100)
								{							
																
									alert(theMessages[counter]+" should have value between 0 to 100.");
									theForm.elements[i].focus();
									return false;
								}
					}
					
					if (trim(theForm.elements[i].value) != '' && thesizes[counter] != "")
					{
								if (trim(theForm.elements[i].value).length>thesizes[counter])
								{							
																
//									alert(theMessages[counter]+" cannot have more than "+thesizes[counter]+" characters.");	
									alert("Maximum characters allowed are "+ thesizes[counter] +". Entered are "+ theForm.elements[i].value.length +" characters.");	
									theForm.elements[i].focus();
									return false;
								}
					}
					
					if (trim(theForm.elements[i].value) != '' && thedecimals[counter] == "Y")
					{
								var str=theForm.elements[i].value;
									 if (str.indexOf('.')!=-1)
										{
										   alert("No decimals allowed for "+theMessages[counter]+".");
										    theForm.elements[i].focus();
											return false;
										}
					}
					/*if (trim(theForm.elements[i].value) != '' && thephonenos[counter] == "Y")
					{
						var regexp=/^(\d{3}-\d{3}-\d{4}|\d{10}|\(\d{3}\)\d{3}-\d{4}|\d{6}|\d{7}|\d{8})$/;
						x = trim(theForm.elements[i].value);
						if(!(regexp.test(x)))
						{
							var msg = "";
							msg = "Please enter the correct "+theMessages[counter];
							msg = msg +  "\n The correct forms are : ";
							msg = msg + "\n xxx-xxx-xxxx";
							msg = msg + "\n (xxx)xxx-xxxx";
							msg = msg + "\n xxxxxxxxxx (10 digited Mobile no)";
							msg = msg + "\n xxxxxx (6 digits no)";
							msg = msg + "\n xxxxxxx (7 digits no)";
							msg = msg + "\n xxxxxxxx (8 digits no)";
							alert(msg);
						    theForm.elements[i].focus();
							return false;
						}
					}*/
					// Email value check
					if (trim(theForm.elements[i].value) != '' && theEMails[counter] == "Y")
					{
						if(!emailcheck(theForm.elements[i],"Please enter valid email address."))  return false;
						//{
						//	alert("Invalid Email Address\n Should be user@domain.com");
						//	theForm.elements[i].focus();
							//return false;	
						//}
					}
					// URL value check
					if (trim(theForm.elements[i].value) != '' && theURLs[counter] == "Y")
					{
						if(!validateURL(trim(theForm.elements[i].value)))
						{
//							alert(" Invalid URL \n Should be http://www.domain.com");
							alert("Please enter valid url. \n http://www.domain.com");
							theForm.elements[i].focus();
							return false;	
						}
					}
					
					if (trim(theForm.elements[i].value) !='' && themins[counter]!='' && themaxs[counter]!='')
					{
						if(parseInt(theForm.elements[i].value)<themins[counter] || parseInt(theForm.elements[i].value)>themaxs[counter])
						{
							alert("Please enter value for "+theMessages[counter]+" between "+themins[counter]+" and "+themaxs[counter]+".");
							theForm.elements[i].focus();
							return false;
						}
					}
					if (trim(theForm.elements[i].value) !='' && themins[counter]!='' && themaxs[counter]=='')
					{
						if((theForm.elements[i].value.length)<themins[counter])
						{
							alert("Please enter valid "+theMessages[counter]+".");
							theForm.elements[i].focus();
							return false;
						}
					}
					if (trim(theForm.elements[i].value) !='' && themaxs[counter]!='')
					{
						if( parseInt(theForm.elements[i].value)>themaxs[counter])
						{
							alert("Please enter value for "+theMessages[counter]+" not more than "+themaxs[counter]+".");
							theForm.elements[i].focus();
							return false;
						}
					}
				
				}
				// Password Validation
				if (theForm.elements[i].type == 'password' && theConfirmPasswords[counter]!="Y" && theForm.elements[i].name!="creditCardVerCode")
				{
					//Blank value check
					if (trim(theForm.elements[i].value) == '')
					{
//						alert(theMessages[counter] + " cannot be blank.");
						alert("Please enter the "+theMessages[counter]+".");
						theForm.elements[i].focus();
						return false;	
					}
					
						if(theForm.elements[i].value.length > 14)
					{
						alert("Password cannot have more than 14 characters.");	
						theForm.elements[i].focus();
						return false;
					}
						if(theForm.elements[i].value.length < 6)
					{
						alert("Password cannot be less than 6 characters.");	
						theForm.elements[i].focus();
						return false;
					}
				}	
				// Confirm Password Validation
				//alert(theForm.elements[i].type);
				//alert(theConfirmPassword[counter]);
				if (theForm.elements[i].type=='password' && theConfirmPasswords[counter]=="Y")
				{
					//alert("mandeep");
					//alert(theForm.elements[i].value);
					//alert(theForm.elements[i-1].value);
					//Blank value check
					if (trim(theForm.elements[i].value) == '')
					{
//						alert(theMessages[counter] + " cannot be blank.");
						alert("Please retype the "+theMessages[counter]+".");
						theForm.elements[i].focus();
						return false;	
					}
					
						if(theForm.elements[i].value.length > 14)
					{
						alert("Password cannot have more than 14 characters.");	
						theForm.elements[i].focus();
						return false;
					}
						if(theForm.elements[i].value.length < 6)
					{
						alert("Password cannot be less than 6 characters.");	
						theForm.elements[i].focus();
						return false;
					}
					if (theForm.elements[i].value!=theForm.elements[i-1].value)
					{
//						alert(theMessages[counter] + " is not same.");
						alert("Passwords do not match.");
						theForm.elements[i].focus();
						return false;	
					}
				}	
				
			//Select box validation
				if (theForm.elements[i].type == "select-one")
				{
					var selIndex,selValue;
					selIndex=theForm.elements[i].selectedIndex;
					var theObject=theForm.elements[i];
					selValue = theObject[selIndex].value;
					if( trim(selValue) == "" || trim(selValue) == "0")
					{
						alert("Please select the " + theMessages[counter] + ".");
						theForm.elements[i].focus();
						return false;	
					}
				}
				if(theForm.elements[i].type == "select-multiple")
				{
					
					var flagselected="0";
					var e1=theForm.elements[i];
					for(var j=1;j<theForm.elements[i].options.length ;j++)
					{
						if(theForm.elements[i].options[j].selected)
						{
							if(theForm.elements[i].options[j].value!="")
							flagselected="1";
							//break;
						}
					}
					if(flagselected=="0")
					{
						alert("Please select the " + theMessages[counter] + ".");
						theForm.elements[i].focus();
						return false;
					}
				}
			//Check box validation
				//alert(theForm.elements[i].type);
				//alert(theemptys[counter]);
				if ((theForm.elements[i].type == "checkbox" ||  theForm.elements[i].type == "radio") && theemptys[counter] == "Y" )
				{ 
					var flagchecked="0";	
					
//					theControls[counter]=theControls[counter].substr(0,theControls[counter].length-2);
//					checkboxname=eval("theForm."+theControls[counter]);
					if (parseInt(thecheckboxlengths[counter]) > 1)
					{				
//						for (j=0;j<parseInt(thecheckboxlengths[counter]);j++)
						for (j=i;j<i+parseInt(thecheckboxlengths[counter]);j++)
						{	
//							checkbox1=eval(checkboxname[j]);				
//							if(checkbox1.checked==true)
							checkbox1=eval(theForm.elements[j]);				
							if(checkbox1.checked==true)
							{	
								flagchecked="1";
								break;
							}
						}
					}
					else
					{
						if(theForm.checkboxname.checked==true)
						{	
							flagchecked="1";
						}				
					}
					if (flagchecked=="0")
					{
						alert("Please select the " + theMessages[counter] + ".");
						theForm.elements[i].focus();
						return false;	
					}
					i=i+parseInt(thecheckboxlengths[counter])-1;
				}
			
			// Text Area Validation
				if (theForm.elements[i].type == "textarea")
				{
					var txtAreaValue;
					txtAreaValue=theForm.elements[i].value;
					if( trim(txtAreaValue) == "" && theemptys[counter] == "Y")
					{
//						alert(theMessages[counter] + " cannot be blank.");
						alert("Please enter the "+theMessages[counter]+".");
						theForm.elements[i].focus();
						return false;	
					}
					if (trim(theForm.elements[i].value) != '' && thesizes[counter] != "")
					{
								if (trim(theForm.elements[i].value).length>thesizes[counter])
								{							
										//Maximum characters allowed are n. Entered are m characters.						
									//alert(theMessages[counter]+" cannot have more than "+thesizes[counter]+" characters.");	
									
									alert("Maximum characters allowed are "+ thesizes[counter] +". Entered are "+ theForm.elements[i].value.length +" characters.");	
									theForm.elements[i].focus();
									return false;
								}
					}
				}
			
			// Radio Button Validation
			// This radio button validation is buggy so I am commneting it out
			/*	if(theForm.elements[i].type == "radio")
				{
//alert(theForm.elements[i].value);
					if(getRadioButtonValue(theForm.elements[i],theForm.elements[i].name) == "-1")
					{
						alert("You must select " + theMessages[counter] + ".");
						return false;		
					}
				}*/
			}
		}
	}
	
	return true;
}
//	************************************	End theValidator *****************************************************
function getRadioButtonValue(theForm,theControl)
{
	var i;
	alert("Hello " + theForm + " control.length: " + theControl.length);
	for( i=0; i< theControl.length; ++i)
	{
alert(theForm[i].checked);
		if( theControl[i].checked)
		{
		
			return theControl[i].value;
		}
	}
	// default (non selected)
	return -1;
}
function ltrim ( s )
{
	return s.replace( /^\s*/, "" )
}
function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}
function trim(str)
{
//	return rtrim(ltrim(str));
	return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
}
function emailcheck(object,str)
{
var email=object.value;
var matcharray=email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) 
	if(matcharray==null){
	alert(str)
	 	object.focus();
		object.select();
	return false;
	}
	else return true
}	
function validateEmail(email)
{
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}
function validateURL1(myobject)
{
	var re;
	var checkend=/\w\.[a-zA-Z]{2,3}/;
	url=myobject.value;
	
	if(url.search(checkend) == -1)
	{
		alert("Please enter valid url. \n http://www.domain.com");
		return false;
	}
	return true;
}
function validateURL(myobject)
{
	var re;
	var checkend=/\w\.[a-zA-Z]{2,3}/;
	url=myobject;
	
	if(url.search(checkend) == -1)
	{
		return false;
	}
	return true;
}
function validateURLNew(myobject)
{
 // This function is used to validate a given
 // address for the proper syntax
	url=myobject;
 //alert(url);
	var re;
 //re = new RegExp("(http|ftp|https)://[-A-Za-z0-9._/]+");
	re = new RegExp("(http|ftp|https)://[-A-Za-z0-9_/]+[.][-A-Za-z0-9._/]+");
 
	if (re.test(url)==false){
		//alert("Please enter valid website.");
		//myobject.focus();
		return false;
	}
	posOfAtSign = url.indexOf(".")
 
			if (posOfAtSign == -1){
		//alert("Please enter valid website.");
		//myobject.focus();
		return false;
			}
			return true;
}
function validate (field, maxlen, str)
{	
	if (field.value.length > maxlen)
	{
//		alert ("Field length exceeded.\nAllowed: "+maxlen+" characters,\nEntered: "+field.value.length+" characters.");
		alert(str+" cannot have more than "+maxlen+" characters.");	
		field.focus();
		return  false;
	}
	return true;
}

function fileextension(object,str)
{
	var s=object.value;
	if (s!="")
	{
		array=s.split("\\");
		len=array.length;
		filename=array[len-1];
		array1=filename.split(".");
		if(array1[1]!="jpg" && array1[1]!="jpeg" && array1[1]!="gif")
		{
			alert(str);
			object.focus();
			return false;
		}
	}
	
	return true;
}
function emailcheck(object,str)
{
var email=object.value;
var matcharray=email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) 
	if(matcharray==null){
	alert(str)
	 	object.focus();
		object.select();
	return false;
	}
	else return true
}

