function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   }
 
function IsNumeric1(sText)

{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   }
 
function validateSell(sellprod)
{
var emsg="";

var shipping=sellprod.shipping.value;
if (IsNumeric(shipping)==false){
emsg+="Shipping must be numeric - no '$' or other text!\n";
}
var orderdate=sellprod.orderdate.value;
var shipdate=sellprod.shipdate.value;
if (shipdate.length>3) {
if (orderdate>shipdate){
emsg+="Order date can't be after the shipping date\n";
}
}
if (emsg.length>2){
	alert(emsg);
	return false;
	}
}
 
  

  
function validate5(addnew)
{
var emsg="";
if (addnew.prodtype.value=="0" && (addnew.Nprodtype.value=="New" || addnew.Nprodtype.value==" ")){
emsg+="You must select a product type or add a new product type!\n"
}
if (addnew.breed.value=="0"&&(addnew.Nbreed.value=="New" || addnew.Nbreed.value==" ")){
emsg+="You must select a breed!\n";
}
if (addnew.price.value=="0.00"){
emsg+="You must enter a price!\n";
}
var price=addnew.price.value;
if (IsNumeric(price)==false){
emsg+="Price must be numeric - no '$' or other text!\n";
}
var quantity=addnew.quantity.value;
if (IsNumeric1(quantity)==false){
emsg+="Quantity must be numeric - no '.', or other text!\n";
}
if (addnew.artist.value=="0" && (addnew.Nartist.value=="New" || addnew.Nartist.value==" ")){
emsg+="You must select an Artist or Manufacturer or add a new one!\n";
}
if (emsg.length>2){
	alert(emsg);
	return false;
	}
else
{
var answer=confirm("Are you sure you want to add this Product?");
if (!answer)
return false;
 }
}
 

 
 function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 }




function validateInfo(cf)
{
var emsg="";
var visitor=cf.visitor.value;
if (visitor.length<1){
emsg+="Please enter your NAME.\n";
}
var tw=cf.theword1.value;
var email=cf.visitormail.value;
var emailconfirm=cf.visitormailconfirm.value;

if (email.length<1){
emsg+="Please enter your EMAIL address.\n"; }
if (email.length>1 && !isValidEmail(email)){
emsg+="Please enter a valid EMAIL address.\n";
}
if (email!=emailconfirm)
{
	emsg+="Your EMAIL addresses do not match.\n";
}
var notes=cf.notes.value;
if (notes.length<1){
emsg+="Please enter a MESSAGE.\n";
}

if (tw=="Woave" || tw=="eArsE" || tw=="BtBeL" || tw=="TpraT" || tw=="Lrakay" || tw=="eRTpb" || tw=="ptRpL" || tw=="PRLpe" || tw=="QrEpe")
{
	emsg+="";
}
else
	emsg+="Please correct the anti-spam letters.";
if (emsg.length>2){
	alert(emsg);
	return false;
	}
}


function IsAlpha(sText)
{
   var ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   var IsALPH=true;
   var Char;
 
   for (i = 0; i < sText.length && IsALPH == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsALPH = false;
         }
      }
   return IsALPH;
 }

function validateletter(letter)
{
var emsg="";

var last=letter.lsearch.value;
if (last.length<1){
emsg+="Enter at least one letter of the customer's LAST NAME.\n";
}
if (IsAlpha(last)==false){
emsg+="Please enter valid Alpha characters only\n";
}
if (emsg.length>2){
	alert(emsg);
	return false;
	}
}
 

function validate10(formname)
{
var searchword=formname.searchword.value;


var emsg="";
if (searchword=="Enter Text Here" || searchword==" " || searchword==""){
emsg+="Please enter some text!\n";
}
if (emsg.length>2){
	alert(emsg);
	return false;
	}
}
 
  
function confirmdel(del)
{
var answer=confirm("Are you sure you want to delete?");
if (!answer){
return false;
 }
}
 
 
function validateprod(prod)
{
var emsg="";

var year=prod.year.value;
if (IsNumeric1(year)==false){
emsg+="Year must be numeric\n";
}
if (year.length!=4){
emsg+="Year must be 4 digits long\n";
}
var model=prod.model.value;
if (model.length<2){
emsg+="Please enter a Model\n";
}
var fuel=prod.fuel.value;
if (fuel.length<2){
emsg+="Please select a Fuel type\n";
}
var description=prod.description.value;
if (description.length<2){
emsg+="Please enter a Description\n";
}
var price=prod.price.value;
if (price.length<1){
emsg+="Please enter a Price\n";
}
if (IsNumeric(price)==false){
emsg+="Price must be numeric - no '$' or other text!\n";
}

if (emsg.length>2){
	alert(emsg);
	return false;
	}
else
{
var answer=confirm("Are you sure you want to save the changes to this product?");
if (!answer)
return false;
 }
}
 
function validateprodA(prod)
{
var emsg="";

var model=prod.model.value;
if (model.length<2){
emsg+="Please enter a Model\n";
}

var description=prod.description.value;
if (description.length<2){
emsg+="Please enter a Description\n";
}
var price=prod.price.value;
if (price.length<1){
emsg+="Please enter a Price\n";
}
if (IsNumeric(price)==false){
emsg+="Price must be numeric - no '$' or other text!\n";
}

if (emsg.length>2){
	alert(emsg);
	return false;
	}
else
{
var answer=confirm("Are you sure you want to save the changes to this product?");
if (!answer)
return false;
 }
}