function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function textCounter(field,counter,maxlimit,linecounter) {
  // text width//
  var fieldWidth =  parseInt(field.offsetWidth);
  var charcnt = field.value.length;
  var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
  if (linecounter) {
    document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
    document.getElementById(linecounter).style.width =  parseInt(fieldWidth)+"px";
    document.getElementById(counter).innerHTML="<nobr>Max: "+percentage+"% - ("+charcnt+"/"+maxlimit+")</nobr>";
  } else {
    // trim the extra text
    if (charcnt > maxlimit) {
      field.value = field.value.substring(0, maxlimit);
    } else {
      // progress bar percentage
      document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
      document.getElementById(counter).innerHTML="<nobr>Max: "+percentage+"% - ("+charcnt+"/"+maxlimit+")</nobr>";
      // color correction on style from CCFFF -> CC0000
      document.getElementById(counter).style["background-color"] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
    }
  }
}