

var first=0;
var otherfirst=0;
var win;
var num = 0;
var sectionNumber = new Array();
var maindoc;
var impElement = new Array();
var aSet;
var sectionTitle = new Array();



function makewin(t)
{

  if(first==0)
  {

	var link = new Array();
	maindoc = t.document;
	
   	win = window.open("", "", "width=700,height=100,resizable=yes,scrollbars=yes");
	d = win.document;
	d.write('<html><head><title></title></head><body onunload="opener.first=0;"><span id="placeholder">Table of Contents</span></body></html>');
	d = win.document;
	var toc = d.createElement("div");


    toc.style.backgroundColor = "white";
    toc.style.fontFamily = "sans-serif";

    var anchor = d.createElement("a"); 
    toc.appendChild(anchor);                   

    anchor.appendChild(d.createTextNode("Table Of Contents"));

    var table = d.createElement("table");
    toc.appendChild(table);

    var tbody = d.createElement("tbody");
    table.appendChild(tbody);

    var sectionNumbers = [0,0,0,0,0,0];


    addSections(this.document.body, tbody, sectionNumbers);


    replace = d.getElementById("placeholder");
    replace.parentNode.replaceChild(toc, replace);


    function addSections(n, toc, sectionNumbers) 
	{
        
        
        for(var m = n.firstChild; m != null; m = m.nextSibling) 
		{


            if ((m.nodeType == 1) &&  (m.tagName.length == 2) && (m.tagName.charAt(0) == "H")) 
			{
		
                var level = parseInt(m.tagName.charAt(1));
                
             		if (!isNaN(level) && (level >= 1) && (level <= 6)) 
					{
		    
		        	sectionNumbers[level-1]++;
		    
		      		for(var i = level; i < 6; i++) sectionNumbers[i] = 0;

		    		sectionNumber[num] = "";
		    		for(var i = 0; i < level; i++) 
						{
						sectionNumber[num] += sectionNumbers[i];
						if (i < level-1) sectionNumber[num] += ".";
		   		 		}
					
				
				impElement[num] = m;
				impElement[num].setAttribute("id",("SECT"+sectionNumber[num]));
					
				sectionTitle[num] = getTextContent(impElement[num]);
		
				if(otherfirst==0)
				{
				impElement[num].insertBefore(this.document.createTextNode(sectionNumber[num]+": "),m.firstChild);
		   		}
		    	var row = d.createElement("tr");
		    
		   		var col1 = d.createElement("td");
		   		var col2 = d.createElement("td");

		   		col1.setAttribute("align", "left");
				var theone = d.createTextNode(sectionNumber[num])
		   		 	col1.appendChild(theone);

					
					link[num] = d.createElement("a");

		    		link[num].appendChild(d.createTextNode(sectionTitle[num]));
					

		    		link[num].setAttribute("name","SECT"+sectionNumber[num]);
		    		link[num].setAttribute("href","");
		  		  	col2.appendChild(link[num]);
					
					
		  		row.appendChild(col1);
		   		row.appendChild(col2);
		   		toc.appendChild(row);
					 
					
				num +=1;
			   }
 
            		}
	    		else 
			{ 
			addSections(m, toc, sectionNumbers);
	    		}
		   			   
        }
    }


    function getTextContent(n) 
    {   
        var s = '';
        var children = n.childNodes;
        for(var i = 0; i < children.length; i++) 
		{	
            var child = children[i];
            if (child.nodeType == 3) s += child.data;
            else s += getTextContent(child);
        }
        return s;
    }
		

  }
  first=1;
  otherfirst=1;
  
    
  	aSet = d.getElementsByTagName("a")
	
	for(w=1;w<aSet.length;w++)
	{
	
  	aSet[w].onclick=function(){(maindoc.getElementById(this.name)).scrollIntoView(true); return false;}
	
  	}
	d.close();
}
function closeThem()
{
	if(win) win.close();
	
   	
	
	
}