function multiImg(name) {
	var preloadedImages=new Array();
	var imgLinks=new Array();
	var klen=0;
	var activeIndex=0,prevIndex=0;
	var imgID,aID,interval,iefix=false;
	var img_interval;
	var selfname=name;
	var playbtn;
	var numberlinks;
	var btn_play=new Image(); btn_play.src="images/play.png";
	var btn_pause=new Image(); btn_pause.src="images/pause.png";
	// set params main img id, <a> id, play/pause btn id, timeout between images
	this.set=function(imgid,aid,playbtnid,timeout,nmbrlnks){
		imgID=imgid;
		aID=aid;
		interval=timeout;
		playbtn=playbtnid;
		numberlinks=nmbrlnks
	}
	this.addImage=function(imgsrc,imglink){
		preloadedImages[klen]=new Image();
		imgLinks[klen]=imglink;
		preloadedImages[klen++].src=imgsrc;
		
	}
	this.setNextImage=function(){
		prevIndex=activeIndex;
		activeIndex++;
		if(activeIndex==klen)
			activeIndex=0;
		this.switchActiveImage(activeIndex);
	}
	this.setPrevImage=function(){
		prevIndex=activeIndex;
		activeIndex--;
		if(activeIndex<0)
			activeIndex=klen-1;
		this.switchActiveImage(activeIndex);
	}
	// function to use for a next button
	this.gotoNext=function(){
		this.setNextImage();
		if(img_interval) this.pause();
	}
	// function to use for a prev button
	this.gotoPrev=function(){
		this.setPrevImage();
		if(img_interval) this.pause();
	}
	this.switchActiveImage=function(num){
		document.getElementById(numberlinks+prevIndex).className="multiimgnumlinkNotActive";
		document.getElementById(numberlinks+num).className="multiimgnumlinkActive";	
		
		document.getElementById(imgID).src=preloadedImages[num].src;
		document.getElementById(aID).href=imgLinks[num];
	}
	// function to use for select num btns
	this.setActiveNum=function(num){
		if(activeIndex!=num){
			prevIndex=activeIndex;
			this.switchActiveImage(num);
			activeIndex=num;
			if(img_interval) this.pause();
		}
	}
	this.start=function(){
		if(klen>1){
			img_interval=setInterval(selfname+".setNextImage()",interval);
			this.switchBtn_to("pause");
		}
	}
	this.pause=function(){
		if(img_interval){
			clearInterval(img_interval);
			img_interval=null;
			this.switchBtn_to("play");
		}else this.start();
	}
	//_private function
	this.switchBtn_to=function(state){
		if(state=="play"){
			if(iefix)
				document.getElementById(playbtn).style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+btn_play.src+"',sizingMethod='scale')";
			else
				document.getElementById(playbtn).src=btn_play.src;
		}else{
			var playbtnX=document.getElementById(playbtn);
			if(playbtnX){
				if(iefix)
					playbtnX.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+btn_pause.src+"',sizingMethod='scale')";
				else
					playbtnX.src=btn_pause.src;
			}
		}
	}
	// function to turn on ie png fix for play/pause button if we use png images
	this.useIEpng_btnfix=function(){
		var arVersion = navigator.appVersion.split("MSIE");
		var version = parseFloat(arVersion[1]);
		if((version >= 5.5) && (document.body.filters)){
			iefix=true;
		}
	}
}
