			// Set speed (milliseconds)		

			var t;

			var j = 0;





			function opacity(id, opacStart, opacEnd, millisec) { 

				//speed for each frame 

				var speed = Math.round(millisec / 100); 

				var timer = 0; 

			

				//determine the direction for the blending, if start and end are the same nothing happens 

				if(opacStart > opacEnd) { 

					for(i = opacStart; i >= opacEnd; i--) { 

						setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 

						timer++; 

					} 

				} else if(opacStart < opacEnd) { 

					for(i = opacStart; i <= opacEnd; i++) 

						{ 

						setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 

						timer++; 

					} 

				} 

			} 

			

			//change the opacity for different browsers 

			function changeOpac(opacity, id) { 

				var object = document.getElementById(id).style; 

				object.opacity = (opacity / 100); 

				object.MozOpacity = (opacity / 100); 

				object.KhtmlOpacity = (opacity / 100); 

				object.filter = "alpha(opacity=" + opacity + ")"; 

			} 



			function shiftOpacity(id, millisec) { 

				//if an element is invisible, make it visible, else make it ivisible 

				if(document.getElementById(id).style.opacity == 0) { 

					opacity(id, 0, 100, millisec); 

				} else { 

					opacity(id, 100, 0, millisec); 

				} 

			} 

					



			function blendimage(divid, imageid, imagefile, millisec) { 

				var speed = Math.round(millisec / 100); 

				var timer = 0; 

				 

				// Set slideShowSpeed (milliseconds)

				//var slideShowSpeed = 80000;

				

				// Duration of crossfade (seconds)

				var crossFadeDuration = 4				 





				 

				//set the current image as background 

				//if(document.getElementById(divid).style.backgroundImage != document.getElementById(imageid).style.backgroundImage)

					document.getElementById(divid).style.backgroundImage = document.getElementById(imageid).style.backgroundImage;				 

				//make image transparent 

			/*   if (document.all)

			   {

					document.getElementById(imageid).style.filter="blendTrans(duration=2)"

					document.getElementById(imageid).style.filter="blendTrans(duration=crossFadeDuration)"

					document.getElementById(imageid).filters.blendTrans.Apply()      

			   }				

			   else*/

			   {

				   	changeOpac(0, imageid); 

			   }

				 

				//make new image 

				document.getElementById(imageid).style.backgroundImage = "url(" +imagefile + ")"; 

			   

		/*	   if (document.all) 

			   {

				  document.getElementById(imageid).filters.blendTrans.Play()

			   }				 

			   else*/

			   {

				//fade in image 

					for(i = 0; i <= 100; i++) 

					{

						setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 

						timer++; 

					} 

			   }

			} 



			function fadeIn(divid, imageid, imagefile, millisec) 

			{

				document.getElementById(divid).style.backgroundImage = document.getElementById(imageid).style.backgroundImage;				

				document.getElementById(imageid).style.filter="blendTrans(duration=2)";	

				document.getElementById(imageid).filters.blendTrans.apply();

				document.getElementById(imageid).style.backgroundImage = "url(" +imagefile + ")"; 

				document.getElementById(imageid).filters.blendTrans.play();

				

				//document.getElementById(imageid).style.display = "block";

				/*document.getElementById(divid).style.backgroundImage = document.getElementById(imageid).style.backgroundImage;				

				document.getElementById(imageid).style.backgroundImage = "url(" +imagefile + ")"; 									

				document.getElementById(imageid).style.filter="blendTrans(duration=2)";				

				if (document.getElementById(imageid).filters.blendTrans.status != 2) 

				{

					document.getElementById('blendpic').style.display="block";

					document.getElementById(imageid).filters.blendTrans.apply();

					//alert(document.getElementById(imageid).style.visibility);					

					document.getElementById(imageid).style.visibility="visible";					

					document.getElementById(imageid).filters.blendTrans.play();

					document.getElementById('blendpic').style.display="none";

				}*/

				//					alert(document.getElementById(imageid).filters.blendTrans.status);

				//document.getElementById(imageid).style.backgroundImage = document.getElementById(divid).style.backgroundImage;				

			}



			function runSlideShow()

			{

				// Set slideShowSpeed (milliseconds)

				var slideShowSpeed = 5000;

				

				// Duration of crossfade (seconds)

				var crossFadeDuration = 4;						

				

			   if (document.all)

			   {			

   					//changeOpac(100, 'slideshowpic');

					//changeOpac(100, 'blendpic');

				 //  document.getElementById('blendpic').innerHTML = Pic[j];

					//document.getElementById('slideshowpic').style.visibility="visible";	

					//document.getElementById('blendpic').style.display="block";											

					//document.getElementById('blendpic').style.visibility="visible";			   					

					fadeIn('slideshowpic','blendpic', Pic[j],slideShowSpeed);

			   }	

			   else

			   {



					blendimage('slideshowpic','blendpic', Pic[j],slideShowSpeed / 3);

			   }

			   

					//document.getElementById('blendpic').innerHTML = j;

					//document.getElementById('slideshowpic').background = Pic[j];

					j = j + 1;

					if (j > (p-1)) 

					{

						j = 0;

						//alert(document.getElementById('blendpic').style.visibility);						

						//alert(document.getElementById('slideshowpic').style.visibility);		

					//document.getElementById('slideshowpic').style.backgroundImage = document.getElementById('blendpic').style.backgroundImage;							

					//document.getElementById('slideshowpic').style.visibility="visible";			   

					//document.getElementById('blendpic').style.visibility="visible";	

					//document.getElementById('slideshowpic').style.display="block";			   

					//document.getElementById('blendpic').style.display="none";						

						//changeOpac(0, 'blendpic'); 

					}



						//runBGSlideShow();

						t = setTimeout('runSlideShow()', slideShowSpeed);

			}