		var i = 1;
		var iss;
		var jss = 1;
		var pss = Picture.length-1;

		var preLoad = new Array();
		for (iss = 1; iss < pss+1; iss++){
			preLoad[iss] = new Image();
			preLoad[iss].src = Picture[iss];
		}

	
		function runSlideShow(i){
			if (doSlideShow){
				if (document.all){
					document.images.PictureBox.style.filter="blendTrans(duration=2)";
					document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
					document.images.PictureBox.filters.blendTrans.Apply();
				}
				document.images.PictureBox.src = preLoad[jss].src;
				if (document.all) 
					document.images.PictureBox.filters.blendTrans.Play();
				jss = jss + 1;
				if (jss > (pss)) jss=1;
					tss = setTimeout('runSlideShow()', SlideShowSpeed);
			}else{		
				document.images.PictureBox.src = preLoad[i].src;
			}
		}
		
		
		var SlideShow = function(){
		    var dialog, showBtn;
		    return {
		        init : function(){
		             showBtn = Ext.get('td-slideshow');
		             showBtn.on('click', this.showDialog, this);
		        },

				
				hideDialog: function(){
					dialog.hide();
				},		       
				
		        showDialog : function(){
		            if(!dialog){ // lazy initialize the dialog and only create it once
		                dialog = new Ext.BasicDialog("slideshow-dlg", { 
								closable: true,
								collapsible: false,
								draggable : true,
								constraintoviewport: false,
	        					fixedcenter:true,
								modal : true,
								resizable : false,
								shadow:false,
								shim: true,
								syncHeightBeforeShow: true,
								//title : '   ' + ptitle,
		                        width:496,
		                        height:620,
		                        minWidth:496,
		                        minHeight:620
		                });
		                dialog.addKeyListener(27, dialog.hide, dialog);
		            }
//runSlideShow(curImg);
					//dialog.moveTo(280, 304);
		            dialog.show(showBtn.dom);
		        }
		    };
		}();
		
		Ext.onReady(SlideShow.init, SlideShow, true);		


		function showSlideShow(){
			doSlideShow = 1;
			runSlideShow(curImg);
		}
		
		function showNext(){
			doSlideShow = 0;
			curImg = curImg + 1;
			if (curImg>iImg)
				curImg = 1;
			runSlideShow(curImg);
		}
		
		function showPrevious(){
			doSlideShow = 0;
			curImg = curImg - 1;
			if (curImg<1)
				curImg = iImg;
			runSlideShow(curImg);
		}

		var CurDiv = 1;
		function setSlideShowThumbs(i,tot){
			var ss_curr = document.getElementById('div_' + CurDiv);
			var ss_show = document.getElementById('div_' + i);
			
			//Ext.get('div_' + CurDiv).slideOut('t');
			//Ext.get('div_' + i).slideIn('r');
			
			ss_curr.style.display = "none";
			ss_show.style.display = "block";
			document.getElementById('href_ss_' + CurDiv).style.color = "#6699CC";
			document.getElementById('href_ss_' + i).style.color = "red";
			CurDiv = i;
			
		}
		
		function slideshow(){
			curImg=1;
			SlideShow.showDialog();
		}
		
		function hideGallery(){
			curImg=1;
			SlideShow.hideDialog();
		}
		

