/* GENERAL UTILITY FUNCTIONS */

// Useful function to trim whitespace off the beginning and end of a string
function trim(str){
  while(str.charAt(0) == (" ") ){  
     str = str.substring(1);
  }
  while(str.charAt(str.length-1) == " " ) {  
     str = str.substring(0,str.length-1);
  }
  return str;
}

// Checks that the string is alphabetic
function isAlphabetic(val){
   if (val.match(/^[a-zA-Z]+$/)){return true;}
   else {return false;} 
}

// Returns the current URL
function getMyURL(){
   var s = window.location.href;
   
   // Now, we need to convert the '%20' substrings into whitespaces
   var re = /%20/g;
   return s.replace(re,' ');    
}
