// -------------------------------------------------------------------------------
//
// Class directoryTree
// Internal Container for business directory
// 
// -------------------------------------------------------------------------------
function populateDirectory(){
	// Add directory Items
	// First  Parameter is the url
	// Second parameter is the Caption
	this.AddItem("Arts and Entertainment","directory.html","arts");
	this.AddItem("Automotive","directory.html","auto");
	this.AddItem("Contractors","directory.html","contractor");
	this.AddItem("Electronics","directory.html","elec");
	this.AddItem("Family and Community","directory.html","fam");
	this.AddItem("Finance and Legal","directory.html","fin");
	this.AddItem("Food and Beverage","directory.html","food");
	this.AddItem("Health and Medicine","directory.html","health");
	this.AddItem("Home and Garden","directory.html","home");
	this.AddItem("Industrial Supplies","directory.html","indus");
	this.AddItem("Investment and Insurance","directory.html","ins");	
	this.AddItem("Manufacturing","directory.html","mf");	
	this.AddItem("Professional Services","directory.html","service");
	this.AddItem("Real Estate","directory.html","re");
	this.AddItem("Shopping and Specialy Stores","directory.html","shopping");
	this.AddItem("Sports and Recreation","directory.html","sports");
	this.AddItem("Travel and Accommodations","directory.html","travel");
	this.AddItem("Transportation","directory.html","transport");
}


function directoryTree(dirActive) {
  
  this.directoryContent = new Array();
  this.directoryActive  = dirActive;
  this.DisplayContent   = displayData;
  this.AddItem          = addItem;
  this.PopulateItems    = populateDirectory;
  
  this.PopulateItems();
  
}

function displayData() {
   
   for (i=0;i <this.directoryContent.length;i++){
   
    document.write('<tr valign="top"><td class="');
    if ((i % 2) == 0){
       document.write('directoryOdd');
    } else {
       document.write('directoryEven');
    }
    
    if (!this.directoryActive){
     document.write('"><a href="'+this.directoryContent[i]._itemURL+'#'+this.directoryContent[i]._itemHint+'"');
    } else {
     document.write('"><a href="#" onClick="showLink(\'#'+this.directoryContent[i]._itemHint+'\')"');
    }
    document.write(' class="menu">');
    document.write(''+this.directoryContent[i]._itemCaption+'</a></td></tr>');   
    
  }
}

function addItem(itemType, itemCaption, itemURL) {
  this.directoryContent[this.directoryContent.length] = new directoryItem(itemType, itemCaption, itemURL);
}



function directoryItem(itemCaption, itemURL, itemHint) {
  this._itemCaption = itemCaption;
  this._itemURL     = itemURL;
  this._itemHint    = itemHint;
}

