﻿//<![CDATA[
var __W3CDOM = (document.createElement && document.getElementsByTagName);
var oBrowser = jQuery.browser;
//-
function onChangeMouseOut(e) {
  var control = $(this);
  control.parent().find(control.attr("relatedElement")).val(control.val());
}
//-
function wordWarp(str, m, b, c) {
  var i, j, s, r = str.split("\n");
  if (m > 0) for (i in r) {
    for (s = r[i], r[i] = ""; s.length > m;
            j = c ? m : (j = s.substr(0, m).match(/\S*$/)).input.length - j[0].length
            || m,
            r[i] += s.substr(0, j) + ((s = s.substr(j)).length ? b : "")
        );
    r[i] += s;
  }
  return r.join("\n");
};
//-
function applyCSS3Extender() {
  applyCSS3Extender2("span[class='groupDesc']");
}
function applyCSS3Extender2(selector) {
    $(selector).each(function (events) {
    var text = jQuery.trim(this.innerHTML);
    var owbr;
    //-
    //- Depends if the content are HTML or static text.
    var regExHTML = /(\<[a-z]\>)/g;
    var regExImg = /(<[iI][mM][gG].*?>)/g; // don't want to word wrap images
    var regExStatic = /(.)/g;
    var regLongestStrings = /[a-zA-Z0-9]{25,255}/;
    //-
    var result = text.match(regLongestStrings);
    if (text.match(regExHTML) != null && text.match(regExHTML).length <= 0)
        if(text.match(regExImg) == null)
        this.innerHTML = text.replace(regExStatic, '$1&#8203;');
    else {
      if (text.match(regLongestStrings) == null) return;
      //-
      text = wordWarp(text, 15, "&#8203;", false);
      this.innerHTML = text;
    }
  });
}
//-
$(document).ready(function(e) {
  applyCSS3Extender();
  applyCSS3Extender2("*[jQueryId='forceWordWarp']");
});
//-
//]]>
