/*======================================================================*\
|| #################################################################### ||
|| # Character Counter for vBulletin 3.6.1 and above.                 # ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2003-2008 CueBlip Media, Inc. All Rights Reserved.    # ||
|| # This file may not be redistributed in whole or significant part  # ||
|| # without express written consent from the author.                 # ||
|| #                                                                  # ||
|| # ---------------------- DETAILS AND SUPPORT --------------------- # ||
|| # Release Date: February 12, 2007                                  # ||
|| # http://www.vbulletin.org/forum/showthread.php?t=170323           # ||
|| #################################################################### ||
\*======================================================================*/

function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function CharacterCounter(entrance,exit,exit2,text,text2,characters) {
  var entranceObj=getObject(entrance);
  var exitObj=getObject(exit);
  var exitObj2=getObject(exit2);
  var length=characters - entranceObj.value.length;
  var length2=entranceObj.value.length;
  if(length <= 0) {
    length=0;
    text='<span class="CounterDisabled"> '+text+' </span>';
    entranceObj.value=entranceObj.value.substr(0,characters);
  }
  exitObj.innerHTML = text.replace("{CHAR}",length);
  exitObj2.innerHTML = text2.replace("{CHAR2}",length2);
}

