/**
 * inline List HTML display
 * Geoff Groskreutz - April 2003
 * Copyright (c) 2003 VersiFit Technologies LLC 
 * 
 * This control Renders an inline set of lists that can be either Horizontal or Vertical
 * in orientation (or any combination), these lists can contain items which
 * can consist of hyperlinks, images, or just text. This control is pure client
 * side script and can be populated by a separate script file, so it can be
 * customized across the whole site without having to update every page each time
 * a change is required. Extensive stylesheet support allows easy item manipulation.
 * 
 */
 function inlineList(bgcolor, border, cellpadding, cellspacing, height, width, classname, style){
   this.parent = null;
   this.lists = new Array();
   this.count = 0;
   this.bgcolor = bgcolor;
   this.border = (border?border:0);
   this.cellpadding = (cellpadding?cellpadding:0);
   this.cellspacing = (cellspacing?cellspacing:0);
   this.height = height;
   this.width = width;
   this.classname = classname;
   this.style = style;
   this.Add = il_add_list;
   this.Render = il_render_lists;
   this.RemapIds = il_remap_list_ids;
   this.Write = il_write_lists;
 }
 function il_list(parent, bgcolor, border, cellpadding, cellspacing, height, width, align, valign, orientation, onnewline, classname, style){
   this.parent = parent;
   this.id = null;
   this.items = new Array();
   this.count = 0;
   this.bgcolor = bgcolor;
   this.border = (border?border:0);
   this.cellpadding = (cellpadding?cellpadding:0);
   this.cellspacing = (cellspacing?cellspacing:0);
   this.height = height;
   this.width = width;
   this.align = align;
   this.valign = valign;
   this.orientation = (orientation?orientation:"h");
   this.onnewline = (onnewline?onnewline:false);
   this.classname = classname;
   this.style = style;
   this.Add = il_add_item;
   this.Render = il_render_items;
   this.RemapIds = il_remap_item_ids;
 }
 function il_item(parent, text, href, src, title, imgalign, bgcolor, height, width, align, classname, style){
   this.parent = parent;
   this.id = null;
   this.text = text;
   this.href = href;
   this.src = src;
   this.title = title;
   this.imgalign = imgalign;
   this.bgcolor = bgcolor;
   this.height = height;
   this.width = width;
   this.align = (align?align:"left");
   this.classname = classname;
   this.style = style;
   this.Render = il_render_item;
 }
 function il_add_list(bgcolor, border, cellpadding, cellspacing, height, width, align, valign, orientation, onnewline, classname, style){
   this.lists[this.count] = new il_list(this, bgcolor, border, cellpadding, cellspacing, height, width, align, valign, orientation, onnewline, classname, style);
   return this.lists[this.count++];
 }
 function il_add_item(text, href, src, title, imgalign, bgcolor, height, width, align, classname, style){
   this.items[this.count] = new il_item(this, text, href, src, title, imgalign, bgcolor, height, width, align, classname, style);
   return this.items[this.count++];
 }
 function il_render_lists(){
   var outputstr = "";
   if (this.count){
     this.RemapIds();
     outputstr = "<table"
     +((this.cellpadding != null)?" cellpadding='"+this.cellpadding+"'":"")
     +((this.cellspacing != null)?" cellspacing='"+this.cellspacing+"'":"")
     +((this.border != null)?" border='"+this.border+"'":"")
     +((this.bgcolor)?" bgcolor='"+this.bgcolor+"'":"")
     +((this.height != null)?" height='"+this.height+"'":"")
     +((this.width != null)?" width='"+this.width+"'":"")
     +((this.classname)?" class='"+this.classname+"'":"")
     +((this.style)?" style='"+this.style+"'":"")
     +">";
     for (var i = 0; i < this.count; i++)
       outputstr += this.lists[i].Render();
     outputstr += "</table>";
   }
   return outputstr;
 }
 function il_render_items(){
   var outputstr = "";
   if (this.onnewline && this.id > 0)
     outputstr = "</td></tr><tr><td"+((this.valign)?" valign='"+this.valign+"'":"")+">";
   else if(this.id == 0)
     outputstr = "<tr><td"+((this.valign)?" valign='"+this.valign+"'":"")+">";
   if (this.count){
     this.RemapIds();
     outputstr += "<table"
     +((this.cellpadding != null)?" cellpadding='"+this.cellpadding+"'":"")
     +((this.cellspacing != null)?" cellspacing='"+this.cellspacing+"'":"")
     +((this.border != null)?" border='"+this.border+"'":"")
     +((this.bgcolor)?" bgcolor='"+this.bgcolor+"'":"")
     +((this.height != null)?" height='"+this.height+"'":"")
     +((this.width != null)?" width='"+this.width+"'":"")
     +((this.align)?" align='"+this.align+"'":"")
     +((this.classname)?" class='"+this.classname+"'":"")
     +((this.style)?" style='"+this.style+"'":"")
     +">";
     if (this.orientation && String(this.orientation).charAt(0).toLowerCase() == "v"){
       for (var i = 0; i < this.count; i++)
         outputstr += "<tr>"+this.items[i].Render()+"</tr>";
     }
     else {
       outputstr += "<tr>";
       for (var i = 0; i < this.count; i++)
         outputstr += this.items[i].Render();
       outputstr += "</tr>";
     }
     outputstr += "</table>";
   }
   if (this.id == this.parent.count-1)
     outputstr += "</td></tr>";
   return outputstr;
 }
 function il_render_item(){
   var outputstr = "";
   if (this.text || this.src){
     outputstr = "<td"
     +((this.bgcolor)?" bgcolor='"+this.bgcolor+"'":"")
     +((this.height != null)?" height='"+this.height+"'":"")
     +((this.width != null)?" width='"+this.width+"'":"")
     +((this.align)?" align='"+this.align+"'":"")
     +((this.valign)?" valign='"+this.valign+"'":"")
     +((this.classname)?" class='"+this.classname+"'":"")
     +((this.style)?" style='"+this.style+"'":"")
     +">";
     if (this.href)
       outputstr += "<a href='"+this.href+"'"
        +((this.title)?" title='"+this.title+"'":"")
        +">";
     if (this.src)
       outputstr += "<img border=0 src='"+this.src+"'"
        +((this.imgalign)?" align='"+this.imgalign+"'":"")
        +((this.title)?" alt='"+this.title+"'":"")
        +"/>";
     if (this.text)
       outputstr += this.text;
     if (this.href)
       outputstr += "</a>";
     outputstr += "</td>";
   }
   return outputstr;
 }
 function il_write_lists(targetElement){
   if (targetElement){
     var targetObject = document.getElementById(targetElement);
     if (targetObject && targetObject.innerHTML != null)
       targetObject.innerHTML = this.Render();
   }
 }
 function il_remap_list_ids()
 {
   for (var i = 0; i < this.count; i++)
     this.lists[i].id = i;
 }
 function il_remap_item_ids()
 {
   for (var i = 0; i < this.count; i++)
     this.items[i].id = i;
 }