function stripNonNumeric(str)
{
  str += '';
  var rgx = /^\d|\.|-$/;
  var out = '';
  for(var i = 0; i < str.length; i++)
  {
   if(rgx.test(str.charAt(i))){
     if(!((str.charAt(i) == '.' && out.indexOf( '.' ) != -1) ||
            (str.charAt(i) == '-' && out.length != 0 ))){
       out += str.charAt(i);
     }
   }
  }

  return out;
}
  
$(document).ready(function() {
  $('.tooltip').tooltip({offset: [-5, 0], cancelDefault: false});
  
  $('select.wl-uiselect').selectmenu();
  
  $('.nm-thousand-format').bind('focus', function() {
     $(this).val($(this).val().replace(/\./g,''));
     $(this).select();
  });

  $('.nm-thousand-format').bind('blur', function() {
      $(this).val($(this).number_format($(this).val(),{numberOfDecimals: 0}));
  });

  $('.nm-thousand-format').each(function() {
      $(this).val($(this).number_format($(this).val().replace(/\./g,''),{numberOfDecimals: 0}));
  });

  $('a.blank[rel*="external"]').bind('click', function() {
    return openLinkInNewWindow(this.href, parseInt(window.innerWidth) - 150, parseInt(window.innerHeight) - 100);
  });

  $("a[rel^='prettyPhoto']").prettyPhoto({
			social_tools: false /* html or false to disable */
  });
});

