

  function hello(){ 
          alert('Web Servants: Paul A. Norman and Michael F. To\'o\n\nhttp://PaulANorman.com\n\nP.O. Box 1005 Nelson 7015 New Zealand South Pacific\n\nGSM Text: +64 21 782 433');
       window.event.cancelBubble = true;
     return(false);
}
var tabs, displays, currentDisplay, showPicts;


function init()
{
  waiting.style.display='none';
	
if (! ie4){alert('Hello,\n\nThis Page is Best Viewed in Internet Explorer 6.0\n\nWill Redirect you to the page of Soap PDFs (Acrobat Reader is needed)');
	document.location.href="http://soap.paulanorman.com";
	return;}
	
	window.resizeTo(800, 600); 
	       //set style attributes not set for CSS usage in Moz and Netscape 
              menuTabs.style.width="599"; 
              menuTabs.style.height="83px";
							menuTabs.style.display ="block";
              whichChapter.style.width="162";
							 whichChapter.style.height="454";
							 whichChapter.style.display ="block";
							 
	displays = document.all("display");
	classUpto = 1;
  tabUpto =1;
 //DISPLAY height : 369px; width : 599px; padding : 15 20 15 12;
  for (i=0; i < displays.length; i++)
	 {	
       //set style attributes not set for CSS usage in Moz and Netscape
			 
			 	 displays.item(i).style.height ="369px";
				 displays.item(i).style.width ="599px";
	       //displays.item(i).style.padding  =" 15 20 15 12";
				 
	     newTab = document.createElement("SPAN");
			 newTab.innerText=displays.item(i).tabText;
			 newTab.setAttribute("identifier", displays.item(i).tabText);
			 newTab.id="tab";
			
			 					tabTitle =  displays.item(i).getAttribute("tabTitle");
				  if (tabTitle != null)
					{
					newTab.setAttribute("title",tabTitle);
					}

			 
			 menuTabs.appendChild(newTab);
			 
			chapterName = displays.item(i).getAttribute("chapterName");
	
			   if (chapterName != null)
		   	   {
		    		 classUpto=1; //resets the tab className numbering
			    	 tabUpto =1;
			    	 newTab.setAttribute("chapterName",chapterName);
				 
				     chapterTitle =  displays.item(i).getAttribute("chapterTitle");
				       if (chapterTitle != null)
					         {
					           newTab.setAttribute("chapterTitle",chapterTitle);
					          }	
 			      }
				 
						 if (classUpto > 15)// 15 is the max predefined colour schemes for tabs
			      {classUpto=1;} 
						
						newTab.className = "tab"+ classUpto;
						newTab.innerText =tabUpto +'. '+newTab.innerText;
								newTab.setAttribute("backgroundColor",newTab.currentStyle.backgroundColor);
								newTab.UNSELECTABLE = "on";

						classUpto++;
						tabUpto++;
	      }
				
  tabs = document.all("tab");	
	//alert(displays.length);
	
 currentDisplay = displays.item(0);

  for (i=0; i < displays.length; i++)
	      {
				backColour = tabs.item(i).currentStyle.backgroundColor;
				
				//displays.item(i).style.backgroundColor =backColour;
				tabs.item(i).style.borderColor =backColour;
				//displays.item(i).style.borderColor =backColour;
				//displays.item(i).style.scrollbarBaseColor =backColour;
				//turn off all display blocks, left on for Netscape / Mozilla display
				displays.item(i).style.display="none";
				foreColour = tabs.item(i).currentStyle.color;				
				//displays.item(i).style.color =foreColour;
				
				}
			chaptNumber=0;	
			chapterCol = 16;
	  for (i=0; i < tabs.length; i++)
	      {		
				   newChapter =	tabs.item(i).getAttribute("chapterName");
				   if (newChapter != null)
				   {
				     chaptNumber++; 
						 chapterCol--;
						 
							if (chapterCol == 0) 
							{chapterCol = 15;}
							
               chapter = "c_"+ chaptNumber;

				        newOption = document.createElement('div');

					      whichChapter.appendChild(newOption);
					    newOption.innerText = newChapter;
					   newOption.setAttribute("value", chapter);
						
// 						Used for finding the chapter in artifical links
						newOption.setAttribute("chapterName", newChapter);
						
					  newOption.className ="chapterMenuItem tab" + chapterCol;
					 newOption.UNSELECTABLE = "on";
					
	          chapterTitle =	tabs.item(i).getAttribute("chapterTitle");
			        	if (chapterTitle != null)
				           {
	                    newOption.setAttribute("title",chapterTitle);
				           }
				 
	
			}
						  tabs.item(i).setAttribute("chapter", chapter);
	
				// hide all tabs that are not chapter One
				      if (chapter != "c_1")
				         {tabs.item(i).style.display='none';
								 }
			}	
		writeImageDisplay('Picture List');	
		
whichChapter.childNodes(0).click();
}

function chooseChapter(chosenChapter)
{

	 firstSpan=0;
 for (i=0; i<tabs.length; i++)
   {

	 thisTab = tabs.item(i);
	   if (thisTab.chapter == chosenChapter)
		  {thisTab.style.display='inline';
			firstSpan++;  
			 if (firstSpan==1)
			       {
							pageChosen(thisTab);
						  }
				
			 }
			 else
			 {thisTab.style.display='none';}
	 }
}

function pageChosen(clicked)
    {
					where = (clicked.sourceIndex - menuTabs.sourceIndex) -1;
            currentDisplay.style.display ='none';
              currentDisplay = displays.item(where);
                currentDisplay.style.display ='block';
							//	 panelArea.runtimeStyle.backgroundColor = tabs.item(where).backgroundColor;
		}						


function showTab(what, tabInnerText)
	 {
				
	for (i=0; i< menuTabs.childNodes.length; i++)
	      {
				   thisTab = menuTabs.childNodes(i);
					 //alert(thisTab.style.display);
				if (thisTab.style.display != 'none')
				    {
						if (tabInnerText.toLowerCase() == thisTab.identifier.toLowerCase())
						     {
								 thisTab.click();
								    return;
									}
						}
				} 	
	 }

function chooseChapterAndTab(chapterText, tabText)
 {

	 for (i=0; i<whichChapter.childNodes.length; i++)
   {

	 thisChapt = whichChapter.childNodes(i);
   //alert('>'+thisChapt.innerText+'<'+'\n\n>'+chapterText+'<');
	   if (thisChapt.innerText.toLowerCase() == chapterText.toLowerCase())
	      {
				thisChapt.click();
				break;
				}
		
		}
    
	 showTab(null, tabText);
 }	 
 
 function writeImageDisplay(tabsText)
  {
	
	var buildHTML = '<h3>Please Click To See Image\'s Page</h3>';
	 
       for (i=0; i <	displays.length ; i++)
			   {
				 if (displays(i).chapterName != null)
				        {chapterName = displays(i).chapterName;}
							jump = ' onclick="JavaScript:chooseChapterAndTab(\''+ chapterName+'\',\''+ displays(i).tabText+'\')" ';	
		  //   alert(buildHTML); 
				    pictures = displays(i).all('pict');
						if (pictures != null)
						    {
								 if (pictures.length == null)
								 {
								 buildHTML += '<img '+jump+' style="width:100; height:100; cursor:hand" src="'+pictures.src+'" alt="'+displays(i).tabText+'\n\n'+displays(i).tabTitle+'\n\n'+pictures.alt+'">&nbsp;&nbsp;';
								 }
								 else
								 for (j = 0; j < pictures.length  ; j++)
							     {
								 buildHTML += '<img '+jump+' style="width:100; height:100; cursor:hand" src="'+pictures(j).src+'" alt="'+displays(i).tabText+'\n\n'+displays(i).tabTitle+'\n\n'+pictures(j).alt+'">&nbsp;&nbsp';;
                   }
								 }// if (pictures != null)
								//	alert(displays(i).tabText);
	          if (displays(i).tabText == tabsText)	//"Picture List"	
						      {
									showPictures = displays(i);
									//alert('tabsText');
									 } 			 
				 
				 }// end for (i=0; i <	displays.length; i++)
			showPictures.innerHTML = 	buildHTML ;
	}// END; function writeImageDisplay(tabsText) 