var communityEmailRegEx = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i;  


function trimString(stringToTrim) {
 return stringToTrim.replace(/^\s+|\s+$/g,"");
}


function initializeCountDowns() {
  jQuery(".countdown").each(function() {
  
    var countdown = {
        init: function() {
            countdown.remaining = countdown.max - jQuery(countdown.obj).val().length;
            if (countdown.remaining > countdown.max) {
                jQuery(countdown.obj).val(jQuery(countdown.obj).val().substring(0,countdown.max));
            }
            var currentText = jQuery(countdown.obj).next('.remaining:eq(0)').html();
            jQuery(countdown.obj).next('.remaining:eq(0)').html(currentText.replace(/([0-9]+)/, countdown.remaining));
        },
        max: null,
        remaining: null,
        obj: null
    };  
    
    jQuery(this).focus(function() {
          var c = jQuery(this).attr("class");
          countdown.max = parseInt(c.match(/limit_[0-9]{1,}_/)[0].match(/[0-9]{1,}/)[0]);
          countdown.obj = this;
          iCount = setInterval(countdown.init,200);
      }).blur(function() {
          clearInterval(iCount);
      });
  });
}

function community_isIE6() {
  return jQuery.browser.msie && /MSIE 6.0/i.test(window.navigator.userAgent) && !/MSIE 7.0/i.test(window.navigator.userAgent) && !/MSIE 8.0/i.test(window.navigator.userAgent);
}
