function checkWholeForm() {
	var marginForm = document.forms["marginForm"];
    var why = "";
	why += checkCompany(marginForm.Company.value);
	why += checkName(marginForm.Name.value);
    why += checkDesignation(marginForm.Designation.value);
    why += checkPhone(marginForm.phone.value);
    why += checkHandphone(marginForm.mphone.value);
    why += checkEmail(marginForm.Email.value);
	why += checkAdd(marginForm.Add1.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;

}

function checkCompany(strng) {
var error = "";
if (strng == "") {
    error = "Please enter your company name.\n";
		}
var valid = "abcdefghijklmnopqrstuvwxyz0123456789&-!().ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i++);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
 error = "The company name contains illegal characters. Please check.\n";
       }      
return error;
}	

function checkName(strng) {
var error = "";
if (strng == "") {
    error = "Please enter your name.\n";
		}
var valid = "abcdefghijklmnopqrstuvwxyz0123456789&-!().ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i++);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
       error = "Your name contains illegal characters. Please check.\n";
       }      
return error;
}	


function checkDesignation (strng) {
 var error = "";
 if (strng == "") {
    error = "Please enter your designation.\n";
    }    
var valid = "abcdefghijklmnopqrstuvwxyz0123456789&-!().ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i++);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
       error = "Your designation contains illegal characters. Please check.\n";
       }      
return error;
}	
	

function checkPhone(strng) {
var error = "";
if ((strng.length < 8)) {
    error = "Please enter your phone number with area code, at min. 8 digits.\n";
		}
if  ((strng.length > 8)) {
    error = "The phone number length is more than 8 digits.\n";
		}
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no"){   
       error = "The phone number contains illegal characters. Please check.\n";
       }
return error;
}	

function checkHandphone(strng) {
var error = "";
if ((strng.length < 7)) {
    error = "Please enter your handphone number correctly.\n";
		}
if  ((strng.length > 7)) {
    error = "The handphone number length is more than 7 digits.\n";
		}
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no"){   
       error = "The handphone number contains illegal characters. Please check.\n";
       }
return error;
}	
 
function checkEmail(strng) {
 var error = "";
 if (strng == "") {
    error = "Please enter your email address.\n";
     }   
var emailFilter=/^.+@.+\..{2,3}$/;
if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
}
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
if (strng.match(illegalChars)) {
   error = "The email address contains illegal characters.\n";
    }      
return error;
}	

function checkAdd(strng) {
var error = "";
if (strng == "") {
    error = "Please enter the address of the site that requires the data de-duplication assessment.\n";
		}
var valid = "abcdefghijklmnopqrstuvwxyz0123456789&-,!().ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var ok = "yes";
var temp;
for (var i=0; i<strng.length; i++) {
temp = "" + strng.substring(i, i++);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
       error = "Your address contains illegal characters. Please check.\n";
       }      
return error;
}	

function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}


function ignoreCommas(string) {
var temp = "";
string = '' + string;
len=string.length;
for(x=0;x<len;++x){ 
  if(string.charAt(x)!=","){temp=temp +string.charAt(x)} 
} 
return temp;
}