// validate form
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

function IsWhiteSpace(strString)
   //  check for white spaces	
   {
   var strInValidChars = " ";
   var strChar;
   var blnResult = true;
   if (strString.length == 0) return false;
   //  test strString consists of invalid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strInValidChars.indexOf(strChar) != -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

function checkWeb(form){
var trimmedStr = form.os0.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
if (trimmedStr==null || trimmedStr==""){
	alert('You must enter the website address that will host Weather Display Live');
	form.os0.focus();
	return false;
	}
else if (IsWhiteSpace(trimmedStr)==false){
	alert('The website address cannot contain spaces');
	form.os0.focus();
	return false;
	}	
else {
	return true;
	}
}

function checkWebBoth(form){
var trimmedStr = form.os0.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
if (trimmedStr==null || trimmedStr==""){
	alert('You must enter the website address that will host Weather Display Live');
	form.os0.focus();
	return false;
	}
else if (IsWhiteSpace(trimmedStr)==false){
	alert('The website address cannot contain spaces');
	form.os0.focus();
	return false;
	}	
else if (form.os1.value.length!=10 ){
	alert('You must enter your current Weather Display Live serial number\nIt is a 10 digit number');
	form.os1.focus();
	return false;
	}  
else if (IsNumeric(form.os1.value)==false){
	alert('You must enter your current Weather Display Live serial number\nas numbers. It is a 10 digit number');
	form.os1.focus();
	return false;
	} 	
 else {
	 return true;
	 }
}

