
function checkString(path,arrayNumber) {
	var newPath = trim(path);
	if(arrayNumber == 1) {
		if (!validate(newPath)){
			return false;
		} else {
			return newPath;	
		}
	} else {
		if(newPath.length<1) return ""; else return newPath
	}
}

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 

    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

function validate(address) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   //var address = newPath;
   if(reg.test(address) == true) {
      //alert('Invalid Email Address');
      return address;
   }
}


