function call()
{

 document.name1.title.focus();
}
// Removes leading whitespaces
function LTrim( value ) {
 
 var re = /\s*((\S+\s*)*)/;
 return value.replace(re, "$1");
 
}

// Removes ending whitespaces
function RTrim( value ) {
 
 var re = /((\s*\S+)*)\s*/;
 return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim( value ) {
 
 return LTrim(RTrim(value));
 
}
function register()
{
	var r=document.name1;
	var user=document.name1.email.value;
	if(r.title.value=="select")
	{
	alert ("Please select the title");
	r.title.focus()
	return false; 
	}
	if(r.firstname.value=="")
	{
	alert ("Please enter the first name");
	r.firstname.focus()
	return false; 
	}
	 else
	 {
	  var len=r.firstname.value;
	  var fn=trim(len);
	  if(fn=="")
	  {
	        alert("Please enter the first name");
	 r.firstname.focus();
	  return false;
	  }
	 }		
	
	
	if(r.login_id.value=="")
	{
	alert ("Please enter the user name");
	r.login_id.focus()
	return false; 
	}
 	if(r.password.value=="")
	{
	alert ("Please enter the password");
	r.password.focus()
	return false; 
	}
	if (r.password.value.length<6 )
    {
    alert("Password must be minimum 6 characters");
    r.password.select()
    return false;	            
    }
	if(r.confirm_password.value=="")
	{
	alert ("Please enter retype password");
	r.confirm_password.focus()
	return false; 
	}
	
	if (r.password.value !=r.confirm_password.value)
    {
    alert("Passwords are not equal");
    r.password.select()
    return false;	            
    }
    
    
	if(r.address1.value=="")
	{
	alert ("Please enter the address");
	r.address1.focus()
	return false; 
	}
	 else
	 {
	  var len=r.address1.value;
	  var add=trim(len);
	  if(add=="")
	  {
	        alert("Please enter the address");
	  r.address1.focus();
	  return false;
	  }
	 }
	if(r.city.value=="")
	{
	alert ("Please enter the city");
	r.city.focus()
	return false; 
	}
	
	if(r.state.value=="")
	{
	alert ("Please enter the state");
	r.state.focus()
	return false; 
	}
	if(r.country.value=="select")
	{
	alert ("Please enter the country");
	r.country.focus()
	return false; 
	}
	if(r.zip_code.value=="")
	{
	alert ("Please enter the zipcode");
	r.zip_code.focus()
	return false; 
	}
	else
	 {
	  var len=r.zip_code.value;
	  var zip=trim(len);
	  if(zip=="")
	  {
	        alert("Please enter the zipcode");
	  r.zip_code.focus();
	  return false;
	  }
	 }
	
	
	if(r.contact_no.value=="")
	{
	alert ("Please enter the phone number");
	r.contact_no.focus()
	return false; 
	}
	else
	 {
	  var len=r.contact_no.value;
	  var ph=trim(len);
	  if(ph=="")
	  {
	        alert("Please enter the phone number");
	  r.contact_no.focus();
	  return false;
	  }
	 }
	
	if((user=="")|| (user=="Enter Your E-Mail ID"))
	{
		alert("Please enter your email");
		r.email.focus();
		return false;
		}
		else if (Email(user))
		{
		alert("Please enter valid email Id  (e.g.: yourname@hotmail.com) ");
		r.email.focus();
		
		return false;
	}
	
	document.name1.submit();
}




function register1()
{
	var r=document.name1;
	var user=document.name1.email.value;
	if(r.title.value=="select")
	{
	alert ("Please select the title");
	r.title.focus()
	return false; 
	}
	if(r.firstname.value=="")
	{
	alert ("Please enter the first name");
	r.firstname.focus()
	return false; 
	}
	 else
	 {
	  var len=r.firstname.value;
	  var fn=trim(len);
	  if(fn=="")
	  {
	        alert("Please enter the first name");
	  r.firstname.focus();
	  return false;
	  }
	 }		
	
	if(r.address1.value=="")
	{
	alert ("Please enter the address");
	r.address1.focus()
	return false; 
	}
	 else
	 {
	  var len=r.address1.value;
	  var add=trim(len);
	  if(add=="")
	  {
	        alert("Please enter the address");
	 r.address1.focus();
	  return false;
	  }
	 }
	if(r.city.value=="")
	{
	alert ("Please enter the city");
	r.city.focus()
	return false; 
	}
	
	if(r.state.value=="")
	{
	alert ("Please enter the state");
	r.state.focus()
	return false; 
	}
	if(r.country.value=="select")
	{
	alert ("Please enter the country");
	r.country.focus()
	return false; 
	}
	if(r.zip_code.value=="")
	{
	alert ("Please enter the zipcode");
	r.zip_code.focus()
	return false; 
	}
	else
	 {
	  var len=r.zip_code.value;
	  var zip=trim(len);
	  if(zip=="")
	  {
	        alert("Please enter the zipcode");
	  r.zip_code.focus();
	  return false;
	  }
	 }
	
	
	if(r.contact_no.value=="")
	{
	alert ("Please enter the phone number");
	r.contact_no.focus()
	return false; 
	}
	else
	 {
	  var len=r.contact_no.value;
	  var ph=trim(len);
	  if(ph=="")
	  {
	        alert("Please enter the phone number");
	 r.contact_no.focus();
	  return false;
	  }
	 }
	
	if((user=="")|| (user=="Enter Your E-Mail ID"))
	{
		alert("Please enter your email");
		r.email.focus();
		return false;
		}
		else if (Email(user))
		{
		alert("Please enter valid email Id  (e.g.: yourname@hotmail.com) ");
		r.email.focus();
		
		return false;
	}
	
	document.name1.submit();
}



function Email(str)
	{
		  var supported = 0;
			if (window.RegExp)
			{
			var tStr = "a";
			var tReg = new RegExp(tStr);
			if (tReg.test(tStr)) supported = 1;
			}
			if (!supported)
			return (str.indexOf(".") <= 2) || (str.indexOf("@") < 0);
			var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			return (r1.test(str) || !r2.test(str));
		}
function isNumberKey1(evt)
      {
	  
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
         {
	         alert("Please enter only numbers");
            return false;
        }

         return true;

      }
      
 function isNumberKey(evt)
      {
	  
          var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode >=48 && charCode <=57 )|| (charCode == 43 )|| (charCode == 46 )||(charCode == 10 )||(charCode == 13 )|| (charCode == 8)||(charCode == 32)||(charCode == 45))
        {
	       return true; 
        }
         else
          {
	         alert("Please enter only numbers");
            return false;
        }
        

      }
function isStringKey(evt)
{
  var charCode = (evt.which) ? evt.which : event.keyCode
  if ((charCode >=97 && charCode <=122 ) || (charCode >=65 && charCode <=90 )|| (charCode == 32)|| (charCode == 127)|| (charCode == 8) )
  {
  return true; 
  }
  else
  {
  alert("Please enter only alphabets");
  
  return false;
  }
}

    
//Limiting Character validation   
function limitlength(obj, length)
{
	var maxlength=length
	if (obj.value.length>maxlength)
	{
	obj.value=obj.value.substring(0, maxlength)
	alert ("Please enter only "+maxlength+" characters");
     }
}  

//Validation for numbers
function alp(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode >=48 && charCode <=57 )||  (charCode == 46 )||(charCode == 10 )||(charCode == 13 )|| (charCode == 8)||(charCode == 32)||(charCode == 45)|| (charCode >=97 && charCode <=122 )|| (charCode >=65 && charCode <=90 )||(charCode == 127))
        {
	       return true; 
        }
         else
          {
	        alert("Special chracters should not be allowed");
            return false;
        }
        
    }