
function cUrl(inStr) {
  tmpS = inStr.replace(/ /g,"_");
  tmpS = tmpS.replace(/'/g,"-");
  return tmpS;
}

function dUrl(inStr) {
  tmpS = inStr.replace("_"," ");
  tmpS = tmpS.replace("-","'");
  return tmpS;
}

function ToMiles(numIn) {
  var miles = numIn * 60;
  miles = Math.round(miles*10)/10;
  miles = miles.toFixed(2);
  return miles;
}

function ShortenString(str,n){ 
  if(str.length > n){  
    var s = str.substr(0, n);
    var words = s.split(' '); 
    words[words.length-1] = '';
    str = words.join(' ') + '&hellip;'
  }
return str;
}

function FormatNumber(str) {
  str = str + "";
  return str.replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,");
}

function CleanString(str) {
  re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
  return str.replace(re, "");
}

function CapString(str) {
  str = str.toLowerCase();
  return str.replace(/\b[a-z]/g,function (match) { return match.toUpperCase(); })
}

function PopUpInfo(url) {
  window.open(url,'', 'width=800,scrollbars=yes', false);
}

function ucwords( str ) {
    str = str.toLowerCase(str); 
    return str.replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );
}
function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

