var NoOfLines = 0;

maxPages = i;

initializeOptionBox();

function initialize()
{
	document.getElementById("selectPage").selectedIndex = 0;
	showPictures();
}

function initializeOptionBox()
{
	for (i=0;i<pagetab.length;i++)
	{
   		  aSelect = document.getElementById("selectPage");
    	  anOption = document.createElement("option");
		  anOption.value = indextab[i];
		  aText = document.createTextNode(pagetab[i]);
		  anOption.appendChild(aText);	   	
		  aSelect.appendChild(anOption);

   		  aSelect = document.getElementById("selectPageBottom");
    	  anOption = document.createElement("option");
		  anOption.value = indextab[i];
		  aText = document.createTextNode(pagetab[i]);
		  anOption.appendChild(aText);	   	
		  aSelect.appendChild(anOption);
	}
}

function showPictures()
{

   document.getElementById("selectPageBottom").selectedIndex = document.getElementById("selectPage").selectedIndex;
   myPageIndex = document.getElementById("selectPage").selectedIndex;

   for (i=NoOfLines;i>0;i--)
   { 
  	  document.getElementById("picturetab").deleteRow(-1);
   }

   NoOfLines = 0 

   for (i=0;i<parttab1.length;i++)
   {

	  if (parttab1[i] == myPageIndex)
	  {
 	   	  aTR = document.getElementById("picturetab").insertRow(-1);
    	  aTD = document.createElement("td");
		  aTD.align = "center";
		  aTD.style.background="#000050";
		  aTD.className="myTitleStyle";
     	  aBR = document.createElement("br");
    	  aTD.appendChild(aBR);

 		  aText = document.createTextNode(parttab3[i]);
    	  aTD.appendChild(aText);
    	  aBR = document.createElement("br");
    	  aTD.appendChild(aBR);
   	  	  aBR = document.createElement("br");
    	  aTD.appendChild(aBR);
   	  	  aTR.appendChild(aTD); 
		  NoOfLines++;
		  		  
 	   	  aTR = document.getElementById("picturetab").insertRow(-1);
    	  aTD = document.createElement("td");
		  aTD.style.background="#AAFF22";
		  aTD.align = "center";
	  	  if (! (parttab4[i] == "600"))
		  { 
     	  	aBR = document.createElement("br");
    	  	aTD.appendChild(aBR);
		  }
    	  img = document.createElement("img");
		  img.src = parttab2[i];
		  if (parttab4[i] == "600") img.width = "600";
    	  aTD.appendChild(img);
   	  	  if (! (parttab4[i] == "600"))
		  { 
     	  	aBR = document.createElement("br");
    	  	aTD.appendChild(aBR);
     	  	aBR = document.createElement("br");
    	  	aTD.appendChild(aBR);
		  }

    	  aTR.appendChild(aTD);  
		  NoOfLines++;
	  }
   }
}

function showPicturesBottom()
{
	   document.getElementById("selectPage").selectedIndex = document.getElementById("selectPageBottom").selectedIndex;
	   showPictures();
}


