var showit=true;
var opcl=true;
var endsh=true;
var refheight;
var refwidth;
var incrm;
var vBut;
var vRes;
var J;
var JJ;
var II;
inw=new Array(12);
inh=new Array(12);
wid=new Array(12);
imgRat=new Array(12);
ihod=new Array(1,-1,-3,-5,1,0,-3,-5,1,-1,-3,-5);
yhod=new Array(1,1,1,1,-10,-12,-10,-10,-23,-23,-23,-23);
//incr1=new Array(3,3,3,3,2,4,3,3,3,3,3,3);
incr1=new Array(3,3,3,3,3,3,3,3,3,3,3,3);
capt=new Array(12);
cap0="<font face=\"arial\" size=\"2\"><b>";
cap1="</b></font>";
function initarrays()
    {
    for (JJ=0; JJ<=11; JJ++)
        {
        vRes=document.images[JJ];
        inw[JJ]=parseInt(vRes.style.left,10);
        inh[JJ]=parseInt(vRes.style.top,10);
        wid[JJ]=parseInt(vRes.height,10);    //alert(vRes.height);
        imgRat[JJ]=parseInt(vRes.width,10)/parseInt(vRes.height,10);
        }
    }
function SelectImage()
    {
    vBut=document.images[II];
	vBut.style.zIndex=+1;
    captxt.innerHTML=cap0+capt[II]+cap1;         
    }
function subChangeSize(incr,inx,iny,hodx,hody)
    {
	vBut.height=vBut.height+incr;
	vBut.width=vBut.height*imgRat[II];
	if (J<100)
	  {
	   vBut.style.top=iny+hody*Math.sqrt(J);
	   vBut.style.left=inx+hodx*J;
	  }
	else
	  {
	   vBut.style.top=iny+hody*Math.sqrt(150-J);
	   vBut.style.left=inx+hodx*(150-J);	  
	  }   
	J=++J;
	GrowImage();
	}	
function ChangeSize()
    {
	if (J<=100)
	     {
		  if (J<=50)
		     {
subChangeSize(incr1[II],inw[II],inh[II],ihod[II],yhod[II]);
        	 }
		  else
		     {
			 J=++J;
			 GrowImage();  
		     }
	     }
	else {
	      if (J<=150) 
	        {         subChangeSize(-incr1[II],inw[II],inh[II],ihod[II],yhod[II]);
			}
		  else 
		    {
			 resetIm();
			 II=II+1;
			 if (II<12)
			    {
				vBut.style.zIndex="-1";
				Mgrow()
				}
			 else
			    {
				 captxt.style.visibility="hidden";
				 //welc.style.visibility="visible";
				 window.setTimeout("Stop()",5000);
				}	
			}	
		  }
	}	
function Mgrow()	
    {
	 if (showit) 
	    {
		welc.style.visibility="hidden";
	    J=1;
	    SelectImage();  
	    GrowImage();
	    }
	}
function GrowImage()
    {if (showit) 
	    {
	     window.setTimeout("ChangeSize()",1);
		 }
	 else 
	     {
		 resetIm();
	     }
    } 
function Stop()
    {
	location="fpage.html";
	}	
function ldir(knd)
   {
   if (document.all)
      {
      if (knd==1)
         {
          top.top1.document.location="../Tag/ietag.html";
         }
      else if (knd==2)
         {
          top.top1.document.location="../Tag/MainTag.html";
         }
      }
   }
function selectPic(Nom)
   {
   if (showit)
      {
      alert('To stop animated show click the red \"Stop\" button');
      }
   else
      {
	  if (opcl)
	     {
	     welc.style.visibility="hidden";
	     II=Nom;
	     J=0;
		 opcl=false;
	     vBut=document.images[II];
		 vBut.style.zIndex=+1;
	     captxt.innerHTML=cap0+capt[II]+cap1;   
	     incrm=incr1[II];
	     OneGrow();
		 }
	  else
	     {
		 if (endsh)
            {
			endsh=false;
			if (J<50)
		        {
			    J=100-J;
			    }
		    OneFade();
			}
		 }	 
	  }	  
   }
function stopShow()
   {
   if (vBut)
	     {
		 vBut.style.zIndex="-1";
		 resetIm();
		 }
   endsh=true; 
   opcl=true;
   if (showit)
      {
	  comm.innerHTML="Click on small pictures to open a larger view and click large pictures to collapse them. Click \"Resume\" to resume automated slide show";
      showit=false;
      swch.src="Pictures/resume.gif";
      swch.width="50";
	  }
   else
      {
	  comm.innerHTML="Click \"Stop\" to stop automated slide show and go to viewing separate pictures.";
	  showit=true;
      swch.src="Pictures/stop.gif";
      swch.width="45";
	  window.setTimeout("ResumeMgrow()",5000);
	  }	  
   }   
function ResumeMgrow()
   {
   if (showit)
      {
	  II=0;
      resetIm();
      window.setTimeout("Mgrow()",1);
	  }
   }   
function resetIm()
   {
   for (JJ=0; JJ<=11; JJ++)
       {
	   vRes=document.images[JJ];
       vRes.height=wid[JJ];      
       vRes.width=wid[JJ]*imgRat[JJ];
       vRes.style.top=inh[JJ];
       vRes.style.left=inw[JJ];
	   };
	J=0;   
   }      
function OneGrow()
    { 
	if (!showit)
	   {
	   window.setTimeout("ChSize()",1);
	   }
	else
	   {
	   resetIm();
	   }   
	}
function ChSize()	
    {
    if (J<=50)
	   {
	   vBut.style.top=inh[II]+yhod[II]*Math.sqrt(J);
	   vBut.style.left=inw[II]+ihod[II]*J;
	   vBut.height=vBut.height+incrm;
       vBut.width=vBut.height*imgRat[II];
	   J=++J;
	   OneGrow();
       }
    }		
function Ch_Size()	
    {
    if (J<=100)
	   {
	   vBut.style.top=inh[II]+yhod[II]*Math.sqrt(100-J);
	   vBut.style.left=inw[II]+ihod[II]*(100-J);
	   vBut.height=vBut.height-incrm;
       vBut.width=vBut.height*imgRat[II];
	   J=++J;
	   OneFade();
       }
	else
	   {
	   resetIm();
	   opcl=true;
	   vBut.style.zIndex="-1";
	   endsh=true;
	   }   
    }		 
function OneFade()
    {
	if (!showit)
	   {
       window.setTimeout("Ch_Size()",1);
	   }
	else
	   {
	   resetIm();
	   }   
    }			 			 

