function isEmpty(s)
	{ 
		return ((s==null)||(s.length==0));
	}
	function isWhiteSpace(s)
	{ 
		var whitespace=" \t\n\r";
		var i;
		if(isEmpty(s))
		{
			return true;
		}
		for(i=0;i<s.length;i++)
		{
			var c=s.charAt(i);
			if(whitespace.indexOf(c)==-1)
			{
				return false;
			}
		}
		return true;
	}
	function checkForNumaric(e)
	{
		ch=window.event?e.keyCode:e.which;
		if(ch<41||ch>57)
		{
			if(navigator.appName == 'Netscape')
			{
				if((ch != 13) && (ch != 0) &&(ch != 8))
				{
					e.returnValue=0;
					alert("Please enter only numbers");
				}
			}
			else
			{
				if((ch != 13) && (ch != 27))
				{
					e.returnValue=0;
					alert("Please enter only numbers");
					return false
				}
			}
		}
	}
	function newvalid(form1)
	{ 
		if(isWhiteSpace(document.form1.txt_fname.value))
		{
			alert("Enter Firstname");
			document.form1.txt_fname.focus();
			return false;
		}
		/*
		else
		{
			var name=new String(document.form1.txt_fname.value);
			for(i=0;i<name.length;i++)
			{
				if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")||(name.charAt(i)=="-")))
				{
					alert("Invalid Text Name");
					document.form1.txt_fname.focus();
					return false;
				}
			}
		}
		  */
   //lastname
	/*
		if(isWhiteSpace(document.form1.txt_lname.value))
		{
     alert("Enter Lastname");
     document.form1.txt_lname.focus();
     return false;
      }
   else
        {
         var name=new String(document.form1.txt_lname.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_lname.focus();     
return false;
          }
          }
        } */
 if(isWhiteSpace(document.form1.txt_add1.value))
     {
     alert("Enter Address1");
     document.form1.txt_add1.focus();
     return false;
      }
 /*if(isWhiteSpace(document.form1.txt_add2.value))
     {
     alert("Enter Address2");file:///usr/share/ubuntu-artwork/home/index.html
     document.form1.txt_add2.focus();
     return false;
      }*/
  if(isWhiteSpace(document.form1.txt_city.value))
     {
     alert("Enter City");
     document.form1.txt_city.focus();
     return false;
      }  
else
        {
         var name=new String(document.form1.txt_city.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_city.focus();     
return false;
          }
          }
        }
   if(document.form1.reqstate1.value=="")
     {
     alert("Enter Country");
     document.form1.reqstate1.focus();
     return false;
      }
   if(document.form1.city1.value=="")
     {
     alert("Enter State in the Shipping & Handling area at the top of the page.");
     document.form1.city1.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_zipcode1.value))
     {
     alert("Enter Zipcode");
     document.form1.txt_zipcode1.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_phno.value))
     {
     alert("Enter Phonenumber");
     document.form1.txt_phno.focus();
     return false;
      }
	  else if(isNaN(document.form1.txt_phno.value))
	  {
	  alert("Only use digits for your phone number.");
     document.form1.txt_phno.focus();
     return false;
	  }
	  // JavaScript Document
// JavaScript Document
if(isWhiteSpace(document.form1.txt_firstname.value))
	{
     alert("Enter Firstname");
     document.form1.txt_firstname.focus();
     return false;
	}
else
{
         var name=new String(document.form1.txt_firstname.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_firstname.focus();
             return false;
          }
          }
 }
   //lastname
/*if(isWhiteSpace(document.form1.txt_lastname.value))
     {
     alert("Enter Lastname");
     document.form1.txt_lastname.focus();
     return false;
      }
   else
        {
         var name=new String(document.form1.txt_lastname.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_lastname.focus();     
return false;
          }
          }
        } 
*/
 if(isWhiteSpace(document.form1.txt_address1.value))
     {
     alert("Enter Address1");
     document.form1.txt_address1.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_city1.value))
     {
     alert("Enter City");
     document.form1.txt_city1.focus();
     return false;
      }  
else
        {
         var name=new String(document.form1.txt_city1.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_city1.focus();     
return false;
          }
          }
        }
   if(document.form1.reqstate2.value=="")
     {
     alert("Enter Country");
     document.form1.reqstate2.focus();
     return false;
      }
   if(document.form1.bill_city.value=="")
     {
     alert("Enter State");
     document.form1.bill_city.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_billzip.value))
     {
     alert("Enter Zipcode");
     document.form1.txt_billzip.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_phoneno.value))
     {
     alert("Enter Phonenumber");
     document.form1.txt_phoneno.focus();
     return false;
      }
	  else if(isNaN(document.form1.txt_phoneno.value))
	  {
	  alert("Enter Digits");
     document.form1.txt_phoneno.focus();
     return false;
	  }
	   if(isWhiteSpace(document.form1.txt_zip.value))
     {
     alert("Enter Zipcode in the Shipping & Handling area at the top of the page.");
     document.form1.txt_zip.focus();
     return false;
      }
	  if(isWhiteSpace(document.form1.reqstate.value))
     {
     alert("Enter Country in the Shipping & Handling area at the top of the page.");
     document.form1.reqstate.focus();
     return false;
      }
	  if(isWhiteSpace(document.form1.city.value))
     {
     alert("Enter City in the Shipping section.");
     document.form1.city.focus();
     return false;
      }
	    if(isWhiteSpace(document.form1.txt_read.value))
     {
     alert("Select Shipping Cost in the Shipping & Handling area at the top of the page.");
     document.form1.txt_read.focus();
     return false;
      }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function newvalid1(form1)
	{ 
		
if(isWhiteSpace(document.form1.txt_firstname.value))
	{
     alert("Enter Firstname");
     document.form1.txt_firstname.focus();
     return false;
	}
else
{
         var name=new String(document.form1.txt_firstname.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_firstname.focus();
             return false;
          }
          }
 }
   //lastname
/*if(isWhiteSpace(document.form1.txt_lastname.value))
     {
     alert("Enter Lastname");
     document.form1.txt_lastname.focus();
     return false;
      }
   else
        {
         var name=new String(document.form1.txt_lastname.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_lastname.focus();     
return false;
          }
          }
        } 
*/
 if(isWhiteSpace(document.form1.txt_address1.value))
     {
     alert("Enter Address1");
     document.form1.txt_address1.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_city1.value))
     {
     alert("Enter City");
     document.form1.txt_city1.focus();
     return false;
      }  
else
        {
         var name=new String(document.form1.txt_city1.value);
         for(i=0;i<name.length;i++)
         {
          if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")))
         {
           alert("Invalid Text Name");
           document.form1.txt_city1.focus();     
return false;
          }
          }
        }
   if(document.form1.reqstate2.value=="")
     {
     alert("Enter Country");
     document.form1.reqstate2.focus();
     return false;
      }
   if(document.form1.bill_city.value=="")
     {
     alert("Enter State");
     document.form1.bill_city.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_billzip.value))
     {
     alert("Enter Zipcode");
     document.form1.txt_billzip.focus();
     return false;
      }
  if(isWhiteSpace(document.form1.txt_phoneno.value))
     {
     alert("Enter Phonenumber");
     document.form1.txt_phoneno.focus();
     return false;
      }
	  else if(isNaN(document.form1.txt_phoneno.value))
	  {
	  alert("Enter Digits");
     document.form1.txt_phoneno.focus();
     return false;
	  }
	 
	  if(document.form1.txt_email.value=="")
{
	alert("Please Enter Email Address");
	document.form1.txt_email.focus();
	return false;
}      
      if(document.form1.txt_password.value=="")
{
	alert("Enter Password");
	document.form1.txt_password.focus();
	return false;
}		
if(document.form1.txt_password1.value=="")
{
	alert("Enter Confirm Password");
	document.form1.txt_password1.focus();
	return false;
}
if (document.form1.txt_password.value !=document.form1.txt_password1.value) {
			 alert("The passwords entered twice, does not match.  Please enter again.");
			 document.form1.txt_password1.focus();
			 return false; 
}
}
