
// TagCount object  (file: TagCount.js.php)

function TagCount() {

  // private variables
  var keepZeros  = true;       // bool

  // public variables
  this.lexias    = new Array;  // format: this.lexias['tagName'] = ##
  this.documents = new Array;  // format: this.documents['tagName'] = ##
	
  // public functions
	
  this.addTag = function (tagName, numLexias, numDocuments) {
    if (keepZeros) {
      this.lexias[tagName] = (null == numLexias) ? 0 : numLexias;
      this.documents[tagName] = (null == numDocuments) ? 0 : numDocuments;
    } else {
      if (null != numLexias && numLexias > 0) this.lexias[tagName] = numLexias;
      if (null != numLexias && numLexias > 0) this.documents[tagName] = numDocuments;
    }
    if (keepZeros || this.lexias[tagName] || this.documents[tagName]) return true;
    return false;
  }

  this.zeros = function (bool) {
    keepZeros = (true == bool) ? true : false;
    var x;
    if (!keepZeros) {
      for (x in this.lexias) {
        if (this.lexias[x] == 0) delete this.lexias[x];
      }
      for (x in this.documents) {
        if (this.documents[x] == 0) delete this.documents[x];
      }
    }
  }
	
  this.getNumLexias = function (tagName) {
    return (this.lexias[tagName]) ? this.lexias[tagName] : false;
  }
	
  this.getNumDocuments = function (tagName) {
    return (this.documents[tagName]) ? this.documents[tagName] : false;
  }
	
  this.addAmountToLexias = function (tagName, myNum) {
    if (this.lexias[tagName] || this.addTag(tagName)) { 
      if (null == myNum) myNum = 1;
      if (this.lexias[tagName]) this.lexias[tagName] = this.lexias[tagName] + myNum;
    }
  }
	
  this.addAmountToDocuments = function (tagName, myNum) {
    if (this.documents[tagName] || this.addTag(tagName)) { 
      if (null == myNum) myNum = 1;
      if (this.documents[tagName]) this.documents[tagName] = this.documents[tagName] + myNum;
    }
  }
	
} // end object

// add content to object
var numTaggedWith = new TagCount();

numTaggedWith.addTag('art', 7, 3);
numTaggedWith.addTag('choices', 3, 3);
numTaggedWith.addTag('copyleft', 1, 1);
numTaggedWith.addTag('copyright', 3, 3);
numTaggedWith.addTag('Creative Commons', 1, 1);
numTaggedWith.addTag('cyberspace', 1, 1);
numTaggedWith.addTag('defect', 20, 8);
numTaggedWith.addTag('digital', 20, 9);
numTaggedWith.addTag('economies', 1, 1);
numTaggedWith.addTag('economy', 4, 2);
numTaggedWith.addTag('enforceability', 1, 1);
numTaggedWith.addTag('fair use', 2, 2);
numTaggedWith.addTag('freedoms', 1, 1);
numTaggedWith.addTag('galleries', 1, 1);
numTaggedWith.addTag('gift', 2, 1);
numTaggedWith.addTag('illegal', 1, 1);
numTaggedWith.addTag('law', 7, 3);
numTaggedWith.addTag('licenses', 3, 1);
numTaggedWith.addTag('market', 3, 1);
numTaggedWith.addTag('museums', 3, 2);
numTaggedWith.addTag('networks', 7, 5);
numTaggedWith.addTag('online', 4, 3);
numTaggedWith.addTag('openness', 1, 1);
numTaggedWith.addTag('ownership', 2, 2);
numTaggedWith.addTag('property', 5, 3);
numTaggedWith.addTag('remix', 1, 1);
numTaggedWith.addTag('Richard Stallman', 1, 1);
numTaggedWith.addTag('sanctuary', 1, 1);
numTaggedWith.addTag('software', 4, 4);
numTaggedWith.addTag('tax', 1, 1);
numTaggedWith.addTag('value', 11, 3);
