function ttSlideShow (name,imagedisplay,imageset,video){
    this.name=name;
    this.imagedisplay=imagedisplay;
    this.imageset=imageset;
    this.interval=10000;
    this.fadelength=500;
    this.video=video;
}

ttSlideShow.prototype.init = function(){
    this.imagedisplay=document.getElementById(this.imagedisplay);
    this.preloadImages();
    var doc="";
    if (this.video!=""){
      doc='<a href="javascript:replaceVideo();">';
    }
    doc+='<div style="'+(this.startFadeIn ? '' : 'background-image: url('+this.imageset[0].src+'); ')+'background-repeat: no-repeat;" id="'+this.name+'_blenddiv">';
    doc+='<img src="'+this.imageset[0].src+'" style="filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0;" id="'+this.name+'_blendimage" alt="" />';
    doc+='</div>';
    if (this.video!=""){
    doc+="</a>";
    }
    this.imagedisplay.innerHTML=doc;
    this.currentimage=0;
    this.imagedisplay.slideshow=this;
	if (this.startFadeIn){
		opacity(this.name+'_blendimage',0,100,this.fadelength);
	}
    if (this.imageset.length>1){
        this.thread=setInterval("document.getElementById('"+this.imagedisplay.id+"').slideshow.nextImage();",this.interval);
    }
}

ttSlideShow.prototype.preloadImages = function(){
    for (i=0; i<this.imageset.length; i++){
        var image=new Image();
        image.src=this.imageset[i].src;
    }
}

ttSlideShow.prototype.nextImage = function(){
    this.gotoImage((this.currentimage+1) % this.imageset.length);
}

ttSlideShow.prototype.gotoImage = function(index){
    this.currentimage=index % this.imageset.length;
    blendimage(this.name+'_blenddiv',this.name+'_blendimage', this.imageset[this.currentimage].src,this.fadelength);
}

function replaceVideo() {
   var doc='<div class="video_box" style="width:'+area_width+'px;">';
   var area_width=508;
   var area_height=287;
   var sshow=document.getElementById('tmp_slideshow_area').slideshow;
   var src=sshow.video;
   clearInterval(sshow.thread);
   doc+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+area_width+'" height="'+area_height+'"> <param value="/video/FLVPlayer_Progressive.swf" name="movie"> <param value="#ffffff" name="bgcolor"><param value="high" name="quality"> <param value="opaque" name="wmode"> <param value="noscale" name="scale"> <param value="lt" name="salign"> <param value="&amp;MM_ComponentVersion=1&amp;skinName=/video/Corona_Skin_3&amp;streamName='+src+'&amp;autoPlay=true&amp;autoRewind=false" name="FlashVars"> <param value="8,0,0,0" name="swfversion"> <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. --> <param value="/video/expressInstall.swf" name="expressinstall"> <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. --> <!--[if !IE]>--> <object data="/video/FLVPlayer_Progressive.swf" type="application/x-shockwave-flash" width="'+area_width+'" height="'+area_height+'"> <!--<![endif]--> <param value="#ffffff" name="bgcolor"> <param value="high" name="quality"> <param value="opaque" name="wmode"> <param value="noscale" name="scale"> <param value="lt" name="salign"> <param value="&amp;MM_ComponentVersion=1&amp;skinName=/video/Corona_Skin_3&amp;streamName='+src+'&amp;autoPlay=true&amp;autoRewind=false" name="FlashVars"> <param value="8,0,0,0" name="swfversion"> <param value="/video/expressInstall.swf" name="expressinstall"> <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. --> <div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4> <p><a href="http://www.adobe.com/go/getflashplayer"><img alt="Get Adobe Flash player" src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"></a></p></div> <!--[if !IE]>--> </object> <!--<![endif]--> </object>';
   doc+='</div>'; 
   document.getElementById('tmp_slideshow_area').innerHTML=doc;
}
