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 CheckConditions() {
	var emailID=document.quotation.email;//validate email format
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

  if(document.quotation.q_antivirus.checked==false && document.quotation.q_spam.checked==false && document.quotation.q_firewall.checked==false){
    alert('Please select at least one Protection Requirement!');
    return false;
} 
  if (document.getElementById("q_pcs").value !=""){ 
     if (IsNumeric(document.getElementById("q_pcs").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_win_servers").value !=""){ 
     if (IsNumeric(document.getElementById("q_win_servers").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_fsw_connections").value !=""){ 
     if (IsNumeric(document.getElementById("q_fsw_connections").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_esw_boxes").value !=""){ 
     if (IsNumeric(document.getElementById("q_esw_boxes").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_fsl_connections").value !=""){ 
     if (IsNumeric(document.getElementById("q_fsl_connections").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_cds").value !=""){ 
     if (IsNumeric(document.getElementById("q_cds").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }
  if (document.getElementById("q_rescd").value !=""){ 
     if (IsNumeric(document.getElementById("q_rescd").value) == false){ 
       alert("Please check - non numeric value!");
       return false;
     }
  }

  return true;

}
function echeck(str) {//function to validate email format

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid Email address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid Email address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid Email address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid Email address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid Email address")
		    return false
		 }

 		 return true					
	}



