	var t;
	var j=0;
	var p;
	var pause = false;
	// Set slideShowSpeed (milliseconds)
	var slideShowSpeed = 5000;
	var preLoad = new Array();
	// Duration of crossfade (seconds)
	var crossFadeDuration = 3
	
	// Specify the image files
	var Pic = new Array()

function initPix() {
	//Default is three pix for slideshow, but there may be fewer if preview element has been deleted
	if (findElement("slide1")!=null) Pic[0] = '1.jpg';
	if (findElement("slide2")!=null) Pic[1] = '2.jpg';
	if (findElement("slide3")!=null) Pic[2] = '3.jpg';
	if (findElement("slide4")!=null) Pic[3] = '4.jpg';
	if (findElement("slide4")!=null) Pic[3] = '4.jpg';
}

function init() {
	//Preload images for nav
	 MM_preloadImages('images/nav/nav_r1_c1_f2.gif','images/nav/nav_r2_c1_f2.gif','images/nav/nav_r3_c1_f2.gif','images/nav/nav_r4_c1_f2.gif','images/nav/nav_r5_c1_f2.gif','images/nav/nav_r6_c1_f2.gif','images/nav/nav_r7_c1_f2.gif','images/nav/nav_r8_c1_f2.gif','images/nav/nav_r9_c1_f2.gif','images/nav/nav_r10_c1_f2.gif','images/nav/nav_r11_c1_f2.gif','images/nav/nav_r12_c1_f2.gif','images/nav/nav_r13_c1_f2.gif','images/nav/nav_r14_c1_f2.gif','images/nav/nav_r15_c1_f2.gif','images/nav/aboutTEI2.gif','images/nav/support2.gif','images/nav/sales2.gif','images/nav/products2.gif','images/nav/services2.gif','images/nav/applications2.gif','images/nav/contact2.gif','images/nav/home2.gif','images/nav/TEInews2.gif','images/nav/sitemap2.gif','images/nav/search2.gif','images/bottommenu/home_f2.gif','images/bottommenu/sales_f2.gif','images/bottommenu/contact_f2.gif');
	 initPix();
	 p = Pic.length
	 
	
	
	for (i = 0; i < p; i++){

	   preLoad[i] = new Image()	
	   preLoad[i].src = "slide"+Pic[i]
		
	}
	runSlideShow();
}

// Pops up the slide currently displayed
function popDefaultSlide() {
	var snum;
	
	snum=j-1;
	//j always points to the next slide, so we have to go back 1 slide
	if (snum==-1) snum=2;
	
	popSlide(snum);
}

//pop up a window with the specified image in it
function popThis(u) {
	var path=u;
	if (u.indexOf('/')==-1) { //no path info in url
		//assume path from location of this doc
		path = document.location.pathname;
		//Doc.location returns the page in the pathname, we need to strip that and add the image doc name
		u = path.substr(0, path.lastIndexOf("/")+1)+u; 
	}
	
	//location of popper
	u='/pops/popup.htm?'+path;

	MM_openBrWindow(u,'','width=550,height=500');
}
//Pops up a window with the slide as its contents
function popSlide(num) {
		
		openSlidePopup(num);
}


//Popup a window with the selected slide
function openSlidePopup(num) {
	//The popup dialog needs to be passed the URL of the image
	//Construct it as a QueryString parameter
	var pict;
	
	if (num>Pic.length) {
		  num=Pic.length;
		  pict="1.jpg";
	} else {
		pict = Pic[num];
	}
	
	//Doc.location returns the page in the pathname, we need to strip that and add the image doc name
	var path = document.location.pathname;
	var u = path.substr(0, path.lastIndexOf("/")+1); 

	u = '/pops/popup.htm?'+u+pict;
	MM_openBrWindow(u,'','width=550,height=500');
}


function runSlideShow(){
	
	//Sometimes the slideshow element has been removed
	if (document.images.SlideShow==null) return;
	
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   
   if (preLoad.length==0) return;
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   
   //  only advance if pause is off
   if (!pause) {
	   j = j + 1
	   if (j > (p-1)) j=0
   }
   
	t = setTimeout('runSlideShow()', slideShowSpeed)
   
}