//slideshow configuration done in c_slideshow.php
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var tl_html='<table cellspacing="0" cellpadding="0" align="center"><tr><td style="background:url(\'/images/border/tl.gif\') bottom right no-repeat;height:12px;width:12px;"></td>';
var t_html='<td style="background:url(\'/images/border/top.gif\') bottom repeat-x;height:12px;"></td>';
var tr_html='<td style="background:url(\'/images/border/tr.gif\') bottom left no-repeat;height:12px;width:12px;"></td></tr>';
var l_html='<tr><td style="background:url(\'/images/border/left.gif\') right repeat-y;width:12px;"></td>';
var r_html='<td style="background:url(\'/images/border/right.gif\') left repeat-y;width:12px;"></td></tr>';
var bl_html='<tr><td style="background:url(\'/images/border/bl.gif\')  top right no-repeat;height:12px;width:12px;"></td>';
var b_html='<td style="background:url(\'/images/border/bottom.gif\') top repeat-x;height:12px;"></td>';
var br_html='<td style="background:url(\'/images/border/br.gif\') top left no-repeat;height:12px;width:12px;"></td></tr></table>';


////////////////////////////////////////////////////////////

var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}

var ie4=document.all
var dom=document.getElementById

if (ie4||dom)
document.write('<div style="text-align:center;vertical-align:middle;position:relative;width:747px;height:303px;overflow:hidden"><div  id="canvas0" style="text-align:center;vertical-align:middle;position:absolute;width:747px;height:303px;top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="text-align:center;vertical-align:middle;position:absolute;width:747px;height:303px;top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')

var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=0
var fadetimeinterval=25//ms
var fadestep=10//pct to fade ea. interval

function fadepic(){
if (curpos<100){
curpos+=fadestep
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=Math.min(curpos,99)/100
}
else{
clearInterval(dropslide)
setTimeout("fadeout()",pause)
}
}

function fadepicdown(){
if (curpos>0){
curpos-=fadestep
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
rotateimage();
}
}

function fadeout(){
var temp='setInterval("fadepicdown()",fadetimeinterval)'
dropslide=eval(temp)

}


function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",fadetimeinterval)'
dropslide=eval(temp)
curcanvas="canvas0";
tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
tempobj.innerHTML=tl_html+t_html+tr_html+l_html+'<td align="center" valign="middle"><img style="padding:0px;border:none;" src="'+fadeimages[nextimageindex]+'"></td>'+r_html+bl_html+b_html+br_html;
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}

function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<div align="center" valign="middle" style="padding:0px;background:url(\'images/ss-top.jpg\') center bottom no-repeat;" width="747" height="13">&nbsp;</div><div align="center" valign="middle" style="padding:0px;background:url(\'images/ss-bg.jpg\') center center repeat-y;" width=747 height=303><img style="padding:0px;border:none;" src="'+fadeimages[curimageindex]+'"></div><div align="center" valign="middle" style="padding:0px;background:url(\'images/ss-bottom.jpg\') center top no-repeat;" width=747 height=13>&nbsp;</div>'
rotateimage()
}

if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
