

//==================================================================
//==================================================================
//==================================================================

var imgpreload=new Array()
for (i=0;i<=picture.length;i++) 
{
	imgpreload[i]=new Image()
	imgpreload[i].src=picture[i]
}

var picturewidth
var pictureheight
var i_loop=0
var i_picture=0
var width_slice
var cliptop=0
var clipbottom
var i_clipright=1
var content=""
pause=pause*1000

window.onresize=initiate2
var timer

function initiate2() {
	i_loop=0
	i_picture=0
	cliptop=0
	clipbottom=0
	i_clipright=1
	content=""
	clearTimeout(timer)
	initiate()
}
function initiate() {
	getcontent()

horizontal_pos=(document.body.clientWidth-imgpreload[0].width)/2 
	
	     for (i=0;i<=x_slices;i++) 
	     {
            thisinners=document.getElementById("s"+i)
            thisinners.innerHTML=content
            thiss=thisinners.style
            thiss.left=horizontal_pos
            thiss.top=vertical_pos
        }
        thisspan = document.getElementById("s"+0)
		  picturewidth=thisspan.offsetWidth 
		  pictureheight=thisspan.offsetHeight
		
      width_slice=Math.ceil(picturewidth/x_slices)
      clipbottom=pictureheight
        
        oWhole=document.getElementById("whole")
        oWhole.style.left=horizontal_pos
		  oWhole.style.top=vertical_pos
	    i_picture++
	    openlamellar()
    
}


function openlamellar()
{
	clipleft=-width_slice
	clipright=0
    if (i_clipright<=width_slice) 
    {
        for (i=0;i<=x_slices;i++) 
        {
            thisinners=document.getElementById("s"+i)
            thiss=thisinners.style
            thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
            clipleft+=width_slice
            clipright=clipleft+i_clipright
		    }
      i_clipright++
      timer=setTimeout("openlamellar()",20)
   	}
   	else 
   	{
		clearTimeout(timer)
		oWhole=document.getElementById("whole")
		oWhole.innerHTML=content
		timer=setTimeout("changepicture()",pause)
	  }
}


function getcontent() 
{
    content="<a href="+pictureurl[i_picture]+" target="+target_url+">"
    content+="<img alt="+alts[i_picture]+" src="+picture[i_picture]+" border=0>"
    content+="</a>"
}


function changepicture() 
{	
	i_clipright=0
	clipleft=0
	clipright=0
	for (i=0;i<=x_slices;i++) 
	{
     	thisinners=document.getElementById("s"+i)
      thiss=thisinners.style
    	thiss.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
	}
	if (i_picture>picture.length-1) {i_picture=0}
	
	getcontent()

	for (i=0;i<=x_slices;i++) 
	{
        thisinners=document.getElementById("s"+i)
        thisinners.innerHTML=content   
  }
	i_picture++
	openlamellar()
}


document.write("<span id='whole' class='s'></span>")
for (i=0;i<=x_slices;i++) 
{
 	document.write("<span id='s"+i+"' class='s'></span>")
}

//document.close()
//window.onload=initiate