function isValidEmail(str) {
error="";
   if ((str.value.indexOf(".") > 2) && (str.value.indexOf("@") > 0)) {
   } else {
   error="Please enter a valid Email Address.\r\n";
   }
	return error;
}

function hasSpace(str,title) {
error="";
   if (str.value.indexOf(" ") > 0) {
   } else {
   error=title + "\r\n";
   }
	return error;
}

function isDateFormat(str,title) {
error="";
   if ( (str.value.indexOf("-",3) > 0) || (str.value.indexOf("/",3) > 0) ) {
   } else {
   error="Please enter " + title + " in MM-DD-YYYY format.\r\n";
   }
	return error;
}

function isFile(str) {
error="";
lowerstr=str.value.toLowerCase();
   if ((lowerstr.indexOf(".pdf") > 1) || (lowerstr.indexOf(".gif") > 1) || (lowerstr.indexOf(".jpg") > 1) || (lowerstr.indexOf(".csv") > 1) || (lowerstr.indexOf(".ppt") > 1) || (lowerstr.indexOf(".pot") > 1)  || (lowerstr.indexOf(".pps") > 1)  || (lowerstr.indexOf(".ppz") > 1)  || (lowerstr.indexOf(".xls") > 1) || (lowerstr.indexOf(".doc") > 1)) {
   } else {
   error="We accept the following file formats: .csv, .doc, .docx, .gif, .jpg, .pdf, .pot, .pps, .ppt, .ppz, .xls, .xlsx.\r\n";
   }
	return error;
}
function isValidStr(str,title) {
var letters="abcdefghijklmnopqrstuvwxyz -.ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var temp
error="";
if (str.value.length == 0) {
 error="Please enter " + title + ".\r\n";
 } else {
//checking the letters in the name and the state and country, numbers in phone and zip  
	for (var i=0;i<str.value.length;i++){
	temp=str.value.substring(i,i+1);
	if (letters.indexOf(temp)==-1){
	error="Use only letters in " + title + ".\r\n";
      }
   }	
  }
 	return error;
 }
 function isValidNum(str,title) {      
var dates="01234556789/-.()";
var temp
error="";
if (str.value.length == 0) {
 error="Please enter " + title + ".\r\n";
 } else {
 for (var i=0;i<str.value.length;i++){
temp=str.value.substring(i,i+1);
if (dates.indexOf(temp)==-1){
error="Use only Numbers and '-','.' or ( ) for " + title + ".\r\n";
      }
   }	
 }
return error;
}

 function isValidDig(str,title) {      
var digits="0123456789";
var temp
error="";
if (str.value.length == 0) {
 error="Please enter " + title + ".\r\n";
 } else {
 for (var i=0;i<str.value.length;i++){
temp=str.value.substring(i,i+1);
if (digits.indexOf(temp)==-1){
error="Please only enter Numbers for " + title + ".\r\n";
      }
   }	
 }
return error;
}

function isThere(str,title){
error="";
if (str.value.length == 0) {
 error="Please enter " + title + ".\r\n";
 } 
 return error;
}
