<!--
var W3CDOM = (document.createElement && document.getElementsByTagName);

addEvent(window, 'load', initCollapsingRows);

// This is the path to the images relative to the HTML file
// Ex. If your HTML file is at /files/Index.html
//     and your JavaScript and images are in /files/collapsible/
//     then the path here would be "collapsible/" 
var pathToImages = "/images/";

function addEvent(obj, eventType,fn, useCapture)
{
	if (obj.addEventListener) {
		obj.addEventListener(eventType, fn, useCapture);
		return true;
	} else {
		if (obj.attachEvent) {
			var r = obj.attachEvent("on"+eventType, fn);
			return r;
		}
	}
}

// this function is needed to work around 
// a bug in IE related to element attributes
function hasClass(obj) {
   var result = false;
   if (obj.getAttributeNode("class") != null) {
       result = obj.getAttributeNode("class").value;
   }
   return result;
}  

function toggleVisibility() {

    var theImage = this;
    var theRowName = this.id.replace('_image', '_comment');
	var theRow = document.getElementById(theRowName);
	var theRowNumber = theRowName.replace('_comment','');	
	theRowNumber = theRowNumber.replace('row_','');
	var k = parseInt(theRowNumber)
	var test
	var elementid 
	
			if (theRow.style.display=="none") {
			 //parseInt(theRowNumber)+7
				for (k; k < parseInt(theRowNumber)+8; k++){
					elementid = "row_"+k+"_comment";
					test = document.getElementById(elementid);
					if (test) {
						test.style.display = "";
					}
					theImage.src = pathToImages + "btnSubtract.gif";
				}
			} else {
				for (k; k < parseInt(theRowNumber)+8; k++){
					elementid = "row_"+k+"_comment";
					test = document.getElementById(elementid);
					if (test) {
						test.style.display = "none";
					}
					theImage.src = pathToImages + "btnSubtract.gif";
				}			

				theImage.src = pathToImages + "btnAdd.gif";
				
			}
}

function insertExtraCells(theTable) {

    // get reference to all of the tbody's, thead's, and tfoot's
    var tbodies = theTable.getElementsByTagName('tbody');
    var theads = theTable.getElementsByTagName('thead');
    var tfoots = theTable.getElementsByTagName('tfoot');

    insertInto(theads, 'th');
    insertInto(tbodies, 'td');
    insertInto(tfoots, 'td');    
    
}

function insertInto(parentCollections, typeOfCell) {
    // loop through all of the parent collections passed in
    for (var m = 0; m < parentCollections.length; m++) {

        // get all of the rows for each collection
        var trs = parentCollections[m].getElementsByTagName('tr');
        
        // loop through each of the rows
        for (i=0;i<trs.length;i++) {
            // create a new cell
            var theNewCell = document.createElement(typeOfCell);
            
            // insert the new cell before the first child
            var cells = trs[i].getElementsByTagName(typeOfCell);
            trs[i].insertBefore(theNewCell, cells[0]);
        }
    }
}

function initCollapsingRows()
{
	if (!W3CDOM) return;

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = true;  

    // get a list of all the tables
    var tables = document.getElementsByTagName('table');

    // if there aren't any tables exit
    if (tables.length==0) { return; }

    // and iterate through them...
    for (var k = 0; k < tables.length; k++) {
        
        // if the table has a class
        if (hasClass(tables[k])) {
            
            // if that class is "collapsible"
            if (tables[k].getAttributeNode('class').value.indexOf('collapsible')!=-1) {
                
                // since we are adding a graphic for expanding and collapsing
                // the rows in the first column of the table, we need to add
                // an extra column everywhere
                insertExtraCells(tables[k]);

                var tbodies = tables[k].getElementsByTagName('tbody');

                // iterate through the bodies...
                for (var h = 0; h < tbodies.length; h++) {
          
                    // find all the &lt;tr&gt; elements... 
                    var trs = tbodies[h].getElementsByTagName('tr');
					//If trs > 8 then allow visibility toggle
        			if (trs.length > 8){
						// ... and iterate through them
						for (var i = 0; i < trs.length; i++) {

							if (i%8==0) {
								// Get a reference to the TD's 0 refers to the column number
								var td = trs[i].getElementsByTagName('td')[0];
		
								// Assign a related unique ID to the next row where the comment is
								// This is the row that will be expanded and collapsed
								var theRowName = "row_" + i + "_comment";
								var j=0
								trs[i+1].id = theRowName								
								trs[i+1].style.display = "none";
								for (j = 2; j < 8; j++) {
									trs[i+j].id = "row_" + parseInt(i+j) + "_comment";									
									trs[i+j].style.display = "none";
								}
								
								// Create the new image object
								var theNewImage = document.createElement('img');
								var theNewImageName = "row_" + i + "_image";
								theNewImage.id = theNewImageName;
								theNewImage.src = pathToImages + "btnAdd.gif";
								theNewImage.alt = "Show/Hide Details"
								theNewImage.width = 55;
								theNewImage.height = 16;
								theNewImage.style.margin = "5px";
								theNewImage.style.cursor = "pointer";
								
								// Add "onclick" event to the image that expands and collapses the next row
								theNewImage.onclick = toggleVisibility;
		
								// Insert an image into the document tree inside the first TD
								td.appendChild(theNewImage);
								td.style.width="1%"
		
								// Skip the collapsbile row
								i++;
							}	
                    	}
					}	
                }
            }
        } 
        // Reset "even" for the next table
        even = true;
    } // End for loop  
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//-->