
	 function validEmail(email)
         {
        
         var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
         var checkend=/\.[a-zA-Z]{2,3}$/;

         if((email.search(exclude) != -1) || (email.search(checkend) == -1))        return false;

         atPos = email.indexOf("@",0);
         pPos1 = email.indexOf(".",0);
         periodPos = email.indexOf(".",atPos);
         pos1 = pPos1;
         pos2 = 0;
         while (pos2 > -1) {
          pos2 = email.indexOf(".",pos1+1);
          if (pos2 == pos1+1)  return false;
          else  pos1 = pos2;
         }
         if (atPos == -1)        return false;
         if (atPos == 0)        return false;
         if (pPos1 == 0)        return false;
         if(email.indexOf("@",atPos+1) > -1)        return false;
         if (periodPos == -1)        return false;
         if (atPos+1 == periodPos)        return false;
         if (periodPos+3 > email.length)
         return false;

         return true;
        }

function checkEmail(email)
	{
				
              if (!validEmail(email.value))
                {
						//alert(emailsend.Email.value);
                        //document.emailsend.Email.select()
			//email.style.backgroundColor="gray";
                        alert("Email is Not Correct");
                        email.style.backgroundColor="white";
                        email.select()
                        email.focus()
                        return false;
                }
	    else	
		{
			return true;
		}
                
          }


function funTrim(s) 
			{
				// Remove leading spaces and carriage returns
				  
				while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
				{
					s = s.substring(1,s.length);
				}

				// Remove trailing spaces and carriage returns

				while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
				{
					s = s.substring(0,s.length-1);
				}
				
				return s;
			}	
      





























