//for dollar functions
//checks if in digits and if not takes out invalid char
//then tells them what's wrong
function checkDollar(thevar){
   var tmpa;
   var len, digits="0123456789,.";
   
   strtmp = "";
   tmpa = document.getElementById(thevar).value;

   //checks if the quantity is a number
   //replaces it if not
   len=tmpa.length;
   for(i=0; i<len; i++)
      {
	  if (digits.indexOf(tmpa.charAt(i))<0)
         {
	     alert("Please enter a positive number.");
	     }
	  else
	    {
	     strtmp=strtmp + tmpa.charAt(i);
        }
	  }
   document.getElementById(thevar).value=strtmp;
}



//for # functions
//checks if in digits and if not takes out invalid char
//then tells them what's wrong
function checkNumber(thevar){
   var tmpa;
   var len, digits="0123456789";
   
   strtmp = "";
   tmpa = document.getElementById(thevar).value;

   //checks if the quantity is a number
   //replaces it if not
   len=tmpa.length;
   for(i=0; i<len; i++)
      {
	  if (digits.indexOf(tmpa.charAt(i))<0)
         {
	     alert("Please enter a positive number.");
	     }
	  else
	    {
	     strtmp=strtmp + tmpa.charAt(i);
        }
	  }
   document.getElementById(thevar).value=strtmp;
}


//for # functions
//checks if in digits and if not takes out invalid char
//then tells them what's wrong
function checkZip(thevar){
   var tmpa;
   var len, digits="0123456789-";
   
   strtmp = "";
   tmpa = document.getElementById(thevar).value;

   //checks if the quantity is a number
   //replaces it if not
   len=tmpa.length;
   for(i=0; i<len; i++)
      {
	  if (digits.indexOf(tmpa.charAt(i))<0)
         {
	     alert("Please enter a number or dash.");
	     }
	  else
	    {
	     strtmp=strtmp + tmpa.charAt(i);
        }
	  }
   document.getElementById(thevar).value=strtmp;
}




//form validation
//finds empty values and requests them to fill in
function chk(formName){
	    var divthingy;
	    var x=document.getElementById(formName);
		var err = "";

		for (var i=0;i<x.length;i++)
		   {
		  if (x.elements[i].value==""){
		      err = err + x.elements[i].alt + "\n";
			  x.elements[i].className="formerr";
		       }
		}
			
		if (err==""){
			return true;
		} else {
			alert('Please fill in:\n' + err);
			return false;
		}
	}
	
function zipch(bx){
	changebox=eval("document.quickquote." + bx)
	if (changebox.value=="Zip Code"){
			changebox.value=""
	}
	changebox.style.color="#000"
}

function zipch2(bx){
	changebox=eval("document.quickquote." + bx)
	if (changebox.value=="" || changebox.value=="Zip Code"){
	changebox.value="Zip Code"
	changebox.style.color="#999"
	}
}

//sets value to nothing
function clearValue(thevar){
   document.getElementById(thevar).value="";
}